/* PRIMIX_THEME_REVAMP_V3 */
/* PRIMIX_THEME_CLEANUP_V4 */
/* هدف الملف: توحيد الشكل على روح dashboard REVAMP (خفيف/واضح/مبهر + Dark/Light مضبوط) */

:root{
  color-scheme: light dark;
  /* legacy compatibility */
  --radius: 18px;
  --topbar-h: 72px;

  /* Light defaults (روح REVAMP) */
  --bg:#f6f7fb;
  --card:#ffffff;
  --card2:#fbfcff;
  --text:#0f172a;
  --muted:#64748b;
  --border:rgba(15,23,42,.10);

  --accent:#2563eb;
  --accent2:#7c3aed;
  --accent-cyan:#0891b2;
  --onAccent:#ffffff;

  --ok:#16a34a;
  --warn:#f59e0b;
  --bad:#ef4444;
  /* dual-mode aliases — legacy/dark-only names now resolve in light too (dark Block #2 keeps !important wins) */
  --success:var(--status-success-fg); --green:var(--status-success-fg);
  --danger:var(--status-danger-fg);   --red:var(--status-danger-fg);
  --warning:var(--status-warn-fg);    --amber:var(--status-warn-fg);   --gold:var(--status-warn-fg);
  --purple:var(--status-violet-fg);
  --blue:var(--accent-cyan);
  --line:var(--border);   --border2:var(--border);
  --muted2:var(--muted);
  --card3:var(--card2);   --bg2:var(--card);
  --color:var(--text);
  --status-neutral-bg:#f1f5f9; --status-neutral-fg:#475569; --status-neutral-border:#e2e8f0;
  --status-info-bg:#dbeafe;    --status-info-fg:#1e40af;    --status-info-border:#bfdbfe;
  --status-warn-bg:#fef3c7;    --status-warn-fg:#92400e;    --status-warn-border:#fde68a;
  --status-success-bg:#dcfce7; --status-success-fg:#166534; --status-success-border:#bbf7d0;
  --status-danger-bg:#fee2e2;  --status-danger-fg:#991b1b;  --status-danger-border:#fecaca;
  --status-violet-bg:#ede9fe;  --status-violet-fg:#6d28d9;  --status-violet-border:#ddd6fe;

  --shadow:0 20px 50px rgba(2,6,23,.08);
  --shadow2:0 10px 25px rgba(2,6,23,.08);

  --r-lg:22px;
  --r-md:16px;
  --r-sm:12px;

  /* status-tint flat tokens — customer-registration Phase 2 (2026-06-30) */
  /* Light values mirror --status-{family}-{bg,fg,border} from the in-flight PMX THEME PHASE-2 work.    */
  /* If those base tokens change, audit these NN-variants for site-wide consistency.                   */
  /* Mechanically self-contained: each token holds a literal hex/rgba, no var() indirection.            */
  --status-info-bg-06:#dbeafe;
  --status-info-bg-075:#dbeafe;
  --status-info-bg-08:#dbeafe;
  --status-info-bg-12:#bfdbfe;
  --status-info-bg-13:#bfdbfe;
  --status-info-bg-17:#bfdbfe;
  --status-info-bg-20:#bfdbfe;
  --status-info-bg-34:#bfdbfe;
  --status-info-border-07:#bfdbfe;
  --status-info-border-09:#bfdbfe;
  --status-info-border-34:#1e40af;
  --status-info-border-35:#1e40af;
  --status-info-border-42:#1e40af;
  --status-info-border-45:#1e40af;
  --status-info-border-55:#1e40af;
  --status-success-bg-06:#dcfce7;
  --status-success-bg-08:#dcfce7;
  --status-success-bg-12:#bbf7d0;
  --status-success-bg-14:#bbf7d0;
  --status-success-border-07:#bbf7d0;
  --status-success-border-08:#bbf7d0;
  --status-success-border-32:#166534;
  --status-success-border-35:#166534;
  --status-success-border-40:#166534;
  --status-success-border-42:#166534;
  --status-success-border-45:#166534;
  --status-warn-bg-07:#fef3c7;
  --status-warn-bg-08:#fef3c7;
  --status-warn-bg-10:#fef3c7;
  --status-warn-bg-12:#fde68a;
  --status-warn-bg-16:#fde68a;
  --status-warn-border-08:#fde68a;
  --status-warn-border-35:#92400e;
  --status-warn-border-40:#92400e;
  --status-warn-border-42:#92400e;
  --status-warn-border-50:#92400e;
  --status-warn-border-52:#92400e;
  --status-warn-border-55:#92400e;
  --status-danger-bg-07:#fee2e2;
  --status-danger-bg-08:#fee2e2;
  --status-danger-bg-09:#fee2e2;
  --status-danger-bg-10:#fee2e2;
  --status-danger-bg-12:#fecaca;
  --status-danger-bg-16:#fecaca;
  --status-danger-border-08:#fecaca;
  --status-danger-border-25:#fecaca;
  --status-danger-border-35:#991b1b;
  --status-danger-border-38:#991b1b;
  --status-danger-border-42:#991b1b;
  --status-danger-border-50:#991b1b;
  --status-danger-border-52:#991b1b;
  --status-danger-border-58:#991b1b;
  --status-violet-bg-08:#ede9fe;
  --status-violet-bg-14:#ddd6fe;
  --status-violet-bg-22:#ddd6fe;
  --status-violet-border-40:#6d28d9;
  --status-violet-border-45:#6d28d9;
  --status-neutral-slate-bg-10:#f1f5f9;
  --status-neutral-slate-border-18:#e2e8f0;
  --status-neutral-slate-border-22:#e2e8f0;
  --status-neutral-slate-border-24:#e2e8f0;
  --status-neutral-slate-border-25:#e2e8f0;
  --status-neutral-slate-border-28:#e2e8f0;
  --status-neutral-slate-border-30:#e2e8f0;
  --status-neutral-navy-bg-12:rgba(241,245,249,.12);
  --status-neutral-navy-bg-14:rgba(241,245,249,.14);
  --status-neutral-navy-bg-16:rgba(241,245,249,.16);
  --status-neutral-navy-bg-18:rgba(241,245,249,.18);
  --status-neutral-navy-bg-20:rgba(241,245,249,.20);
  --status-neutral-navy-bg-25:rgba(241,245,249,.25);
  --status-neutral-navy-bg-78:rgba(241,245,249,.78);
}

