/* ==============================================================
   Fleet & Rental Management System — Design System
   الخط: Rubik  |  الاتجاه: RTL + LTR بملف واحد
   Developed by Ahmed Al-Janabi — https://a7medmajid.com
   ============================================================== */

/*
 * لا @font-face محلي.
 *
 * كان يشير إلى ملف غير موجود فيُنتج 404 في كل صفحة، والمتصفح ينتظره
 * قبل رسم النص. الخط يأتي من Google Fonts بتحميل غير حاجب، وسلسلة
 * الاحتياط أدناه تعرض النص فوراً بخط النظام إن تأخّر أو حُجب —
 * فلا تبقى الصفحة فارغة أبداً.
 */
/* ============================================================
   TOKENS
   ============================================================ */
:root{
  /* neutrals */
  --bg:#F5F6F8;
  --surface:#FFFFFF;
  --surface-2:#F7F9FA;
  --border:#E4E9ED;
  --border-strong:#D2DAE1;
  --text:#0F1A22;
  --text-muted:#657785;
  --text-faint:#93A3AF;

  /* brand */
  --ink:#0F1A22;              /* أزرار وعناصر رئيسية */
  --ink-hover:#1E2C36;
  --on-ink:#FFFFFF;
  --accent:#0E7490;           /* روابط وتمييز */
  --accent-soft:#E2F1F4;
  --accent-hover:#0B5D74;

  /* statuses */
  --st-available:#16A34A;  --st-available-bg:#E8F6EC;
  --st-hold:#C2760A;       --st-hold-bg:#FCF2E0;
  --st-reserved:#2563EB;   --st-reserved-bg:#E7EEFD;
  --st-rented:#7C3AED;     --st-rented-bg:#F0E9FE;
  --st-overdue:#EA580C;    --st-overdue-bg:#FDECE2;
  --st-service:#DC2626;    --st-service-bg:#FCE9E9;
  --st-blocked:#64748B;    --st-blocked-bg:#EEF1F4;

  /* shape */
  --r-card:18px;
  --r-ctl:10px;
  --r-chip:999px;
  --shadow:0 1px 2px rgba(15,26,34,.03), 0 1px 3px rgba(15,26,34,.04);
  --shadow-lift:0 4px 12px -4px rgba(15,26,34,.10), 0 12px 32px -12px rgba(15,26,34,.14);
  --shadow-pop:0 12px 32px -8px rgba(15,26,34,.22);

  /* type */
  --font:'Rubik', 'Segoe UI', 'Noto Kufi Arabic', 'Noto Sans Arabic', 'Tahoma', 'Geeza Pro', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --mono:"Rubik",system-ui,sans-serif;

  --sidebar-w:262px;
  --header-h:64px;
}
[data-theme="dark"]{
  --bg:#0A1016;
  --surface:#121B23;
  --surface-2:#18232D;
  --border:#243039;
  --border-strong:#31404C;
  --text:#E7EEF4;
  --text-muted:#8DA0AE;
  --text-faint:#69808F;

  --ink:#1FA0B8;
  --ink-hover:#2CB3CC;
  --on-ink:#04161B;
  --accent:#3BB8CE;
  --accent-soft:#123039;
  --accent-hover:#5ACADD;

  --st-available:#4ADE80;  --st-available-bg:#123322;
  --st-hold:#FBBF24;       --st-hold-bg:#33270B;
  --st-reserved:#60A5FA;   --st-reserved-bg:#122744;
  --st-rented:#A78BFA;     --st-rented-bg:#241B44;
  --st-overdue:#FB923C;    --st-overdue-bg:#37200F;
  --st-service:#F87171;    --st-service-bg:#3A1717;
  --st-blocked:#94A3B8;    --st-blocked-bg:#1E2831;

  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-pop:0 12px 32px -8px rgba(0,0,0,.7);
}

/* ============================================================
   BASE
   ============================================================ */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  transition:background .2s ease,color .2s ease;
}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* المعرّفات والأرقام: نفس خط الواجهة مع أرقام جدولية ثابتة العرض */
.mono{
  font-family:var(--mono);
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
  letter-spacing:0;
}

.kpi-val,.nav-count,.plate,.loc,.veh-id,.sw code,.seg button,.seg a,table td,table th{
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app{display:flex;min-height:100vh}

/* ---------- Sidebar ---------- */
.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);
  background:var(--surface);
  border-inline-end:1px solid var(--border);
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
}
.brand{display:flex;align-items:center;gap:10px;padding:20px 18px 16px}
.brand-mark{
  width:34px;height:34px;border-radius:9px;flex:0 0 34px;
  background:var(--ink);color:var(--on-ink);
  display:grid;place-items:center;
}
.brand-name{font-weight:700;font-size:16px;letter-spacing:-.01em}
.brand-sub{font-size:11px;color:var(--text-faint);margin-top:-4px}

.nav{flex:1;overflow-y:auto;padding:4px 12px 12px}
.nav-group{margin-top:14px}
.nav-label{
  font-size:10.5px;font-weight:600;letter-spacing:.08em;
  color:var(--text-faint);padding:0 10px 6px;text-transform:uppercase;
}
.nav-item{
  display:flex;align-items:center;gap:11px;
  padding:9px 11px;margin-bottom:2px;
  border-radius:var(--r-ctl);
  color:var(--text-muted);text-decoration:none;
  font-size:13.5px;font-weight:500;
  transition:background .15s,color .15s;
}
.nav-item:hover{background:var(--surface-2);color:var(--text)}
.nav-item.active{background:var(--ink);color:var(--on-ink);font-weight:600}
.nav-item svg{flex:0 0 18px;opacity:.85}
.nav-count{
  margin-inline-start:auto;font-family:var(--mono);font-size:11px;font-weight:600;
  background:var(--surface-2);color:var(--text-muted);
  padding:1px 7px;border-radius:var(--r-chip);
}
.nav-item.active .nav-count{background:rgba(255,255,255,.18);color:var(--on-ink)}
.nav-count.alert{background:var(--st-overdue-bg);color:var(--st-overdue)}

.sidebar-foot{padding:12px;border-top:1px solid var(--border)}
.shift-card{
  background:var(--surface-2);border:1px solid var(--border);
  border-radius:12px;padding:12px;
}
.shift-row{display:flex;justify-content:space-between;align-items:baseline;font-size:12px}
.shift-row+.shift-row{margin-top:6px}
.shift-label{color:var(--text-muted)}

/* ---------- Header ---------- */
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.header{
  height:var(--header-h);
  background:var(--surface);
  border-bottom:1px solid var(--border);
  display:flex;align-items:center;gap:14px;
  padding:0 22px;position:sticky;top:0;z-index:20;
}
.menu-btn{display:none}
.crumb{font-size:13px;color:var(--text-muted);white-space:nowrap}
.crumb b{color:var(--text);font-weight:600}

.search{
  flex:1;max-width:420px;margin-inline-start:auto;position:relative;
}
.search input{
  width:100%;height:38px;
  background:var(--surface-2);
  border:1px solid var(--border);border-radius:var(--r-ctl);
  padding-inline:38px 12px;
  font-family:var(--font);font-size:13px;color:var(--text);
}
.search input::placeholder{color:var(--text-faint)}
.search input:focus{background:var(--surface);border-color:var(--border-strong);outline:none}
.search .ico{position:absolute;inset-inline-start:12px;top:10px;color:var(--text-faint)}
.search kbd{
  position:absolute;inset-inline-end:9px;top:9px;
  font-family:var(--mono);font-size:10px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:5px;padding:2px 5px;color:var(--text-faint);
}

