:root {
  --bg: #f4f2ed;
  --paper: #ffffff;
  --ink: #16202e;
  --muted: #5f6878;
  --line: #e3dfd6;
  --brand: #0f2a47;
  --brand-2: #1f4e79;
  --gold: #b08d45;
  --accent-soft: #edf1f6;
  --ok: #2e7d4f;
  --warn: #a86b12;
  --err: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b;
    --paper: #1a1f27;
    --ink: #e8eaef;
    --muted: #a0a8b6;
    --line: #2b313c;
    --brand: #9cc3ea;
    --brand-2: #7fb0e0;
    --gold: #d6b26a;
    --accent-soft: #222c3a;
    --ok: #6cc28f;
    --warn: #e0a84f;
    --err: #ef7a70;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.75; }
a { color: var(--brand-2); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* ---------- الهيدر ---------- */
header.site { background: #0f2a47; color: #fff; border-bottom: 3px solid var(--gold); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 16px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: none; }
.brand b { font-size: 1.4rem; display: block; line-height: 1.2; }
.brand small { color: #c9d4e2; font-size: .85rem; }
header.site nav a { color: #dbe4ef; text-decoration: none; font-size: .9rem; border: 1px solid rgba(255,255,255,.25); padding: 6px 14px; border-radius: 8px; }
header.site nav a:hover { background: rgba(255,255,255,.08); }

/* ---------- عناصر عامة ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-block: 20px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 1.1rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { font-size: .9rem; color: var(--muted); }
select, input, textarea, button { font: inherit; }
select, input[type=text], input[type=password], input[type=file], textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); min-width: 0;
}
select { min-width: 240px; flex: 1; }
textarea { width: 100%; min-height: 360px; font-family: ui-monospace, monospace; font-size: .85rem; direction: ltr; text-align: left; }
button { padding: 10px 20px; border-radius: 8px; border: 1px solid var(--brand-2); background: var(--brand-2); color: #fff; cursor: pointer; }
@media (prefers-color-scheme: dark) { button { color: #0f1520; } }
button.ghost { background: transparent; color: var(--brand-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.error { color: var(--err); }

/* ---------- التقدم ---------- */
.progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.progress-list li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: start; font-size: .9rem; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.progress-list .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); margin-top: 8px; }
.progress-list li.running .dot { background: var(--brand-2); animation: pulse 1s infinite alternate; }
.progress-list li.found .dot { background: var(--ok); }
.progress-list li.not_found .dot { background: var(--warn); }
.progress-list li.error .dot { background: var(--err); }
.progress-list .act { display: block; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
@keyframes pulse { to { opacity: .3; } }

/* ---------- رأس التقرير ---------- */
.r-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.r-head .eyebrow { color: var(--gold); font-weight: 600; font-size: .85rem; letter-spacing: .02em; }
.r-head h1 { margin: 2px 0 4px; font-size: 2rem; line-height: 1.3; }
.r-head .meta { color: var(--muted); font-size: .88rem; }
.r-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 16px; min-width: 130px; }
.stat b { display: block; font-size: 1.35rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8rem; }

/* ---------- الشريط: التصنيفات وطريقة العرض ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: .88rem; }
.chip[aria-pressed=true] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed=true] { color: #0f1520; } }
.chip small { opacity: .7; margin-inline-start: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--paper); color: var(--muted); padding: 6px 14px; font-size: .85rem; }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--brand-2); font-weight: 600; }

/* ---------- بطاقات المؤشرات ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.icard {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s; min-height: 210px;
}
.icard:hover, .icard:focus-visible { transform: translateY(-2px); border-color: var(--brand-2); }
.icard:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.ic-top { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.ic-cat { color: var(--gold); font-weight: 600; }
.icard h3 { margin: 0; font-size: 1rem; line-height: 1.5; }
.ic-org { color: var(--muted); font-size: .78rem; margin-top: -6px; }
.ic-score { display: flex; align-items: baseline; gap: 6px; margin-top: auto; }
.ic-score b { font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--brand); }
.ic-score span { color: var(--muted); font-size: .85rem; }
.ic-empty { color: var(--muted); font-size: .9rem; margin-top: auto; }
.rank { font-size: .8rem; color: var(--muted); }
.rank .bar { position: relative; height: 6px; background: var(--accent-soft); border-radius: 99px; margin: 6px 0 4px; }
.rank .bar i { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-2); border: 2px solid var(--paper); transform: translate(50%, -50%); }
.rank .ends { display: flex; justify-content: space-between; font-size: .7rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; background: var(--accent-soft); color: var(--brand-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.not_found { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.badge.error { background: transparent; color: var(--err); border: 1px solid var(--err); }
.ic-more { color: var(--brand-2); font-size: .8rem; font-weight: 600; }

/* ---------- الجدول ---------- */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { background: var(--accent-soft); font-weight: 600; white-space: nowrap; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }

/* ---------- نافذة التفاصيل ---------- */
dialog#detail { border: 0; padding: 0; border-radius: 16px; width: min(720px, calc(100% - 32px)); max-height: calc(100vh - 48px); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog#detail::backdrop { background: rgba(10, 20, 35, .55); }
.d-head { position: sticky; top: 0; background: var(--paper); padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; z-index: 1; }
.d-head h2 { margin: 0; font-size: 1.25rem; line-height: 1.4; }
.d-head .org { color: var(--muted); font-size: .85rem; }
.d-close { background: transparent; border: 1px solid var(--line); color: var(--ink); padding: 4px 12px; height: fit-content; }
.d-body { padding: 18px 22px 24px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.fact { background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.fact span { display: block; color: var(--muted); font-size: .78rem; }
.fact b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.block { margin-bottom: 16px; }
.block h4 { margin: 0 0 6px; font-size: .9rem; color: var(--gold); }
.block p { margin: 0; }
.block.reading { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; }
.subs { width: 100%; font-size: .88rem; }
.subs td { padding: 7px 10px; }
.note { font-size: .85rem; color: var(--warn); }
.sources { font-size: .82rem; color: var(--muted); margin: 0; padding-inline-start: 18px; }
.sources a { overflow-wrap: anywhere; }
.disclaimer { font-size: .8rem; color: var(--muted); padding-top: 12px; margin: 24px 0 32px; border-top: 1px solid var(--line); }
.print-only { display: none; }

/* ---------- الإدارة ---------- */
.docs { width: 100%; }
.docs td button { padding: 3px 10px; font-size: .8rem; background: transparent; color: var(--err); border-color: var(--err); }
.docs tbody tr { cursor: default; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.grid2 > * { width: 100%; }

@media (max-width: 600px) {
  .r-head h1 { font-size: 1.6rem; }
  dialog#detail { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; max-width: 100%; }
}

@media print {
  header.site, #picker, #progress, .no-print, .toolbar, .grid, .table-wrap, dialog { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; color: #000; }
  .panel, .p-item { box-shadow: none; border: 1px solid #ccc; }
  .p-item { break-inside: avoid; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
}

/* ================= الصفحة الرئيسية ================= */
a.brand { color: inherit; text-decoration: none; }
.main-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
header.site .main-nav a { border: 0; padding: 6px 12px; }
header.site .main-nav a.nav-admin { border: 1px solid rgba(255,255,255,.25); margin-inline-start: 6px; }
html { scroll-behavior: smooth; }
section[id], main[id] { scroll-margin-top: 16px; }

.hero { background: radial-gradient(1200px 500px at 85% -10%, #1f4e79 0%, transparent 60%), #0f2a47; color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(214,178,106,.18) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to left, #000, transparent 70%); pointer-events: none; }
.hero-in { position: relative; z-index: 1; display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; padding-block: 64px 72px; }
.hero .eyebrow { color: #d6b26a; font-weight: 600; font-size: .9rem; }
.hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.45; margin: 10px 0 16px; }
.hero h1 em { font-style: normal; color: #d6b26a; }
.hero p { color: #c9d4e2; font-size: 1.05rem; max-width: 60ch; margin: 0; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.btn { display: inline-block; padding: 12px 26px; border-radius: 10px; background: #d6b26a; color: #0f2a47; font-weight: 700; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); font-weight: 600; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-stats div { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 18px; }
.hero-stats b { display: block; font-size: 1.9rem; line-height: 1.2; color: #fff; }
.hero-stats span { color: #c9d4e2; font-size: .85rem; }

.picker { margin-top: -36px; position: relative; z-index: 2; }

.section { padding-block: 56px; }
.section.alt { background: var(--paper); border-block: 1px solid var(--line); }
.section .eyebrow, .goal-card .eyebrow { color: var(--gold); font-weight: 600; font-size: .85rem; }
.section h2 { font-size: 1.6rem; margin: 6px 0 14px; line-height: 1.4; }
.section p { color: var(--ink); }
.section-title { font-size: 1.45rem; margin: 0 0 8px; }
.section-title::after { content: ""; display: block; width: 48px; height: 3px; background: var(--gold); border-radius: 2px; margin-top: 10px; }
.section-sub { color: var(--muted); margin: 10px 0 0; }
.narrow { max-width: 820px; }
.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: center; }
.goal-card { background: #0f2a47; color: #fff; border-radius: 16px; padding: 28px; border-inline-start: 4px solid var(--gold); }
.goal-card .goal { color: #fff; font-size: 1.15rem; line-height: 1.9; margin: 8px 0 0; }

.steps { margin-top: 48px; }
.steps ol { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; position: relative; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--brand-2); font-weight: 700; margin-bottom: 10px; }
.steps li b { display: block; margin-bottom: 4px; }
.steps li span { color: var(--muted); font-size: .9rem; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.feature { border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--bg); }
.f-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #0f2a47; color: #d6b26a; font-size: 1.2rem; margin-bottom: 12px; }
.feature b { display: block; margin-bottom: 6px; }
.feature p { color: var(--muted); margin: 0; font-size: .92rem; }

.audiences { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
.aud { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.aud b { display: block; font-size: 1.05rem; margin-bottom: 8px; color: var(--brand); }
.aud p { margin: 0; color: var(--muted); font-size: .92rem; }

.ind-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 24px; }
.ind-group h4 { margin: 0 0 8px; color: var(--gold); font-size: .95rem; }
.ind-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ind-group li { background: var(--bg); border-radius: 8px; padding: 8px 12px; }
.ind-group li small { display: block; color: var(--muted); font-size: .78rem; }

.method { margin: 20px 0 0; padding-inline-start: 20px; display: grid; gap: 10px; }
.method li::marker { color: var(--gold); }

.site-foot { background: #0f2a47; color: #c9d4e2; padding-block: 22px; border-top: 3px solid var(--gold); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-foot b { color: #fff; }

@media (max-width: 900px) {
  .hero-in, .two-col { grid-template-columns: 1fr; }
  .steps ol, .audiences { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .main-nav a:not(.nav-admin) { display: none; }
  .steps ol, .audiences, .features { grid-template-columns: 1fr; }
  .hero-in { padding-block: 40px 60px; }
}
@media print { .hero, .section, .site-foot { display: none !important; } }

/* ---------- الاشتراكات ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: var(--shadow); }
.plan.featured { border: 2px solid var(--gold); transform: translateY(-6px); }
.p-tag { position: absolute; top: -13px; right: 24px; background: var(--gold); color: #0f2a47; font-size: .78rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.p-name { font-size: 1.15rem; color: var(--brand); }
.p-price { margin: 10px 0 4px; display: flex; align-items: baseline; gap: 6px; }
.p-price strong { font-size: 2.2rem; line-height: 1.2; }
.p-price span { color: var(--muted); font-size: .9rem; }
.p-desc { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.plan ul { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; font-size: .92rem; }
.plan li { padding-inline-start: 22px; position: relative; }
.plan li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--gold); font-weight: 700; }
.btn-plan { margin-top: auto; text-align: center; padding: 11px; border-radius: 10px; background: #0f2a47; color: #fff; text-decoration: none; font-weight: 600; }
.plan.featured .btn-plan { background: var(--gold); color: #0f2a47; }
.btn-plan.soon { background: var(--accent-soft) !important; color: var(--muted) !important; cursor: default; }
.hint.center { text-align: center; margin-top: 18px; }

/* ---------- من نحن ---------- */
.founder { display: flex; gap: 22px; align-items: flex-start; margin-top: 24px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.f-avatar { flex: none; width: 76px; height: 76px; border-radius: 50%; background: #0f2a47; display: grid; place-items: center; border: 3px solid var(--gold); }
.f-title { display: block; font-size: 1.15rem; color: var(--brand); }
.f-role { color: var(--gold); font-size: .88rem; font-weight: 600; }
.founder p { margin: 10px 0 0; }

@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } .plan.featured { transform: none; } }
@media (max-width: 560px) { .founder { flex-direction: column; } }
.p-price strong.txt { font-size: 1.6rem; }

/* ---------- الرؤية ---------- */
.roadmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; position: relative; }
.rm { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.rm-tag { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--brand-2); background: var(--accent-soft); padding: 3px 12px; border-radius: 999px; margin-bottom: 12px; }
.rm b { display: block; font-size: 1.1rem; margin-bottom: 6px; }
.rm p { color: var(--muted); margin: 0; font-size: .93rem; }
.rm.future { background: #0f2a47; border-color: #0f2a47; }
.rm.future b { color: #fff; }
.rm.future p { color: #c9d4e2; }
.rm.future .rm-tag { background: var(--gold); color: #0f2a47; }
.goal-card .goal + .goal { margin-top: 12px; }
.goal-card .goal b { color: #d6b26a; }
.creds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.creds span { font-size: .8rem; background: var(--paper); border: 1px solid var(--line); color: var(--brand); padding: 4px 12px; border-radius: 999px; }
@media (max-width: 900px) { .roadmap { grid-template-columns: 1fr; } }

/* ---------- الحساب في الهيدر ---------- */
.acct { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 6px; }
.acct-btn { background: #d6b26a; color: #0f2a47; border: 0; padding: 7px 16px; font-weight: 700; font-size: .88rem; }
.acct-chip { color: #fff; font-size: .85rem; background: rgba(255,255,255,.08); padding: 6px 12px; border-radius: 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.site .main-nav .acct a { padding: 6px 10px; }

/* ---------- الخريطة ---------- */
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.picker-head h2 { margin: 0; }
.quota { font-size: .85rem; background: var(--accent-soft); color: var(--brand); padding: 6px 12px; border-radius: 8px; }
.map-wrap { position: relative; background: #05070c; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.map svg { display: block; width: 100%; height: auto; }
.map .others path { fill: #4d4e55; stroke: #0b0c10; stroke-width: .7; }
.map .c { fill: #9a9c72; stroke: #14161a; stroke-width: 1; cursor: pointer; transition: fill .15s; outline: none; }
.map .c.pending { fill: #6d6f55; }
.map .c.viewed { fill: #b9b98a; }
.map .c:hover, .map .c:focus-visible { fill: #d6b26a; }
.map .c.sel { fill: #d6b26a; stroke: #fff; stroke-width: 1.4; }
.map .dot { stroke: #05070c; stroke-width: 1.5; }
.map-tip { position: absolute; transform: translate(-50%, -140%); background: #0f2a47; color: #fff; border: 1px solid #d6b26a; padding: 4px 10px; border-radius: 6px; font-size: .82rem; pointer-events: none; white-space: nowrap; }
.map-legend { position: absolute; bottom: 8px; right: 10px; display: flex; gap: 12px; font-size: .75rem; color: #c9d4e2; background: rgba(5,7,12,.7); padding: 4px 10px; border-radius: 6px; flex-wrap: wrap; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: middle; }
.lg.ok { background: #9a9c72; } .lg.pending { background: #6d6f55; } .lg.out { background: #4d4e55; }

.upsell { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: #0f2a47; color: #fff; border-radius: 12px; padding: 16px 20px; border-inline-start: 4px solid #d6b26a; }
.upsell b { color: #d6b26a; } .upsell p { margin: 2px 0 0; color: #c9d4e2; font-size: .9rem; }

/* ---------- نافذة الحساب ---------- */
dialog.auth-dlg { border: 0; padding: 0; border-radius: 16px; width: min(440px, calc(100% - 32px)); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.auth-dlg::backdrop { background: rgba(10, 20, 35, .55); }
.auth-tabs { display: flex; margin-bottom: 16px; }
.auth-tabs button { flex: 1; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 4px; color: var(--ink); font-size: .9rem; }
.auth-form input { width: 100%; }
.auth-form small { color: var(--muted); font-size: .75rem; }
.auth-form button[type=submit] { margin-top: 4px; }
@media (max-width: 560px) { .map-legend { position: static; border-radius: 0; } .acct-chip { max-width: 120px; } }

/* ================= نسخة الطباعة / PDF ================= */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(main), main > *:not(#report), #report > *:not(.pdoc), dialog { display: none !important; }
  main.wrap { max-width: none; padding: 0; }
  .pdoc { display: block !important; color: #16202e; font-size: 10pt; line-height: 1.6; }
  .pdoc, .pdoc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* الإطار: thead/tfoot يتكرران في كل صفحة فيتركان مساحة للترويسة والتذييل */
  .p-frame { width: 100%; border-collapse: collapse; }
  .p-frame > tbody > tr > td, .p-frame > thead > tr > td, .p-frame > tfoot > tr > td { padding: 0 14mm; border: 0; }
  .p-sp-top { height: 20mm; } .p-sp-bot { height: 16mm; }

  .p-head, .p-foot { position: fixed; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 14mm; font-size: 8pt; z-index: 2; }
  .p-head { top: 0; height: 13mm; background: #0f2a47; color: #fff; border-bottom: 1.2mm solid #d6b26a; }
  .p-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 10pt; }
  .p-foot { bottom: 0; height: 10mm; color: #5f6878; border-top: .3mm solid #d9d4c8; background: #fff; }

  /* العلامة المائية: تتكرر في كل صفحة */
  .p-wm { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-32deg); display: flex; flex-direction: column; align-items: center; opacity: .055; pointer-events: none; z-index: 0; color: #0f2a47; white-space: nowrap; }
  .p-wm span:first-child { font-size: 88pt; font-weight: 700; line-height: 1.1; }
  .p-wm span:last-child { font-size: 30pt; letter-spacing: 12pt; font-weight: 700; }
  .p-frame { position: relative; z-index: 1; }

  /* الغلاف */
  .p-hero { display: flex; justify-content: space-between; align-items: center; gap: 10mm; background: #0f2a47; color: #fff; border-radius: 4mm; padding: 7mm 8mm; margin-top: 2mm; border-inline-start: 2mm solid #d6b26a; }
  .p-eyebrow { color: #d6b26a; font-weight: 700; font-size: 9pt; }
  .p-hero h1 { margin: 1mm 0; font-size: 26pt; line-height: 1.25; }
  .p-sub { color: #c9d4e2; font-size: 9pt; }
  .p-qr { background: #fff; border-radius: 3mm; padding: 3mm; text-align: center; color: #0f2a47; flex: none; }
  .p-qr img { width: 24mm; height: 24mm; display: block; margin: 0 auto 1mm; }
  .p-qr span { display: block; font-size: 7pt; color: #5f6878; }
  .p-qr b { font-size: 8pt; }
  .p-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; margin: 5mm 0; }
  .p-kpis div { border: .3mm solid #e3dfd6; border-top: 1mm solid #d6b26a; border-radius: 3mm; padding: 3mm 4mm; background: #faf9f6; }
  .p-kpis strong { display: block; font-size: 18pt; line-height: 1.2; color: #0f2a47; }
  .p-kpis small { font-size: 10pt; color: #5f6878; }
  .p-kpis span { font-size: 8pt; color: #5f6878; }
  .p-h2 { font-size: 13pt; margin: 4mm 0 3mm; color: #0f2a47; }
  .p-h2::after { content: ""; display: block; width: 14mm; height: .8mm; background: #d6b26a; margin-top: 1.5mm; }

  .p-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; }
  .pt { border: .3mm solid #e3dfd6; border-radius: 3mm; padding: 3mm; background: #fff; break-inside: avoid; display: flex; flex-direction: column; gap: 1mm; min-height: 38mm; }
  .pt-top { display: flex; justify-content: space-between; font-size: 7pt; color: #b08d45; font-weight: 700; }
  .pt-top span:last-child { color: #5f6878; }
  .pt-name { font-size: 9pt; line-height: 1.4; }
  .pt-org { font-size: 7pt; color: #5f6878; }
  .pt-score { margin-top: auto; display: flex; align-items: baseline; gap: 1.5mm; }
  .pt-score strong { font-size: 17pt; color: #0f2a47; line-height: 1.1; }
  .pt-score span, .pt-empty { font-size: 8pt; color: #5f6878; }
  .pt-empty { margin-top: auto; }
  .pt-rank { font-size: 7pt; color: #5f6878; }
  .pt-bar { position: relative; height: 1.4mm; background: #edf1f6; border-radius: 1mm; margin-top: 1mm; }
  .pt-bar i { position: absolute; top: 50%; width: 2.6mm; height: 2.6mm; border-radius: 50%; background: #1f4e79; transform: translate(50%, -50%); }
  .pt-cls { font-size: 7pt; background: #edf1f6; color: #1f4e79; border-radius: 2mm; padding: .5mm 2mm; align-self: flex-start; }

  /* التفاصيل */
  .p-details { break-before: page; }
  .p-item { border: .3mm solid #e3dfd6; border-radius: 3mm; padding: 4mm; margin-bottom: 3mm; break-inside: avoid; background: #fff; }
  .p-item-h { display: flex; justify-content: space-between; align-items: baseline; gap: 4mm; border-bottom: .3mm solid #e3dfd6; padding-bottom: 2mm; margin-bottom: 2mm; }
  .p-item-h b { font-size: 11pt; color: #0f2a47; }
  .p-item-h span { font-size: 7.5pt; color: #5f6878; }
  .pdoc .facts { display: flex; flex-wrap: wrap; gap: 2mm; margin-bottom: 2mm; }
  .pdoc .fact { background: #faf9f6; border-radius: 2mm; padding: 1.5mm 3mm; }
  .pdoc .fact span { font-size: 7pt; } .pdoc .fact b { font-size: 9.5pt; }
  .pdoc .block { margin-bottom: 2mm; } .pdoc .block h4 { font-size: 8.5pt; margin: 0 0 1mm; color: #b08d45; }
  .pdoc .block.reading { background: #edf1f6; border-radius: 2mm; padding: 2.5mm 3mm; }
  .pdoc .subs td { padding: 1mm 2mm; font-size: 8.5pt; border-bottom: .2mm solid #e3dfd6; }
  .pdoc .sources { font-size: 7.5pt; } .pdoc .sources a { color: #1f4e79; text-decoration: none; }
  .pdoc .note { font-size: 8pt; }
  .p-end { margin-top: 5mm; padding: 4mm; border-radius: 3mm; background: #faf9f6; border-inline-start: 1mm solid #d6b26a; font-size: 8pt; color: #5f6878; break-inside: avoid; }
  .p-end p { margin: 0 0 1mm; }
}

/* ---------- طباعة بالأبيض والأسود ---------- */
@media print {
  .pdoc { color: #000; }
  .p-head { background: #fff; color: #000; border-bottom: .6mm solid #000; }
  .p-brand svg circle, .p-brand svg path { stroke: #000; }
  .p-foot { color: #333; border-top: .3mm solid #000; }
  .p-wm { color: #000; opacity: .06; }
  .p-hero { background: #fff; color: #000; border: .5mm solid #000; border-inline-start: 2mm solid #000; }
  .p-eyebrow { color: #000; text-decoration: underline; }
  .p-sub { color: #333; }
  .p-qr { border: .3mm solid #000; color: #000; }
  .p-qr span { color: #333; }
  .p-kpis div { background: #fff; border: .3mm solid #000; border-top: 1mm solid #000; }
  .p-kpis strong { color: #000; } .p-kpis small, .p-kpis span { color: #333; }
  .p-h2 { color: #000; } .p-h2::after { background: #000; }
  .pt { border: .3mm solid #000; }
  .pt-top, .pt-top span:last-child { color: #333; }
  .pt-org, .pt-score span, .pt-empty, .pt-rank { color: #333; }
  .pt-score strong { color: #000; }
  .pt-desc { margin-top: auto; font-size: 7.5pt; line-height: 1.5; color: #000; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
  .pt-bar { background: #fff; border: .25mm solid #000; }
  .pt-bar i { background: #000; border: .3mm solid #fff; }
  .pt-cls { background: #fff; color: #000; border: .25mm solid #000; }
  .p-item { border: .3mm solid #000; }
  .p-item-h { border-bottom: .3mm solid #000; } .p-item-h b { color: #000; } .p-item-h span { color: #333; }
  .pdoc .fact { background: #fff; border: .25mm solid #666; }
  .pdoc .fact span { color: #333; }
  .pdoc .block h4 { color: #000; text-decoration: underline; }
  .pdoc .block.reading { background: #fff; border: .3mm solid #000; border-inline-start: 1.2mm solid #000; }
  .pdoc .subs td { border-bottom: .2mm solid #666; }
  .pdoc .sources, .pdoc .sources a { color: #000; }
  .pdoc .note { color: #000; font-style: italic; }
  .pdoc .badge { color: #000; border: .25mm solid #000; background: #fff; }
  .p-end { background: #fff; border: .3mm solid #000; border-inline-start: 1.2mm solid #000; color: #000; }
}
.roadmap { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
@media print { .p-end { display: inline-block; width: 100%; page-break-inside: avoid; } }