html[data-theme="dark"]{
  --bg:#0b1220;
  --card:#0f1a2b;
  --card2:#0b1626;
  --text:#e5e7eb;
  --muted:#9aa4b2;
  --border:rgba(148,163,184,.18);

  --shadow:0 24px 70px rgba(0,0,0,.35);
  --shadow2:0 12px 30px rgba(0,0,0,.28);
  --status-neutral-bg:#283448; --status-neutral-fg:#cbd5e1; --status-neutral-border:#334155;
  --status-info-bg:#1a2b4d;    --status-info-fg:#60a5fa;    --status-info-border:#2c4a6e;
  --status-warn-bg:#3a2e16;    --status-warn-fg:#fbbf24;    --status-warn-border:#4d3d1a;
  --status-success-bg:#16352a; --status-success-fg:#4ade80; --status-success-border:#1f4a2e;
  --status-danger-bg:#3a2020;  --status-danger-fg:#f87171;  --status-danger-border:#4d2020;
  --status-violet-bg:#2a1f4d;  --status-violet-fg:#a78bfa;  --status-violet-border:#3d2e6e;
  --accent-cyan:#7dd3fc;
}

/* خلفية “مبهرة” بدون إزعاج */
body{
  min-height:100vh;
  background:var(--bg);
  color:var(--text);
}
body::before{
  content:"";
  position:fixed;
  inset:-120px -120px auto -120px;
  height:520px;
  pointer-events:none;
  background:
    radial-gradient(900px 420px at 20% -10%, rgba(37,99,235,.18), transparent 60%),
    radial-gradient(800px 360px at 80% -12%, rgba(124,58,237,.16), transparent 55%);
  filter:saturate(1.05);
  z-index:-1;
}
html[data-theme="dark"] body::before{
  background:
    radial-gradient(900px 420px at 20% -10%, rgba(37,99,235,.22), transparent 60%),
    radial-gradient(800px 360px at 80% -12%, rgba(124,58,237,.20), transparent 55%);
  opacity:.9;
}

