/* أسطول كنز — الهوية: أحمر كنز #C8102E وكحلي كنز #0B1B4D
   عناوين: Noto Kufi Arabic — نصوص: IBM Plex Sans Arabic */

:root {
  --red: #C8102E;
  --red-strong: #A50D26;
  --red-soft: #FBE9EC;
  --navy: #0B1B4D;
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --text: #121833;
  --muted: #5A6380;
  --border: #E1E4EE;
  --focus: #3B5BDB;
  --input-bg: #F7F8FC;
  --input-border: #C5CBDC;

  --violation: #C8102E;
  --violation-bg: #FCECEF;
  --warning: #9A5B00;
  --warning-bg: #FFF4DE;
  --missing: #4B5675;
  --missing-bg: #EEF0F6;
  --ok: #157A4C;
  --ok-bg: #E5F5EC;

  /* مقياس الزوايا: الحاويات أنعم والعناصر الداخلية أضيق */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --card-border: transparent;
  /* ظل بلون الكحلي بدل الأسود، ومصدر ضوء واحد من فوق */
  --shadow: 0 1px 1px rgba(11, 27, 77, .04), 0 2px 4px rgba(11, 27, 77, .04), 0 12px 28px -14px rgba(11, 27, 77, .16);
  --shadow-lift: 0 2px 4px rgba(11, 27, 77, .06), 0 18px 36px -16px rgba(11, 27, 77, .24);
  --hairline: rgba(11, 27, 77, .08);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-head: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Noto Kufi Arabic", system-ui, sans-serif;
  --nav-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #EF3E5A; --red-strong: #FF5C75; --red-soft: #351521;
    --bg: #070B17; --surface: #0F1630; --surface-2: #0B1126; --text: #E9ECF5; --muted: #98A2BE;
    --border: #1E2848; --focus: #8EA6FF; --input-bg: #1A2445; --input-border: #3A4673;
    --violation: #FF6B80; --violation-bg: #351521; --warning: #F5B94A; --warning-bg: #2E230D;
    --missing: #A9B2CC; --missing-bg: #18213D; --ok: #4CD08F; --ok-bg: #0E2A1F;
    --card-border: rgba(255, 255, 255, .06);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 28px -16px rgba(0, 0, 0, .7);
    --shadow-lift: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 18px 36px -16px rgba(0, 0, 0, .8);
    --hairline: rgba(255, 255, 255, .07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red: #EF3E5A; --red-strong: #FF5C75; --red-soft: #351521;
  --bg: #070B17; --surface: #0F1630; --surface-2: #0B1126; --text: #E9ECF5; --muted: #98A2BE;
  --border: #1E2848; --focus: #8EA6FF; --input-bg: #1A2445; --input-border: #3A4673;
  --violation: #FF6B80; --violation-bg: #351521; --warning: #F5B94A; --warning-bg: #2E230D;
  --missing: #A9B2CC; --missing-bg: #18213D; --ok: #4CD08F; --ok-bg: #0E2A1F;
  --card-border: rgba(255, 255, 255, .06);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 28px -16px rgba(0, 0, 0, .7);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 18px 36px -16px rgba(0, 0, 0, .8);
  --hairline: rgba(255, 255, 255, .07);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
/* ملاحظة: ما في letter-spacing على العربي — بيقطّع الحروف المتصلة */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.35; margin: 0; font-weight: 700; text-wrap: balance; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.02rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
p { text-wrap: pretty; }
/* أرقام بعرض ثابت حتى الأعمدة والعدادات ما ترقص */
.stat b, .kpi b, .kv dd, .road-percent, .bell-count, .table td, .big-input, .tab .count { font-variant-numeric: tabular-nums; }
a { color: inherit; }
p { margin: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ── الهيكل ── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); color: #fff;
  /* كحلي كنز مع توهج أحمر خفيف من جهة الشعار */
  background:
    radial-gradient(90% 180% at 100% 0%, rgba(200, 16, 46, .28) 0%, transparent 46%),
    linear-gradient(180deg, #0E2160 0%, var(--navy) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 6px 20px -10px rgba(11, 27, 77, .6);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(200, 16, 46, .45)); }
.brand b { font-family: var(--font-head); font-size: 1.05rem; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 12px; border: 0; background: transparent; color: inherit; cursor: pointer;
  transition: background-color .2s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn:active { transform: scale(.94); }
.user-chip {
  display: flex; flex-direction: column; line-height: 1.25; text-align: start;
  padding-inline-end: 12px; margin-inline-end: 6px; border-inline-end: 1px solid rgba(255, 255, 255, .14);
}
.user-chip small { opacity: .7; font-size: .74rem; }
@media (max-width: 480px) { .user-chip { display: none; } .topbar { gap: 2px; padding-inline: 12px; } }

.layout { display: flex; min-height: calc(100dvh - 62px); }
.sidebar { display: none; }
.content { flex: 1; min-width: 0; padding: 20px 16px calc(var(--nav-h) + 32px); max-width: 1180px; margin-inline: auto; }

/* شريط الجوال السفلي: مؤشر كبسولة خلف الأيقونة النشطة */
.bottomnav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px 4px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--hairline);
}
.bottomnav a, .bottomnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font: inherit; font-size: .7rem; font-weight: 500;
  background: none; border: 0; cursor: pointer; transition: color .2s var(--ease);
}
.bottomnav .icon {
  width: 56px; height: 30px; padding: 4px 17px; border-radius: 999px; box-sizing: border-box;
  transition: background-color .25s var(--ease), transform .2s var(--ease);
}
.bottomnav a:active .icon, .bottomnav button:active .icon { transform: scale(.9); }
.bottomnav .active { color: var(--red); font-weight: 700; }
.bottomnav .active .icon { background: var(--red-soft); stroke-width: 2.2; }

.more-sheet { position: fixed; inset: 0; z-index: 40; display: none; background: rgba(8, 13, 28, .5); }
.more-sheet.open { display: block; animation: fade-in .2s var(--ease); }
.more-sheet .sheet {
  position: absolute; inset-inline: 0; bottom: 0; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0, 0, 0, .2);
  animation: sheet-up .3s var(--ease);
}
.more-sheet .sheet::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 10px;
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

@media (min-width: 900px) {
  .bottomnav, .more-sheet { display: none !important; }
  .sidebar {
    display: block; width: 240px; flex: none; padding: 18px 12px; background: var(--surface);
    border-inline-start: 1px solid var(--hairline);
    position: sticky; top: 60px; height: calc(100dvh - 60px); overflow-y: auto;
  }
  .content { padding: 28px 32px 48px; }
}
.navlink {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-weight: 500; font-size: .95rem;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.navlink .icon { color: var(--muted); transition: color .2s var(--ease); }
.navlink:hover { background: var(--surface-2); }
.navlink.active { background: var(--red-soft); color: var(--red); font-weight: 600; }
.navlink.active .icon { color: var(--red); }
.navlink.active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--red);
}

/* ── عناصر عامة ── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
/* بطاقة جوّا بطاقة: سطح مسطح بدون ظل حتى ما يصير «علب جوّا علب» */
.card .card { background: var(--surface-2); box-shadow: none; border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 14px; }
.card + .card, .section + .section, .card + section, section + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + * { margin-top: 0; }
a.card { transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease); }
@media (hover: hover) { a.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); } .card a.card:hover { box-shadow: none; transform: none; background: var(--surface); } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-head > a.small { color: var(--muted); text-decoration: none; font-weight: 500; }
.card-head > a.small:hover { color: var(--red); }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 1000px) { .grid-4 { grid-template-columns: repeat(4, 1fr); gap: 14px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--red); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 16px -8px color-mix(in srgb, var(--red) 70%, transparent);
  transition: background-color .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { background: var(--red-strong); }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 1px 2px rgba(11, 27, 77, .05); }
