/* ===== AdsOne — assets/css/app-v3.css — v3 =====
   v3: اسم ملف جديد (app-v3) حتى لا يقدّم أي كاش النسخة القديمة.
   v2: إعادة بناء الهيكل — شريط جانبي ممتد لكامل ارتفاع الشاشة دائماً، هيدر احترافي،
       ووضعان فاتح وداكن قابلان للتبديل يدوياً مع حفظ الاختيار. */

/* ---------- الألوان: الوضع الفاتح ---------- */
:root {
  --bg: #f5f7fb;
  --bg-2: #eef1f8;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #eef2f8;
  --ink: #101626;
  --ink-2: #566078;
  --ink-3: #8a93a8;
  --line: #e2e7f0;
  --line-2: #d6dce8;

  --brand: #3b6cf6;
  --brand-2: #7b5cfa;
  --brand-ink: #ffffff;
  --brand-soft: rgba(59, 108, 246, .10);

  --ok: #0e9f6e;
  --warn: #d98500;
  --bad: #dc3f36;
  --time: #7b5cfa;

  --shadow-s: 0 1px 2px rgba(16, 22, 38, .06);
  --shadow: 0 1px 3px rgba(16, 22, 38, .07), 0 10px 28px rgba(16, 22, 38, .07);
  --shadow-l: 0 20px 48px rgba(16, 22, 38, .16);

  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --head-h: 62px;
  --side-w: 264px;
}

/* ---------- الألوان: الوضع الداكن ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d14;
    --bg-2: #0e121b;
    --panel: #12161f;
    --panel-2: #171c27;
    --panel-3: #1e2431;
    --ink: #eaeefa;
    --ink-2: #9aa4bb;
    --ink-3: #6e788f;
    --line: #222838;
    --line-2: #2c3446;
    --brand: #5b84ff;
    --brand-soft: rgba(91, 132, 255, .14);
    --ok: #26b37f;
    --warn: #e5a033;
    --bad: #ef5a50;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);
    --shadow-l: 0 24px 60px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0d14;
  --bg-2: #0e121b;
  --panel: #12161f;
  --panel-2: #171c27;
  --panel-3: #1e2431;
  --ink: #eaeefa;
  --ink-2: #9aa4bb;
  --ink-3: #6e788f;
  --line: #222838;
  --line-2: #2c3446;
  --brand: #5b84ff;
  --brand-soft: rgba(91, 132, 255, .14);
  --ok: #26b37f;
  --warn: #e5a033;
  --bad: #ef5a50;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-l: 0 24px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.3; letter-spacing: -.2px; }
h1 { font-size: 1.45rem; font-weight: 750; }
h2 { font-size: 1.02rem; font-weight: 700; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
small { display: block; font-size: .76rem; }
.muted-t { color: var(--ink-3); font-weight: 400; }
::selection { background: var(--brand); color: #fff; }

/* شريط تمرير أنيق */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   الهيكل العام — الشريط الجانبي ممتد لكامل الشاشة دائماً
   ========================================================= */
body.app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.shell { flex: 1 1 auto; display: flex; align-items: stretch; min-height: 0; }

.main {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.main-inner { flex: 1 1 auto; padding: 22px clamp(14px, 2.4vw, 30px) 30px; }

/* ---------- الهيدر ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--head-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(12px, 2vw, 20px);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; color: inherit; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -.6px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent);
}
.brand-mark small { display: inline; font-size: 10px; opacity: .92; margin-inline-start: 1px; margin-top: 6px; }
.brand-mark.lg small { font-size: 13px; margin-top: 9px; }
.brand-mark.lg { width: 56px; height: 56px; font-size: 23px; border-radius: 17px; }
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 1rem; font-weight: 750; line-height: 1.2; }
.brand-text em {
  display: block; font-style: normal; font-size: .62rem; font-weight: 600;
  color: var(--ink-3); letter-spacing: .7px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px;
}

.head-sep { width: 1px; height: 26px; background: var(--line); flex: 0 0 auto; }

.head-crumb { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.head-crumb b { font-size: .88rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-crumb span { font-size: .68rem; color: var(--ink-3); }

.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

/* زر أيقونة دائري */
.iconbtn {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: 0 0 36px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--ink-2);
  cursor: pointer; transition: .15s;
}
.iconbtn:hover { background: var(--panel-3); color: var(--ink); border-color: var(--line-2); text-decoration: none; }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn.lang { width: auto; padding: 0 11px; font-size: .76rem; font-weight: 750; letter-spacing: .4px; }
.ico-sun, .ico-moon { display: grid; place-items: center; }
:root[data-theme="dark"] .ico-moon { display: none; }
:root:not([data-theme="dark"]) .ico-sun { display: none; }