.header-actions{display:flex;align-items:center;gap:8px}
.icon-btn{
  width:38px;height:38px;border-radius:var(--r-ctl);
  background:var(--surface-2);border:1px solid var(--border);
  color:var(--text-muted);display:grid;place-items:center;cursor:pointer;
  position:relative;transition:.15s;
}
.icon-btn:hover{background:var(--surface);color:var(--text);border-color:var(--border-strong)}
.dot{
  position:absolute;top:8px;inset-inline-end:9px;
  width:7px;height:7px;border-radius:50%;
  background:var(--st-overdue);border:2px solid var(--surface-2);
}
.seg{display:flex;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-ctl);padding:2px}
.seg button,.seg a{
  border:0;background:transparent;cursor:pointer;text-decoration:none;
  font-family:var(--mono);font-size:11.5px;font-weight:600;
  color:var(--text-muted);padding:5px 10px;border-radius:7px;transition:.15s;
}
.seg button.on,.seg a.on{background:var(--surface);color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.06)}

.user{
  display:flex;align-items:center;gap:9px;padding:4px 6px 4px 4px;
  border-radius:var(--r-ctl);cursor:pointer;
}
.user:hover{background:var(--surface-2)}
.avatar{
  width:32px;height:32px;border-radius:9px;flex:0 0 32px;
  background:var(--accent-soft);color:var(--accent);
  display:grid;place-items:center;font-weight:700;font-size:12px;
}
.user-meta{line-height:1.25}
.user-name{font-size:12.5px;font-weight:600}
.user-role{font-size:11px;color:var(--text-faint)}

/* ---------- Content ---------- */
.content{padding:22px;display:flex;flex-direction:column;gap:16px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}
.page-title{font-size:22px;font-weight:700;letter-spacing:-.02em;margin:0}
.page-sub{color:var(--text-muted);font-size:13px;margin:2px 0 0}
.toolbar{display:flex;gap:8px;flex-wrap:wrap}

.btn{
  display:inline-flex;align-items:center;gap:7px;
  height:38px;padding:0 15px;border-radius:var(--r-ctl);
  font-family:var(--font);font-size:13px;font-weight:600;
  cursor:pointer;border:1px solid transparent;transition:.15s;white-space:nowrap;
}
.btn-primary{background:var(--ink);color:var(--on-ink)}
.btn-primary:hover{background:var(--ink-hover)}
.btn-ghost{background:var(--surface);border-color:var(--border);color:var(--text)}
.btn-ghost:hover{border-color:var(--border-strong);background:var(--surface-2)}

/* ---------- Cards ---------- */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-card);
  box-shadow:var(--shadow);
}
.card-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:16px 18px;border-bottom:1px solid var(--border);
}
.card-title{font-size:14.5px;font-weight:600;margin:0}
.card-body{padding:18px}

.grid-kpi{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.kpi{padding:16px 17px}
.kpi-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.kpi-ico{width:36px;height:36px;border-radius:10px;display:grid;place-items:center}
.kpi-val{font-family:var(--mono);font-size:27px;font-weight:600;letter-spacing:-.03em;line-height:1.1}
.kpi-label{font-size:12.5px;color:var(--text-muted);margin-top:3px}
.delta{
  display:inline-flex;align-items:center;gap:3px;
  font-family:var(--mono);font-size:11px;font-weight:600;
  padding:2px 7px;border-radius:var(--r-chip);
}
.delta.up{background:var(--st-available-bg);color:var(--st-available)}
.delta.down{background:var(--st-service-bg);color:var(--st-service)}
.delta.warn{background:var(--st-overdue-bg);color:var(--st-overdue)}

.grid-main{display:grid;grid-template-columns:1fr 340px;gap:16px}

/* ---------- Status chip ---------- */
.chip{
  display:inline-flex;align-items:center;gap:6px;
  padding:3px 10px 3px 8px;border-radius:var(--r-chip);
  font-size:12px;font-weight:600;white-space:nowrap;
}
.chip::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;flex:0 0 6px}
.chip.available{background:var(--st-available-bg);color:var(--st-available)}
.chip.hold     {background:var(--st-hold-bg);color:var(--st-hold)}
.chip.reserved {background:var(--st-reserved-bg);color:var(--st-reserved)}
.chip.rented   {background:var(--st-rented-bg);color:var(--st-rented)}
.chip.overdue  {background:var(--st-overdue-bg);color:var(--st-overdue)}
.chip.service  {background:var(--st-service-bg);color:var(--st-service)}
.chip.blocked  {background:var(--st-blocked-bg);color:var(--st-blocked)}

/* ---------- Location token (العنصر المميّز) ---------- */
.loc{
  display:inline-flex;align-items:stretch;
  font-family:var(--mono);font-size:11.5px;font-weight:500;
  border:1px solid var(--border);border-radius:7px;overflow:hidden;
  background:var(--surface-2);
}
.loc span{padding:2px 7px;color:var(--text-muted)}
.loc span:first-child{background:var(--surface);color:var(--text);font-weight:600}
.loc span+span{border-inline-start:1px solid var(--border)}
.loc.unknown{border-color:var(--st-service);background:var(--st-service-bg)}
.loc.unknown span{color:var(--st-service)}

/* ---------- Distribution bar ---------- */
.dist{display:flex;height:10px;border-radius:var(--r-chip);overflow:hidden;gap:2px}
.dist i{display:block;height:100%}
.legend{display:flex;flex-wrap:wrap;gap:8px 16px;margin-top:16px}
.legend-item{display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--text-muted)}
.legend-item i{width:9px;height:9px;border-radius:3px;flex:0 0 9px}
.legend-item b{font-family:var(--mono);color:var(--text);font-weight:600}

/* ---------- Table ---------- */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13px}
thead th{
  text-align:start;font-size:11px;font-weight:600;letter-spacing:.04em;
  color:var(--text-faint);text-transform:uppercase;
  padding:10px 16px;background:var(--surface-2);
  border-bottom:1px solid var(--border);white-space:nowrap;
}
tbody td{padding:12px 16px;border-bottom:1px solid var(--border);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:var(--surface-2)}
.veh{display:flex;align-items:center;gap:11px}
.veh-img{
  width:38px;height:38px;border-radius:9px;flex:0 0 38px;
  background:var(--surface-2);border:1px solid var(--border);
  display:grid;place-items:center;color:var(--text-faint);
}
.veh-name{font-weight:600;font-size:13px;line-height:1.3}
.veh-id{font-family:var(--mono);font-size:11px;color:var(--text-faint)}
/* ==============================================================
   لوحة دبي — تحاكي نسب اللوحة الحقيقية وترتيبها
   الترتيب دائماً من اليسار: اسم الإمارة ورمز اللوحة، ثم الرقم.
   لذلك نفرض direction:ltr حتى داخل صفحة عربية.
   ============================================================== */
.plate{
  --plate-h:30px;
  direction:ltr;
  display:inline-flex;align-items:stretch;gap:0;
  height:var(--plate-h);
  background:#F4F5F6;
  border:1.5px solid #23282E;
  border-radius:calc(var(--plate-h) * .17);
  padding:0;
  overflow:hidden;
  vertical-align:middle;
  box-shadow:inset 0 0 0 1.5px #F4F5F6, inset 0 0 0 2.5px #8A9199;
  font-family:var(--font);
  white-space:nowrap;
  user-select:all;
}

/* العمود الأيسر: شعار الإمارة فوق رمز اللوحة */
.plate-left{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding-inline:calc(var(--plate-h) * .20);
  gap:calc(var(--plate-h) * .04);
  min-width:calc(var(--plate-h) * 1.3);
}

/* شعار دبي — كلمة DUBAI بلونَي العلامة.
   للاستبدال بالملف الرسمي: ضع public/assets/img/dubai-logo.svg
   وسيُستخدم تلقائياً بدل النص. */