.btn-secondary:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 18%, var(--border)); }
.btn-ghost { background: transparent; color: var(--text); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
/* زر أحمر خفيف: للأزرار المتكررة بقائمة حتى ما تصير الصفحة كلها أحمر */
.btn-soft { background: var(--red-soft); color: var(--red); box-shadow: none; }
.btn-soft:hover { background: var(--red); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-danger-outline { background: transparent; color: var(--violation); border-color: currentColor; box-shadow: none; }
.btn[aria-disabled="true"] { pointer-events: none; filter: saturate(.3); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 7px;
  font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.badge-violation { background: var(--violation-bg); color: var(--violation); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-missing { background: var(--missing-bg); color: var(--missing); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--font-head); font-size: 1.7rem; line-height: 1.2; }
.grid-4 > .stat { padding: 12px 14px; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.is-violation b { color: var(--violation); }
.stat.is-warning b { color: var(--warning); }

/* شريط المؤشرات: سطح واحد مقسوم بخطوط رفيعة بدل أربع علب منفصلة */
.kpis {
  display: grid; grid-template-columns: repeat(2, 1fr); background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 16px; text-decoration: none; color: inherit;
  box-shadow: -1px 0 0 var(--hairline), 0 -1px 0 var(--hairline); transition: background-color .2s var(--ease);
}
a.kpi:hover { background: var(--surface-2); }
.kpi-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); color: var(--muted);
}
.kpi-icon .icon { width: 20px; height: 20px; }
.kpi b { display: block; font-family: var(--font-head); font-size: 1.6rem; line-height: 1.1; }
.kpi > div > span { display: block; color: var(--muted); font-size: .82rem; line-height: 1.35; margin-top: 2px; }
.kpi.is-zero b { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.kpi.tone-progress:not(.is-zero) .kpi-icon { background: var(--progress-bg); color: var(--progress); }
.kpi.tone-warning:not(.is-zero) .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi.tone-warning:not(.is-zero) b { color: var(--warning); }
.kpi.tone-violation:not(.is-zero) .kpi-icon { background: var(--violation-bg); color: var(--violation); }
.kpi.tone-violation:not(.is-zero) b { color: var(--violation); }

/* تنبيه بارز قابل للضغط (بدل الستايل المكتوب جوّا الصفحة) */
.callout {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--warning-bg); color: var(--text); text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.callout-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.callout .grow { flex: 1; min-width: 0; line-height: 1.5; }
.callout .grow .small { color: var(--muted); }
.callout .go { color: var(--warning); transition: transform .2s var(--ease); }
@media (hover: hover) { .callout:hover { box-shadow: var(--shadow-lift); } .callout:hover .go { transform: translateX(-4px); } }
.callout:active { transform: scale(.99); }

.vehicle-tile-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px dashed var(--hairline); }
.vehicle-tile-body { margin-top: 12px; display: grid; gap: 3px; }
.vehicle-tile-body b { font-weight: 600; }

.plate {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px; border: 2px solid var(--text);
  border-radius: 8px; font-weight: 700; background: var(--surface); white-space: nowrap;
}
.plate .latin { direction: ltr; font-family: ui-monospace, monospace; font-size: .85em; color: var(--muted); }

/* القوائم */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.row-link { text-decoration: none; display: block; }
.row-link .title, .row-link .route { transition: color .2s var(--ease); }
.row-link:hover .title, .row-link:hover .route { color: var(--red); }
.title { font-weight: 600; }

.alert-item { display: flex; gap: 10px; align-items: flex-start; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 8px; flex: none; }
.alert-dot.violation { background: var(--violation); }
.alert-dot.warning { background: var(--warning); }
.alert-dot.missing { background: var(--missing); }

/* جدول القيم: صفوف بخط رفيع بينها، والروابط حمرا بدون خط تحت */
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 0 14px; margin: 0; font-size: .94rem; }
.kv dt, .kv dd { padding: 9px 0; border-top: 1px solid var(--hairline); }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv a, .stops a, .timeline a { color: var(--red); text-decoration: none; font-weight: 600; }
.kv a:hover, .stops a:hover, .timeline a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* حالة فاضية: علامة صح هادية بدل نص لحاله */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 22px 12px;
  color: var(--muted); font-size: .92rem; border-radius: var(--radius-sm); background: var(--surface-2);
}
.empty::before {
  content: ""; width: 34px; height: 34px; border-radius: 50%; background-color: var(--ok-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23157A4C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E");
  background-size: 18px; background-repeat: no-repeat; background-position: center;
}
.placeholder { border: 1.5px dashed var(--border); background: var(--surface-2); box-shadow: none; }
.placeholder .phase { font-size: .8rem; color: var(--muted); }

/* الجداول (تتحول لبطاقات على الجوال) */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* «المطلوب منك الآن» بأول اللوحة: رقم كبير ملون وجنبه شو المطلوب */
.todo .todo-row { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.todo-count {
  flex: none; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums;
}
.todo-count.tone-warning { background: var(--warning-bg); color: var(--warning); }
.todo-count.tone-violation { background: var(--violation-bg); color: var(--violation); }
.todo-count.tone-neutral { background: var(--surface-2); color: var(--muted); }

/* النماذج */
.form-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .form-grid { grid-template-columns: repeat(2, 1fr); } .form-grid .full { grid-column: 1 / -1; } }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field .help { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.field .error { color: var(--violation); font-size: .85rem; margin-top: 4px; font-weight: 500; }
/* الخانة لازم تبان كخانة: لونها غير لون البطاقة وإطارها واضح (بالداكن كانت نفس لون البطاقة بالزبط) */
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--input-border);
  background: var(--input-bg); color: var(--text); font: inherit; font-size: 1rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:hover:not(:focus) { border-color: color-mix(in srgb, var(--text) 30%, var(--input-border)); }
textarea.input { min-height: 96px; }
.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
.field.has-error .input { border-color: var(--violation); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violation) 15%, transparent); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.check { width: 22px; height: 22px; accent-color: var(--red); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
/* عنوان قسم جوّا النموذج: عنوان واضح مع شرطة حمرا بدل نص رمادي فوق خط */
.fieldset-title {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 18px;
  border-top: 1px solid var(--hairline); color: var(--text); font-family: var(--font-head); font-weight: 600; font-size: .95rem;
}
.fieldset-title::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: var(--red); flex: none; }
.fieldset-title:empty { display: none; }
.form-grid > .fieldset-title:first-child, .form-grid > .field-wrap:first-child > .fieldset-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* القائمة المنسدلة: سهم موحد بدل سهم المتصفح */
select.input {
  -webkit-appearance: none; appearance: none; padding-inline-end: 12px; padding-inline-start: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6380' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: left 12px center;
}
select.input:invalid, select.input.is-empty { color: var(--muted); }
select.input option { color: var(--text); }

/* صف اختيار قابل للضغط كامل */
.check-list .check-row, .field > .check-row {
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--hairline); background: var(--surface);
  cursor: pointer; transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.check-list { gap: 6px; }
.check-list .check-row:has(input:checked), .field > .check-row:has(input:checked) { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }

/* زر الحفظ بآخر النموذج وبعرض الشاشة على الجوال. ما بيعوم فوق الخانات حتى ما يغطي اللي عم ينكتب
   (كان مدير المصنع يدوّر على خانة «البضاعة» وهي تحت الزر) */
@media (max-width: 899px) {
  .form-grid ~ .form-actions > .btn:not(.btn-ghost):not(.btn-secondary) { flex: 1; }
}

/* اختيار ملف بالعربي (بيتركّب من app.js فوق حقل الملف الأصلي) */
.file-pick {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 6px 6px 12px;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.file-pick:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.file-pick:focus-within { border-color: var(--focus); border-style: solid; }
.file-pick input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-pick .fp-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: .88rem;
}
.file-pick .fp-name { flex: 1; min-width: 0; color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick.has-file { border-style: solid; border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-bg); }
.file-pick.has-file .fp-name { color: var(--ok); font-weight: 600; }
.inline-form .file-pick { flex: 1; min-width: 180px; min-height: 40px; }

/* الرسائل */
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.msg {
  padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 500; border: 1px solid transparent;
  border-inline-start: 4px solid currentColor; animation: fade-in .3s var(--ease);
}
.msg-success { background: var(--ok-bg); color: var(--ok); }
.msg-error { background: var(--violation-bg); color: var(--violation); }
.msg-warning { background: var(--warning-bg); color: var(--warning); }
.msg-info { background: var(--missing-bg); color: var(--missing); }

/* شاشة الدخول */
.auth {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 85% 10%, rgba(200, 16, 46, .35) 0%, transparent 60%),
    radial-gradient(70% 60% at 10% 100%, rgba(59, 91, 219, .22) 0%, transparent 60%),
    var(--navy);
}
/* شبكة خطوط خفيفة توحي بالطرق والخرائط */
.auth::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--card-border); border-radius: 24px;
  padding: 32px 24px 26px; box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 30px 80px -20px rgba(0, 0, 0, .55);
  animation: rise .5s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.auth-logo { display: block; margin: 0 auto 10px; height: 64px; filter: drop-shadow(0 8px 18px rgba(200, 16, 46, .35)); }
.auth h1 { text-align: center; margin-bottom: 4px; font-size: 1.5rem; }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: .92rem; }

/* شاشة السائق: أزرار كبيرة وحالة واضحة */
.driver-hero { text-align: center; padding: 26px 16px; }
.driver-hero h1 { font-size: 1.5rem; }
.big-action {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--card-border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.08rem; font-weight: 600;
  text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease);
}
.big-action > .icon {
  width: 46px; height: 46px; padding: 11px; border-radius: 14px; box-sizing: border-box;
  background: var(--red-soft); color: var(--red);
}
.big-action::after {
  content: ""; margin-inline-start: auto; width: 9px; height: 9px; flex: none;
  border-left: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); opacity: .6;
}
.big-action:active { transform: scale(.985); box-shadow: none; }
@media (hover: hover) { .big-action:hover { box-shadow: var(--shadow-lift); } }
.big-action[aria-disabled="true"] { opacity: .55; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; flex: 1; }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 16px; }
.diff { font-size: .85rem; }
.diff div { margin-top: 2px; }
.diff del { color: var(--violation); text-decoration: line-through; }
.diff ins { color: var(--ok); text-decoration: none; font-weight: 600; }