/* حاويات مشتركة */
.pmx-shell,.pmx-wrap,.container{
  max-width:1200px;
  margin:0 auto;
  padding:22px 18px 44px;
}

/* Topbar (تتوافق مع أغلب الصفحات) */
.pmx-topbar{
  position:sticky; top:0; z-index:50;
  background:linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.36));
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
html[data-theme="dark"] .pmx-topbar{
  background:linear-gradient(180deg, rgba(15,26,43,.78), rgba(15,26,43,.40));
}
.pmx-row{display:flex; align-items:center; gap:12px}
.pmx-row-between{justify-content:space-between}
.pmx-brand{display:flex; align-items:center; gap:12px; text-decoration:none; color:inherit}
.pmx-logo{
  width:38px;height:38px;border-radius:14px;
  background:linear-gradient(135deg, rgba(37,99,235,.20), rgba(124,58,237,.18));
  border:1px solid rgba(37,99,235,.22);
  box-shadow:0 10px 25px rgba(37,99,235,.10);
}
.pmx-title{font-weight:900;color:var(--text)}
.pmx-subtitle{font-size:12px; color:var(--muted)}

/* Cards */
.pmx-card,.card,section.card,div.card{
  background:linear-gradient(180deg, rgba(255,255,255,.76), rgba(255,255,255,.32));
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow2);
}
html[data-theme="dark"] .pmx-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] section.card,
html[data-theme="dark"] div.card{
  background:linear-gradient(180deg, rgba(15,26,43,.78), rgba(15,26,43,.32));
}
.pmx-card.pad{padding:16px}

/* Buttons */
.pmx-btn,.btn,button{
  border-radius:14px;
  border:1px solid var(--border);
}
.pmx-btn.primary,.btn.primary,.btn-primary{
  background:linear-gradient(135deg, rgba(37,99,235,.95), rgba(124,58,237,.92));
  color:white;
  border-color:rgba(37,99,235,.28);
  box-shadow:0 12px 25px rgba(37,99,235,.22);
}
.pmx-btn.ghost,.btn.ghost,.btn-ghost{
  background:transparent;
  color:var(--text);
}
.pmx-btn:hover,.btn:hover,button:hover{
  transform:translateY(-1px);
  box-shadow:0 16px 34px rgba(2,6,23,.10);
}

/* Inputs */
.pmx-input,.pmx-select,input,select,textarea{
  background:var(--card);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  outline:none;
}
html[data-theme="dark"] .pmx-input,
html[data-theme="dark"] .pmx-select,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:var(--card2);
}
.pmx-input:focus,.pmx-select:focus,input:focus,select:focus,textarea:focus{
  border-color:rgba(37,99,235,.45);
  box-shadow:0 0 0 4px rgba(37,99,235,.14);
}

/* Tables */
table{width:100%; border-collapse:collapse}
th,td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  text-align:right;
}
thead th{
  color:var(--muted);
  font-weight:800;
  background:rgba(37,99,235,.06);
}
html[data-theme="dark"] thead th{background:rgba(37,99,235,.10)}

/* Text helpers */
.muted{color:var(--muted)}
hr{border:none; border-top:1px solid var(--border)}

/* Messages */
.pmx-msg{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(2,6,23,.03);
}
html[data-theme="dark"] .pmx-msg{background:rgba(148,163,184,.06)}
.pmx-msg.ok{border-color:rgba(22,163,74,.28); background:rgba(22,163,74,.10)}
.pmx-msg.err{border-color:rgba(239,68,68,.28); background:rgba(239,68,68,.10)}
.pmx-msg.warn{border-color:rgba(245,158,11,.28); background:rgba(245,158,11,.10)}