.plate-logo{
  display:flex;align-items:center;justify-content:center;
  font-size:calc(var(--plate-h) * .32);
  font-weight:700;line-height:1;
  letter-spacing:-.015em;
  font-family:var(--font);
}
.plate-logo i{font-style:normal}
.plate-logo .c1{color:#27AAE1}   /* أزرق العلامة */
.plate-logo .c2{color:#EC008C}   /* وردي العلامة */

/* عند توفير ملف الشعار الرسمي */
.plate-logo.has-image{
  width:calc(var(--plate-h) * 1.1);
  height:calc(var(--plate-h) * .36);
  background:var(--plate-logo) center/contain no-repeat;
  font-size:0;
}
.plate-logo.has-image i{display:none}

.plate-code{
  font-size:calc(var(--plate-h) * .40);
  font-weight:700;line-height:1;color:#15181C;
  font-variant-numeric:tabular-nums;letter-spacing:.02em;
}
.plate-code:empty{display:none}

/* الرقم: الجزء الأبرز */
.plate-number{
  display:flex;align-items:center;
  padding-inline:calc(var(--plate-h) * .28) calc(var(--plate-h) * .34);
  font-size:calc(var(--plate-h) * .56);
  font-weight:700;line-height:1;color:#15181C;
  letter-spacing:.04em;
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
}

/* المقاسات */
.plate.sm{--plate-h:26px}
.plate.lg{--plate-h:46px}
.plate.xl{--plate-h:64px}

/* اللوحة تبقى فاتحة في الوضع الغامق لأن اللوحة الحقيقية فاتحة،
   لكن نخفّف الوهج قليلاً حتى لا تصرخ في الشاشة المظلمة */
[data-theme="dark"] .plate{
  background:#DFE2E5;
  border-color:#0B0D0F;
  box-shadow:inset 0 0 0 1.5px #DFE2E5, inset 0 0 0 2.5px #6E757C;
}

/* داخل الجداول: تصغير تلقائي */
table .plate{--plate-h:27px}
.muted{color:var(--text-muted)}
.tiny{font-size:11.5px}

/* ---------- Task list ---------- */
.task{display:flex;gap:12px;padding:13px 18px;border-bottom:1px solid var(--border)}
.task:last-child{border-bottom:0}
.task-rail{width:3px;border-radius:2px;flex:0 0 3px}
.task-title{font-weight:600;font-size:13px}
.task-meta{font-size:11.5px;color:var(--text-muted);display:flex;gap:8px;flex-wrap:wrap;margin-top:3px}
.task-meta .mono{color:var(--text-faint)}

/* ---------- Empty state ---------- */
.empty{padding:30px 18px;text-align:center}
.empty p{margin:8px 0 14px;color:var(--text-muted);font-size:13px}

/* ---------- Swatches (مرجع) ---------- */
.swatches{display:grid;grid-template-columns:repeat(auto-fill,minmax(126px,1fr));gap:10px}
.sw{border:1px solid var(--border);border-radius:11px;overflow:hidden}
.sw i{display:block;height:44px}
.sw div{padding:7px 9px;font-size:11px}
.sw b{display:block;font-weight:600;font-size:11.5px}
.sw code{font-family:var(--mono);font-size:10px;color:var(--text-faint)}

/* ---------- Responsive ---------- */
@media (max-width:1100px){
  .grid-kpi{grid-template-columns:repeat(2,1fr)}
  .grid-main{grid-template-columns:1fr}
}
@media (max-width:860px){
  .sidebar{position:fixed;inset-block:0;inset-inline-start:0;z-index:60;transform:translateX(0);
           box-shadow:var(--shadow-pop);transition:transform .22s ease}
  html[dir="rtl"] .sidebar:not(.open){transform:translateX(100%)}
  html[dir="ltr"] .sidebar:not(.open){transform:translateX(-100%)}
  .menu-btn{display:grid}
  .search{max-width:none}
  .crumb{display:none}
  .user-meta{display:none}
  .content{padding:14px}
  .grid-kpi{grid-template-columns:1fr 1fr;gap:10px}
  .kpi-val{font-size:23px}
}
@media (max-width:520px){
  .header{padding:0 12px;gap:8px}
  .seg{display:none}
}

/* ==============================================================
   إضافات إنتاجية غير موجودة في النموذج المبدئي
   ============================================================== */

/* ---------- شاشة تسجيل الدخول ---------- */
.auth-wrap{
  min-height:100vh;display:grid;place-items:center;
  padding:24px;background:var(--bg);
}
.auth-card{
  width:100%;max-width:400px;background:var(--surface);
  border:1px solid var(--border);border-radius:var(--r-card);
  box-shadow:var(--shadow);padding:30px 28px 24px;
}
.auth-brand{display:flex;align-items:center;gap:11px;margin-bottom:22px}
.auth-title{font-size:19px;font-weight:600;letter-spacing:-.02em;margin:0 0 4px}
.auth-sub{font-size:13px;color:var(--text-muted);margin:0 0 22px}

/* ---------- الحقول ---------- */
.field{margin-bottom:15px}
.field label{display:block;font-size:12.5px;font-weight:600;margin-bottom:6px;color:var(--text)}
.field .hint{font-size:11.5px;color:var(--text-faint);margin-top:5px}
.input,select.input,textarea.input{
  width:100%;min-height:40px;padding:9px 12px;
  background:var(--surface-2);border:1px solid var(--border);
  border-radius:var(--r-ctl);font-family:var(--font);font-size:13.5px;
  color:var(--text);transition:.15s;
}
.input:hover{border-color:var(--border-strong)}
.input:focus{background:var(--surface);border-color:var(--accent);outline:none;
  box-shadow:0 0 0 3px var(--accent-soft)}
.input::placeholder{color:var(--text-faint)}
.input:disabled{opacity:.55;cursor:not-allowed}
.input.error{border-color:var(--st-service);background:var(--st-service-bg)}
textarea.input{min-height:88px;resize:vertical;line-height:1.6}
select.input{cursor:pointer}
.field-error{font-size:11.5px;color:var(--st-service);margin-top:5px;font-weight:500}
.input-group{display:flex;gap:8px}
.input-group .input{flex:1}

/* ---------- التنبيهات ---------- */
.alert{
  display:flex;gap:10px;padding:12px 14px;border-radius:var(--r-ctl);
  font-size:13px;margin-bottom:16px;border:1px solid transparent;line-height:1.55;
}
.alert svg{flex:0 0 17px;margin-top:1px}
.alert-danger {background:var(--st-service-bg);color:var(--st-service);border-color:currentColor}
.alert-success{background:var(--st-available-bg);color:var(--st-available);border-color:currentColor}
.alert-warning{background:var(--st-overdue-bg);color:var(--st-overdue);border-color:currentColor}
.alert-info   {background:var(--accent-soft);color:var(--accent);border-color:currentColor}

/* ---------- الأزرار: أحجام وأنواع إضافية ---------- */
.btn-block{width:100%;justify-content:center}
.btn-sm{height:32px;padding:0 12px;font-size:12.5px}
.btn-danger{background:var(--st-service);color:#fff}
.btn-danger:hover{filter:brightness(.92)}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn.loading{position:relative;color:transparent}
.btn.loading::after{
  content:"";position:absolute;inset:0;margin:auto;width:15px;height:15px;
  border:2px solid currentColor;border-top-color:transparent;border-radius:50%;
  animation:spin .6s linear infinite;color:var(--on-ink);
}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- الروابط ---------- */
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

/* ---------- التذييل ---------- */
.app-footer{
  padding:16px 22px;border-top:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;flex-wrap:wrap;font-size:12px;color:var(--text-faint);
}
.credit{
  color:var(--accent);font-weight:600;text-decoration:none;
  display:inline-flex;align-items:center;gap:5px;transition:.15s;
}
.credit:hover{color:var(--accent-hover);text-decoration:none}
.credit::after{
  content:"";width:5px;height:5px;border-radius:50%;
  background:currentColor;opacity:.7;
}
.auth-footer{
  text-align:center;margin-top:20px;padding-top:16px;
  border-top:1px solid var(--border);font-size:12px;color:var(--text-faint);
}

/* ---------- شريط تنبيه عدم الاتصال ---------- */
.offline-bar{
  position:fixed;inset-inline:0;bottom:0;z-index:90;
  background:var(--st-overdue);color:#fff;
  padding:9px 16px;font-size:12.5px;font-weight:600;
  display:none;align-items:center;justify-content:center;gap:8px;
}
body.is-offline .offline-bar{display:flex}

/* ---------- الترقيم ---------- */
.pagination{display:flex;gap:5px;padding:14px 18px;justify-content:center;flex-wrap:wrap}
.pagination a,.pagination span{
  min-width:34px;height:34px;padding:0 9px;display:grid;place-items:center;
  border:1px solid var(--border);border-radius:9px;font-size:12.5px;
  color:var(--text-muted);text-decoration:none;font-variant-numeric:tabular-nums;
}
.pagination a:hover{border-color:var(--border-strong);color:var(--text);text-decoration:none}
.pagination .current{background:var(--ink);color:var(--on-ink);border-color:var(--ink);font-weight:600}
.pagination .disabled{opacity:.4;pointer-events:none}

/* ---------- شاشات الخطأ ---------- */
.error-page{min-height:100vh;display:grid;place-items:center;padding:24px;text-align:center}
.error-code{font-size:64px;font-weight:700;letter-spacing:-.04em;line-height:1;color:var(--text-faint)}
.error-msg{font-size:15px;color:var(--text-muted);margin:12px 0 22px;max-width:420px}

/* ---------- إخفاء بصري مع إبقاء الوصولية ---------- */
.sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}


/* ==============================================================
   طبقة 2026 — بطاقات ومخططات
   Developed by Ahmed Al-Janabi — https://a7medmajid.com

   المبدأ: الرقم هو البطل. كل ما حوله يخدم قراءته — مربّع أيقونة
   ملوّن يعرّف بالمقياس، وخط مصغّر يعطي الاتجاه، وشارة تعطي التغيّر.
   ============================================================== */

.card{
  border-radius:var(--r-card);
  box-shadow:var(--shadow);
  transition:box-shadow .18s ease, transform .18s ease;
}
.card:hover{box-shadow:var(--shadow-lift)}

/* ---------- بطاقة مؤشر ---------- */
.kpi-grid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;margin-bottom:16px;
}
.kpi-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r-card);padding:18px 18px 14px;
  display:flex;flex-direction:column;gap:12px;
  position:relative;overflow:hidden;
  box-shadow:var(--shadow);transition:box-shadow .18s ease,transform .18s ease;
}
.kpi-card:hover{box-shadow:var(--shadow-lift);transform:translateY(-2px)}
.kpi-card::after{
  content:'';position:absolute;inset-block-start:0;inset-inline:0;height:3px;
  background:var(--kpi-tone,var(--accent));opacity:.9;
}
.kpi-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.kpi-tile{
  width:42px;height:42px;border-radius:13px;
  display:grid;place-items:center;flex:0 0 42px;
  background:var(--kpi-bg,var(--accent-soft));color:var(--kpi-tone,var(--accent));
}
.kpi-tile svg{width:20px;height:20px}
.kpi-num{
  font-family:var(--mono);font-size:32px;font-weight:600;
  letter-spacing:-.035em;line-height:1;font-variant-numeric:tabular-nums;
}
.kpi-cap{font-size:12.5px;color:var(--text-muted);margin-top:5px}
.kpi-foot{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;min-height:30px}
.spark{width:96px;height:30px;flex:0 0 96px;opacity:.9}