/* ── أوامر الحركة ── */
:root { --progress: #1D5FD1; --progress-bg: #E6EEFC; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --progress: #7DA7FF; --progress-bg: #15254A; } }
:root[data-theme="dark"] { --progress: #7DA7FF; --progress-bg: #15254A; }
.badge-progress { background: var(--progress-bg); color: var(--progress); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); text-decoration: none; font-weight: 500; font-size: .9rem;
}
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab .count { font-size: .78rem; opacity: .8; }

.route { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.route .arrow { color: var(--muted); font-weight: 400; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 24px 20px 0; border-inline-start: 2px solid var(--hairline); margin-inline-start: 8px; }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: -9px; top: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--border); box-sizing: border-box;
}
.timeline li.done { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.timeline li.done:last-child { border-color: transparent; }
.timeline li.done::before { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.timeline li.current::before { border-color: var(--progress); box-shadow: 0 0 0 4px var(--progress-bg); }
.timeline li > b { font-family: var(--font-head); font-weight: 600; font-size: .95rem; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.photos a, .photos img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--surface-2);
  color: transparent; font-size: 0; overflow: hidden;
}
.photos a { border: 1px solid var(--hairline); transition: transform .2s var(--ease); }
@media (hover: hover) { .photos a:hover { transform: scale(1.03); } }
.photo-caption { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* عارض المستندات داخل التطبيق (بدون ما يفتح المتصفح الخارجي، حتى يرجع السائق بزر الرجوع) */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: #0A0E1C; color: #fff; z-index: 50; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy); flex: none; }
.viewer-bar .grow { flex: 1; min-width: 0; line-height: 1.25; }
.viewer-bar b { display: block; font-family: var(--font-head); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-bar small { display: block; opacity: .75; font-size: .8rem; }
.viewer-bar .icon-btn { color: #fff; }
.viewer-bar .icon-btn .icon { transform: scaleX(-1); }
.viewer-bar .icon-btn[download] .icon { transform: scaleY(-1); }
.viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px; touch-action: pan-x pan-y pinch-zoom; }
.viewer-body img { display: block; max-width: 100%; width: 100%; height: auto; border-radius: 6px; background: #fff; cursor: zoom-in; }
.viewer-body img.zoomed { max-width: none; width: 220%; cursor: zoom-out; }
.viewer-hint { flex: none; text-align: center; font-size: .78rem; opacity: .7; padding: 6px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }

/* محفظة المستندات */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.doc-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; border: 1px solid var(--hairline); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.doc-card:active { transform: scale(.985); }
@media (hover: hover) { .doc-card:hover { box-shadow: var(--shadow-lift); } }
.doc-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #fff; }
.doc-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--red); font-weight: 700; background: var(--surface); }
.doc-pdf .icon { width: 34px; height: 34px; }
.doc-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.doc-body b { font-family: var(--font-head); font-size: .92rem; }
.doc-body .badge { align-self: flex-start; }

/* شاشة خطوة السائق */
.step-head { text-align: center; padding: 8px 0 18px; }
.step-head h1 { font-size: 1.5rem; }
.capture {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 180px;
  border: 2px dashed color-mix(in srgb, var(--red) 30%, var(--border)); border-radius: var(--radius); cursor: pointer; text-align: center;
  font-size: 1.1rem; font-weight: 600; padding: 20px;
  background: radial-gradient(120% 90% at 50% 0%, var(--red-soft) 0%, var(--surface) 70%);
  transition: transform .15s var(--ease), border-color .2s var(--ease);
}
.capture:active { transform: scale(.99); }
.capture:focus-within { border-color: var(--focus); border-style: solid; }
.capture .icon {
  width: 64px; height: 64px; padding: 16px; box-sizing: border-box; border-radius: 20px; color: #fff; background: var(--red);
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--red) 80%, transparent);
}
.capture input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.capture-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.capture-preview img { width: 100%; border-radius: 12px; }
.big-input { font-size: 1.6rem; text-align: center; letter-spacing: 2px; min-height: 64px; font-weight: 700; }
.btn-xl { min-height: 64px; font-size: 1.2rem; border-radius: 16px; }
.status-hero { text-align: center; padding: 22px 16px; border-radius: 18px; }
.status-hero .badge { font-size: .95rem; padding: 4px 14px; }
.status-hero.progress { background: var(--progress-bg); }
.status-hero.ok { background: var(--ok-bg); }
.status-hero.warning { background: var(--warning-bg); }
.pending-banner { display: flex; align-items: center; gap: 10px; }
.flag-row { display: flex; gap: 10px; align-items: flex-start; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inline-form .input { flex: 1; min-width: 180px; min-height: 40px; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 4px; }

/* ── الراصد ── */
.map { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.sync-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.leaflet-container { font-family: var(--font-body); }

/* خريطة المركبات الآن: مقفلة بالجوال حتى ما يعلق الإصبع، وشريط مركبات فوقها، وملء شاشة */
.fleet-map-wrap { --map-h: 380px; margin-bottom: 14px; }
@media (max-width: 700px) { .fleet-map-wrap { --map-h: 240px; } }
.map-frame { position: relative; }
.map-frame .map { height: var(--map-h); }
.map-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.map-chips::-webkit-scrollbar { display: none; }
.map-chips .chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .85rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.map-chips .chip small { font-weight: 400; color: var(--muted); }
.map-chips .chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.map-chips .chip.active small { color: rgba(255, 255, 255, .75); }
.map-chips .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.moving, .truck-marker.moving { --state: #1D5FD1; }
.dot.stopped, .truck-marker.stopped { --state: var(--red); }
.dot.offline, .truck-marker.offline { --state: #9A5B00; }
.map-chips .dot { background: var(--state); }
.map-lock {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem; color: #fff; background: rgba(11, 27, 77, .22); border: 0; cursor: pointer;
  border-radius: var(--radius); text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.map-lock .icon { width: 22px; height: 22px; }
.map-tools { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.map-tool { width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; }
.map-tool .icon { width: 20px; height: 20px; }
.map-updated { position: absolute; bottom: 8px; inset-inline-start: 10px; z-index: 2; font-size: .72rem; color: #fff; background: rgba(11, 27, 77, .65); padding: 2px 8px; border-radius: 6px; }
.truck-marker-wrap { background: none; border: 0; }
.truck-marker {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; border-radius: 10px; white-space: nowrap;
  background: var(--state); color: #fff; font-family: var(--font-head); font-size: .8rem; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); border: 2px solid #fff;
  position: relative; transform: translateY(-6px);
}
.truck-marker::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 0; height: 0; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
.truck-marker .icon { width: 18px; height: 18px; }
/* ملء الشاشة */
.fleet-map-wrap.map-fullscreen { position: fixed; inset: 0; z-index: 60; background: var(--bg); margin: 0; padding: 10px; display: flex; flex-direction: column; --map-h: auto; }
.fleet-map-wrap.map-fullscreen .map-frame { flex: 1; min-height: 0; }
.fleet-map-wrap.map-fullscreen .map { height: 100%; border-radius: var(--radius-sm); }
body.map-fullscreen-open { overflow: hidden; }
/* الوضع الداكن: تظليل البلاطات بس، العلامات والنوافذ تضل كما هي */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.8); } }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-popup-content { font-family: var(--font-body); margin: 10px 14px; line-height: 1.5; }

/* ── الإشعارات ── */
.bell { position: relative; }
.bell-count {
  position: absolute; top: 4px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}
.notif.unread .title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-inline-end: 6px; }
.push-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── تقدّم الرحلة: شكل الطريق ── */
.road-progress { padding: 4px 2px; }
.road-head, .road-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.road-city { font-weight: 600; font-size: .95rem; }
.road-percent { font-family: var(--font-head); font-size: 1.35rem; color: var(--red); line-height: 1; }
.road-percent.over { color: var(--warning); }
.road-track { position: relative; height: 38px; margin: 6px 8px; }
.road-rest { position: absolute; top: 18px; inset-inline: 0; border-top: 2px dashed var(--border); }
.road-done { position: absolute; top: 17px; right: 0; height: 4px; background: var(--red); border-radius: 2px; transition: width .6s ease; }
.road-dot { position: absolute; top: 13px; width: 12px; height: 12px; border-radius: 50%; }
.road-dot.start { right: -6px; background: var(--red); }
.road-dot.end { left: -6px; background: var(--surface); border: 2px solid var(--muted); }
.road-dot.end.reached { background: var(--red); border-color: var(--red); }
.road-truck {
  position: absolute; top: 2px; width: 32px; height: 32px; margin-right: -16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--red); color: var(--red);
  display: flex; align-items: center; justify-content: center; transition: right .6s ease;
}
.road-truck .icon { width: 18px; height: 18px; transform: scaleX(-1); }
.road-truck.moving { animation: road-pulse 2s ease-in-out infinite; }
@keyframes road-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--red) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { .road-truck.moving { animation: none; } }
.road-foot { font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.road-over { color: var(--warning); }
.road-place { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .82rem; color: var(--muted); }
.road-progress.compact .road-percent { font-size: 1.1rem; }
.road-progress.compact .road-track { height: 30px; }
.road-progress.compact .road-rest { top: 14px; }
.road-progress.compact .road-done { top: 13px; }
.road-progress.compact .road-dot { top: 9px; }
.road-progress.compact .road-truck { width: 26px; height: 26px; margin-right: -13px; }
.road-progress.compact .road-truck .icon { width: 15px; height: 15px; }
/* محطات الرحلة على الشريط: مليانة = خلصت، فاضية = لسا، والتالية اسمها تحتها */
.road-track.has-stops { margin-bottom: 18px; }
.road-stop {
  position: absolute; top: 12px; width: 14px; height: 14px; margin-right: -7px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted); z-index: 1;
}
.road-stop.done { background: var(--red); border-color: var(--red); }
.road-stop.next { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.road-stop-label {
  position: absolute; top: 34px; transform: translateX(50%); white-space: nowrap;
  font-size: .72rem; font-weight: 600; color: var(--red);
}
.road-progress.compact .road-stop { top: 8px; }
.road-progress.compact .road-stop-label { top: 28px; }

.trip-card { display: block; text-decoration: none; }
.trip-card + .trip-card { margin-top: 12px; }
/* «بالطريق الآن»: كل رحلة ببطاقة لحالها */
.on-road .trip-card {
  border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface);
  transition: border-color .2s var(--ease);
}
.on-road .trip-card:hover { border-color: color-mix(in srgb, var(--red) 35%, var(--hairline)); }
.on-road .trip-card .meta { color: var(--text); font-weight: 600; font-size: .9rem; }
.trip-card .meta { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

/* ── اللوحة السعودية (التصميم المعتمد): أرقام | حروف | شريط، عربي فوق ولاتيني تحت ── */
.ksa-plate {
  --kp-h: 46px; --kp-gap: calc(var(--kp-h) * .045);
  display: inline-grid; grid-template-columns: auto auto calc(var(--kp-h) * .5); grid-template-rows: 1fr 1fr;
  grid-auto-flow: row; gap: var(--kp-gap); height: var(--kp-h); padding: var(--kp-gap);
  background: #1b1b1d; border-radius: calc(var(--kp-h) * .12); vertical-align: middle; flex: none;
  line-height: 1; white-space: nowrap; color: #161616;
}
.ksa-plate .kp-cell {
  display: flex; align-items: center; justify-content: center; background: #fff;
  border-radius: calc(var(--kp-h) * .06); padding: 0 calc(var(--kp-h) * .2);
  direction: ltr; unicode-bidi: bidi-override; font-weight: 700;
}
.ksa-plate .kp-ar { font-family: var(--font-head); font-size: calc(var(--kp-h) * .3); padding-top: calc(var(--kp-h) * .03); }
.ksa-plate .kp-en { font-family: Arial, "Helvetica Neue", sans-serif; font-size: calc(var(--kp-h) * .3); }
.ksa-plate .kp-strip {
  grid-column: 3; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: calc(var(--kp-h) * .05) 0; border-radius: calc(var(--kp-h) * .06);
  background: #F5B400; color: #161616; overflow: hidden;
}
.ksa-plate .kp-emblem { width: 70%; height: auto; }
.ksa-plate .kp-country { font-family: var(--font-body); font-size: calc(var(--kp-h) * .085); font-weight: 600; }
.ksa-plate .kp-ksa { display: flex; flex-direction: column; align-items: center; font-family: Arial, sans-serif;
  font-size: calc(var(--kp-h) * .11); font-weight: 700; line-height: 1.05; }
.ksa-plate .kp-bar { width: 60%; height: calc(var(--kp-h) * .045); border-radius: 2px; background: #d9dadd; }
.ksa-plate .kp-sym { font-size: calc(var(--kp-h) * .11); line-height: 1; }
.ksa-plate.strip-white .kp-strip { background: #fff; }
.ksa-plate.strip-blue .kp-strip { background: #1E5BB8; color: #fff; }
.ksa-plate.strip-blue .kp-emblem path { stroke: #fff; }
/* بالأحجام الصغيرة: الشعار وKSA والرمز بس */
.ksa-plate:not(.lg) .kp-country, .ksa-plate:not(.lg) .kp-bar { display: none; }
.ksa-plate.sm { --kp-h: 36px; }
.ksa-plate.lg { --kp-h: 110px; }

/* ── طلبات التوصيل ───────────────────────────────────── */
.field > .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.check-list { display: grid; gap: 2px; }
.field .check-row { display: flex; font-weight: 500; margin: 0; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.stepper li { position: relative; font-size: .82rem; color: var(--muted); padding-top: 30px; }
.stepper li span { position: absolute; top: 4px; inset-inline-start: 50%; transform: translateX(50%); width: 20px; height: 20px;
  border-radius: 50%; border: 2px solid var(--border); background: var(--surface); z-index: 1; }
.stepper li::before { content: ""; position: absolute; top: 13px; inset-inline-start: -50%; width: 100%; height: 2px; background: var(--border); }
.stepper li:first-child::before { display: none; }
.stepper li.done { color: var(--ok); font-weight: 600; }
.stepper li.done span { background: var(--ok); border-color: var(--ok); }
.stepper li.done::before, .stepper li.current::before { background: var(--ok); }
.stepper li.current { color: var(--text); font-weight: 700; }
.stepper li.current span { border-color: var(--progress); box-shadow: 0 0 0 4px var(--progress-bg); }
.dest { margin-top: 12px; text-align: start; }
.dest-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.dest-actions .btn { min-height: 48px; }
.more-fields { margin-top: 16px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 0 14px; background: var(--surface-2); }
.more-fields > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; min-height: 46px; font-size: .92rem;
}
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::after {
  content: ""; margin-inline-start: auto; width: 8px; height: 8px; flex: none;
  border-left: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg) translateY(-2px);
  transition: transform .25s var(--ease);
}
.more-fields[open] > summary::after { transform: rotate(135deg) translateY(-2px); }
.more-fields[open] { padding-bottom: 14px; }
.more-fields[open] > summary { margin-bottom: 4px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.seg-opt { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; text-align: center; cursor: pointer; background: var(--surface); }
.seg-opt input { accent-color: var(--red); width: 18px; height: 18px; flex: none; }
.seg-opt:has(input:checked) { border-color: var(--red); background: var(--red-soft); color: var(--red-strong); }
/* طريقة دفع الأجرة عند التنزيل: خانة المبلغ للكاش، وصورة الإيصال للتحويل */
.pay-cash, .pay-transfer { display: none; }
[data-pay]:has([name=payment_method][value=cash]:checked) .pay-cash,
[data-pay]:has([name=payment_method][value=transfer]:checked) .pay-transfer { display: block; }
.route-stops { list-style: none; margin: 0; padding: 0; counter-reset: stop; }
.route-stops > li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.route-stops > li:first-child { border-top: 0; }
.order-input { width: 58px; min-height: 40px; text-align: center; flex: none; }
.stops { list-style: none; margin: 0; padding: 0; }
.stops > li { position: relative; padding: 12px 0 12px 0; border-top: 1px solid var(--border); }
.stops > li:first-child { border-top: 0; padding-top: 0; }
.stop-head { display: flex; align-items: center; gap: 8px; }
.stop-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  font-size: .85rem; background: var(--surface-2); border: 1.5px solid var(--border); }
.stops > li.done .stop-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.stops > li.next .stop-num { border-color: var(--red); color: var(--red); }
.stops > li.done .stop-title { color: var(--muted); }
.btn-lg { min-height: 54px; font-size: 1.05rem; border-radius: 14px; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warning); font-weight: 600; }

/* أوراق الشحنة: سطر لكل ورقة، والرفع بينفتح تحتها */
.doc-list { display: grid; gap: 8px; margin-top: 8px; }
.doc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-row .badge { font-size: .85rem; }
.doc-upload > summary { cursor: pointer; color: var(--red); list-style: none; }
.doc-upload[open] { flex-basis: 100%; }
.doc-upload form { margin-top: 6px; }

/* أسهم ترتيب المسار */
.move-btns { display: flex; flex-direction: column; gap: 2px; flex: none; }
.move-btns form { margin: 0; }
.move-btns .btn { min-height: 34px; min-width: 40px; padding: 2px 8px; font-size: .8rem; }
.field-wrap { display: contents; }
.field-wrap[hidden] { display: none !important; }
.seg { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.review-sheet { position: fixed; inset: 0; z-index: 100; background: rgba(8, 13, 28, .55); display: flex; align-items: flex-end; justify-content: center; }
.review-box { background: var(--surface); color: var(--text); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); max-height: 90vh; overflow: auto; }
@media (min-width: 700px) { .review-sheet { align-items: center; } .review-box { border-radius: 22px; } }
.presence-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 7px; background: var(--border); }
.presence-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.presence-dot.away { background: var(--warning); }
.push-banner.denied { background: var(--warning-bg) !important; }

/* ══ الحركة والتفاعل (13/10/2026): كل ضغطة إلها ردة فعل ══ */

/* شريط التحميل فوق الشاشة */
.nav-progress {
  position: fixed; top: 0; inset-inline: 0; z-index: 200; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--red), #FF7A8C); transform-origin: right; transform: scaleX(0); opacity: 0;
  box-shadow: 0 0 10px color-mix(in srgb, var(--red) 60%, transparent);
}
.nav-progress.is-loading { opacity: 1; animation: progress-run 8s cubic-bezier(.1, .7, .2, 1) forwards; }
.nav-progress.is-done { opacity: 0; transform: scaleX(1); transition: transform .2s ease, opacity .35s ease .15s; }
@keyframes progress-run { 0% { transform: scaleX(0); } 12% { transform: scaleX(.35); } 100% { transform: scaleX(.9); } }

/* زر شغال: دوّارة مكان النص، وما بينضغط مرتين */
.btn.is-busy, button.is-busy { position: relative; pointer-events: none; }
.btn.is-busy > *, .btn.is-busy { color: transparent !important; }
.btn.is-busy > .icon { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, #fff 35%, transparent); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after, .btn-soft.is-busy::after, .btn-danger-outline.is-busy::after {
  border-color: color-mix(in srgb, var(--red) 25%, transparent); border-top-color: var(--red);
}
.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* الضغط على سطر أو بطاقة: بيبين إنه انضغط قبل ما تفتح الصفحة */
a.row-link, a.trip-card, a.vehicle-tile, a.kpi, a.big-action, .todo-row { transition: background-color .15s var(--ease), transform .15s var(--ease), opacity .15s; border-radius: 10px; }
a.row-link:active, a.trip-card:active, a.big-action:active, .todo-row:active { background: color-mix(in srgb, var(--red) 6%, transparent); transform: scale(.992); }
a.is-pressed { opacity: .72; }

/* الانتقال بين الصفحات: المحتوى بيتبدّل بحركة ناعمة، والشريط العلوي والسفلي ثابتين */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.bottomnav { view-transition-name: bottomnav; }
.sidebar { view-transition-name: sidebar; }
/* ما بنعطي .content اسم: الاسم بيعمل طبقة مستقلة، فالنوافذ اللي جوّاها (الخريطة بملء الشاشة، ورقة التأكيد) بتصير تحت الشريط السفلي */
::view-transition-old(root) { animation: vt-out .14s ease-in both; }
::view-transition-new(root) { animation: vt-in .26s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
/* المتصفحات بدون الانتقال: المحتوى بيطلع بحركة خفيفة */
@supports not (view-transition-name: none) { .content { animation: rise .3s var(--ease); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .nav-progress.is-loading { animation: none; transform: scaleX(.6); }
}

/* القائمة الجانبية بعناوين مجموعات */
.nav-group-title { font-size: .74rem; font-weight: 700; color: var(--muted); padding: 14px 14px 4px; letter-spacing: 0; }
.sidebar .nav-group-title:first-child { padding-top: 0; }

/* تبويبات أقسام المجموعة فوق الصفحة */
.subnav {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -6px -16px 18px; padding: 4px 16px 2px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--hairline); transition: background-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.subnav-tab:active { transform: scale(.96); }
.subnav-tab.active { background: var(--navy); color: #fff; border-color: transparent; font-weight: 600; }
:root[data-theme="dark"] .subnav-tab.active { background: var(--red); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .subnav-tab.active { background: var(--red); } }
@media (min-width: 900px) { .subnav { display: none; } }

/* الرسائل */
.messages:empty { display: none; }
.toasts {
  position: fixed; z-index: 150; inset-inline: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; padding: 12px 18px; border-radius: 14px;
  background: var(--navy); color: #fff; font-weight: 500; box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .45);
  animation: toast-in .35s var(--ease); transition: opacity .3s, transform .3s var(--ease); cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .14);
}
.toast .icon { color: #5BE39B; }
.toast-error { background: #5A0A17; }
.toast-error .icon, .toast-warning .icon { color: #FFB4BF; }
.toast.out { opacity: 0; transform: translateY(10px) scale(.97); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* إجراء بمكانه: العنصر الجديد بيلمع، واللي انحذف بينطوي */
.is-fresh { animation: fresh 1.2s var(--ease); }
@keyframes fresh { 0% { background: color-mix(in srgb, var(--ok) 18%, transparent); } 100% { background: transparent; } }
.is-leaving { animation: leave .28s var(--ease) forwards; overflow: hidden; }
@keyframes leave { to { opacity: 0; transform: translateX(-24px); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; } }

/* شريط تقدّم رفع الملفات */
.upload-progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.upload-progress::before { content: ""; display: block; height: 100%; width: var(--p, 0%); background: var(--red); transition: width .2s; }

/* الخريطة قبل ما تحمّل: سطح بيلمع بدل فراغ */
.map-frame .map:not(.leaflet-container) {
  background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 60%, var(--border)) 50%, var(--surface-2) 70%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }
.syncing { display: inline-flex; align-items: center; gap: 8px; }

/* ══ لوحة «برج المراقبة» ══ */
.tower-status {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 18px 18px 14px; margin-bottom: 16px; color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(200, 16, 46, .38) 0%, transparent 52%),
    linear-gradient(160deg, #13286F 0%, var(--navy) 70%);
  box-shadow: var(--shadow);
}
.tower-status.all-good {
  background: radial-gradient(120% 140% at 100% 0%, rgba(76, 208, 143, .32) 0%, transparent 55%), linear-gradient(160deg, #13286F 0%, var(--navy) 70%);
}
.ts-main { display: flex; align-items: center; gap: 14px; }
.ts-icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); }
.all-good .ts-icon { background: rgba(76, 208, 143, .2); color: #5BE39B; }
.ts-icon .icon { width: 26px; height: 26px; stroke-width: 2.4; }
.pulse-dot { width: 14px; height: 14px; border-radius: 50%; background: #FF5C75; box-shadow: 0 0 0 0 rgba(255, 92, 117, .7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(255, 92, 117, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 92, 117, 0); } }
.ts-greet { font-size: .82rem; opacity: .75; }
.tower-status h1 { font-size: 1.3rem; margin-top: 2px; }
.ts-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ts-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border-radius: 999px; font-size: .82rem;
  background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .85); text-decoration: none; border: 1px solid rgba(255, 255, 255, .08);
  transition: background-color .2s var(--ease);
}
a.ts-chip:hover { background: rgba(255, 255, 255, .16); }
.ts-chip b { color: #fff; font-weight: 600; }
.ts-chip.is-violation { background: rgba(255, 92, 117, .22); }
.ts-chip.is-warning { background: rgba(245, 185, 74, .2); }
.ts-sync { display: inline; margin: 0; }
.ts-sync-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-inline-start: 2px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
.ts-sync-btn:active { transform: rotate(-90deg); }
.ts-sync-btn.is-busy .icon { animation: spin 1s linear infinite; visibility: visible; }
.ts-sync-btn.is-busy::after { display: none; }

/* صندوق القرارات */
.decision { flex-wrap: wrap; }
.decision > .row-link { min-width: 220px; }
.d-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.d-kind { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; flex: none; }
.d-kind.tone-warning { background: var(--warning-bg); color: var(--warning); }
.d-kind.tone-violation { background: var(--violation-bg); color: var(--violation); }
.d-kind.tone-progress { background: var(--progress-bg, var(--missing-bg)); color: var(--progress, var(--missing)); }
.d-kind.tone-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.d-flag { margin-top: 6px; margin-inline-end: 4px; font-size: .74rem; }
.d-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.d-actions form { margin: 0; }
.d-actions .btn { min-width: 74px; }
.d-reason { flex-basis: 100%; display: flex; gap: 8px; align-items: center; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); animation: fade-in .2s var(--ease); }
.d-reason .input { flex: 1; min-width: 0; min-height: 40px; }
.btn.is-open { background: var(--surface-2); }
@media (max-width: 560px) {
  .decision > .row-link { flex-basis: 100%; }
  .d-actions { flex-basis: 100%; }
  .d-actions > form, .d-actions > .btn, .d-actions > a { flex: 1; }
  .d-actions .btn { width: 100%; }
  .d-reason { flex-wrap: wrap; }
  .d-reason .btn { width: 100%; }
}
.team-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: -4px 4px 16px; font-size: .88rem; }
.team-line a { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--border); }
.team-line a:hover { color: var(--red); }

/* المركبات الآن */
.fleet-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.fleet-card {
  display: block; text-decoration: none; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--hairline); transition: transform .15s var(--ease), box-shadow .2s var(--ease);
}
.fleet-card:active { transform: scale(.985); }
@media (hover: hover) { .fleet-card:hover { box-shadow: var(--shadow-lift); } }
.fc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fc-sub { margin: 6px 0 2px; }
.fleet-card .road-progress { margin-top: 8px; }

/* رحلات اليوم: خط زمني */
.today-list { list-style: none; margin: 0; padding: 0; }
.today-list .row-link { display: flex; align-items: center; gap: 12px; padding: 10px 4px; }
.tt + .tt { border-top: 1px solid var(--hairline); }
.tt-time { flex: none; width: 46px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .88rem; color: var(--muted); }
.tt-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--border); position: relative; }
.tt-progress .tt-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.tt-ok .tt-dot { background: var(--ok); }
.tt-warning .tt-dot { background: var(--warning); }
.tt-meta { display: block; }

/* المركبة بشكلها واسمها («لوبد 4046») بدل اللوحة الكبيرة بالقوائم */
.vchip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.vicon { width: 44px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--navy); }
:root[data-theme="dark"] .vicon { color: #AFC0F5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vicon { color: #AFC0F5; } }
.vchip-name b { font-variant-numeric: tabular-nums; font-weight: 700; }
.vchip.sm { gap: 5px; font-size: .9rem; }
.vchip.sm .vicon { width: 34px; height: 17px; }

/* زر الاعتماد أخضر (قرار سيف 14/10/2026) */
.btn-ok { background: #138A52; color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 16px -8px rgba(19, 138, 82, .7); }
.btn-ok:hover { background: #0F7444; }
:root[data-theme="dark"] .btn-ok { background: #1E9E63; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-ok { background: #1E9E63; } }

/* ══ لوحة «أوراق الشحنة» (13/10/2026): خانة لكل ورقة، نفس الشكل بكل مكان ══ */
.papers { display: grid; gap: 8px; margin-top: 10px; }
.paper {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--hairline); flex-wrap: wrap;
}
.paper.is-missing { border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning-bg) 60%, var(--surface-2)); }
.paper.is-signed { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.paper-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--ok-bg); color: var(--ok);
}
.paper.is-missing .paper-mark { background: var(--warning-bg); color: var(--warning); }
.paper.is-signed .paper-mark { background: var(--ok); color: #fff; }
.paper-body { flex: 1; min-width: 150px; line-height: 1.45; }
.paper-body b { font-weight: 600; }
.paper-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: .85rem; }
.paper-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--red); text-decoration: none; font-weight: 600; }
.paper-upload { margin: 0; flex: none; }
.upload-btn { position: relative; cursor: pointer; }
.file-hidden { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.paper-upload.is-sending .upload-btn { pointer-events: none; opacity: .6; }
.paper-upload .upload-progress { width: 100%; min-width: 110px; }
@media (max-width: 560px) { .paper-upload { flex-basis: 100%; } .paper-upload .upload-btn { width: 100%; } }

/* ══ شاشة مهام المشرف: خطوات الدورة بالترتيب ══ */
.task-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.task-card { margin: 0; }
.task-card > summary { list-style: none; cursor: pointer; }
.task-card > summary::-webkit-details-marker { display: none; }
.task-head { display: flex; align-items: center; gap: 12px; }
.task-head h2 { margin: 0; }
.task-num {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--surface-2); color: var(--muted); border: 1.5px solid var(--border);
}
.task-step.has-rows .task-num { background: var(--red); color: #fff; border-color: transparent; }
.task-step:not(.has-rows) .task-card { box-shadow: none; opacity: .8; }
.task-step:not(.has-rows) .task-card > summary { cursor: default; }
.task-hint { margin: 10px 0 2px; }
.task-card[open] > .list, .task-card[open] > .trip-card { margin-top: 12px; }
.task-panel { flex-basis: 100%; }


/* ══ طلب المصنع (صفحة وحدة، 24/10/2026) ══ */
/* حقلين قصار جنب بعض حتى على الجوال (الوزن والقطع) */
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* قراءة الدليفري بالذكاء الاصطناعي: حالة القراءة، والحقول اللي تعبّت (أزرق) أو ما انقرأت بوضوح (برتقالي) */
.scan-status { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--progress-bg); color: var(--progress); }
.scan-status.is-busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-inline-end: 8px; border-radius: 50%;
  border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