/* قائمة المستخدم */
.usermenu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); cursor: pointer; transition: .15s;
}
html[dir="rtl"] .user-chip { padding: 5px 5px 5px 10px; }
.user-chip:hover { border-color: var(--line-2); background: var(--panel-3); }
.avatar {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-size: .72rem; font-weight: 750;
}
.user-chip .u-txt { text-align: start; line-height: 1.15; }
.user-chip .u-txt b { display: block; font-size: .8rem; font-weight: 650; }
.user-chip .u-txt span { display: block; font-size: .64rem; color: var(--ink-3); }
.user-chip .caret { width: 14px; height: 14px; color: var(--ink-3); }

.dropdown {
  position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0;
  min-width: 212px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-l);
  display: none; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown .dd-head { padding: 9px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.dropdown .dd-head b { display: block; font-size: .84rem; }
.dropdown .dd-head span { display: block; font-size: .7rem; color: var(--ink-3); direction: ltr; text-align: start; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 11px; border: 0; border-radius: var(--radius-xs);
  background: none; color: var(--ink-2); font-size: .84rem; font-weight: 550;
  cursor: pointer; text-align: start;
}
.dropdown a:hover, .dropdown button:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.dropdown svg { width: 16px; height: 16px; flex: 0 0 16px; }
.dropdown .danger { color: var(--bad); }

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  flex: 0 0 var(--side-w); width: var(--side-w);
  position: sticky; top: var(--head-h);
  height: calc(100vh - var(--head-h)); height: calc(100dvh - var(--head-h));
  display: flex; flex-direction: column;
  background: var(--panel);
  border-inline-end: 1px solid var(--line);
  transition: width .2s ease, flex-basis .2s ease;
}

.side-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 12px 8px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.nav-h {
  margin: 16px 12px 7px; font-size: .64rem; font-weight: 750;
  letter-spacing: .9px; text-transform: uppercase; color: var(--ink-3);
}
.nav-h:first-child { margin-top: 2px; }

.sidebar nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-xs);
  color: var(--ink-2); font-size: .875rem; font-weight: 550;
  transition: background .14s, color .14s;
}
.sidebar nav a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.sidebar nav a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.sidebar nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sidebar nav a.on svg { opacity: 1; }
.sidebar nav a.on::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 50%;
  width: 3px; height: 20px; transform: translateY(-50%);
  background: var(--brand); border-radius: 0 3px 3px 0;
}
html[dir="rtl"] .sidebar nav a.on::before { border-radius: 3px 0 0 3px; }

/* أسفل الشريط الجانبي */
.side-foot {
  flex: 0 0 auto; padding: 12px; border-top: 1px solid var(--line);
  background: var(--panel);
}
.side-card {
  padding: 11px 12px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line);
}
.side-card b { display: block; font-size: .78rem; font-weight: 700; }
.side-card span { display: block; font-size: .68rem; color: var(--ink-3); margin-top: 1px; }
.side-ver { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; padding: 0 3px; font-size: .66rem; color: var(--ink-3); }

.side-backdrop { display: none; }

/* ---------- عنوان الصفحة ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--ink-2); font-size: .87rem; max-width: 72ch; }
.page-tools { margin-inline-start: auto; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.range, .picker { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 0; }
.range label, .picker label { display: flex; flex-direction: column; gap: 3px; }
.range label span, .picker label span { font-size: .68rem; font-weight: 600; color: var(--ink-3); }

/* ---------- الإدخال ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-xs);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus {
  background: var(--panel); border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { resize: vertical; min-height: 72px; }
input[type="date"] { min-width: 0; }
.range input[type="date"] { min-width: 148px; }

.form { display: flex; flex-direction: column; gap: 13px; }
.form > label { display: flex; flex-direction: column; gap: 5px; }
.form > label > span, .form fieldset label > span { font-size: .76rem; font-weight: 650; color: var(--ink-2); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row-2 label, .row-3 label { display: flex; flex-direction: column; gap: 5px; }

fieldset.sub {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 15px 15px; margin: 2px 0;
  display: flex; flex-direction: column; gap: 11px;
  background: var(--panel-2);
}
fieldset.sub legend { padding: 0 7px; font-size: .74rem; font-weight: 750; color: var(--ink-2); }

.check { display: flex; flex-direction: row !important; align-items: center; gap: 9px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.check span { font-size: .85rem; font-weight: 550 !important; color: var(--ink) !important; }
.hint { margin: 0; font-size: .75rem; color: var(--ink-3); line-height: 1.55; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: var(--panel); color: var(--ink);
  font-size: .85rem; font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, transform .08s, box-shadow .14s;
}
.btn:hover { background: var(--panel-2); border-color: var(--line-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand-2) 72%, var(--brand)));
  color: var(--brand-ink); border-color: transparent;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 32%, transparent);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn.sm { padding: 6px 11px; font-size: .78rem; }
.btn.block { width: 100%; }
.inline { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions .pw { display: flex; gap: 4px; align-items: center; }
.actions .pw input { width: 136px; padding: 5px 9px; font-size: .78rem; }
.danger-zone { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); }

/* ---------- البطاقات ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-s);
  padding: 17px 19px; margin-bottom: 18px;
}
.card > h2 { margin-bottom: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-side { display: grid; grid-template-columns: minmax(290px, 370px) 1fr; gap: 18px; align-items: start; }
.grid-main { display: grid; grid-template-columns: 1fr minmax(250px, 320px); gap: 18px; align-items: start; }
/* عناصر الشبكة لا تتمدد بمحتواها فتخرج من الصفحة */
.grid-2 > *, .grid-side > *, .grid-main > *, .kpis > * { min-width: 0; }