.trend{
  display:inline-flex;align-items:center;gap:3px;
  font-family:var(--mono);font-size:11.5px;font-weight:600;
  padding:3px 8px;border-radius:999px;white-space:nowrap;
}
.trend.up{background:var(--st-available-bg);color:var(--st-available)}
.trend.down{background:var(--st-service-bg);color:var(--st-service)}
.trend.flat{background:var(--surface-2);color:var(--text-muted)}

/* ---------- شبكة اللوحة ---------- */
.dash-grid{display:grid;grid-template-columns:1.75fr 1fr;gap:16px;margin-bottom:16px}
.dash-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:16px}

/* ---------- المخططات ---------- */
.chart{width:100%;height:220px;display:block;overflow:visible}
.chart-grid{stroke:var(--border);stroke-width:1;stroke-dasharray:3 5;opacity:.75}
.chart-line{fill:none;stroke:var(--accent);stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.chart-dot{fill:var(--surface);stroke:var(--accent);stroke-width:2.2;opacity:0;transition:opacity .15s}
.chart-dot-g:hover .chart-dot{opacity:1}
.chart-axis{
  font-family:var(--mono);font-size:10.5px;fill:var(--text-faint);
  font-variant-numeric:tabular-nums;
}
.chart-empty{
  display:grid;place-items:center;height:180px;
  color:var(--text-faint);font-size:13px;
}
.chart-legend{display:flex;gap:16px;flex-wrap:wrap;margin-top:10px}
.chart-legend span{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted)}
.chart-legend i{width:9px;height:9px;border-radius:3px;display:inline-block}

.donut{width:100%;max-width:180px;height:auto;margin:0 auto;display:block}
.donut-val{
  font-family:var(--mono);font-size:26px;font-weight:600;
  fill:var(--text);letter-spacing:-.03em;
}
.donut-cap{font-size:11px;fill:var(--text-muted)}

.donut-legend{display:flex;flex-direction:column;gap:9px;margin-top:16px}
.donut-legend > div{display:flex;align-items:center;gap:9px;font-size:12.5px}
.donut-legend i{width:9px;height:9px;border-radius:3px;flex:0 0 9px}
.donut-legend b{margin-inline-start:auto;font-family:var(--mono);font-variant-numeric:tabular-nums}

/* ---------- قائمة أشرطة ---------- */
.barlist{display:flex;flex-direction:column;gap:13px}
.barlist-head{display:flex;justify-content:space-between;font-size:12.5px;margin-bottom:6px}
.barlist-head b{font-variant-numeric:tabular-nums}
.barlist-track{height:7px;border-radius:999px;background:var(--surface-2);overflow:hidden}
.barlist-track span{display:block;height:100%;border-radius:999px;background:var(--accent);transition:width .4s ease}

/* ---------- بطاقات العمل المفتوح ---------- */
.work-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.work-item{
  display:flex;align-items:center;gap:11px;padding:12px 13px;
  background:var(--surface-2);border-radius:13px;
  border:1px solid transparent;transition:border-color .15s,background .15s;
  color:inherit;text-decoration:none;
}
.work-item:hover{border-color:var(--border-strong);background:var(--surface)}
.work-ico{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;flex:0 0 34px}
.work-num{font-family:var(--mono);font-size:19px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums}
.work-lbl{font-size:11.5px;color:var(--text-muted);margin-top:2px}

/* ---------- ترويسة اللوحة ---------- */
.dash-hero{
  display:flex;align-items:flex-end;justify-content:space-between;
  gap:16px;flex-wrap:wrap;margin-bottom:18px;
}
.dash-hello{font-size:23px;font-weight:600;letter-spacing:-.02em}
.dash-sub{font-size:13px;color:var(--text-muted);margin-top:4px}