.scan-status.is-ok { background: var(--ok-bg); color: var(--ok); }
.scan-status.is-warn { background: var(--warning-bg); color: var(--warning); }
.ai-filled { border-color: var(--progress) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--progress) 25%, transparent); }
.ai-unclear .input { border-color: var(--warning) !important; }
.ai-note { color: var(--warning); margin-top: 4px; }
.item-rows { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: 1fr 72px 72px auto; gap: 6px; align-items: center; }
.plain-list { margin: 0; padding-inline-start: 18px; }
/* بطاقات تصوير الأوراق */
.doc-tiles { display: grid; gap: 10px; }
.doc-tile {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1.5px dashed var(--input-border); background: var(--input-bg); transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.doc-tile:active { transform: scale(.99); }
.doc-tile-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.doc-tile b { display: block; }
.doc-tile-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.doc-tile-check { flex: none; width: 28px; height: 28px; border-radius: 50%; display: none; place-items: center; background: var(--ok); color: #fff; }
.doc-tile.is-set { border-style: solid; border-color: var(--ok); background: color-mix(in srgb, var(--ok-bg) 70%, var(--input-bg)); }
.doc-tile.is-set .doc-tile-check { display: grid; }
.doc-tile.is-set .doc-tile-icon { background: var(--ok-bg); color: var(--ok); }
.doc-tile.has-error { border-color: var(--violation); }

/* بطاقات طلبات مدير المصنع */
.req-cards { display: grid; gap: 12px; }
.req-card { border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.req-main { display: block; padding: 12px 14px; }
.req-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.req-stage { margin-inline-start: auto; }
.req-steps { margin: 12px 0 4px; }
.req-steps .stepper li { font-size: .72rem; }
.req-papers { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; }
.req-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--hairline); background: var(--surface); flex-wrap: wrap; }

/* فلتر «طلباتي / كل الطلبات» عند مدير المصنع: بيبين على كل الشاشات */
.subnav.req-filter { display: flex; margin: 0 0 12px; padding: 0; -webkit-mask-image: none; mask-image: none; }

/* ══ أصناف بدل التنسيق الداخلي (15/10/2026) ══
   كانت هذه القيم مكتوبة style="" داخل القوالب. التنسيق الداخلي يغلب كل القواعد، فالأصناف العامة
   هنا تحمل !important حتى تبقى النتيجة نفسها بالضبط مهما كان ترتيب القواعد (نفس أسلوب أصناف Bootstrap). */
/* المسافات */
.mt-0 { margin-top: 0 !important; } .mt-2 { margin-top: 2px !important; } .mt-4 { margin-top: 4px !important; }
.mt-6 { margin-top: 6px !important; } .mt-8 { margin-top: 8px !important; } .mt-10 { margin-top: 10px !important; }
.mt-12 { margin-top: 12px !important; } .mt-14 { margin-top: 14px !important; } .mt-16 { margin-top: 16px !important; }
.mt-18 { margin-top: 18px !important; } .mt-20 { margin-top: 20px !important; } .mt-22 { margin-top: 22px !important; }
.mb-6 { margin-bottom: 6px !important; } .mb-8 { margin-bottom: 8px !important; } .mb-10 { margin-bottom: 10px !important; }
.mb-12 { margin-bottom: 12px !important; } .mb-14 { margin-bottom: 14px !important; } .mb-16 { margin-bottom: 16px !important; }
.m-0 { margin: 0 !important; }
.py-6 { padding-top: 6px !important; padding-bottom: 6px !important; }
/* التخطيط */
.flex { display: flex !important; } .block { display: block !important; } .hide { display: none !important; }
.flex-wrap { flex-wrap: wrap !important; } .flex-1 { flex: 1 !important; }
.items-center { align-items: center !important; } .items-start { align-items: flex-start !important; }
.justify-center { justify-content: center !important; } .justify-between { justify-content: space-between !important; }
.gap-6 { gap: 6px !important; } .gap-8 { gap: 8px !important; } .gap-10 { gap: 10px !important; } .gap-12 { gap: 12px !important; }
.stack-6 { display: grid !important; gap: 6px !important; } .stack-12 { display: grid !important; gap: 12px !important; }
.cols-1 { grid-template-columns: 1fr !important; }
.relative { position: relative !important; }
/* الأبعاد */
.w-90 { width: 90px !important; } .w-120 { width: 120px !important; } .w-auto { width: auto !important; } .w-full { width: 100% !important; }
.minw-200 { min-width: 200px !important; } .minw-220 { min-width: 220px !important; } .minw-240 { min-width: 240px !important; }
.maxw-200 { max-width: 200px !important; } .maxw-640 { max-width: 640px !important; } .maxw-720 { max-width: 720px !important; }
.minh-36 { min-height: 36px !important; }
/* النص واللون */
.text-center { text-align: center !important; } .text-end { text-align: end !important; }
.pre-line { white-space: pre-line !important; } .fw-600 { font-weight: 600 !important; }
.fs-90 { font-size: .9rem !important; } .fs-95 { font-size: .95rem !important; } .fs-100 { font-size: 1rem !important; }
.text-ok { color: var(--ok) !important; } .text-warning { color: var(--warning) !important; } .text-violation { color: var(--violation) !important; }
.text-red { color: var(--red) !important; } .text-progress { color: var(--progress) !important; } .text-white { color: #fff !important; }
.opacity-50 { opacity: .5 !important; } .pointer { cursor: pointer !important; }
.bg-surface-2 { background: var(--surface-2) !important; }
/* أصناف خاصة بمكوّنات (كانت تنسيقاً داخلياً على عنصر واحد) */
.card.pending-banner { background: var(--warning-bg); border-color: transparent; }
.card.push-banner { background: var(--progress-bg); border-color: transparent; margin-bottom: 14px; }
.card.needs-bayan { border-color: var(--warning); }
.alert-dot.is-ok { background: var(--ok); }
.fieldset-title.flush { margin-top: 0; border: 0; padding-top: 0; }
.arrange-grid { align-items: start; }
.map.map-trip { height: 340px; }
.photos.photos-lg { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.photos-lg img { aspect-ratio: auto; object-fit: contain; }
.table tr.row-warning { background: var(--warning-bg); } .table tr.row-violation { background: var(--violation-bg); }
/* شريط التقدّم: النسبة من القالب عبر متغير --pct على العنصر بدل width/right مكتوبة */
.road-done { width: var(--pct, 0%); }
.road-truck, .road-stop, .road-stop-label { right: var(--pct, 0%); }

/* ══ لوحة المدير — نسخة 2 (15/10/2026) ══
   كل القواعد هنا محصورة تحت .dash2 (غلاف لوحة المدير فقط) حتى لا تتأثر أي شاشة ثانية.
   الحركات: 150–250 م.ث، ناعمة، وتتعطّل مع «تقليل الحركة». الحالة دائماً لون + كلمة. مساحة اللمس 44 نقطة. */
.dash2 { --d2-ease: cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; gap: 16px; }
/* على الجوال الغلاف الأوسط شفاف حتى يترتب كل قسم بترتيبه: الحالة، القرارات، الفريق، المركبات، اليوم */
.dash2 .d2-main { display: contents; }
.dash2 .card, .dash2 .d2-status, .dash2 .d2-team { margin: 0 !important; }
.dash2 .d2-status { order: 0; } .dash2 .d2-decisions { order: 1; } .dash2 .d2-team { order: 2; } .dash2 .d2-fleet { order: 3; } .dash2 .d2-today { order: 4; }
.dash2 .d2-head { flex-wrap: wrap; }
.dash2 .d2-head h2 { white-space: nowrap; }

/* ظهور الأقسام بتدرّج خفيف مرة واحدة عند فتح الصفحة */
@keyframes d2-in { from { opacity: 0; transform: translateY(8px); } }
.dash2 > .d2-status, .dash2 .d2-main > *, .dash2 > .d2-fleet { animation: d2-in .22s var(--d2-ease) backwards; }
.dash2 .d2-main > :nth-child(1) { animation-delay: .05s; }
.dash2 .d2-main > :nth-child(2) { animation-delay: .1s; }
.dash2 .d2-main > :nth-child(3) { animation-delay: .15s; }
.dash2 > .d2-fleet { animation-delay: .1s; }

/* الأزرار: تصغر قليلاً عند الضغط، وترتفع قليلاً عند مرور الماوس على الكمبيوتر فقط */
.dash2 .btn { transition: transform .15s var(--d2-ease), background-color .2s var(--d2-ease), box-shadow .2s var(--d2-ease), border-color .2s var(--d2-ease); }
.dash2 .btn:active { transform: scale(.97); box-shadow: none; }
@media (hover: hover) {
  .dash2 .btn:hover { transform: translateY(-1px); }
  .dash2 .btn:active { transform: scale(.97); }
}
.dash2 .btn-sm { min-height: 44px; padding: 8px 14px; font-size: .9rem; }

/* ── ١) شريط الحالة ── */
.dash2 .d2-status {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 18px 18px 16px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(160deg, #13286F 0%, var(--navy) 70%); box-shadow: var(--shadow);
  transition: background .25s var(--d2-ease);
}
.dash2.tone-bad .d2-status { background: radial-gradient(120% 150% at 100% 0%, rgba(200, 16, 46, .55) 0%, transparent 55%), linear-gradient(160deg, #13286F 0%, var(--navy) 70%); }
.dash2.tone-good .d2-status { background: radial-gradient(120% 140% at 100% 0%, rgba(76, 208, 143, .32) 0%, transparent 55%), linear-gradient(160deg, #13286F 0%, var(--navy) 70%); }
.dash2 .d2-status-main { display: flex; align-items: center; gap: 14px; }
.dash2 .d2-status-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); transition: background-color .25s var(--d2-ease); }
.dash2 .d2-status-icon .icon { width: 26px; height: 26px; stroke-width: 2.4; display: none; }
.dash2.tone-bad .d2-status-icon { background: rgba(255, 92, 117, .28); color: #FFC2CC; }
.dash2.tone-bad .d2-status-icon .icon-bad { display: block; }
.dash2.tone-work .d2-status-icon .icon-work { display: block; }
.dash2.tone-good .d2-status-icon { background: rgba(76, 208, 143, .22); color: #5BE39B; }
.dash2.tone-good .d2-status-icon .icon-good { display: block; }
.dash2 .d2-greet { font-size: .82rem; opacity: .75; }
.dash2 .d2-status h1 { font-size: 1.3rem; margin-top: 2px; }
.dash2 .d2-status h1 > span { display: none; }
.dash2.tone-bad .d2-status .h-bad, .dash2.tone-work .d2-status .h-work, .dash2.tone-good .d2-status .h-good { display: inline; }
.dash2 #ts-count { font-variant-numeric: tabular-nums; }

/* سطور المشاكل: كل مشكلة سطر بلون وكلمة، وتُضغط لتفتح مكانها */
.dash2 .d2-problems { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.dash2 .d2-problem {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12); color: #fff; font-weight: 600; font-size: .92rem;
  text-decoration: none; transition: background-color .2s var(--d2-ease), transform .15s var(--d2-ease);
}
.dash2 .d2-problem:active { transform: scale(.98); }
@media (hover: hover) { .dash2 .d2-problem:hover { background: rgba(255, 255, 255, .18); } }
.dash2 .d2-problem.is-violation { background: rgba(255, 92, 117, .2); border-color: rgba(255, 92, 117, .45); }
.dash2 .d2-problem.is-warning { background: rgba(245, 185, 74, .16); border-color: rgba(245, 185, 74, .4); }
.dash2 .d2-problem .led { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #FF5C75; box-shadow: 0 0 0 3px rgba(255, 92, 117, .3); }
.dash2 .d2-problem.is-warning .led { background: #F5B94A; box-shadow: 0 0 0 3px rgba(245, 185, 74, .3); }
.dash2 .d2-problem::after { content: "‹"; margin-inline-start: auto; opacity: .6; font-size: 1.2rem; line-height: 1; }
@media (min-width: 700px) {
  .dash2 .d2-problems { display: flex; flex-wrap: wrap; }
  .dash2 .d2-problem::after { display: none; }
}

/* الحبّات الثانوية تحت الشريط: التنبيهات، الراصد، القرارات */
.dash2 .d2-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dash2 .d2-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border-radius: 999px; font-size: .84rem;
  background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .85); text-decoration: none; border: 1px solid rgba(255, 255, 255, .08);
  transition: background-color .2s var(--d2-ease), transform .15s var(--d2-ease);
}
.dash2 a.d2-chip:active { transform: scale(.97); }
@media (hover: hover) { .dash2 a.d2-chip:hover { background: rgba(255, 255, 255, .18); } }
.dash2 .d2-chip b { color: #fff; font-weight: 600; }
.dash2 .d2-chip.is-violation { background: rgba(255, 92, 117, .22); }
.dash2 .d2-chip.is-warning { background: rgba(245, 185, 74, .2); }
.dash2 .d2-chip.is-work { background: rgba(255, 255, 255, .16); }
.dash2 .ts-sync-btn { width: 32px; height: 32px; margin-inline-start: 4px; transition: transform .2s var(--d2-ease), background-color .2s var(--d2-ease); }
@media (hover: hover) { .dash2 .ts-sync-btn:hover { background: rgba(255, 255, 255, .26); } }

/* ── ٢) بانتظار قرارك ── */
.dash2 .d2-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 8px; margin-inline-start: 6px;
  background: var(--red-soft); color: var(--red); font-size: .85rem; font-variant-numeric: tabular-nums; vertical-align: middle;
}
.dash2 .decision-list > li.decision { position: relative; padding: 14px 0; padding-inline-start: 14px; transition: background-color .2s var(--d2-ease); }
.dash2 .decision-list > li.decision:first-child { padding-top: 4px; }
/* شريط لون على طرف السطر حسب نوع القرار */
.dash2 .decision::before { content: ""; position: absolute; inset-inline-start: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 4px; background: var(--border); }
.dash2 .decision:first-child::before { top: 4px; }
.dash2 .decision[data-kind="approve"]::before { background: var(--warning); }
.dash2 .decision[data-kind="unauthorized"]::before { background: var(--violation); }
.dash2 .decision[data-kind="expense"]::before { background: var(--muted); }
.dash2 .decision[data-kind="arrange"]::before, .dash2 .decision[data-kind="bayan"]::before { background: var(--progress); }
.dash2 .d-top .route, .dash2 .d-top .title { font-size: 1rem; }
.dash2 .d-actions { gap: 8px; }
.dash2 .d-actions .btn { min-width: 96px; }
.dash2 .d-reason .input { min-height: 44px; }
.dash2 .d-reason .btn { min-height: 44px; }
/* بعد القرار: علامة صح خضراء على السطر، ثم ينطوي بالارتفاع (ضمن 280 م.ث قبل ما يُحذف من الصفحة) */
.dash2 .decision.is-leaving { animation: d2-leave .28s var(--d2-ease) forwards; overflow: hidden; }
.dash2 .decision.is-leaving::after { content: ""; position: absolute; inset: 4px 0; border-radius: 10px; background: var(--ok-bg); animation: d2-flash .28s var(--d2-ease) forwards; }
.dash2 .decision.is-leaving::before {
  width: 34px; height: 34px; border-radius: 50%; top: 50%; inset-inline-start: 50%; bottom: auto; transform: translate(50%, -50%); z-index: 1;
  background-color: var(--ok); background-size: 20px; background-repeat: no-repeat; background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5 9.5-10'/%3E%3C/svg%3E");
  animation: d2-check .28s var(--d2-ease) forwards;
}
@keyframes d2-leave { 0%, 45% { opacity: 1; max-height: 420px; } 100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-top-width: 0; } }
@keyframes d2-flash { 0% { opacity: 0; } 25%, 55% { opacity: 1; } 100% { opacity: 0; } }
@keyframes d2-check { 0% { opacity: 0; transform: translate(50%, -50%) scale(.6); } 30%, 55% { opacity: 1; transform: translate(50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(50%, -50%) scale(.9); } }
.dash2 .d2-done { display: flex; align-items: center; gap: 8px; padding: 14px 4px 4px; color: var(--ok); font-weight: 600; animation: d2-in .22s var(--d2-ease); }
.dash2 .d2-done .icon { stroke-width: 2.4; }
.dash2 .d2-team { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 0 6px; font-size: .88rem; }
.dash2 .d2-team a { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--border); transition: color .2s var(--d2-ease); }
.dash2 .d2-team a:hover { color: var(--red); }

/* ── ٣) المركبات الآن: بطاقة لكل مركبة، والخريطة تحتها ── */
.dash2 .fleet-grid { grid-template-columns: 1fr; gap: 8px; }
.dash2 .fleet-card {
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--hairline);
  transition: transform .15s var(--d2-ease), box-shadow .2s var(--d2-ease), border-color .2s var(--d2-ease);
}
.dash2 .fleet-card:active { transform: scale(.985); }
@media (hover: hover) { .dash2 .fleet-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); } }
.dash2 .fleet-card.is-progress { border-color: color-mix(in srgb, var(--progress) 40%, transparent); }
.dash2 .fleet-card.is-warning { border-color: color-mix(in srgb, var(--violation) 50%, transparent); background: color-mix(in srgb, var(--violation-bg) 55%, var(--surface-2)); }
.dash2 .fleet-card.is-missing { border-style: dashed; border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.dash2 .fc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash2 .fc-state { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.dash2 .fc-state .led { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.dash2 .is-progress .fc-state { background: var(--progress-bg); color: var(--progress); }
.dash2 .is-neutral .fc-state { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.dash2 .is-warning .fc-state { background: var(--violation-bg); color: var(--violation); }
.dash2 .is-missing .fc-state { background: var(--warning-bg); color: var(--warning); }
/* نبضة خفيفة فقط للمركبة التي في الطريق */
@keyframes d2-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); } 60% { box-shadow: 0 0 0 6px transparent; } }
.dash2 .is-moving .fc-state .led { animation: d2-pulse 2s ease-in-out infinite; }
.dash2 .fc-sub { margin: 6px 0 2px; }
.dash2 .fc-warn { color: var(--violation); font-weight: 600; }
.dash2 .fc-place { margin-top: 2px; }
.dash2 .fleet-card .road-progress { margin-top: 6px; }
.dash2 .road-truck.moving { animation: none; }
.dash2 .road-percent { font-size: 1.05rem; }
.dash2 .fleet-map-wrap { margin-top: 12px; }
.dash2 .map-chips { padding-bottom: 6px; }
.dash2 .map-chips .chip { min-height: 34px; padding: 4px 10px; font-size: .82rem; }
.dash2 .map-chips .chip small { display: none; }
.dash2 .map-frame .map { border-radius: var(--radius-sm); }

/* ── ٤) اليوم والقادم ── */
.dash2 .today-list .row-link { padding: 11px 4px; min-height: 52px; transition: background-color .2s var(--d2-ease); }
.dash2 .tt-empty { padding: 10px 4px; font-size: .92rem; }
.dash2 .d2-sub { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; padding-top: 12px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: .85rem; font-weight: 600; }
.dash2 .d2-sub::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: var(--red); flex: none; }
.dash2 .tt-ok .tt-dot { background: var(--ok); }

/* ── الكمبيوتر: عمودان. اليمين: الحالة والقرارات واليوم. اليسار: المركبات والخريطة ثابتة أثناء النزول ── */
@media (min-width: 1000px) {
  .dash2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
  .dash2 > .d2-status { grid-column: 1 / -1; padding: 20px 22px 18px; }
  .dash2 .d2-status h1 { font-size: 1.45rem; }
  .dash2 .d2-main { display: block; grid-column: 1; grid-row: 2; min-width: 0; }
  .dash2 .d2-main > * + * { margin-top: 16px !important; }
  .dash2 > .d2-fleet { grid-column: 2; grid-row: 2; position: sticky; top: 76px; }
  .dash2 .decision-list > li.decision { padding-inline-start: 16px; }
  .dash2 .d2-fleet .map-frame .map { height: 300px; }
}
@media (min-width: 1280px) { .dash2 { grid-template-columns: minmax(0, 1fr) 420px; } }

/* «تقليل الحركة»: لا ظهور متدرّج ولا نبضة ولا طيّ */
@media (prefers-reduced-motion: reduce) {
  .dash2 > .d2-status, .dash2 .d2-main > *, .dash2 > .d2-fleet, .dash2 .d2-done, .dash2 .is-moving .fc-state .led,
  .dash2 .decision.is-leaving, .dash2 .decision.is-leaving::before, .dash2 .decision.is-leaving::after { animation: none !important; }
  .dash2 .decision.is-leaving { opacity: 0; }
}
.dash2 .road-city { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* شريط التطوير المحلي (DEBUG فقط): تبديل حساب التجربة بضغطة */
.dev-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 12px; font-size: .78rem; background: repeating-linear-gradient(135deg, #FFF4DE 0 10px, #FFEBC2 10px 20px); color: #5B3A00; border-bottom: 1px solid #F0D28A; }
.dev-switch form { margin: 0; }
.dev-switch button { min-height: 32px; padding: 4px 10px; border-radius: 8px; border: 1px solid #E0B45A; background: #fff; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.dev-switch button.active { background: var(--navy); color: #fff; border-color: transparent; }

/* توقيع المستلم على الشاشة وسند القبض على الجوال (قرار سيف 01/11/2026: ما في طابعة مع السائق) */
.sign-pad { position: relative; border: 2px dashed color-mix(in srgb, var(--red) 30%, var(--border)); border-radius: var(--radius); background: #fff; }
.sign-pad canvas { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.sign-pad .sign-hint { position: absolute; inset: auto 0 12px; text-align: center; color: #9AA5B8; font-size: .9rem; pointer-events: none; }
.sign-pad.has-ink .sign-hint { display: none; }
.sign-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.receipt-head { display: flex; align-items: center; gap: 12px; }
.receipt-logo { width: 104px; height: auto; background: #fff; border-radius: 10px; padding: 6px 8px; }
.receipt-sign { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 10px; background: #fff; }
.receipt-sign img { display: block; max-width: 100%; max-height: 160px; margin: 6px auto 0; }
