/* ==========================================================================
   76 PDF  |  main.css
   Brand: navy #1C2E4A, gold #C9963A, cream #FAF6ED (from logo.svg)
   No inline styles are needed anywhere, so the site runs under a strict CSP.
   ========================================================================== */

/* ---------- Self hosted fonts (SIL Open Font License, see /assets/vendor/licenses) ---------- */
@font-face { font-family: 'DM Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/dm-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 500; font-style: normal; font-display: swap; src: url('fonts/dm-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 600; font-style: normal; font-display: swap; src: url('fonts/dm-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/dm-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/playfair-display-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-weight: 900; font-style: normal; font-display: swap; src: url('fonts/playfair-display-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Arabic'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/noto-sans-arabic-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Noto Sans Arabic'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/noto-sans-arabic-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Dancing Script'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/dancing-script-latin-700-normal.woff2') format('woff2'); }

/* ---------- Tokens ---------- */
:root {
  --navy: #1c2e4a;
  --navy-2: #243a5c;
  --gold: #c9963a;
  --gold-hover: #dcaa52;
  --gold-ink: #8a6212;
  --cream: #faf6ed;

  --bg: #f6f3ec;
  --surface: #ffffff;
  --soft: #fffdf8;
  --soft-2: #faf6ed;
  --text: #1b2433;
  --muted: #566176;
  --border: #e2dccd;
  --input-border: #cfc7b4;
  --heading: #1c2e4a;
  --primary: #1c2e4a;
  --primary-ink: #faf6ed;
  --primary-hover: #c9963a;
  --primary-hover-ink: #1c2e4a;
  --topbar-bg: rgba(250, 246, 237, 0.88);
  --success: #1f8a5b;
  --error: #b83a2e;
  --link: #8a6212;
  --track: #ece5d3;
  --gold-soft: rgba(201, 150, 58, 0.12);
  --drop-bg: linear-gradient(180deg, #fffdf8, #faf6ed);
  --drop-border: #cdbf9d;
  --drop-hover: #fff7e6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(28, 46, 74, 0.06);
  --shadow-md: 0 6px 18px rgba(28, 46, 74, 0.1);
  --shadow-lg: 0 18px 40px rgba(28, 46, 74, 0.18);
  --focus: 0 0 0 3px rgba(201, 150, 58, 0.6);
  --sidebar-w: 280px;
  --topbar-h: 64px;
  --ease: 0.18s ease;

  --font-body: 'DM Sans', 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', 'Noto Sans Arabic', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0e1626;
  --surface: #162136;
  --soft: #1b2942;
  --soft-2: #1b2942;
  --text: #e7ecf5;
  --muted: #9fb0c9;
  --border: #2a3a58;
  --input-border: #3a4c6d;
  --heading: #f3efe4;
  --primary: #c9963a;
  --primary-ink: #14203a;
  --primary-hover: #dcaa52;
  --primary-hover-ink: #14203a;
  --topbar-bg: rgba(14, 22, 38, 0.88);
  --success: #3fbf8a;
  --error: #ff7b6e;
  --link: #e0b25c;
  --track: #263550;
  --gold-soft: rgba(201, 150, 58, 0.16);
  --drop-bg: linear-gradient(180deg, #1b2942, #162136);
  --drop-border: #4a5d82;
  --drop-hover: #22314d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0e1626; --surface: #162136; --soft: #1b2942; --soft-2: #1b2942; --text: #e7ecf5; --muted: #9fb0c9;
    --border: #2a3a58; --input-border: #3a4c6d; --heading: #f3efe4; --primary: #c9963a; --primary-ink: #14203a;
    --primary-hover: #dcaa52; --primary-hover-ink: #14203a; --topbar-bg: rgba(14, 22, 38, 0.88);
    --success: #3fbf8a; --error: #ff7b6e; --link: #e0b25c; --track: #263550; --gold-soft: rgba(201, 150, 58, 0.16);
    --drop-bg: linear-gradient(180deg, #1b2942, #162136); --drop-border: #4a5d82; --drop-hover: #22314d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35); --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; color: var(--heading); }
a { color: var(--link); }
img, svg { max-width: 100%; }
h1:focus, h1:focus-visible { outline: none; box-shadow: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
[dir='rtl'] h1, [dir='rtl'] h2, [dir='rtl'] .brand-word { letter-spacing: 0; }
[dir='rtl'] .flip { transform: scaleX(-1); }

.skip-link { position: fixed; inset-inline-start: 1rem; top: -4rem; z-index: 3000; background: var(--gold); color: var(--navy); font-weight: 700; padding: 0.6rem 1rem; border-radius: 8px; text-decoration: none; transition: top var(--ease); }
.skip-link:focus { top: 1rem; }
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #1c2e4a 0%, #172640 100%); color: var(--cream);
  z-index: 1000; display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain;
}
[dir='rtl'] #sidebar { transform: translateX(102%); }
#sidebar.open, [dir='rtl'] #sidebar.open { transform: translateX(0); }
:root[data-theme='dark'] #sidebar { background: linear-gradient(180deg, #111c31 0%, #0c1424 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) #sidebar { background: linear-gradient(180deg, #111c31 0%, #0c1424 100%); } }
#sidebar::before, #sidebar::after { content: ''; position: sticky; display: block; height: 4px; background: var(--gold); flex: none; inset-inline: 0; }
#sidebar::before { top: 0; z-index: 2; }
#sidebar::after { bottom: 0; margin-top: auto; }

.sidebar-brand { display: flex; align-items: center; gap: 0.85rem; padding: 1.4rem 1.4rem 1.2rem; text-decoration: none; color: var(--cream); border-bottom: 1px solid rgba(250, 246, 237, 0.1); }
.sidebar-brand img { width: 46px; height: 46px; border-radius: 11px; flex: none; box-shadow: 0 0 0 1.5px rgba(201, 150, 58, 0.55); }
.brand-word { display: block; font-family: var(--font-display); font-weight: 900; font-size: 1.55rem; letter-spacing: 0.01em; line-height: 1; color: var(--cream); }
.brand-word small { font-family: var(--font-body); font-weight: 500; font-size: 0.8rem; color: var(--gold); letter-spacing: 0.08em; margin-inline-start: 2px; }
.brand-tag { display: block; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(250, 246, 237, 0.55); margin-top: 0.4rem; font-weight: 500; }
[dir='rtl'] .brand-tag { letter-spacing: 0; }

.sidebar-nav { padding: 0.5rem 0.75rem 1.25rem; flex: 1; }
.sidebar-section-label { padding: 0.95rem 0.9rem 0.35rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(250, 246, 237, 0.5); }
[dir='rtl'] .sidebar-section-label { letter-spacing: 0; font-size: 0.78rem; }
.nav-item { position: relative; display: flex; align-items: center; gap: 0.8rem; padding: 0.62rem 0.9rem; margin: 2px 0; border-radius: 10px; color: rgba(250, 246, 237, 0.85); text-decoration: none; font-size: 0.94rem; font-weight: 500; transition: background var(--ease), color var(--ease); }
.nav-item .ic { color: rgba(250, 246, 237, 0.6); transition: color var(--ease); }
.nav-item:hover { background: rgba(250, 246, 237, 0.08); color: #fff; }
.nav-item:hover .ic { color: var(--gold); }
.nav-item[aria-current='page'] { background: rgba(201, 150, 58, 0.18); color: #fff; }
.nav-item[aria-current='page'] .ic { color: var(--gold); }
.nav-item[aria-current='page']::before { content: ''; position: absolute; inset-inline-start: -0.75rem; top: 8px; bottom: 8px; width: 4px; background: var(--gold); border-radius: 0 4px 4px 0; }
[dir='rtl'] .nav-item[aria-current='page']::before { border-radius: 4px 0 0 4px; }
.nav-item:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.sidebar-divider { height: 1px; background: rgba(250, 246, 237, 0.1); margin: 0.6rem 0.9rem; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(12, 20, 36, 0.55); z-index: 999; opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s; }
.sidebar-overlay.visible { opacity: 1; visibility: visible; }

/* ---------- Top bar ---------- */
#topbar { position: fixed; top: 0; inset-inline: 0; height: var(--topbar-h); z-index: 100; display: flex; align-items: center; gap: 0.55rem; padding: 0 1rem; background: var(--topbar-bg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--primary); color: var(--primary-ink); border: none; cursor: pointer; transition: background var(--ease), color var(--ease); font: inherit; }
.icon-btn:hover { background: var(--primary-hover); color: var(--primary-hover-ink); }
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn.quiet { background: var(--surface); color: var(--heading); border: 1px solid var(--border); }
.icon-btn.quiet:hover { border-color: var(--gold); background: var(--soft); color: var(--heading); }
.back-btn { display: inline-flex; align-items: center; gap: 0.4rem; height: 42px; padding: 0 0.95rem; border-radius: 11px; background: var(--surface); color: var(--heading); border: 1px solid var(--border); font-weight: 600; font-size: 0.92rem; text-decoration: none; transition: border-color var(--ease), background var(--ease); }
.back-btn:hover { border-color: var(--gold); background: var(--soft); }
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-spacer { flex: 1; }
.privacy-pill { display: inline-flex; align-items: center; gap: 0.4rem; flex: none; background: rgba(31, 138, 91, 0.12); color: var(--success); padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; border: 1px solid rgba(31, 138, 91, 0.3); }
.privacy-pill .ic { width: 16px; height: 16px; }
.install-btn { display: inline-flex; align-items: center; gap: 0.4rem; height: 42px; padding: 0 0.9rem; border-radius: 11px; border: 1px solid var(--gold); background: var(--gold-soft); color: var(--heading); font: inherit; font-weight: 700; font-size: 0.88rem; cursor: pointer; }
.install-btn:hover { background: var(--gold); color: var(--navy); }

/* ---------- Layout ---------- */
#main { display: flex; flex-direction: column; min-height: 100vh; padding-top: var(--topbar-h); }
#content-area { flex: 1 0 auto; width: 100%; max-width: 1240px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
@media (min-width: 1024px) {
  #sidebar, [dir='rtl'] #sidebar { transform: none; box-shadow: none; }
  .sidebar-overlay { display: none; }
  #main { margin-inline-start: var(--sidebar-w); }
  #topbar { inset-inline-start: var(--sidebar-w); padding: 0 1.75rem; }
  #hamburger-btn { display: none; }
  #content-area { padding: 2.5rem 2rem 4rem; }
}
@media (max-width: 900px) { .privacy-pill span, .install-btn span { display: none; } .privacy-pill, .install-btn { padding: 0 0.6rem; } .privacy-pill { height: 34px; } }
@media (max-width: 560px) { .back-btn span { display: none; } .back-btn { padding: 0 0.7rem; } .topbar-title { font-size: 1.05rem; } #topbar { gap: 0.4rem; padding: 0 0.6rem; } }
@media (max-width: 400px) { .privacy-pill { display: none; } }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); margin-bottom: 1.25rem; max-width: 820px; margin-inline: auto; list-style: none; }
.breadcrumb li + li::before { content: '/'; margin-inline-end: 0.35rem; color: var(--border); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }

/* ---------- Home ---------- */
.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 400px at 85% -10%, rgba(201, 150, 58, 0.18), transparent 60%), #1c2e4a; color: var(--cream); border-radius: 20px; padding: 3.25rem 2rem 2.75rem; text-align: center; box-shadow: var(--shadow-md); }
:root[data-theme='dark'] .hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(201, 150, 58, 0.2), transparent 60%), #15233b; border: 1px solid var(--border); }
.hero::before, .hero::after { content: ''; position: absolute; inset-inline: 0; height: 5px; background: var(--gold); }
.hero::before { top: 0; } .hero::after { bottom: 0; }
.hero-mark { width: 76px; height: 76px; margin: 0 auto 1.25rem; display: block; border-radius: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); color: #fff; max-width: 22ch; margin: 0 auto 1rem; }
.hero p.lead { font-size: clamp(1rem, 1.6vw, 1.2rem); color: #cfd8e7; max-width: 56ch; margin: 0 auto 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-bottom: 1.75rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 0.45rem; background: rgba(250, 246, 237, 0.08); border: 1px solid rgba(250, 246, 237, 0.16); padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 500; color: var(--cream); }
.hero-badge .ic { color: var(--gold); width: 1.1em; height: 1.1em; }
.section-head { text-align: center; margin: 3.5rem auto 1.75rem; max-width: 640px; }
.section-head h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); margin-bottom: 0.5rem; }
.section-head p { color: var(--muted); }
.group-title { font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 2rem 0 0.8rem; }
[dir='rtl'] .group-title { letter-spacing: 0; font-size: 0.9rem; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }
.tool-card { position: relative; display: flex; flex-direction: column; gap: 0.35rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease); }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--gold); }
.tool-card-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #1c2e4a; color: var(--gold); margin-bottom: 0.7rem; }
:root[data-theme='dark'] .tool-card-icon { background: #0d1830; border: 1px solid var(--border); }
.tool-card-icon .ic { width: 24px; height: 24px; }
.tool-card-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--heading); }
.tool-card-desc { color: var(--muted); font-size: 0.92rem; }
.tool-card-go { position: absolute; inset-inline-end: 1.2rem; top: 1.5rem; color: var(--border); transition: color var(--ease), transform var(--ease); }
.tool-card:hover .tool-card-go { color: var(--gold); transform: translateX(3px); }
[dir='rtl'] .tool-card:hover .tool-card-go { transform: scaleX(-1) translateX(3px); }
.tool-card.compact { padding: 1rem 1.1rem; flex-direction: row; align-items: center; gap: 0.8rem; }
.tool-card.compact .tool-card-icon { width: 40px; height: 40px; margin: 0; }
.tool-card.compact .tool-card-name { font-size: 1rem; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; counter-reset: step; list-style: none; }
.steps li { counter-increment: step; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 1.4rem 1.4rem; padding-inline-start: 4.2rem; }
.steps li::before { content: counter(step); position: absolute; inset-inline-start: 1.2rem; top: 1.4rem; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; background: var(--gold); color: #1c2e4a; border-radius: 50%; font-weight: 800; font-family: var(--font-display); }
.steps strong { display: block; color: var(--heading); margin-bottom: 0.2rem; }
.steps span { color: var(--muted); font-size: 0.93rem; }

.faq { max-width: 820px; margin: 0 auto; display: grid; gap: 0.7rem; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 1.2rem; }
.faq summary { cursor: pointer; list-style: none; padding: 1rem 0; font-weight: 700; color: var(--heading); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.5rem; line-height: 1; color: var(--link); font-weight: 500; transition: transform var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 1.1rem; color: var(--muted); }

/* ---------- Tool pages ---------- */
.tool-head { text-align: center; max-width: 720px; margin: 0 auto 2rem; }
.tool-head .tool-card-icon { margin: 0 auto 1rem; width: 56px; height: 56px; border-radius: 14px; }
.tool-head h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin-bottom: 0.6rem; }
.tool-head p { color: var(--muted); font-size: 1.08rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-sm); max-width: 640px; margin: 0 auto 1.5rem; }
.card.wide { max-width: 820px; }
.card h3 { font-family: var(--font-display); color: var(--heading); font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.card h3:first-child { margin-top: 0; }
.card p { color: var(--muted); margin-bottom: 1rem; }
.card p:last-child { margin-bottom: 0; }
.below { max-width: 720px; margin: 2.5rem auto 0; display: grid; gap: 2rem; }
.below h2 { font-size: 1.35rem; margin-bottom: 0.6rem; }
.below p, .below li { color: var(--muted); }
.below ol { padding-inline-start: 1.3rem; display: grid; gap: 0.3rem; }
.below .faq { margin: 0; max-width: none; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }

/* Forms */
.form-row { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.form-row.stack { flex-direction: column; align-items: stretch; gap: 0.4rem; }
.form-label { font-weight: 600; min-width: 96px; color: var(--heading); font-size: 0.95rem; }
.form-input { flex: 1; min-width: 180px; width: 100%; padding: 0.75rem 0.95rem; font: inherit; font-size: 1rem; color: var(--text); border: 1px solid var(--input-border); border-radius: 10px; background: var(--soft); transition: border-color var(--ease), box-shadow var(--ease); }
.form-input:focus { outline: none; border-color: var(--gold); box-shadow: var(--focus); }
.form-input.narrow { max-width: 140px; min-width: 90px; }
textarea.form-input { min-height: 150px; resize: vertical; }
.form-hint { color: var(--muted); font-size: 0.85rem; }
.hp { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
input[type='range'] { flex: 1; accent-color: var(--gold); min-width: 140px; }
.check { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; cursor: pointer; color: var(--text); }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--gold); flex: none; }
.pw-meter { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; margin-top: 0.4rem; }
.pw-meter > i { display: block; height: 100%; width: 0; background: var(--error); transition: width var(--ease), background var(--ease); }
.pw-meter > i.s1 { width: 25%; } .pw-meter > i.s2 { width: 50%; background: #d89b2b; } .pw-meter > i.s3 { width: 75%; background: #6aa84f; } .pw-meter > i.s4 { width: 100%; background: var(--success); }

/* Drop zone */
.drop-zone { position: relative; overflow: hidden; text-align: center; border: 2px dashed var(--drop-border); border-radius: var(--radius); padding: 2.4rem 1.5rem; margin-bottom: 1.5rem; background: var(--drop-bg); transition: border-color var(--ease), background var(--ease), transform var(--ease); }
.drop-zone.flush { margin-bottom: 0; }
.drop-zone input[type='file'] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--gold); background: var(--drop-hover); }
.drop-zone.dragover { transform: scale(1.01); }
.drop-zone:focus-within { box-shadow: var(--focus); }
.drop-zone-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 0.9rem; background: #1c2e4a; color: var(--gold); border-radius: 50%; }
.drop-zone-icon .ic { width: 26px; height: 26px; }
.drop-zone-label { font-size: 1.1rem; font-weight: 700; color: var(--heading); }
.drop-zone-sub { color: var(--muted); font-size: 0.9rem; }