@media (max-width:1200px){
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dash-grid,.dash-grid-3{grid-template-columns:1fr}
}
@media (max-width:640px){
  .kpi-grid{grid-template-columns:1fr;gap:10px}
  .kpi-num{font-size:28px}
  .work-grid{grid-template-columns:1fr}
}

/* ==============================================================
   طبقة فاخرة — بطاقات متدرّجة ورؤوس جداول ملوّنة
   Developed by Ahmed Al-Janabi — https://a7medmajid.com

   التدرّج هنا ليس زينة: كل مقياس يأخذ لوناً ثابتاً يتكرر عبر
   النظام كله، فتتعرّف العين على «المتاح» من لونه قبل قراءة رقمه.
   ============================================================== */

:root{
  --grad-teal:linear-gradient(135deg,#0E9AA7 0%,#12B886 100%);
  --grad-indigo:linear-gradient(135deg,#5B6CFF 0%,#8B5CF6 100%);
  --grad-violet:linear-gradient(135deg,#7C3AED 0%,#C026D3 100%);
  --grad-amber:linear-gradient(135deg,#F59E0B 0%,#EF4444 100%);
  --grad-sky:linear-gradient(135deg,#0EA5E9 0%,#2563EB 100%);
  --grad-rose:linear-gradient(135deg,#F43F5E 0%,#BE185D 100%);
  --grad-head:linear-gradient(90deg,#4F63D2 0%,#6D8AE0 100%);
}

/* ---------- بطاقة مؤشر متدرّجة ---------- */
.kpi-card.grad{
  background:var(--kpi-grad,var(--grad-teal));
  border:none;color:#fff;
  box-shadow:0 6px 20px -8px var(--kpi-glow,rgba(14,154,167,.55));
  padding:20px;
}
.kpi-card.grad::after{display:none}
.kpi-card.grad:hover{
  transform:translateY(-3px);
  box-shadow:0 14px 32px -10px var(--kpi-glow,rgba(14,154,167,.6));
}
/* دوائر ضوء خفيفة تعطي عمقاً بلا صور */
.kpi-card.grad::before{
  content:'';position:absolute;
  inset-block-start:-46px;inset-inline-end:-30px;
  width:130px;height:130px;border-radius:50%;
  background:rgba(255,255,255,.13);pointer-events:none;
}
.kpi-card.grad .kpi-tile{
  background:rgba(255,255,255,.2);color:#fff;
  backdrop-filter:blur(2px);
  width:46px;height:46px;flex:0 0 46px;border-radius:50%;
}
.kpi-card.grad .kpi-num{color:#fff;font-size:30px}
.kpi-card.grad .kpi-cap{color:rgba(255,255,255,.86);font-weight:500}
.kpi-card.grad .trend{background:rgba(255,255,255,.22);color:#fff}
.kpi-card.grad .spark path{stroke:rgba(255,255,255,.9)}

/* ---------- رأس جدول ملوّن ---------- */
.table-wrap.head-tint thead th{
  background:var(--grad-head);
  color:#fff;border-bottom:none;
  font-weight:600;letter-spacing:.01em;
  text-transform:none;font-size:12px;
}
.table-wrap.head-tint thead th:first-child{border-start-start-radius:12px}
.table-wrap.head-tint thead th:last-child{border-start-end-radius:12px}
.table-wrap.head-tint{border-radius:12px;overflow:hidden}
.table-wrap.head-tint tbody tr:hover{background:var(--accent-soft)}

/* ---------- بطاقة رسم بترويسة غنية ---------- */
.chart-card .card-head{
  align-items:flex-start;padding-bottom:6px;border-bottom:none;
}
.chart-stats{display:flex;gap:22px;margin:2px 0 10px}
.chart-stat{display:flex;flex-direction:column;gap:2px}
.chart-stat .v{
  font-family:var(--mono);font-size:18px;font-weight:600;
  font-variant-numeric:tabular-nums;letter-spacing:-.02em;
}
.chart-stat .k{font-size:11px;color:var(--text-muted)}

/* ---------- قرص التوزيع بنِسب ---------- */
.donut-legend .pct{
  font-family:var(--mono);font-size:11px;color:var(--text-muted);
  margin-inline-start:8px;font-variant-numeric:tabular-nums;
}
.donut-wrap{display:flex;align-items:center;gap:20px;flex-wrap:wrap}
.donut-wrap .donut{flex:0 0 168px;margin:0}
.donut-wrap .donut-legend{flex:1;min-width:150px;margin-top:0}

/* ---------- شرائح تصفية دائرية ---------- */
.pillbar{display:inline-flex;background:var(--surface-2);border-radius:999px;padding:3px;gap:2px}
.pillbar a{
  padding:6px 14px;border-radius:999px;font-size:12.5px;
  color:var(--text-muted);text-decoration:none;transition:.15s;
}
.pillbar a.on{background:var(--surface);color:var(--text);font-weight:600;box-shadow:var(--shadow)}

[data-theme="dark"] .table-wrap.head-tint tbody tr:hover{background:rgba(255,255,255,.04)}

/* ==============================================================
   القوائم المنسدلة — الإشعارات والحساب
   Developed by Ahmed Al-Janabi — https://a7medmajid.com
   ============================================================== */

.pop{position:relative}
.pop-panel{
  position:absolute;inset-block-start:calc(100% + 10px);inset-inline-end:0;
  min-width:320px;max-width:min(400px,calc(100vw - 32px));
  background:var(--surface);border:1px solid var(--border);
  border-radius:16px;box-shadow:var(--shadow-lift);
  z-index:120;overflow:hidden;
  animation:popIn .14s ease;
}
@keyframes popIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.pop-panel[hidden]{display:none}

.pop-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:13px 16px;border-bottom:1px solid var(--border);font-size:13.5px;
}
.pop-link{
  background:none;border:none;cursor:pointer;padding:0;
  color:var(--accent);font-size:12px;font-family:inherit;
}
.pop-link:hover{text-decoration:underline}

.pop-body{max-height:min(58vh,420px);overflow-y:auto}
.pop-empty{padding:30px 16px;text-align:center;color:var(--text-faint);font-size:12.5px}

.pop-notif{
  display:flex;gap:11px;padding:12px 16px;
  border-bottom:1px solid var(--border);
  text-decoration:none;color:inherit;transition:background .12s;
}
.pop-notif:last-child{border-bottom:none}
.pop-notif:hover{background:var(--surface-2)}
.pop-notif.unread{background:var(--accent-soft)}
.pop-notif.unread:hover{background:var(--accent-soft);filter:brightness(.98)}
.pop-notif .ico{
  width:32px;height:32px;border-radius:10px;flex:0 0 32px;
  display:grid;place-items:center;background:var(--surface-2);
}
.pop-notif.sev-danger .ico{background:var(--st-service-bg);color:var(--st-service)}
.pop-notif.sev-warning .ico{background:var(--st-overdue-bg);color:var(--st-overdue)}
.pop-notif.sev-success .ico{background:var(--st-available-bg);color:var(--st-available)}
.pop-notif.sev-info .ico{background:var(--accent-soft);color:var(--accent)}
.pop-notif .t{font-size:12.8px;font-weight:600;line-height:1.45}
.pop-notif .b{font-size:11.8px;color:var(--text-muted);line-height:1.5;margin-top:2px}
.pop-notif .w{font-size:10.5px;color:var(--text-faint);margin-top:3px}

.pop-foot{
  display:flex;justify-content:space-between;gap:10px;
  padding:11px 16px;border-top:1px solid var(--border);background:var(--surface-2);
}
.pop-foot a{font-size:12px;color:var(--accent);text-decoration:none}
.pop-foot a:hover{text-decoration:underline}

/* قائمة الحساب */
.pop-menu{min-width:250px}
.pop-item{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:11px 16px;font-size:13px;color:inherit;text-decoration:none;
  background:none;border:none;cursor:pointer;font-family:inherit;
  text-align:start;transition:background .12s;
}
.pop-item:hover{background:var(--surface-2)}
.pop-item.danger{color:var(--st-service)}
.pop-sep{height:1px;background:var(--border);margin:4px 0}

/* زر الحساب صار قابلاً للنقر */
button.user{
  background:none;border:none;cursor:pointer;font-family:inherit;
  display:flex;align-items:center;gap:9px;padding:4px 6px;
  border-radius:12px;color:inherit;transition:background .12s;
}
button.user:hover{background:var(--surface-2)}
button.user .caret{opacity:.5;flex:0 0 13px}

.badge-count{
  position:absolute;inset-block-start:-2px;inset-inline-end:-2px;
  min-width:16px;height:16px;padding:0 4px;border-radius:999px;
  background:var(--st-service);color:#fff;
  font-family:var(--mono);font-size:9.5px;font-weight:700;
  display:grid;place-items:center;line-height:1;
}

/* هوية الموقع */
.brand-logo{width:34px;height:34px;border-radius:11px;object-fit:contain;flex:0 0 34px}

@media (max-width:520px){
  .pop-panel{
    position:fixed;inset-block-start:60px;inset-inline:12px;
    min-width:0;max-width:none;
  }
  button.user .user-meta,button.user .caret{display:none}
}

/* ==============================================================
   نتائج البحث الفوري
   ============================================================== */
.search{position:relative}
.search-results{
  position:absolute;inset-block-start:calc(100% + 8px);inset-inline:0;
  background:var(--surface);border:1px solid var(--border);
  border-radius:14px;box-shadow:var(--shadow-lift);
  z-index:130;max-height:min(62vh,460px);overflow-y:auto;
  animation:popIn .13s ease;
}
.search-results[hidden]{display:none}
.sr-group{padding:6px 0}
.sr-group + .sr-group{border-top:1px solid var(--border)}
.sr-label{
  padding:7px 14px 5px;font-size:10.5px;font-weight:700;
  letter-spacing:.06em;text-transform:uppercase;color:var(--text-faint);
}
.sr-item{
  display:flex;align-items:center;gap:10px;
  padding:9px 14px;text-decoration:none;color:inherit;
  transition:background .12s;
}
.sr-item:hover,.sr-item:focus{background:var(--surface-2);outline:none}
.sr-t{font-family:var(--mono);font-size:13px;font-weight:600;flex:0 0 auto}
.sr-s{
  font-size:12px;color:var(--text-muted);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;
}
.sr-empty{padding:26px 14px;text-align:center;color:var(--text-faint);font-size:12.5px}

/* منتقي مركبة قابل للبحث */
.combo{position:relative}
.combo-list{
  position:absolute;inset-block-start:calc(100% + 4px);inset-inline:0;
  background:var(--surface);border:1px solid var(--border);
  border-radius:12px;box-shadow:var(--shadow-lift);
  max-height:280px;overflow-y:auto;z-index:60;
}
.combo-list[hidden]{display:none}
.combo-opt{
  padding:9px 13px;font-size:12.8px;cursor:pointer;
  display:flex;gap:9px;align-items:center;
}
.combo-opt:hover,.combo-opt.on{background:var(--accent-soft)}
.combo-opt .p{font-family:var(--mono);font-weight:600}
.combo-opt .m{color:var(--text-muted);font-size:11.5px}
.combo-empty{padding:18px 13px;text-align:center;color:var(--text-faint);font-size:12px}

/* ==============================================================
   النافذة المنبثقة — إجراء سريع
   Developed by Ahmed Al-Janabi — https://a7medmajid.com
   ============================================================== */

.modal-back{
  position:fixed;inset:0;z-index:200;
  background:rgba(15,26,34,.5);backdrop-filter:blur(3px);
  display:grid;place-items:center;padding:20px;
  animation:fadeIn .14s ease;
}
.modal-back[hidden]{display:none}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

.modal{
  background:var(--surface);border-radius:20px;
  box-shadow:0 24px 64px -12px rgba(15,26,34,.4);
  width:min(560px,100%);max-height:90vh;
  display:flex;flex-direction:column;overflow:hidden;
  animation:modalIn .18s cubic-bezier(.2,.9,.3,1);
}
@keyframes modalIn{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}

.modal-head{
  display:flex;align-items:flex-start;gap:12px;
  padding:18px 20px;border-bottom:1px solid var(--border);
}
.modal-head .t{font-size:16px;font-weight:600;letter-spacing:-.01em}
.modal-head .s{font-size:12.5px;color:var(--text-muted);margin-top:3px}
.modal-x{
  margin-inline-start:auto;background:none;border:none;cursor:pointer;
  width:32px;height:32px;border-radius:10px;display:grid;place-items:center;
  color:var(--text-muted);flex:0 0 32px;
}
.modal-x:hover{background:var(--surface-2);color:var(--text)}

.modal-body{padding:18px 20px;overflow-y:auto;flex:1}
.modal-foot{
  display:flex;gap:9px;justify-content:flex-end;flex-wrap:wrap;
  padding:14px 20px;border-top:1px solid var(--border);background:var(--surface-2);
}

.qk-grid{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:11px;margin-bottom:18px;
}
.qk-cell{background:var(--surface-2);border-radius:13px;padding:12px 13px}
.qk-cell .k{font-size:10.5px;color:var(--text-faint);margin-bottom:4px}
.qk-cell .v{font-size:14px;font-weight:600;font-variant-numeric:tabular-nums}
.qk-cell.mono .v{font-family:var(--mono)}

.qk-sec{
  font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  color:var(--text-faint);margin:16px 0 9px;
}
.qk-block{
  display:flex;align-items:center;gap:10px;padding:10px 12px;
  border:1px solid var(--border);border-radius:12px;margin-bottom:8px;
  text-decoration:none;color:inherit;font-size:12.5px;transition:border-color .15s;
}
.qk-block:hover{border-color:var(--border-strong);background:var(--surface-2)}
.qk-block .n{font-family:var(--mono);font-weight:600}
.qk-block .arrow{margin-inline-start:auto;opacity:.4}

.qk-msg{
  padding:10px 13px;border-radius:11px;font-size:12.5px;margin-bottom:14px;
}
.qk-msg.err{background:var(--st-service-bg);color:var(--st-service)}
.qk-msg.ok{background:var(--st-available-bg);color:var(--st-available)}
.qk-msg[hidden]{display:none}

/* صفوف قابلة للنقر */
tr.row-click{cursor:pointer}
tr.row-click:hover{background:var(--accent-soft)}
tr.row-click:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}

@media (max-width:560px){
  .modal{border-radius:16px}
  .modal-foot{flex-direction:column}
  .modal-foot .btn{width:100%}
}

/* ==============================================================
   جرس الإشعارات — تنبيه واضح
   Developed by Ahmed Al-Janabi — https://a7medmajid.com

   الرقم وحده لا يكفي: العين لا تلاحظ رقماً صغيراً رمادياً في شريط
   مزدحم. الجرس نفسه يتلوّن، والشارة تنبض نبضتين ثم تسكن — نبض دائم
   يُتعب ويُتجاهل بعد دقائق.
   ============================================================== */

.icon-btn.bell{position:relative}

.icon-btn.bell.has-unread{
  color:var(--st-service);
  background:var(--st-service-bg);
}
.icon-btn.bell.has-unread:hover{background:var(--st-service-bg);filter:brightness(.96)}

/* الجرس يهتزّ مرتين عند الوصول */
.icon-btn.bell.has-unread svg{animation:bellRing 1.1s ease 2}
@keyframes bellRing{
  0%,100%{transform:rotate(0)}
  15%{transform:rotate(11deg)}
  30%{transform:rotate(-9deg)}
  45%{transform:rotate(6deg)}
  60%{transform:rotate(-4deg)}
  75%{transform:rotate(2deg)}
}

.badge-count{
  position:absolute;inset-block-start:-4px;inset-inline-end:-4px;
  min-width:18px;height:18px;padding:0 5px;border-radius:999px;
  background:#DC2626;color:#fff;
  font-family:var(--mono);font-size:10.5px;font-weight:700;
  display:grid;place-items:center;line-height:1;
  box-shadow:0 0 0 2px var(--surface);
  font-variant-numeric:tabular-nums;
}
.badge-count[hidden]{display:none}

/* حلقة تتسع وتتلاشى — نبضتان فقط */
.badge-count::after{
  content:'';position:absolute;inset:0;border-radius:999px;
  background:#DC2626;opacity:.55;
  animation:badgePulse 1.6s ease-out 2;
}
@keyframes badgePulse{
  0%{transform:scale(1);opacity:.55}
  100%{transform:scale(2.4);opacity:0}
}

[data-theme="dark"] .badge-count{box-shadow:0 0 0 2px var(--surface)}

/* على الجوال: الجرس أكبر والشارة أوضح */
@media (max-width:640px){
  .icon-btn.bell{width:40px;height:40px}
  .badge-count{min-width:19px;height:19px;font-size:11px;inset-block-start:-5px;inset-inline-end:-5px}
}

/* شارة في الشريط الجانبي بجانب «الإشعارات» */
.nav-item .nav-badge{
  margin-inline-start:auto;min-width:19px;height:19px;padding:0 5px;
  border-radius:999px;background:#DC2626;color:#fff;
  font-family:var(--mono);font-size:10.5px;font-weight:700;
  display:grid;place-items:center;line-height:1;
}

/* ==============================================================
   حجوزات السائق — بطاقات الشوطات
   Developed by Ahmed Al-Janabi — https://a7medmajid.com

   السائق يقرأ على هاتف بيد واحدة وهو واقف: بطاقة واحدة لكل شوط،
   الموعد أبرز عنصر، ونوع الشوط بلون يميّز التسليم من الاستلام قبل
   قراءة الكلمة.
   ============================================================== */

.d-head{margin-bottom:16px}
.d-head h1{font-size:21px;font-weight:600;letter-spacing:-.02em;margin:0}
.d-head .d-sub{font-size:13px;color:var(--text-muted);margin:5px 0 0}

.d-tabs{
  display:flex;gap:4px;background:var(--surface-2);
  border-radius:999px;padding:4px;margin-bottom:20px;
}
.d-tabs a{
  flex:1;text-align:center;padding:9px 12px;border-radius:999px;
  font-size:13px;color:var(--text-muted);text-decoration:none;transition:.15s;
}
.d-tabs a.on{background:var(--surface);color:var(--text);font-weight:600;box-shadow:var(--shadow)}

.d-label{
  font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  color:var(--text-faint);margin:0 0 10px;
}
.d-empty{
  padding:26px 16px;text-align:center;color:var(--text-faint);
  font-size:13px;background:var(--surface);border-radius:14px;
  border:1px dashed var(--border);
}

.rsv-card{
  display:block;background:var(--surface);border:1px solid var(--border);
  border-radius:16px;padding:14px;margin-bottom:11px;
  text-decoration:none;color:inherit;
  box-shadow:var(--shadow);transition:box-shadow .16s, transform .16s;
}
.rsv-card:active{transform:scale(.99)}
.rsv-card.is-overdue{border-color:var(--st-overdue);background:var(--st-overdue-bg)}

.rsv-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}

.rsv-leg{
  font-size:11.5px;font-weight:600;padding:3px 9px;border-radius:999px;
}
.rsv-leg.out{background:var(--st-rented-bg);color:var(--st-rented)}
.rsv-leg.in{background:var(--st-available-bg);color:var(--st-available)}

.rsv-when{
  font-size:17px;font-weight:600;letter-spacing:-.02em;
  font-variant-numeric:tabular-nums;margin-bottom:10px;
}

.rsv-veh{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:9px}
.rsv-model{font-size:12.5px;color:var(--text-muted)}

.rsv-meta{
  display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;
  font-size:12.5px;color:var(--text-muted);
}
.rsv-meta b{color:var(--text);font-weight:600}

.rsv-place{
  display:flex;align-items:center;gap:6px;margin-top:8px;
  font-size:12px;color:var(--text-muted);
}
.rsv-note{
  margin-top:9px;padding:8px 11px;border-radius:10px;
  background:var(--st-hold-bg);color:var(--st-hold);
  font-size:12px;line-height:1.6;
}

@media (min-width:700px){
  .rsv-card{padding:16px}
  .rsv-when{font-size:18px}
}

/* حقل اللوحة يُبرز نفسه حين يُوجَّه إليه السائق */
.d-input.is-focus{
  border-color:var(--accent);
  box-shadow:0 0 0 4px var(--accent-soft);
  animation:plateNudge .5s ease;
}
@keyframes plateNudge{
  0%,100%{transform:translateX(0)}
  25%{transform:translateX(-4px)}
  75%{transform:translateX(4px)}
}

/* ==============================================================
   شريحة طلب تفعيل الإشعارات
   Developed by Ahmed Al-Janabi — https://a7medmajid.com
   ============================================================== */
.push-ask{
  position:fixed;inset-inline:16px;inset-block-end:16px;z-index:190;
  display:flex;align-items:center;gap:12px;
  max-width:520px;margin-inline:auto;
  padding:13px 15px;border-radius:16px;
  background:var(--surface);border:1px solid var(--border);
  box-shadow:0 12px 36px -10px rgba(15,26,34,.28);
  opacity:0;transform:translateY(14px);transition:opacity .2s, transform .2s;
}
.push-ask.in{opacity:1;transform:none}

.push-ico{
  width:38px;height:38px;border-radius:12px;flex:0 0 38px;
  display:grid;place-items:center;
  background:var(--accent-soft);color:var(--accent);
}
.push-txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.push-txt b{font-size:13px;font-weight:600}
.push-txt span{font-size:11.8px;color:var(--text-muted);line-height:1.5}

.push-x{
  background:none;border:none;cursor:pointer;padding:6px;border-radius:9px;
  color:var(--text-faint);flex:0 0 auto;
}
.push-x:hover{background:var(--surface-2);color:var(--text)}

@media (max-width:520px){
  .push-ask{inset-inline:10px;inset-block-end:76px;padding:12px}
  .push-txt span{display:none}
}

/* ==============================================================
   روابط سياقية — تختصر الرحلة بين الشاشات
   Developed by Ahmed Al-Janabi — https://a7medmajid.com
   ============================================================== */
.rsv-links,.link-tiles{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;
}
.link-tile{
  display:flex;align-items:center;gap:10px;
  padding:12px 13px;border-radius:13px;
  background:var(--surface-2);border:1px solid transparent;
  text-decoration:none;color:inherit;transition:border-color .15s,background .15s;
}
.link-tile:hover{border-color:var(--border-strong);background:var(--surface)}
.link-tile > svg{flex:0 0 16px;color:var(--accent)}
.link-tile span{display:flex;flex-direction:column;gap:2px;min-width:0}
.link-tile b{font-size:12.5px;font-weight:600}
.link-tile i{
  font-style:normal;font-size:11px;color:var(--text-muted);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}

/* أفعال بطاقة الحجز عند السائق */
.rsv-acts{
  display:flex;gap:8px;margin:-6px 0 12px;flex-wrap:wrap;
}
.rsv-act{
  display:inline-flex;align-items:center;gap:6px;
  padding:9px 13px;border-radius:11px;
  background:var(--surface);border:1px solid var(--border);
  font-size:12.5px;font-weight:500;color:inherit;text-decoration:none;
  transition:border-color .15s,background .15s;
}
.rsv-act:active{background:var(--surface-2)}
.rsv-act svg{color:var(--accent);flex:0 0 15px}
@media (max-width:400px){
  .rsv-act{flex:1;justify-content:center;padding:10px 8px}
}

/* زر «خذها» يتميّز عن بقية الأفعال */
.rsv-act.is-claim{
  background:var(--accent);color:#fff;border-color:var(--accent);
  font-family:inherit;cursor:pointer;
}
.rsv-act.is-claim svg{color:#fff}
.rsv-act.is-claim:active{filter:brightness(.94)}

/* صفحات الميدان داخل القالب الرئيسي */
.content .d-head h1{font-size:23px}
.content .d-tabs{max-width:420px}
.content .rsv-card{max-width:620px}
.content .rsv-acts{max-width:620px}
.content .d-empty{max-width:620px}

/* عدّاد داخل بطاقة الرابط */
.link-tile .link-count{
  margin-inline-start:auto;font-style:normal;
  font-family:var(--mono);font-size:12px;font-weight:600;
  min-width:24px;height:22px;padding:0 7px;border-radius:999px;
  display:grid;place-items:center;
  background:var(--accent-soft);color:var(--accent);
  font-variant-numeric:tabular-nums;
}
.link-tile .link-count.is-zero{background:var(--surface);color:var(--text-faint)}

/* ==============================================================
   لوحة اليوم — أعمدة الإلحاح
   Developed by Ahmed Al-Janabi — https://a7medmajid.com

   خمسة أعمدة تمرّر أفقياً على الجوال وتتوزّع على الشاشة الكبيرة.
   البطاقة تحمل قرارها معها فلا يغادر المشغّل الشاشة إلا للتفصيل.
   ============================================================== */

.t-board{
  display:grid;grid-template-columns:repeat(5,minmax(250px,1fr));
  gap:14px;align-items:start;
}
.t-col{
  background:var(--surface-2);border-radius:16px;
  display:flex;flex-direction:column;max-height:calc(100vh - 210px);
}
.t-col-head{
  display:flex;align-items:center;gap:8px;
  padding:13px 14px;border-bottom:1px solid var(--border);
  font-size:13px;position:sticky;inset-block-start:0;
  background:var(--surface-2);border-radius:16px 16px 0 0;z-index:2;
}
.t-dot{width:9px;height:9px;border-radius:3px;flex:0 0 9px}
.t-dot.service{background:var(--st-service)}
.t-dot.rented{background:var(--st-rented)}
.t-dot.available{background:var(--st-available)}
.t-dot.blocked{background:var(--text-faint)}
.t-dot.hold{background:var(--st-hold)}
.t-count{
  margin-inline-start:auto;font-style:normal;
  font-family:var(--mono);font-size:11.5px;font-weight:700;
  min-width:22px;height:20px;padding:0 6px;border-radius:999px;
  display:grid;place-items:center;background:var(--surface);
  font-variant-numeric:tabular-nums;
}
.t-count.is-zero{color:var(--text-faint)}
.t-col-body{padding:10px;overflow-y:auto;display:flex;flex-direction:column;gap:9px}

.t-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:13px;padding:11px 12px;
}
.t-card.is-late{border-color:var(--st-service);background:var(--st-service-bg)}

.t-top{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-bottom:8px}
.t-time{font-size:15px;font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.t-veh{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:7px}
.t-model{font-size:11.5px;color:var(--text-muted)}
.t-who{display:flex;justify-content:space-between;gap:8px;font-size:12.5px;margin-bottom:5px}
.t-who b{font-weight:600}
.t-who .mono{font-size:10.5px}
.t-place{font-size:11.5px;color:var(--text-muted);margin-bottom:7px}
.t-driver{margin-bottom:9px}

.t-acts{display:flex;gap:6px;flex-wrap:wrap}
.t-act{
  padding:6px 11px;border-radius:9px;font-size:11.5px;font-weight:500;
  background:var(--surface-2);border:1px solid transparent;
  color:inherit;text-decoration:none;cursor:pointer;font-family:inherit;
}
.t-act:hover{border-color:var(--border-strong)}
.t-act.is-claim{background:var(--accent);color:#fff}

.t-empty{
  padding:22px 12px;text-align:center;
  color:var(--text-faint);font-size:12px;
}

@media (max-width:1500px){
  .t-board{
    grid-auto-flow:column;grid-auto-columns:minmax(260px,1fr);
    grid-template-columns:none;overflow-x:auto;
    padding-bottom:10px;scroll-snap-type:x mandatory;
  }
  .t-col{scroll-snap-align:start}
}

/* ==============================================================
   الجوال: عمود واحد كامل العرض، والتنقّل بالسحب أفقياً
   Developed by Ahmed Al-Janabi — https://a7medmajid.com

   الأعمدة كانت أفقية فعلاً، لكن كل عمود يمتدّ بطول محتواه فتصبح
   الصفحة طويلة جداً — فيمرّر المستخدم لأسفل داخل عمود واحد ولا
   يخطر بباله أن يسحب جانباً. الحلّ ثلاثي: عمود واحد يملأ العرض،
   وسقف لارتفاعه يبقي الصفحة قصيرة، وشريط تنقّل يُظهر بقية الأعمدة.
   ============================================================== */
@media (max-width:640px){
  .t-board{
    grid-auto-columns:calc(100vw - 32px);
    gap:12px;
    /* تمرير داخل اللوحة لا في الصفحة */
    scroll-padding-inline:0;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .t-board::-webkit-scrollbar{display:none}

  .t-col{
    max-height:calc(100vh - 260px);
    scroll-snap-align:center;
  }
  .t-col-body{padding:10px 12px 14px}

  /* حافة العمود التالي تظهر فتدعو للسحب */
  .t-board{padding-inline-end:26px}
}

/* شريط التنقّل بين الأعمدة — على الجوال فقط */
.t-nav{display:none}
@media (max-width:640px){
  .t-nav{
    display:flex;gap:6px;overflow-x:auto;
    margin-bottom:12px;padding-bottom:4px;
    scrollbar-width:none;
  }
  .t-nav::-webkit-scrollbar{display:none}
  .t-nav button{
    flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;
    padding:8px 13px;border-radius:999px;
    background:var(--surface-2);border:1px solid transparent;
    font-family:inherit;font-size:12.5px;color:var(--text-muted);cursor:pointer;
    white-space:nowrap;transition:.15s;
  }
  .t-nav button.on{
    background:var(--surface);color:var(--text);font-weight:600;
    border-color:var(--border-strong);box-shadow:var(--shadow);
  }
  .t-nav button i{
    font-style:normal;font-family:var(--mono);font-size:11px;font-weight:700;
    min-width:19px;height:19px;padding:0 5px;border-radius:999px;
    display:grid;place-items:center;background:var(--surface);
  }
  .t-nav button.on i{background:var(--accent-soft);color:var(--accent)}
  .t-nav button.zero{opacity:.55}
}

/* زر الملاحة بإحداثيات دقيقة */
.rsv-act.is-exact{border-color:var(--accent);color:var(--accent)}
.rsv-act.is-exact svg{color:var(--accent)}
.geo-out.is-ok{color:var(--st-available)}
.geo-out.is-bad{color:var(--st-service)}

/* بطاقة المهمة في لوحة اليوم */
.t-card.is-urgent{border-color:var(--st-overdue);background:var(--st-overdue-bg)}
.t-route{
  display:flex;align-items:center;gap:7px;flex-wrap:wrap;
  font-size:12px;color:var(--text-muted);margin-bottom:7px;
}
.t-route b{color:var(--accent);font-size:13px}