/* ============================================================
   PMX THEME PHASE-2 (final) — global dark override
   Two layers, BOTH scoped to html[data-theme="dark"] so LIGHT
   mode is never touched:
   (A) Re-map theme variables, defeating pages that ship their own
       light-only :root (≈119 pages). Pages that read var(--bg)
       etc. now follow dark.
   (B) Re-map hardcoded template classes for fixed-color pages
       (≈28 pages) whose <style> writes literal hex.
   Pages that already ship their own html[data-theme="dark"] block
   keep working (same variable names → consistent).
   ============================================================ */

/* (A) variable re-map — wins over page-local :root because this
       selector (html[data-theme="dark"]) is more specific than :root
       and loads via theme-revamp.css which we cache-bump. */
html[data-theme="dark"]{
  --bg:#0b1220 !important;   --bg2:#0b1626 !important;
  --card:#0f1a2b !important; --card2:#0b1626 !important; --card3:#0f1a2b !important;
  --text:#e5e7eb !important; --color:#e5e7eb !important;
  --muted:#9aa4b2 !important; --muted2:#9aa4b2 !important;
  --border:rgba(148,163,184,.18) !important; --border2:rgba(148,163,184,.12) !important;
  --line:rgba(148,163,184,.18) !important;
  --accent:#3b82f6 !important; --accent2:#7c3aed !important; --blue:#60a5fa !important;
  --green:#4ade80 !important; --ok:#4ade80 !important; --success:#4ade80 !important;
  --amber:#fbbf24 !important; --warn:#fbbf24 !important; --warning:#fbbf24 !important; --gold:#fbbf24 !important;
  --red:#f87171 !important; --bad:#f87171 !important; --danger:#f87171 !important;
  --purple:#a78bfa !important;
  --shadow:0 24px 70px rgba(0,0,0,.35) !important; --shadow2:0 12px 30px rgba(0,0,0,.28) !important;
}