/* الحقول المتجاورة تنطوي تلقائياً حين تضيق البطاقة — مهما كان مكانها */
.card { container-type: inline-size; }
@container (max-width: 560px) { .row-3 { grid-template-columns: 1fr 1fr; } }
@container (max-width: 420px) { .row-2, .row-3 { grid-template-columns: 1fr; } }

/* ---------- بطاقات الأرقام ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 13px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow-s);
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.kpi:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi::after {
  content: ""; position: absolute; inset-block-start: 0; inset-inline-start: 0;
  width: 42px; height: 3px; border-radius: 0 0 3px 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.kpi.live::after { background: linear-gradient(90deg, var(--ok), #4fd1a5); }
.kpi-label { font-size: .73rem; color: var(--ink-3); font-weight: 650; }
.kpi-value { font-size: 1.55rem; font-weight: 780; letter-spacing: -.8px; }
.kpi-sub { font-size: .71rem; color: var(--ink-3); }

/* ---------- أشرطة التقدّم ---------- */
.bar-wrap { display: flex; flex-direction: column; gap: 5px; min-width: 142px; }
.bar-head { display: flex; justify-content: space-between; gap: 8px; font-size: .69rem; color: var(--ink-3); font-weight: 600; }
.bar { height: 7px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.bar i.warn { background: var(--warn); }
.bar i.bad { background: var(--bad); }
.bar i.time { background: linear-gradient(90deg, var(--time), var(--brand)); }

/* ---------- الرسوم ---------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: 136px; display: block; overflow: visible; }
.chart-x { display: flex; justify-content: space-between; font-size: .69rem; color: var(--ink-3); margin-top: 7px; }

.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(74px, 32%) 1fr auto; align-items: center; gap: 11px; }
.hb-label { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 7px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.hb-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }
.hb-val { font-size: .8rem; font-weight: 700; color: var(--ink-2); }

/* ---------- الجداول ---------- */
.tbl-scroll { overflow-x: auto; margin: 0 -5px; padding: 0 5px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th {
  position: sticky; top: 0;
  text-align: start; padding: 10px; font-size: .69rem; font-weight: 750;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .5px;
  background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl td small { margin-top: 2px; }
.w-bar { min-width: 164px; }

.empty {
  color: var(--ink-3); font-size: .87rem; text-align: center;
  padding: 26px 12px; margin: 0;
}

/* حالة البداية */
.onboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 13px; }
.onboard a {
  display: flex; flex-direction: column; gap: 5px;
  padding: 15px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2); color: inherit; transition: .15s;
}
.onboard a:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.onboard b { font-size: .9rem; font-weight: 700; }
.onboard span { font-size: .76rem; color: var(--ink-3); }
.onboard .step { font-size: .66rem; font-weight: 750; color: var(--brand); letter-spacing: .6px; }

/* ---------- حالة الاتصال ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: 0 0 8px; }
.status.on { color: var(--ok); }
.status.on i { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); animation: pulse 1.8s infinite; }
.status.off { color: var(--ink-3); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- الشارات ---------- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: .71rem; font-weight: 700; white-space: nowrap;
  background: var(--panel-3); color: var(--ink-2);
}
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

.pbadge { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; white-space: nowrap; }
.pbadge i {
  display: grid; place-items: center; width: 21px; height: 21px; border-radius: 7px;
  background: var(--pc, var(--brand)); color: #fff; font-style: normal; font-size: .66rem; font-weight: 800;
}

/* ---------- بطاقات المنصات ---------- */
.plat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 13px; }
.plat-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px;
  background: var(--panel-2); border-top: 3px solid var(--pc, var(--brand));
  transition: .15s;
}
.plat-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.plat-top { margin-bottom: 9px; }
.plat-stats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.plat-stats li { display: flex; justify-content: space-between; font-size: .8rem; }
.plat-stats li span { color: var(--ink-3); }
.plat-stats li b { font-weight: 700; }
.plat-stats li.strong { margin-top: 4px; padding-top: 7px; border-top: 1px dashed var(--line-2); }

