/* ══════════════════════════════════════════════════════════════════
   لوحة التحكم — هوية AXIS البصرية
   ------------------------------------------------------------------
   المرجع صورة الهوية نفسها: سماء فاتحة يتوسّطها ضوء، أطراف زرقاء،
   أفق مضيء في الأسفل، وشعار كحلي حرّ بلا إطار. فالتصميم هادئ نظيف:
   لا نيون ولا حلقات تدور ولا جسيمات — كلها تناقض الهوية.

   بلا أي مكتبة خارجية: الملف يُحمَّل من سيرفر الزبون نفسه، وأي CDN
   يعني اعتماداً على شبكة قد تكون محجوبة عنه.

   ⚠️ القاعدة التي يقوم عليها الملف: لا لون يُكتب داخل قاعدة.
      كل لون متغيّر يُعرَّف مرتين (فاتح/داكن) في أعلى الملف. لون مكتوب
      في قاعدة يبقى على حاله حين يتبدّل الوضع، فيختفي النص فوقه —
      وقد حدث ذلك مرتين: عنوان أبيض على أبيض، ونافذة داكنة في لوحة
      فاتحة.
   ══════════════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;

  /* ── الألوان الخمسة المعتمدة ── */
  --navy:   #071F49;
  --cobalt: #1F67E8;
  --azure:  #4A9BFF;
  --ice:    #CEE7FF;
  --sky:    #EAF5FF;

  /* ── الوضع الفاتح = الهوية نفسها (الافتراضي) ── */
  --bg: var(--sky);
  --text: var(--navy);
  --muted: #56739E;
  --label: #3B5B8C;
  --accent: var(--cobalt);
  --on-accent: #ffffff;
  --logo: var(--navy);

  --surface: rgba(255,255,255,.90);
  --surface-2: #F3F9FF;
  --field: #F6FAFF;
  --border: rgba(7,31,73,.11);
  --line-strong: rgba(31,103,232,.22);
  --shadow: 0 6px 22px rgba(7,31,73,.09);
  --shadow-press: 0 2px 8px rgba(7,31,73,.10);
  --chrome-bg: rgba(255,255,255,.80);
  --chrome-shadow: 0 -4px 20px rgba(7,31,73,.07);
  --sheet-bg: #F4F9FF;
  --sheet-card: #ffffff;
  --overlay: rgba(7,31,73,.42);

  /* التدرّجان: الأول للأفعال الأساسية، والثاني للبطاقة البطلة وحدها.
     نهاية الأول أغمق من AZURE الصِّرف: الأبيض فوق AZURE تباينه 2.9
     ولا يُقرأ تحت شمس الجوال، وفوق هذه الدرجة يبلغ 4.1 بخط عريض. */
  --grad: linear-gradient(135deg, var(--cobalt), #3582F5);
  --grad-hot: linear-gradient(135deg, var(--navy) 0%, #0F3F9E 55%, var(--cobalt) 100%);
  --hero-shadow: 0 16px 36px rgba(7,31,73,.28);
  --hero-calm-shadow: 0 14px 30px rgba(31,103,232,.26);
  --btn-shadow: 0 8px 20px rgba(31,103,232,.26);

  /* ألوان الحالة — أغمق في الفاتح كي يُقرأ نصّها فوق الأبيض */
  --ok: #0E9F6E;      --ok-soft: rgba(14,159,110,.10);    --ok-line: rgba(14,159,110,.30);
  --warn: #B7791F;    --warn-soft: rgba(183,121,31,.10);  --warn-line: rgba(183,121,31,.32);
  --danger: #E11D48;  --danger-soft: rgba(225,29,72,.08); --danger-line: rgba(225,29,72,.28);
  --gold: #B7791F;
  --accent-soft: rgba(31,103,232,.10);
  --accent-line: rgba(31,103,232,.30);
  --toast-bg: #ffffff;
  --toast-ok: #ECFDF5;  --toast-err: #FFF1F3;  --toast-warn: #FFF8E6;
  --toast-shadow: 0 10px 30px rgba(7,31,73,.18);

  /* ── مشهد الهوية ──
     ثلاث طبقات كما في الصورة: أفق مضيء عند ٧٤٪، ضوء في أعلى الوسط،
     وقاعدة زرقاء على الأطراف. القيم مأخوذة من بكسلات الصورة. */
  --scene:
    linear-gradient(180deg, transparent 0 60%, rgba(240,248,255,.92) 73%,
                    rgba(232,244,255,.70) 79%, transparent 93%),
    radial-gradient(ellipse 64% 50% at 50% 22%, #E6F2FE 0%, rgba(230,242,254,.80) 34%, transparent 74%),
    linear-gradient(180deg, #8CC0FC 0%, #86BDFD 40%, #6FADF8 62%, #A9D0FC 84%, #8EC0FD 100%);
  /* داخل اللوحة المشهد أهدأ: المحتوى هنا بطاقات وأرقام تُقرأ، فالخلفية
     تلمّح للهوية ولا تنافسها. */
  --app-scene:
    radial-gradient(ellipse 85% 42% at 50% 0%, rgba(255,255,255,.85), transparent 72%),
    linear-gradient(180deg, #B9D9FD 0%, #D9EBFE 28%, var(--sky) 58%, #D3E8FE 100%);

  --glass: rgba(255,255,255,.62);
  --glass-line: rgba(255,255,255,.85);
  --glass-shadow: 0 24px 60px rgba(7,31,73,.16);
  --login-field: rgba(255,255,255,.90);
  --login-btn: linear-gradient(100deg, var(--navy), #0F3F9E 55%, var(--cobalt));
  --login-btn-shadow: 0 12px 28px rgba(7,31,73,.28);
  --brand-sub: var(--cobalt);

  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ══════════════════════════════════════════════════════════════════
   الوضع الداكن — الهوية نفسها ليلاً
   ------------------------------------------------------------------
   التركيب ذاته (ضوء في الوسط، أفق في الأسفل) على كحلي الهوية بدل
   سمائها، والشعار يصير أبيض. يُفعَّل بـ data-theme="dark" على <html>؛
   سكربت صغير في رأس الصفحة يضبطه قبل أول رسم (انظر index.html).

   الخلفية مشتقّة من NAVY لا سوداء: الأسود الكامل يجعل الظلال غير
   مرئية فتفقد البطاقات عمقها.
   ══════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #04122c;
  --text: var(--sky);
  --muted: #8FAAD0;
  --label: #A8C4E8;
  --accent: var(--azure);
  --logo: #ffffff;

  --surface: rgba(255,255,255,.07);
  --surface-2: rgba(255,255,255,.11);
  --field: rgba(255,255,255,.08);
  --border: rgba(206,231,255,.13);
  --line-strong: rgba(74,155,255,.34);
  --shadow: 0 8px 28px rgba(2,10,28,.50);
  --shadow-press: 0 2px 10px rgba(0,0,0,.30);
  --chrome-bg: rgba(5,18,44,.86);
  --chrome-shadow: 0 -4px 20px rgba(0,0,0,.45);
  --sheet-bg: #0A1C3F;
  --sheet-card: rgba(255,255,255,.06);
  --overlay: rgba(0,6,20,.64);

  --grad-hot: linear-gradient(135deg, #0F3F9E 0%, var(--cobalt) 60%, var(--azure) 100%);
  --hero-shadow: 0 16px 38px rgba(31,103,232,.34);
  --hero-calm-shadow: 0 14px 32px rgba(31,103,232,.26);
  --btn-shadow: 0 8px 22px rgba(31,103,232,.34);

  --ok: #34D399;      --ok-soft: rgba(52,211,153,.15);      --ok-line: rgba(52,211,153,.34);
  --warn: #FBBF24;    --warn-soft: rgba(251,191,36,.15);    --warn-line: rgba(251,191,36,.34);
  --danger: #FB7185;  --danger-soft: rgba(251,113,133,.15); --danger-line: rgba(251,113,133,.36);
  --gold: #FBBF24;
  --accent-soft: rgba(74,155,255,.16);
  --accent-line: rgba(74,155,255,.40);
  --toast-bg: #0E2147;
  --toast-ok: #0C2A26;  --toast-err: #2C1422;  --toast-warn: #2B2410;
  --toast-shadow: 0 10px 32px rgba(0,0,0,.55);

  --scene:
    linear-gradient(180deg, transparent 0 60%, rgba(74,155,255,.20) 73%,
                    rgba(74,155,255,.09) 79%, transparent 93%),
    radial-gradient(ellipse 64% 50% at 50% 22%, rgba(31,103,232,.42) 0%, rgba(31,103,232,.16) 40%, transparent 74%),
    linear-gradient(180deg, #030D22 0%, #061A3E 45%, var(--navy) 66%, #05152F 100%);
  --app-scene:
    radial-gradient(ellipse 85% 40% at 50% 0%, rgba(31,103,232,.30), transparent 72%),
    linear-gradient(180deg, #05173A 0%, #04122c 45%, #04122c 100%);

  --glass: rgba(7,31,73,.50);
  --glass-line: rgba(206,231,255,.16);
  --glass-shadow: 0 30px 70px rgba(0,0,0,.50);
  --login-field: rgba(3,13,34,.62);
  --login-btn: linear-gradient(100deg, var(--cobalt), #3582F5 55%, var(--azure));
  --login-btn-shadow: 0 12px 30px rgba(31,103,232,.38);
  --brand-sub: var(--azure);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  /* Cairo أولاً ثم بدائل النظام: الخط يأتي من Google Fonts وقد يتعذّر
     على شبكة محجوبة، فالبديل يجب أن يكون عربياً مقروءاً لا لاتينياً. */
  font-family: Cairo, "Segoe UI", Tahoma, "Noto Naskh Arabic", system-ui, sans-serif;
  direction: rtl;
  overscroll-behavior-y: contain;
}

body {
  padding-bottom: calc(68px + var(--safe-bottom));
  position: relative;
  min-height: 100vh;
}

/* ───────── مشهد الهوية خلف اللوحة ─────────
   طبقة مثبّتة واحدة بدل background-attachment:fixed الذي يتقطّع عند
   التمرير على الجوال.

   ⚠️ z-index:0 لا -1: السالب يضعها خلف خلفية body نفسها، فتختفي على
   بعض المتصفحات. الصفر يبقيها فوق الخلفية وتحت المحتوى،
   وpointer-events:none يمنعها من اعتراض أي لمسة. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0;
  background: var(--app-scene); pointer-events: none;
}

/* ───────── شريط علوي ───────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--chrome-bg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 700; }
.topbar .tenant {
  font-size: 10.5px; color: var(--accent); font-weight: 700; display: block;
  letter-spacing: .12em;
}

.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 11px; font-size: 17px;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:active { transform: scale(.94); }

/* ───────── محتوى ─────────
   position/z-index هنا يضعان المحتوى فوق طبقة المشهد صراحةً. */
.view { padding: 14px; display: none; animation: fade .18s ease;
        position: relative; z-index: 1; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.section-title {
  font-size: 13px; color: var(--muted); margin: 18px 0 8px;
  display: flex; align-items: center; gap: 8px; font-weight: 600;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ───────── البطاقة البطلة ─────────
   الرقم الوحيد الذي يستحق تدرجاً كاملاً: السحوبات المعلّقة هي ما
   يكلّف المشرف مالاً وغضب عملاء حين يتأخّر عنه. أي رقم آخر يشاركها
   هذا الوزن البصري يُلغي ميزتها. */
.hero {
  border-radius: 24px; margin-bottom: 12px;
  background: var(--grad-hot);
  box-shadow: var(--hero-shadow);
  position: relative; overflow: hidden;
  transition: transform .12s ease;
}
.hero[data-go] { cursor: pointer; }
.hero[data-go]:active { transform: scale(.985); }
/* دائرة ضوئية داخلية تكسر سطح التدرج فلا يبدو ورقة ملوّنة مسطّحة */
.hero::after {
  content: ""; position: absolute; top: -60px; inset-inline-end: -40px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255,255,255,.12); pointer-events: none;
}
/* لا سحوبات معلّقة = لا إلحاح: يهدأ اللون بدل أن يصرخ بلا سبب */
.hero.calm { background: var(--grad); box-shadow: var(--hero-calm-shadow); }
.hero-body { position: relative; padding: 20px; color: #fff; }
.hero-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 600; opacity: .95; }
.hero-top .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 12px #4ade80;
}
.hero-num { display: flex; align-items: flex-end; gap: 10px; }
.hero-num .big { font-size: 52px; font-weight: 800; line-height: .95; letter-spacing: -2.4px; }
.hero-num .side { padding-bottom: 8px; }
.hero-num .amt { font-size: 17px; font-weight: 700; direction: ltr; }
.hero-num .cap { font-size: 11px; opacity: .82; }
.hero-cta {
  margin-top: 16px; display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.16); border-radius: 13px; padding: 11px 15px;
  font-size: 13px; font-weight: 700;
}

/* ───────── بطاقات الإحصاء ───────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
/* الأيقونة في صدر البطاقة لا مطلقة فوق النص: الوضع المطلق كان
   يركب على العنوان في RTL، فصارت الأيقونة تحجب أول كلمة. */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow);
}
/* الرقم كبير: هذه البطاقات تُقرأ بنظرة خاطفة على جوال بيد واحدة،
   والرقم هو كل ما يهمّ فيها فعلاً. */
.stat .label { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -.7px; line-height: 1.15; }
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 5px; }
.stat .ico {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px;
  background: var(--accent-soft);
  margin-bottom: 9px;
}
.stat.warn   .ico { background: var(--warn-soft); }
.stat.danger .ico { background: var(--danger-soft); }
.stat.ok     .ico { background: var(--ok-soft); }
.stat.accent { border-color: var(--accent-line); }
.stat.warn   { border-color: var(--warn-line); }
.stat.danger { border-color: var(--danger-line); }
.stat.ok     { border-color: var(--ok-line); }
.stat.warn .value   { color: var(--warn); }
.stat.danger .value { color: var(--danger); }
.stat.ok .value     { color: var(--ok); }

/* ───────── قوائم ─────────
   ⚠️ بلا backdrop-filter على البطاقات عمداً: كان يُنتج بطاقات ممزّقة
   ونصّاً مقطّعاً على متصفح أندرويد حين يجتمع مع طبقة مثبّتة خلفها. */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
/* استجابة لمس محسوسة: انكماش طفيف مع ظلّ أخفّ يوحي بانضغاط البطاقة
   نحو الصفحة. بلا ذلك يشكّ المستخدم أن لمسته لم تُسجَّل فيكررها. */
.card.tap:active {
  background: var(--surface-2);
  transform: scale(.985);
  box-shadow: var(--shadow-press);
}
.row { display: flex; align-items: center; gap: 10px; }
.row + .row { margin-top: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: left; direction: ltr; }

.title { font-weight: 700; font-size: 15px; }
.meta { font-size: 12px; color: var(--muted); }

/* ───────── الحرف الأول الملوّن (أعضاء الفريق والمستخدمون) ─────────
   اللون يُشتقّ من المعرّف لا يُختار عشوائياً: العضو نفسه يأخذ لونه
   نفسه في كل مرة، فتتعرّف عليه العين قبل أن تقرأ اسمه.
   الدرجات كلها من أزرق الهوية — ستّ درجات تكفي للتمييز بلا خروج عنها. */
.ava {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 800; color: #fff;
  letter-spacing: 0; border: 1px solid var(--border);
}
.ava.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
.ava.c0 { background: var(--grad); }
.ava.c1 { background: var(--cobalt); }
.ava.c2 { background: var(--navy); }
.ava.c3 { background: var(--azure); }
.ava.c4 { background: #3460BF; }
.ava.c5 { background: #0F3F9E; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; font-size: 12px; }

/* ───────── شارات ───────── */
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.badge.ok     { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok-line); }
.badge.warn   { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn-line); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.info   { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.badge.gold   { background: var(--warn-soft);   color: var(--gold);   border-color: var(--warn-line); }

/* ───────── أزرار ───────── */
.btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 11px 15px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; display: inline-flex;
  align-items: center; justify-content: center; gap: 7px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary {
  background: var(--grad); border-color: transparent; color: var(--on-accent);
  font-weight: 700;
  box-shadow: var(--btn-shadow);
}
.btn.ok      { background: var(--ok);     border-color: var(--ok);     color: #fff; }
.btn.danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost   { background: transparent; border-color: var(--line-strong); }
.btn.block   { width: 100%; }
.btn.sm      { padding: 8px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ───────── حقول ───────── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--label); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--field);
  color: var(--text); font-size: 15px; font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=number], input.ltr { direction: ltr; text-align: right; }
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
.hint.warn { color: var(--warn); }

.search { position: relative; margin-bottom: 12px; }
.search input { padding-inline-start: 38px; }
.search::before {
  content: "🔍"; position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); font-size: 14px; opacity: .6;
}

.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 13px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer;
}
.chip.on { background: var(--grad); border-color: transparent; color: var(--on-accent); font-weight: 700; }

/* مبدّل الوضع في القائمة: ثلاث خانات متلاصقة تُقرأ كعنصر واحد */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px;
       background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font-family: inherit;
  font-size: 13px; font-weight: 600; padding: 8px 4px; border-radius: 10px; cursor: pointer;
}
.seg button.on { background: var(--grad); color: var(--on-accent); font-weight: 700; }

/* ───────── شريط سفلي ───────── */
.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  /* ظل علوي: بلا حدّ يذوب الشريط في المحتوى المارّ تحته عند التمرير،
     فلا يعود يُقرأ كشريط قائم بذاته. */
  box-shadow: var(--chrome-shadow);
  padding-bottom: var(--safe-bottom);
}
.tab {
  padding: 9px 4px 8px; text-align: center; cursor: pointer;
  color: var(--muted); font-size: 10.5px; position: relative;
}
.tab .ico { font-size: 19px; display: block; margin-bottom: 2px; transition: transform .14s ease; }
/* التبويب النشط: شريط علوي يجعل الحالة واضحة بلا الاتكال على اللون
   وحده — أهمّ لمن لا يميّز الألوان. */
.tab.on { color: var(--accent); font-weight: 700; }
.tab.on .ico { transform: translateY(-1px) scale(1.1); }
/* -1px لا 0: الشريط العلوي للـ tabbar يشغل البكسل الأول، فمؤشر
   عند 0 يقف فوقه لا عليه ويبدو معلّقاً في الهواء. */
.tab.on::before {
  content: ""; position: absolute; top: -1px; inset-inline: 24%;
  height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.tab:active .ico { transform: scale(.9); }
.tab .dot {
  position: absolute; top: 5px; inset-inline-end: 50%; transform: translateX(50%) translateX(14px);
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 999px; display: grid; place-items: center;
  padding: 0 4px;
}

/* ───────── نافذة منبثقة ───────── */
.sheet-bg {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100;
  display: none; align-items: flex-end;
  /* الغلاف لا يمرّر: التمرير داخل .sheet وحدها. حاويتان تمرّران
     تتنازعان لمسة الإصبع على الجوال. */
  overflow: hidden;
}
.sheet-bg.on { display: flex; }
/* تجميد الصفحة خلف النافذة: بلا ذلك يتحرّك المحتوى تحتها حين تبلغ
   النافذة حافتها، فيفقد المستخدم موضعه في القائمة حين يغلقها. */
body.sheet-open { overflow: hidden; }
/* معتمة لا شفافة: النافذة تطفو فوق طبقة تعتيم، والسطح الشفاف يجعل
   محتوى الصفحة يظهر خلف النص فيصعب قراءته. */
/* ⚠️ overscroll-behavior:contain هو مربط الفرس.
   بدونه تتسرّب لمسة التمرير إلى body تحت النافذة فور بلوغ الحافة،
   فيمرّر الجسم بدل النافذة ولا تعود لأعلاها — وهو العطل الذي ظهر
   في بطاقة المستخدم: تنزل ولا تصعد.
   وwebkit-overflow-scrolling يعطي تمريراً سلساً على iOS. */
.sheet {
  background: var(--sheet-bg); width: 100%;
  max-height: 88vh; overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 24px 24px 0 0; padding: 18px;
  padding-bottom: calc(18px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  animation: up .22s cubic-bezier(.2,.8,.3,1);
}
/* بطاقات داخل النافذة: سطح صريح يفصلها عن لوح النافذة، بلا ظل —
   الظل فوق ظل النافذة يثقل المشهد بلا فائدة. */
.sheet .card { background: var(--sheet-card); box-shadow: none; }
.sheet .card.tap:active { background: var(--surface-2); }
@keyframes up { from { transform: translateY(100%); } }
.sheet h3 { margin: 0 0 14px; font-size: 17px; }
.sheet-handle {
  width: 38px; height: 4px; background: var(--line-strong);
  border-radius: 99px; margin: -6px auto 14px;
}

/* ───────── تنبيهات ───────── */
#toasts {
  position: fixed; bottom: calc(80px + var(--safe-bottom)); inset-inline: 14px;
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
}
/* ⚠️ خلفية معتمة لا var(--surface): التنبيه يطفو فوق محتوى متحرّك،
   والسطح الشفاف يجعله صندوقاً باهتاً. المعتم هو ما يجعله يُقرأ فوراً. */
.toast {
  background: var(--toast-bg); border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 13px 15px; border-radius: 13px;
  box-shadow: var(--toast-shadow);
  font-size: 14px; animation: up .2s;
}
.toast.ok     { border-color: var(--ok);     background: var(--toast-ok); }
.toast.err    { border-color: var(--danger); background: var(--toast-err); }
.toast.warn   { border-color: var(--warn);   background: var(--toast-warn); }

/* ───────── حالات ───────── */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ico { font-size: 40px; display: block; margin-bottom: 10px; opacity: .55; }
.loading { text-align: center; padding: 30px; color: var(--muted); font-size: 14px; }
.spin {
  width: 22px; height: 22px; border: 2.5px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: rot .7s linear infinite; margin: 0 auto 10px;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════
   تسجيل الدخول — صورة الهوية نفسها
   ------------------------------------------------------------------
   الشعار حرّ فوق السماء كما في الصورة، تحته الاسم بحروف متباعدة
   والسطر الأزرق الصغير، ثم بطاقة زجاجية للحقول.
   ══════════════════════════════════════════════════════════════════ */
#login {
  position: fixed; inset: 0; z-index: 300;
  display: none; overflow-y: auto;
  background: var(--bg);
}
#login.on { display: block; }

/* المشهد مثبّت خلف المحتوى فلا يتحرّك الأفق حين تُمرَّر الصفحة على
   شاشة قصيرة. زخرفي وخارج مسار النقر. */
.login-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: var(--scene);
}

/* min-height بدل height: على الشاشات القصيرة يكبر المحتوى عن الشاشة،
   ومع ارتفاع ثابت يُقصّ أعلاه ولا يمكن التمرير إليه. */
.login-page {
  position: relative; z-index: 2;
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 34px 18px calc(28px + var(--safe-bottom));
}
.login-wrap {
  width: min(440px, 100%);
  animation: card-appear .7s cubic-bezier(.16,1,.3,1);
}
@keyframes card-appear {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── الشعار ──
   قناع يُلوَّن بمتغيّر: كحلي في الفاتح وأبيض في الداكن من ملف واحد.
   صورة ملوّنة كانت ستحتاج نسختين، وتبقى الكحلية غير مرئية ليلاً. */
.logo-area { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.logo-mark {
  width: 128px; aspect-ratio: 545 / 455;
  background: var(--logo);
  -webkit-mask: url(logo-mark.png) center / contain no-repeat;
          mask: url(logo-mark.png) center / contain no-repeat;
}
.brand {
  margin-top: 16px; font-size: 25px; font-weight: 800; color: var(--text);
  text-align: center; line-height: 1.25;
}
/* الاسم اللاتيني يُكتب كعلامة AXIS: حروف كبيرة رفيعة متباعدة.
   ⚠️ للّاتيني وحده: التباعد يفكّ اتصال الحروف العربية فتصير الكلمة
      حروفاً منفصلة لا تُقرأ. السكربت يضيف الصنف حين يكون الاسم لاتينياً. */
.brand.latin {
  font-weight: 400; font-size: 30px; text-transform: uppercase;
  letter-spacing: .32em; margin-inline-end: -.32em;   /* يعادل تباعد الحرف الأخير */
  direction: ltr;
}
.brand-sub {
  color: var(--brand-sub); font-size: 11px; font-weight: 800;
  letter-spacing: .22em; margin-top: 6px; direction: ltr;
}

/* ── البطاقة الزجاجية ── */
.login-card {
  position: relative;
  padding: 26px 22px 22px; border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: var(--glass-shadow);
}

.login-card .title { text-align: center; margin-bottom: 20px; }
.login-card .title h1 { font-size: 23px; font-weight: 800; margin: 0 0 3px; color: var(--text); }
.login-card .title p { color: var(--muted); font-size: 13px; font-weight: 500; margin: 0; }

/* ── الحقول ── */
.login-card .field { margin-bottom: 15px; }
.field-label { display: block; margin-bottom: 7px; color: var(--label); font-size: 13px; font-weight: 600; }
.field-hint  { margin-top: 6px; font-size: 11px; color: var(--muted); }

.input-wrapper { position: relative; }
.input-wrapper .input-icon {
  position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; color: var(--muted);
  transition: color .25s; pointer-events: none;
}
.input-wrapper input {
  width: 100%; height: 56px; border-radius: 15px;
  border: 1px solid var(--line-strong); outline: none;
  background: var(--login-field); color: var(--text);
  font-family: inherit; font-size: 15px;
  /* مساحة الأيقونة في البداية ومساحة زر العين في النهاية */
  padding-inline: 50px 52px;
  transition: border-color .25s, box-shadow .25s;
}
.input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-wrapper:focus-within .input-icon { color: var(--accent); }
/* حقل الخادم يُكتب بالإنجليزية: يُقلب اتجاهه وحده مع بقاء الأيقونة مكانها */
.input-wrapper input.ltr { direction: ltr; text-align: left; }

.password-toggle {
  position: absolute; inset-inline-end: 15px; top: 50%; transform: translateY(-50%);
  display: flex; padding: 4px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; transition: color .25s;
}
.password-toggle:hover, .password-toggle:focus-visible { color: var(--accent); }

/* ── زر الدخول ──
   كحلي الشعار في الفاتح: هو أثقل لون في الهوية فيحمل الفعل الوحيد
   في الشاشة. وفي الداكن يصير أزرق مضيئاً — كحلي فوق كحلي لا يُرى. */
.login-button {
  position: relative; width: 100%; height: 57px; margin-top: 4px;
  border: none; border-radius: 16px; cursor: pointer; overflow: hidden;
  color: #fff; font-family: inherit; font-size: 16px; font-weight: 800;
  background: var(--login-btn);
  box-shadow: var(--login-btn-shadow);
  transition: transform .2s, opacity .2s;
}
.login-button:hover { transform: translateY(-1px); }
.login-button:active { transform: scale(.985); }
.login-button:disabled { opacity: .65; pointer-events: none; }
.button-content {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  position: relative; z-index: 2;
}
.login-button .arrow { font-size: 21px; transition: transform .3s; }
.login-button:hover .arrow { transform: translateX(-4px); }
.login-button .spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: rot .7s linear infinite;
}

/* ── شارة الأمان ── */
.security {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); font-size: 11px; margin-top: 16px;
}
.security-icon {
  width: 15px; height: 12px; border: 1.5px solid currentColor;
  border-radius: 3px; position: relative; flex: none; margin-top: 5px;
}
.security-icon::before {
  content: ""; position: absolute; width: 7px; height: 6px;
  border: 1.5px solid currentColor; border-bottom: none; border-radius: 5px 5px 0 0;
  top: -7px; left: 50%; transform: translateX(-50%);
}

/* ── رسالة الخطأ ──
   تنطوي بارتفاع صفر بدل الإخفاء، فيبقى الانتقال مرئياً عند ظهورها. */
.login-card .message {
  max-height: 0; opacity: 0; overflow: hidden;
  padding: 0 15px; margin-bottom: 0;
  border-radius: 12px; border: 1px solid transparent;
  background: var(--danger-soft); color: var(--danger);
  font-size: 12px; font-weight: 600; text-align: center; transition: .35s;
}
.login-card .message.show {
  max-height: 90px; opacity: 1; padding: 11px 15px; margin-bottom: 15px;
  border-color: var(--danger-line);
}

/* ── توقيع المبرمج ──
   يظهر في شاشة الدخول وفي القائمة داخل اللوحة بالصيغة نفسها. */
.dev-sign, .login-sign { text-align: center; margin-top: 18px; padding-bottom: 4px; }
.dev-sign .rule, .login-sign .rule {
  width: 96px; height: 1px; margin: 0 auto 10px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.dev-sign .by, .login-sign .by { font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.dev-sign .by b, .login-sign .by b { font-weight: 800; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .login-wrap, .view, .sheet, .toast { animation: none; }
}

@media (max-width: 600px) {
  .login-page { padding: 24px 16px calc(20px + var(--safe-bottom)); }
  .logo-mark { width: 112px; }
  .brand.latin { font-size: 26px; }
}
@media (max-width: 360px), (max-height: 680px) {
  .logo-mark { width: 88px; }
  .logo-area { margin-bottom: 18px; }
  .brand { font-size: 21px; margin-top: 12px; }
  .brand.latin { font-size: 22px; }
  .login-card { padding: 20px 16px 18px; }
  .input-wrapper input { height: 52px; }
  .login-button { height: 53px; }
}

/* ───────── رسم بياني بسيط ───────── */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding: 10px 0; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
                   gap: 2px; height: 100%; }
.chart .bar { border-radius: 5px 5px 2px 2px; min-height: 2px; }
.chart .bar.dep { background: linear-gradient(180deg, var(--azure), var(--cobalt)); }
.chart .bar.wd  { background: var(--danger); opacity: .55; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); justify-content: center; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-inline-end: 4px; }
.chart-legend i.dep { background: var(--cobalt); }
.chart-legend i.wd  { background: var(--danger); opacity: .55; }

.list-more { text-align: center; padding: 12px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.num { direction: ltr; display: inline-block; }