/* (B) hardcoded-template class re-map for fixed-color pages */
html[data-theme="dark"] body{ background:var(--bg) !important; color:var(--text) !important; }
html[data-theme="dark"] .wrap{ color:var(--text); }
html[data-theme="dark"] .hero{ background:linear-gradient(135deg,#0b1220,#1e293b) !important; color:var(--text) !important; }
html[data-theme="dark"] .hero p{ color:var(--muted) !important; }
html[data-theme="dark"] .btn{ background:var(--card2) !important; color:var(--text) !important; }
html[data-theme="dark"] .card{ background:var(--card) !important; border-color:var(--border) !important; color:var(--text); }
html[data-theme="dark"] .muted{ color:var(--muted) !important; }
html[data-theme="dark"] .metric .value{ color:var(--text); }
html[data-theme="dark"] .pill{ border-color:var(--border) !important; }
html[data-theme="dark"] .good{ background:rgba(34,197,94,.15) !important; color:#86efac !important; }
html[data-theme="dark"] .warn{ background:rgba(245,158,11,.15) !important; color:#fcd34d !important; }
html[data-theme="dark"] .bad{ background:rgba(239,68,68,.15) !important; color:#fca5a5 !important; }
html[data-theme="dark"] .notice{ background:var(--card2) !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] table td, html[data-theme="dark"] table th{ border-bottom-color:var(--border) !important; }
html[data-theme="dark"] .error{ background:rgba(239,68,68,.15) !important; color:#fca5a5 !important; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea{ background:var(--card2); color:var(--text); border-color:var(--border); }

/* ===== PMX THEME PHASE-2b — extra hardcoded classes ===== */
html[data-theme="dark"] .primary,
html[data-theme="dark"] .btn-primary{ background:linear-gradient(135deg,var(--accent),var(--accent2)) !important; color:#fff !important; border-color:transparent !important; }
html[data-theme="dark"] .btn-success{ background:rgba(34,197,94,.20) !important; color:#86efac !important; }
html[data-theme="dark"] .soft{ background:var(--card2) !important; color:var(--text) !important; }
html[data-theme="dark"] .ghost{ background:transparent !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] .quote{ background:var(--card2) !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] .box,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .tile,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .stat{ background:var(--card) !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] .badge,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .tag{ background:var(--card2) !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] .info{ background:rgba(59,130,246,.15) !important; color:#93c5fd !important; border-color:rgba(59,130,246,.3) !important; }
html[data-theme="dark"] .step{ background:var(--card) !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] .linkbtn{ background:var(--card2) !important; color:var(--text) !important; border-color:var(--border) !important; }
html[data-theme="dark"] .sub,
html[data-theme="dark"] .footer{ color:var(--muted) !important; }
html[data-theme="dark"] body{ background:var(--bg) !important; background-image:none !important; color:var(--text) !important; }

/* ===== PMX THEME PHASE-2c — governance & misc translucent-white pills ===== */
html[data-theme="dark"] .status-pill{ background:var(--card2) !important; border-color:var(--border) !important; color:var(--text) !important; }
html[data-theme="dark"] .verdict-text{ color:var(--text) !important; }
html[data-theme="dark"] .metric{ border-bottom-color:var(--border) !important; }
html[data-theme="dark"] .k{ color:var(--muted) !important; }
html[data-theme="dark"] .v{ color:var(--text) !important; }

/* status-tint flat tokens — customer-registration Phase 2 dark overrides (2026-06-30) */
/* Dark values = exact rgba from customer-registration.html pre-Phase-2 (pixel fidelity). */
html[data-theme="dark"]{
  --status-info-bg-06:rgba(96,165,250,.06);
  --status-info-bg-075:rgba(96,165,250,.075);
  --status-info-bg-08:rgba(96,165,250,.08);
  --status-info-bg-12:rgba(96,165,250,.12);
  --status-info-bg-13:rgba(96,165,250,.13);
  --status-info-bg-17:rgba(96,165,250,.17);
  --status-info-bg-20:rgba(96,165,250,.20);
  --status-info-bg-34:rgba(96,165,250,.34);
  --status-info-border-07:rgba(96,165,250,.07);
  --status-info-border-09:rgba(96,165,250,.09);
  --status-info-border-34:rgba(96,165,250,.34);
  --status-info-border-35:rgba(96,165,250,.35);
  --status-info-border-42:rgba(96,165,250,.42);
  --status-info-border-45:rgba(96,165,250,.45);
  --status-info-border-55:rgba(96,165,250,.55);
  --status-success-bg-06:rgba(34,197,94,.06);
  --status-success-bg-08:rgba(34,197,94,.08);
  --status-success-bg-12:rgba(34,197,94,.12);
  --status-success-bg-14:rgba(34,197,94,.14);
  --status-success-border-07:rgba(34,197,94,.07);
  --status-success-border-08:rgba(34,197,94,.08);
  --status-success-border-32:rgba(34,197,94,.32);
  --status-success-border-35:rgba(34,197,94,.35);
  --status-success-border-40:rgba(34,197,94,.40);
  --status-success-border-42:rgba(34,197,94,.42);
  --status-success-border-45:rgba(34,197,94,.45);
  --status-warn-bg-07:rgba(245,158,11,.07);
  --status-warn-bg-08:rgba(245,158,11,.08);
  --status-warn-bg-10:rgba(245,158,11,.10);
  --status-warn-bg-12:rgba(245,158,11,.12);
  --status-warn-bg-16:rgba(245,158,11,.16);
  --status-warn-border-08:rgba(245,158,11,.08);
  --status-warn-border-35:rgba(245,158,11,.35);
  --status-warn-border-40:rgba(245,158,11,.40);
  --status-warn-border-42:rgba(245,158,11,.42);
  --status-warn-border-50:rgba(245,158,11,.50);
  --status-warn-border-52:rgba(245,158,11,.52);
  --status-warn-border-55:rgba(245,158,11,.55);
  --status-danger-bg-07:rgba(239,68,68,.07);
  --status-danger-bg-08:rgba(239,68,68,.08);
  --status-danger-bg-09:rgba(239,68,68,.09);
  --status-danger-bg-10:rgba(239,68,68,.10);
  --status-danger-bg-12:rgba(239,68,68,.12);
  --status-danger-bg-16:rgba(239,68,68,.16);
  --status-danger-border-08:rgba(239,68,68,.08);
  --status-danger-border-25:rgba(239,68,68,.25);
  --status-danger-border-35:rgba(239,68,68,.35);
  --status-danger-border-38:rgba(239,68,68,.38);
  --status-danger-border-42:rgba(239,68,68,.42);
  --status-danger-border-50:rgba(239,68,68,.50);
  --status-danger-border-52:rgba(239,68,68,.52);
  --status-danger-border-58:rgba(239,68,68,.58);
  --status-violet-bg-08:rgba(168,85,247,.08);
  --status-violet-bg-14:rgba(168,85,247,.14);
  --status-violet-bg-22:rgba(168,85,247,.22);
  --status-violet-border-40:rgba(168,85,247,.40);
  --status-violet-border-45:rgba(168,85,247,.45);
  --status-neutral-slate-bg-10:rgba(148,163,184,.10);
  --status-neutral-slate-border-18:rgba(148,163,184,.18);
  --status-neutral-slate-border-22:rgba(148,163,184,.22);
  --status-neutral-slate-border-24:rgba(148,163,184,.24);
  --status-neutral-slate-border-25:rgba(148,163,184,.25);
  --status-neutral-slate-border-28:rgba(148,163,184,.28);
  --status-neutral-slate-border-30:rgba(148,163,184,.30);
  --status-neutral-navy-bg-12:rgba(15,23,42,.12);
  --status-neutral-navy-bg-14:rgba(15,23,42,.14);
  --status-neutral-navy-bg-16:rgba(15,23,42,.16);
  --status-neutral-navy-bg-18:rgba(15,23,42,.18);
  --status-neutral-navy-bg-20:rgba(15,23,42,.20);
  --status-neutral-navy-bg-25:rgba(15,23,42,.25);
  --status-neutral-navy-bg-78:rgba(15,23,42,.78);
}

/* ═══ PMX_FAB_STACK_V5 — صف علوي منسّق (محاذاة+أحجام موحّدة) ═══ */
/* الجرس المرجع: top:16 left:16، حجم موحّد 42px، تباعد 50px */
#pmx-bell-wrap{top:14px!important;left:16px!important;z-index:999!important}
#pmx-bell-btn{width:42px!important;height:42px!important;display:flex!important;align-items:center!important;justify-content:center!important}
#pmx-ai-chat-btn{top:12px!important;bottom:auto!important;left:64px!important;right:auto!important;width:48px!important;height:48px!important;min-width:48px!important;max-width:48px!important;min-height:48px!important;max-height:48px!important;padding:0!important;z-index:998!important;box-shadow:0 4px 12px rgba(0,0,0,.2)!important;display:flex!important;align-items:center!important;justify-content:center!important}
#pmx-ai-chat-btn svg,#pmx-ai-chat-btn img{width:28px!important;height:28px!important}
#pmx-support-fab{top:auto!important;bottom:20px!important;left:20px!important;right:auto!important;z-index:998!important}
.pmx-help-btn{top:14px!important;bottom:auto!important;left:116px!important;right:auto!important;width:42px!important;height:42px!important;z-index:998!important;box-shadow:0 4px 12px rgba(0,0,0,.2)!important}
/* التقارير: نص → نجعله متناسقاً بارتفاع 42، محاذاة وسط */
#pmxDailyBriefingQuickLink{top:14px!important;bottom:auto!important;left:166px!important;right:auto!important;height:42px!important;display:inline-flex!important;align-items:center!important;z-index:998!important;padding:0 14px!important;font-size:12px!important;border-radius:21px!important;box-shadow:0 4px 12px rgba(0,0,0,.2)!important}