/* ---------- مواقع وروابط ---------- */
.site-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 15px; margin-bottom: 12px; background: var(--panel-2); }
.site-block header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.site-meta { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--ink-2); }
.snippet-label { display: block; font-size: .73rem; color: var(--ink-3); margin-bottom: 5px; }
.snippet {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 8px 11px; overflow: hidden;
}
.snippet code { flex: 1 1 auto; overflow-x: auto; white-space: nowrap; color: var(--ink-2); }
.site-actions { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; align-items: center; }

.site-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 13px; margin-bottom: 13px; }
.mini { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; background: var(--panel-2); }
.mini-dom { display: block; font-size: .82rem; font-weight: 700; direction: ltr; margin-bottom: 7px; }
.mini-nums { display: flex; gap: 20px; }
.mini-nums b { display: block; font-size: 1.2rem; font-weight: 780; }
.mini-nums span { font-size: .69rem; color: var(--ink-3); }

.vis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(216px, 1fr)); gap: 10px; }
.vis { border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 11px 13px; background: var(--panel-2); cursor: pointer; transition: .14s; }
.vis:hover { border-color: var(--line-2); }
.vis:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- الرسائل ---------- */
.flash {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: .86rem; font-weight: 550; border: 1px solid;
  background: color-mix(in srgb, var(--ok) 11%, var(--panel)); border-color: color-mix(in srgb, var(--ok) 34%, transparent); color: var(--ok);
}
.flash.err { background: color-mix(in srgb, var(--bad) 11%, var(--panel)); border-color: color-mix(in srgb, var(--bad) 34%, transparent); color: var(--bad); }
.flash.warn { background: color-mix(in srgb, var(--warn) 13%, var(--panel)); border-color: color-mix(in srgb, var(--warn) 36%, transparent); color: var(--warn); }

/* ---------- صفحة الدخول ---------- */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 70%),
    radial-gradient(800px 500px at 85% 110%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent 70%),
    var(--bg);
}
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 26px 16px; }
.login-card {
  width: 100%; max-width: 408px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-l); padding: 30px 28px;
}
.login-card.wide { max-width: 580px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-mark { margin: 0 auto 12px; }
.login-brand h1 { font-size: 1.55rem; margin-bottom: 3px; }
.login-brand p { margin: 0; font-size: .68rem; font-weight: 650; letter-spacing: 1.3px; color: var(--ink-3); }
.login-lang { display: flex; justify-content: center; gap: 14px; margin-top: 16px; font-size: .8rem; }
.login-lang a { color: var(--ink-3); }

/* ---------- التذييل ---------- */
.foot {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 14px clamp(14px, 2.4vw, 30px);
  font-size: .73rem; color: var(--ink-3);
  border-top: 1px solid var(--line); background: var(--panel);
}
.foot .dot { opacity: .5; }

/* =========================================================
   الاستجابة
   ========================================================= */
@media (max-width: 1100px) { .grid-side { grid-template-columns: minmax(260px, 330px) 1fr; } }

@media (max-width: 980px) {
  .grid-2, .grid-side, .grid-main { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr; }
  .head-crumb, .head-sep { display: none; }
}

@media (max-width: 820px) {
  .burger { display: grid !important; }
  .sidebar {
    position: fixed; inset-block: var(--head-h) 0; inset-inline-start: 0;
    z-index: 55; height: auto;
    transform: translateX(calc(var(--dirsign, -1) * 100%));
    transition: transform .24s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--shadow-l);
  }
  html[dir="rtl"] .sidebar { --dirsign: 1; }
  .sidebar.open { transform: translateX(0); }
  .side-backdrop {
    display: block; position: fixed; inset: var(--head-h) 0 0 0; z-index: 50;
    background: rgba(5, 8, 15, .5); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .side-backdrop.on { opacity: 1; pointer-events: auto; }
  .brand-text em { display: none; }
  .user-chip .u-txt { display: none; }
  .user-chip { padding: 4px; }
  .row-2 { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.3rem; }
  .main-inner { padding: 16px 14px 24px; }
}

.burger { display: none; }

@media print {
  .topbar, .sidebar, .foot, .side-backdrop { display: none !important; }
  .main-inner { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
