/* الوضع الداكن للوحة التحكم — يُفعَّل بـ html[data-theme="dark"] (تلقائي/فاتح/داكن من زر الشريط العلوي). */
html[data-theme="dark"]{
  color-scheme:dark;
  --brand:#6b8cff; --brand2:#86a0ff; --brand3:#a5b8ff;
  --brand-50:rgba(107,140,255,.12); --brand-100:rgba(107,140,255,.24);
  --accent:#2dd4bf; --accent2:#5eead4;
  --ink:#e6eaf2; --ink2:#c3cad8; --muted:#8e99ad; --faint:#6b778c;
  --bg:#0b1120; --card:#121a2b; --soft:#0f1626; --line:#232e44; --line2:#1b2538;
  --ok:#34d399; --warn:#fbbf24; --err:#f87171;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow:0 1px 2px rgba(0,0,0,.35),0 10px 30px -8px rgba(0,0,0,.55);
  --shadow-lg:0 30px 70px -12px rgba(0,0,0,.7);
  --ring:0 0 0 4px rgba(107,140,255,.22);
  --grad:linear-gradient(135deg,#2a45b8 0%,#3d63f0 60%,#5b7cff 100%);
  --grad-soft:linear-gradient(135deg,#16213a,#13262a);
}
html[data-theme="dark"] body{
  background:radial-gradient(900px 380px at 85% -120px,rgba(107,140,255,.10),transparent 70%),
             radial-gradient(700px 340px at 0% 0%,rgba(45,212,191,.06),transparent 70%),var(--bg);
}
html[data-theme="dark"] .nav{background:rgba(11,17,32,.82)}
html[data-theme="dark"] .mnav{background:rgba(11,17,32,.94)}
html[data-theme="dark"] .nav-links a:hover{background:rgba(255,255,255,.04)}
html[data-theme="dark"] .btn-primary{background:#3d63f0;border-color:#3d63f0;color:#fff}
html[data-theme="dark"] .btn-primary:hover{background:#2f52d8;border-color:#2f52d8;color:#fff}
html[data-theme="dark"] .input{border-color:#2b3752;box-shadow:none}
html[data-theme="dark"] .hero{background:linear-gradient(180deg,#141d31,var(--card))}
html[data-theme="dark"] .stat.s1 .ic{background:rgba(107,140,255,.14);color:#8ea6ff}
html[data-theme="dark"] .stat.s2 .ic{background:rgba(56,189,248,.12);color:#7dd3fc}
html[data-theme="dark"] .stat.s3 .ic{background:rgba(45,212,191,.12);color:#5eead4}
html[data-theme="dark"] .stat.s4 .ic{background:rgba(232,121,249,.12);color:#f0abfc}
html[data-theme="dark"] .umenu-pop .danger:hover{background:#3b1418;color:#fca5a5}
html[data-theme="dark"] .tbl th{background:var(--soft)}
html[data-theme="dark"] .tbl tr:hover td{background:#16203a}

/* الأسطح البيضاء الثابتة */
html[data-theme="dark"] .btn,
html[data-theme="dark"] .input,
html[data-theme="dark"] .tile,
html[data-theme="dark"] .feat,
html[data-theme="dark"] .ov-box,
html[data-theme="dark"] .ov-btns button,
html[data-theme="dark"] .rt-search,
html[data-theme="dark"] .rt-sel,
html[data-theme="dark"] .rowmenu-pop,
html[data-theme="dark"] .ans-row,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{background:var(--card);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .btn{color:var(--ink2)}
html[data-theme="dark"] .btn:hover{background:#18223a;color:var(--ink)}
html[data-theme="dark"] .btn.btn-primary{background:#3d63f0;border-color:#3d63f0;color:#fff}
html[data-theme="dark"] .btn.btn-primary:hover{background:#2f52d8;color:#fff}
html[data-theme="dark"] .ov-btns .danger{background:var(--err);color:#0b1222;border-color:var(--err)}
html[data-theme="dark"] .ov-btns .primary{background:var(--brand2);color:#fff;border-color:var(--brand2)}
html[data-theme="dark"] .input::placeholder{color:#64748b}
html[data-theme="dark"] .input:disabled{background:#0e1628;color:#94a3b8}

/* أزرار بخلفية بيضاء مكتوبة داخل السطر (style="background:#fff") */
html[data-theme="dark"] [style*="background:#fff"]{background:var(--card)!important}
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background:#fafbff"]{background:#0e1628!important}


/* نصوص داكنة ثابتة */
html[data-theme="dark"] .field label,
html[data-theme="dark"] .checkbox,
html[data-theme="dark"] .ov-title,
html[data-theme="dark"] .legal-body,
html[data-theme="dark"] .ans-a,
html[data-theme="dark"] .rowmenu-pop a,
html[data-theme="dark"] .rowmenu-pop button,
html[data-theme="dark"] .folders-panel .fp-title{color:#cbd5e1}
html[data-theme="dark"] .ov-box p,html[data-theme="dark"] .land-hero p{color:#94a3b8}
html[data-theme="dark"] [style*="color:#334155"],
html[data-theme="dark"] [style*="color:#475569"],
html[data-theme="dark"] [style*="color:#0f172a"],
html[data-theme="dark"] [style*="color:#1e293b"]{color:#cbd5e1!important}

/* الجداول والقوائم */
html[data-theme="dark"] .tbl tr:hover td,
html[data-theme="dark"] .resp-tbl tbody tr:hover td{background:#16233d}
html[data-theme="dark"] .rowmenu-pop a:hover,html[data-theme="dark"] .rowmenu-pop button:hover{background:#16233d}
html[data-theme="dark"] .rowmenu-pop .danger:hover{background:#3b1418;color:#fca5a5}
html[data-theme="dark"] .folders-panel{background:#0e1628}
html[data-theme="dark"] .folders-panel .fp-chip{background:#16233d;border-color:#23304a;color:#bfdbfe}

/* شارات وتنبيهات فاتحة → نسخ داكنة هادئة */
html[data-theme="dark"] .flash.ok{background:#052e24;color:#6ee7b7;border-color:#065f46}
html[data-theme="dark"] .flash.err{background:#3b1418;color:#fda4af;border-color:#7f1d1d}
html[data-theme="dark"] .badge.form,html[data-theme="dark"] .land-badge,html[data-theme="dark"] .ov-ico{background:#16233d}
html[data-theme="dark"] .badge.quiz{background:#0f2a33}
html[data-theme="dark"] .ov-ico.danger{background:#3b1418}
html[data-theme="dark"] .ans-row.ans-ok{background:#082a20;border-color:#065f46}
html[data-theme="dark"] .ans-row.ans-bad{background:#2d1216;border-color:#7f1d1d}
html[data-theme="dark"] .ans-correct{background:#052e24;border-color:#065f46;color:#6ee7b7}

/* صفحات هذا الإصدار (الدعوات/الأمان/الردود) */
html[data-theme="dark"] .inv-stat,html[data-theme="dark"] .inv-check,html[data-theme="dark"] .ava-box{background:#0e1628;border-color:var(--line)}
html[data-theme="dark"] .inv-stat span{color:#94a3b8}
html[data-theme="dark"] .inv-tag.done{background:#052e24;border-color:#065f46;color:#6ee7b7}
html[data-theme="dark"] .inv-tag.wait{background:#2d2006;border-color:#78350f;color:#fcd34d}
html[data-theme="dark"] .inv-tag.mail{background:#0f1f3d;border-color:#1e3a8a;color:#93c5fd}
html[data-theme="dark"] .inv-tag.rem{background:#1f1837;border-color:#4c1d95;color:#c4b5fd}
html[data-theme="dark"] .inv-tag.muted{background:#0e1628;color:#94a3b8}
html[data-theme="dark"] .inv-remind{color:#cbd5e1}
html[data-theme="dark"] .tfa-ico{background:#16233d}
html[data-theme="dark"] .tfa-btn{background:var(--card);color:#cbd5e1;border-color:var(--line)}
html[data-theme="dark"] .tfa-btn.primary{background:var(--brand2);border-color:var(--brand2);color:#fff}
html[data-theme="dark"] .tfa-btn.danger{background:#3b1418;border-color:#7f1d1d;color:#fca5a5}
html[data-theme="dark"] .tfa-badge.on{background:#052e24;border-color:#065f46;color:#6ee7b7}
html[data-theme="dark"] .tfa-badge.off{background:#0e1628;color:#94a3b8}
html[data-theme="dark"] .tfa-left{color:#cbd5e1}
html[data-theme="dark"] .tfa-steps{color:#cbd5e1}
html[data-theme="dark"] .tfa-secret code,html[data-theme="dark"] .tfa-codes span{background:#0e1628;color:#e2e8f0;border-color:var(--line)}
html[data-theme="dark"] .tfa-mini{background:var(--card)}
html[data-theme="dark"] .tfa-note{background:#2d2006;border-color:#78350f;color:#fcd34d}
html[data-theme="dark"] .tfa-err{background:#3b1418;border-color:#7f1d1d;color:#fca5a5}
html[data-theme="dark"] .rt-pdf{border-color:#7f1d1d;color:#fca5a5}
html[data-theme="dark"] .ava-btn{background:#16233d;color:#93c5fd;border-color:#1e3a8a}
html[data-theme="dark"] .ava-btn.danger{background:#3b1418;color:#fca5a5;border-color:#7f1d1d}

/* زر اختيار المظهر */
.theme-pick{position:relative}
.theme-pop{position:absolute;top:calc(100% + 8px);inset-inline-end:0;background:var(--card);border:1px solid var(--line);
  border-radius:14px;box-shadow:var(--shadow-lg);padding:6px;min-width:170px;z-index:50;display:none}
.theme-pop.open{display:block;animation:fadeUp .15s both}
.theme-pop button{display:flex;width:100%;align-items:center;gap:.6rem;border:0;background:transparent;color:var(--ink);
  font-family:inherit;font-weight:700;font-size:.9rem;padding:.55rem .7rem;border-radius:10px;cursor:pointer;text-align:start}
.theme-pop button i{width:18px;text-align:center;color:var(--brand)}
.theme-pop button:hover{background:rgba(37,99,235,.10)}
.theme-pop button[aria-checked="true"]{background:rgba(37,99,235,.14)}
.theme-pop button[aria-checked="true"]::after{content:"\f00c";font-family:"Font Awesome 6 Free";font-weight:900;margin-inline-start:auto;color:var(--brand)}

html[data-theme="dark"] .frow-ic.q,html[data-theme="dark"] .badge.quiz{background:rgba(45,212,191,.1);color:#5eead4;border-color:rgba(45,212,191,.2)}
html[data-theme="dark"] .trend.up{background:rgba(52,211,153,.12);color:#6ee7b7}
html[data-theme="dark"] .trend.down{background:rgba(248,113,113,.12);color:#fca5a5}
html[data-theme="dark"] .spark span{background:linear-gradient(180deg,#4a63c9,#1f2a48)}
html[data-theme="dark"] .spark span.today{background:linear-gradient(180deg,#86a0ff,#3d63f0)}
html[data-theme="dark"] .qi.c1{background:rgba(107,140,255,.14);color:#8ea6ff}
html[data-theme="dark"] .qi.c2{background:rgba(232,121,249,.12);color:#f0abfc}
html[data-theme="dark"] .qi.c3{background:rgba(45,212,191,.12);color:#5eead4}
html[data-theme="dark"] .qi.c4{background:rgba(251,146,60,.12);color:#fdba74}
html[data-theme="dark"] .co-row.ref{background:rgba(251,191,36,.08)}
html[data-theme="dark"] .co-note.ok,html[data-theme="dark"] .st-approved,html[data-theme="dark"] .ob-state.on,html[data-theme="dark"] .pr-cur{background:rgba(52,211,153,.1);border-color:rgba(52,211,153,.3);color:#6ee7b7}
html[data-theme="dark"] .co-note.warn,html[data-theme="dark"] .st-pending,html[data-theme="dark"] .bm-warn{background:rgba(251,191,36,.1);border-color:rgba(251,191,36,.3);color:#fcd34d}
html[data-theme="dark"] .st-rejected{background:rgba(248,113,113,.1);border-color:rgba(248,113,113,.3);color:#fca5a5}
html[data-theme="dark"] .co-drop.has{background:rgba(52,211,153,.08)}
html[data-theme="dark"] .pr-save{background:rgba(52,211,153,.15);color:#6ee7b7}
html[data-theme="dark"] .sw span,html[data-theme="dark"] .fc-sw{background:#334155}
html[data-theme="dark"] .pr-feats li.n i{color:#f87171}
html[data-theme="dark"] .trial-bar{background:rgba(99,102,241,.12);border-color:rgba(129,140,248,.35);color:#c7d2fe}
html[data-theme="dark"] .trial-bar small{color:#a5b4fc}
html[data-theme="dark"] .trial-bar.end{background:rgba(245,158,11,.1);border-color:rgba(245,158,11,.35);color:#fcd34d}
html[data-theme="dark"] .trial-bar.end small{color:#fde68a}
html[data-theme="dark"] .ou-plan.trial{color:#a5b4fc}html[data-theme="dark"] .ou-plan.paid{color:#6ee7b7}