/* File lists */
.file-list { list-style: none; margin-bottom: 1.5rem; display: grid; gap: 0.5rem; }
.file-list:empty { display: none; }
.file-list li { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; background: var(--soft); border: 1px solid var(--border); border-radius: 10px; }
.file-list li.sortable-ghost { opacity: 0.4; }
.drag-handle { cursor: grab; color: var(--muted); display: inline-flex; }
.fn { flex: 1; font-weight: 600; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fs { color: var(--muted); font-size: 0.82rem; flex: none; }
.rm, .file-remove { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer; background: rgba(184, 58, 46, 0.12); color: var(--error); transition: background var(--ease), color var(--ease); }
.rm:hover, .file-remove:hover { background: var(--error); color: #fff; }
.rm .ic, .file-remove .ic { width: 16px; height: 16px; }
.file-info-bar { display: none; align-items: center; gap: 0.8rem; padding: 0.65rem 0.9rem; margin-bottom: 1.5rem; background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 10px; }
.file-info-bar.visible { display: flex; }
.file-info-bar > .ic { color: var(--link); }

/* Progress and results */
.progress-wrap { margin: 1.5rem 0; display: none; }
.progress-wrap.visible { display: block; }
.progress-wrap.slim { max-width: 640px; margin-inline: auto; }
.progress-bar-track { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; margin-bottom: 0.45rem; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hover)); width: 0; transition: width 0.25s ease; }
.progress-label { text-align: center; font-size: 0.85rem; color: var(--muted); }
.result-note { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold); color: var(--text); font-size: 0.93rem; display: none; }
.result-note.visible { display: block; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; padding: 0.8rem 1.4rem; border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none; transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: var(--primary-hover-ink); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-gold { background: var(--gold); color: #1c2e4a; }
.btn-gold:hover:not(:disabled) { background: var(--gold-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--cream); border-color: rgba(250, 246, 237, 0.4); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-light { background: var(--surface); color: var(--heading); border-color: var(--border); }
.btn-light:hover:not(:disabled) { border-color: var(--gold); background: var(--soft); }
.btn-danger { background: rgba(184, 58, 46, 0.12); color: var(--error); }
.btn-danger:hover:not(:disabled) { background: var(--error); color: #fff; }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.9rem; border-radius: 9px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.seg button { padding: 0.5rem 0.95rem; border: 1px solid var(--border); background: var(--soft); color: var(--text); border-radius: 9px; cursor: pointer; font: inherit; font-size: 0.9rem; font-weight: 600; transition: background var(--ease), border-color var(--ease), color var(--ease); }
.seg button:hover { border-color: var(--gold); }
.seg button[aria-checked='true'], .seg button[aria-selected='true'] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

#toast { position: fixed; inset-inline-start: 50%; bottom: 1.5rem; z-index: 2000; max-width: min(92vw, 460px); background: #1c2e4a; color: var(--cream); padding: 0.9rem 1.3rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 0.95rem; text-align: center; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
[dir='rtl'] #toast { transform: translate(50%, 24px); }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
[dir='rtl'] #toast.show { transform: translate(50%, 0); }
#toast.success { background: #1f8a5b; } #toast.error { background: #b83a2e; }
.form-status { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 10px; font-weight: 600; display: none; }
.form-status.ok { display: block; background: rgba(31, 138, 91, 0.12); color: var(--success); border: 1px solid rgba(31, 138, 91, 0.35); }
.form-status.err { display: block; background: rgba(184, 58, 46, 0.1); color: var(--error); border: 1px solid rgba(184, 58, 46, 0.35); }

/* Dialogs */
dialog { margin: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); padding: 1.6rem; width: min(92vw, 440px); }
dialog.wide { width: min(94vw, 560px); }
dialog::backdrop { background: rgba(8, 14, 26, 0.6); }
dialog h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }
dialog p { color: var(--muted); margin-bottom: 1rem; font-size: 0.95rem; }
.dialog-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.dialog-error { color: var(--error); font-weight: 600; font-size: 0.9rem; min-height: 1.3em; margin-top: 0.4rem; }
.sig-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.sig-pad { width: 100%; height: 190px; border: 1px dashed var(--input-border); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sig-type-preview { width: 100%; height: 120px; border: 1px dashed var(--input-border); border-radius: 12px; background: #fff; display: block; margin-top: 0.8rem; }
.sig-upload-prev { max-width: 100%; max-height: 160px; display: block; margin: 0.8rem auto 0; border-radius: 8px; background: repeating-conic-gradient(#e8e8e8 0% 25%, #fff 0% 50%) 0 0 / 14px 14px; }
.sig-colors { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; }

/* ---------- Rotate ---------- */
.rot-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; }
.rot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.9rem; margin-bottom: 1.5rem; }
.rot-grid:empty { display: none; }
.rot-item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.6rem; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; }
.rot-stage { width: 110px; height: 110px; display: grid; place-items: center; }
.rot-stage canvas { max-width: 100px; max-height: 100px; box-shadow: var(--shadow-md); background: #fff; transition: transform 0.2s ease; }
.rot-btns { display: flex; gap: 0.4rem; align-items: center; }
.rot-btns button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--heading); cursor: pointer; }
.rot-btns button:hover { background: var(--primary); color: var(--primary-ink); }
.rot-num { font-size: 0.78rem; color: var(--muted); font-weight: 700; }

/* ---------- PDF editor ---------- */
.editor-toolbar { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 60; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.7rem; margin: 0 auto 1.5rem; box-shadow: var(--shadow-md); }
.tb-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.tb-sep { width: 1px; height: 28px; background: var(--border); }
.tb-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
[dir='rtl'] .tb-label { letter-spacing: 0; }
.tool-btn[aria-pressed='true'] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
@media (max-width: 1500px) and (min-width: 1024px) { .editor-toolbar .tb-sep { display: none; } }
@media (max-width: 640px) { .editor-toolbar { position: static; } .tb-sep { display: none; } }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; box-shadow: 0 0 0 1px var(--border); transition: transform var(--ease); padding: 0; }
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked='true'] { box-shadow: 0 0 0 2px var(--gold); transform: scale(1.08); }
.tb-select { padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--soft); color: var(--text); font: inherit; font-size: 0.9rem; }
.editor-file { text-align: center; color: var(--muted); font-weight: 600; margin-bottom: 0.75rem; min-height: 1.5em; word-break: break-all; }
.editor-hint { text-align: center; color: var(--muted); font-size: 0.88rem; margin: 0 auto 1rem; max-width: 720px; }
.pdf-scroll { overflow-x: auto; padding: 0.5rem 0 2rem; }
.pdf-viewer { display: flex; flex-direction: column; align-items: center; gap: 28px; min-width: min-content; }
.page-wrapper { position: relative; flex: none; background: #fff; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); border: 1px solid var(--border); }
.pdf-canvas, .overlay-canvas { display: block; }
.overlay-canvas { position: absolute; top: 0; left: 0; z-index: 10; pointer-events: none; }
.pdf-viewer.tool-draw .overlay-canvas { pointer-events: auto; cursor: crosshair; touch-action: none; }
.pdf-viewer.tool-text .overlay-canvas { pointer-events: auto; cursor: text; touch-action: none; }
.pdf-viewer.tool-sign .overlay-canvas { pointer-events: auto; cursor: copy; touch-action: none; }
.page-badge { position: absolute; left: 10px; bottom: 10px; z-index: 30; pointer-events: none; background: rgba(28, 46, 74, 0.88); color: #faf6ed; font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; }
.page-controls { position: absolute; top: 10px; right: 10px; z-index: 40; display: flex; flex-direction: column; gap: 6px; background: rgba(255, 255, 255, 0.96); padding: 6px; border-radius: 10px; box-shadow: var(--shadow-md); border: 1px solid #e2dccd; }
.page-controls button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; background: #fffdf8; border: 1px solid #e2dccd; color: #1c2e4a; transition: background var(--ease), color var(--ease); }
.page-controls button:hover { background: #1c2e4a; color: var(--gold); }
.page-controls .del-btn { color: #b83a2e; background: rgba(184, 58, 46, 0.08); border-color: transparent; }
.page-controls .del-btn:hover { background: #b83a2e; color: #fff; }

/* Annotations stay real DOM nodes (movable, editable) until the PDF is saved */
.ann-text { position: absolute; z-index: 20; }
.ann-input { display: block; height: calc(1.2em + 2px); line-height: 1.2; padding: 0 2px; margin: 0; font-family: Helvetica, Arial, 'Liberation Sans', sans-serif; background: transparent; border: 1px dashed transparent; border-radius: 3px; outline: none; min-width: 40px; color: #111; }
.ann-text:hover .ann-input, .ann-text:focus-within .ann-input { border-color: var(--gold); background: rgba(255, 247, 230, 0.45); }
.ann-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: none; align-items: center; justify-content: center; border-radius: 6px; border: none; cursor: pointer; }
.ann-btn .ic { width: 13px; height: 13px; }
.ann-text:hover .ann-btn, .ann-text:focus-within .ann-btn { display: inline-flex; }
.ann-move { left: -26px; background: #1c2e4a; color: var(--gold); cursor: grab; touch-action: none; }
.ann-del { right: -26px; background: #b83a2e; color: #fff; }
.ann-cover { position: absolute; z-index: 15; pointer-events: none; }
.ann-img { position: absolute; z-index: 20; border: 1px dashed transparent; touch-action: none; cursor: grab; }
.ann-img img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.ann-img:hover, .ann-img:focus-within, .ann-img.active { border-color: var(--gold); }
.ann-img .ann-del { top: -12px; right: -12px; transform: none; display: none; }
.ann-img:hover .ann-del, .ann-img.active .ann-del { display: inline-flex; }
.ann-resize { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; border-radius: 4px; background: var(--gold); border: 2px solid #fff; cursor: nwse-resize; display: none; touch-action: none; }
.ann-img:hover .ann-resize, .ann-img.active .ann-resize { display: block; }
.hot { position: absolute; z-index: 12; cursor: text; border-radius: 2px; background: transparent; }
.hot:hover { outline: 1.5px dashed var(--gold); background: rgba(201, 150, 58, 0.14); }
.pdf-viewer:not(.tool-edittext) .hot { display: none; }

/* ---------- Guides ---------- */
.prose { max-width: 720px; margin: 0 auto; }
.prose h1 { font-size: clamp(1.9rem, 3.8vw, 2.7rem); margin-bottom: 0.8rem; }
.prose h2 { font-size: 1.4rem; margin: 2.2rem 0 0.6rem; }
.prose p { color: var(--text); margin-bottom: 1rem; font-size: 1.04rem; }
.prose .meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.prose .cta { display: flex; margin-top: 2rem; }
.guide-list { display: grid; gap: 1rem; max-width: 820px; margin: 0 auto; }
.guide-card { display: block; padding: 1.3rem 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color var(--ease), transform var(--ease); }
.guide-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.guide-card h2, .guide-card h3 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.guide-card p { color: var(--muted); font-size: 0.95rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--soft-2); padding: 2.5rem 1.5rem 2rem; text-align: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 900; font-size: 1.3rem; color: var(--heading); text-decoration: none; margin-bottom: 0.5rem; }
.footer-brand img { width: 32px; height: 32px; border-radius: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; justify-content: center; margin: 0.75rem 0 1.25rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.93rem; }
.footer-links a:hover { color: var(--link); text-decoration: underline; }
.footer-credits, .footer-copyright { font-size: 0.82rem; color: var(--muted); max-width: 720px; margin: 0 auto 0.75rem; }

@media (max-width: 600px) { .card { padding: 1.4rem 1.1rem; } .hero { padding: 2.5rem 1.2rem 2.25rem; } .form-label { min-width: 100%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { #sidebar, #topbar, .site-footer, #toast { display: none !important; } #main { margin: 0; padding: 0; } }

/* ---------- small utilities (replace inline styles so the CSP can forbid them) ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mt { margin-top: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
select.form-input { appearance: auto; }
.note { color: var(--muted); font-size: 0.88rem; margin-top: 0.9rem; }
