/* =====================================================================
   Platform Fleet mockup · design system
   Layout: dark ink sidebar + light working canvas; dense operational
   tables; one tenant accent (white-label, from the branding table).
   Arabic-first: logical properties everywhere, RTL by default.
   ===================================================================== */

:root {
  /* tenant brand (branding table drives these in the real product) */
  --brand: #0E6B5C;
  --brand-ink: #0A5347;
  --brand-soft: #E3F2EE;
  --brand-line: #B9DDD4;

  /* neutrals, slightly green-biased toward the brand */
  --bg: #F2F4F3;
  --surface: #FFFFFF;
  --surface-2: #F7F9F8;
  --surface-3: #EEF2F0;
  --ink: #12201C;
  --ink-2: #3B4A46;
  --muted: #677773;
  --faint: #95A29E;
  --line: #DDE4E1;
  --line-2: #E9EEEC;

  /* sidebar */
  --side-bg: #0F1C1A;
  --side-bg-2: #172825;
  --side-ink: #C9D6D2;
  --side-muted: #7E918C;
  --side-active: #1F3A35;

  /* semantic */
  --good: #15803D;  --good-bg: #E5F4EA;  --good-line: #BFE3CB;
  --warn: #B45309;  --warn-bg: #FCF0DF;  --warn-line: #F2D3A6;
  --bad:  #B91C1C;  --bad-bg:  #FBE6E6;  --bad-line:  #F1C0C0;
  --info: #1D4ED8;  --info-bg: #E6EDFC;  --info-line: #C3D3F6;
  --idle: #5B6B67;  --idle-bg: #EDF0EF;  --idle-line: #D5DCDA;

  /* platform series colours (neutral, non-brand, never logos) */
  --p-talabat: #2563EB;
  --p-keeta: #7C3AED;
  --p-jahez: #D97706;
  --p-deliveroo: #0891B2;

  /* type */
  --font: "Readex Pro", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Readex Pro", ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 13.5px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;

  --shadow-1: 0 1px 2px rgba(16, 32, 28, .06), 0 1px 1px rgba(16, 32, 28, .04);
  --shadow-2: 0 8px 24px rgba(16, 32, 28, .12), 0 2px 6px rgba(16, 32, 28, .06);
  --shadow-3: 0 24px 64px rgba(16, 32, 28, .22);

  --side-w: 256px;
  --top-h: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num, .mono, td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { text-align: end; }
.center { text-align: center; }
.hstack { display: flex; align-items: center; gap: 8px; }
.hstack.wrap { flex-wrap: wrap; }
.vstack { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1 1 auto; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "side top" "side main";
  min-height: 100vh;
}
.sidebar {
  grid-area: side;
  background: var(--side-bg);
  color: var(--side-ink);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.brandbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex: none; }
.brand-name { font-weight: 600; font-size: 14px; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--side-muted); }
.tenant-pill { margin: 12px 14px 4px; padding: 8px 10px; border-radius: var(--r); background: var(--side-bg-2); display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tenant-pill .mode { margin-inline-start: auto; font-size: 10.5px; padding: 2px 6px; border-radius: 999px; background: rgba(46, 196, 170, .16); color: #7FE0CC; white-space: nowrap; }
.nav { padding: 8px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); padding: 14px 10px 6px; }
[dir="rtl"] .nav-group { letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--side-ink); font-size: 13px;
  text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 var(--brand); }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav a .badge { margin-inline-start: auto; }
.side-foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; color: var(--side-muted); }

.topbar {
  grid-area: top;
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding-inline: 20px;
}
.topbar .burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; width: min(340px, 34vw);
  color: var(--muted); font-size: var(--fs-sm);
}
.search input { border: 0; background: transparent; outline: none; width: 100%; }
.clock { font-size: var(--fs-sm); color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.iconbtn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative;
}
.iconbtn:hover { background: var(--surface-3); }
.iconbtn .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
.langbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.langbtn b { font-weight: 600; }
.userchip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.userchip .meta { line-height: 1.15; }
.userchip .meta div:first-child { font-size: 12.5px; font-weight: 600; }
.userchip .meta div:last-child { font-size: 11px; color: var(--muted); }

.main { grid-area: main; padding: 20px 24px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: var(--fs-xl); line-height: 1.2; margin: 0; font-weight: 600; text-wrap: balance; }
.page-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; max-width: 80ch; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--r); border: 1px solid; margin-bottom: 14px; font-size: var(--fs-sm); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner.info { background: var(--info-bg); border-color: var(--info-line); color: #1E3A8A; }
.banner.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #7C2D12; }
.banner.bad { background: var(--bad-bg); border-color: var(--bad-line); color: #7F1D1D; }
.banner.good { background: var(--good-bg); border-color: var(--good-line); color: #14532D; }
.banner.demo { background: #FFF8E1; border-color: #F3DE9A; color: #6B4E00; }

/* ---------- grid ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.split-r { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); min-height: 50px; flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.card-h .sub { font-size: var(--fs-xs); color: var(--muted); }
.card-h .tools { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.card-f { padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* KPI tiles */
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .label svg { width: 15px; height: 15px; }
.kpi .value { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.1; font-family: var(--mono); letter-spacing: -.01em; }
.kpi .value small { font-size: 13px; color: var(--muted); font-weight: 500; font-family: var(--font); margin-inline-start: 4px; }
.kpi .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.kpi .foot .chip { white-space: normal; height: auto; padding: 3px 8px; line-height: 1.35; }
.kpi.alert { border-color: var(--warn-line); background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; }
.kpi .bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.kpi .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.delta { font-family: var(--mono); font-size: var(--fs-xs); padding: 1px 6px; border-radius: 999px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--idle); background: var(--idle-bg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 9px; font-size: var(--fs-xs); border-radius: 7px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: var(--fs-md); border-radius: 11px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.btn-group button { border: 0; background: transparent; padding: 0 12px; height: 32px; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-2); }
.btn-group button + button { border-inline-start: 1px solid var(--line); }
.btn-group button.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 500; border: 1px solid; white-space: nowrap; line-height: 1; }
.chip svg { width: 12px; height: 12px; }
.chip.good { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.chip.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.chip.info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.chip.idle { color: var(--idle); background: var(--idle-bg); border-color: var(--idle-line); }
.chip.brand { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-line); }
.chip .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pchip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.pchip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: var(--bad); color: #fff; font-family: var(--mono); }
.badge.brand { background: var(--brand); }
.badge.idle { background: #3A4A46; color: #C9D6D2; }
.tag { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }

/* ---------- avatars ---------- */
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 600; color: #fff; flex: none; background: #5B6B67; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .sb { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.t thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: var(--fs-xs);
  text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.t tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tbody tr:hover td { background: #FAFCFB; }
.t tbody tr.sel td { background: var(--brand-soft); }
.t tbody tr.clickable { cursor: pointer; }
.t td.num, .t th.num { text-align: end; white-space: nowrap; }
.t th.num { font-family: var(--font); }
[dir="rtl"] .var-pos, [dir="rtl"] .var-neg, [dir="rtl"] .var-zero, [dir="rtl"] .tag, [dir="rtl"] span.mono { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.hstack > .prog { flex: 1 1 60px; min-width: 60px; }
.t tfoot td { padding: 10px 12px; background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); }
.t .cell-edit { border: 1px dashed transparent; border-radius: 6px; padding: 2px 6px; min-width: 56px; display: inline-block; text-align: end; }
.t .cell-edit:hover { border-color: var(--brand-line); background: var(--brand-soft); cursor: text; }
.t tr.locked td { color: var(--ink-2); }
.var-pos { color: var(--warn); }
.var-neg { color: var(--bad); }
.var-zero { color: var(--faint); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.input, .select, textarea.input {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  padding: 0 10px; font-size: var(--fs-sm); outline: none; width: 100%;
}
textarea.input { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.sm, .select.sm { height: 30px; font-size: var(--fs-xs); }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.filters .input, .filters .select { width: auto; min-width: 140px; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--line); border: 0; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: inset-inline-start .15s; }
.switch.on { background: var(--brand); }
.switch.on::after { inset-inline-start: 18px; }
.check { width: 16px; height: 16px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.dropzone { border: 1.5px dashed var(--brand-line); background: var(--brand-soft); border-radius: var(--r); padding: 22px; text-align: center; color: var(--brand-ink); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-size: var(--fs-sm); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.tabs.in-card { margin: 0; padding: 0 12px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.li .ic svg { width: 16px; height: 16px; }
.ic.good { background: var(--good-bg); color: var(--good); }
.ic.warn { background: var(--warn-bg); color: var(--warn); }
.ic.bad { background: var(--bad-bg); color: var(--bad); }
.ic.info { background: var(--info-bg); color: var(--info); }
.ic.idle { background: var(--idle-bg); color: var(--idle); }
.ic.brand { background: var(--brand-soft); color: var(--brand-ink); }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 14px; font-size: var(--fs-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; }

/* steps / timeline */
.steps { display: flex; gap: 0; counter-reset: s; }
.steps .st { flex: 1; display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); }
.steps .st::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 600; flex: none; }
.steps .st.done::before { content: "✓"; background: var(--brand); color: #fff; }
.steps .st.on { color: var(--ink); font-weight: 600; }
.steps .st.on::before { background: var(--brand-soft); color: var(--brand-ink); box-shadow: 0 0 0 2px var(--brand); }
.steps .st + .st::after { content: none; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl { display: grid; grid-template-columns: 18px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.tl::before { content: ""; position: absolute; inset-inline-start: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .pt { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--brand-line); background: var(--brand); margin-top: 2px; }

/* progress */
.prog { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.prog > i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--fs-xs); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------- drawer / modal / toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 22, 19, .38); z-index: 80; opacity: 0; transition: opacity .18s; }
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 90;
  width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease;
}
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.show { transform: translateX(0) !important; }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.drawer-b { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal {
  position: fixed; z-index: 95; top: 50%; left: 50%; transform: translate(-50%, -46%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  opacity: 0; transition: opacity .18s, transform .18s;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal .drawer-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal.show { opacity: 1; transform: translate(-50%, -50%); }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.toasts { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { background: #12201C; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-2); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; animation: tin .2s ease; }
.toast svg { width: 16px; height: 16px; color: #7FE0CC; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- empty state ---------- */
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }

/* ---------- charts (SVG helpers) ---------- */
.chart { width: 100%; display: block; }
.chart text { font-family: var(--font); font-size: 10.5px; fill: var(--muted); }
.chart .grid-l { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-l { stroke: var(--line); stroke-width: 1; }

/* ---------- map ---------- */
.map { height: 520px; border-radius: var(--r-lg); overflow: hidden; background: #DCE6E2; position: relative; }
.map.flush { border-radius: 0; }
.marker { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); font-family: var(--mono); }
.marker.sel { box-shadow: 0 0 0 4px rgba(14, 107, 92, .35), 0 2px 6px rgba(0,0,0,.35); }

/* ---------- phone frame (driver app) ---------- */
.phone { width: 360px; height: 740px; border-radius: 44px; background: #0B1412; padding: 12px; box-shadow: var(--shadow-3); flex: none; position: relative; }
.phone .screen { width: 100%; height: 100%; border-radius: 34px; overflow: hidden; background: var(--bg); position: relative; display: flex; flex-direction: column; }
.phone .notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 110px; height: 26px; background: #0B1412; border-radius: 0 0 16px 16px; z-index: 5; }

/* ---------- hub page ---------- */
.hub-hero { background: var(--side-bg); color: #E8F0EE; border-radius: var(--r-lg); padding: 28px; display: grid; gap: 10px; }
.hub-hero h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 600; text-wrap: balance; }
.hub-hero p { margin: 0; color: #A9BAB5; max-width: 72ch; }
.screen-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-decoration: none; color: inherit; }
.screen-card:hover { text-decoration: none; border-color: var(--brand-line); box-shadow: var(--shadow-2); }
.screen-card .t1 { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.screen-card .t1 svg { width: 18px; height: 18px; color: var(--brand); }
.screen-card .t2 { font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Leaflet core (inlined so no external stylesheet is needed) ---------- */
.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}
.leaflet-container{overflow:hidden;direction:ltr;background:#DCE6E2;font-family:var(--font);font-size:12px;outline-offset:1px;-webkit-tap-highlight-color:transparent}
.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}
.leaflet-tile{filter:inherit;visibility:hidden}
.leaflet-tile-loaded{visibility:inherit}
.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}
.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}
.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}
.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}
.leaflet-control{position:relative;z-index:800;pointer-events:auto;float:left;clear:both}
.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}
.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}
.leaflet-right .leaflet-control{float:right}
.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}
.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}
.leaflet-zoom-animated{transform-origin:0 0}
.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}
.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}
.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}
.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-dragging .leaflet-grab{cursor:move}
.leaflet-bar{box-shadow:var(--shadow-2);border-radius:9px;overflow:hidden}
.leaflet-bar a{background:#fff;border-bottom:1px solid var(--line);width:30px;height:30px;line-height:30px;display:block;text-align:center;text-decoration:none;color:var(--ink);font-size:18px}
.leaflet-bar a:last-child{border-bottom:none}
.leaflet-control-attribution{background:rgba(255,255,255,.8);margin:0;padding:0 5px;color:#555;font-size:10px}
.leaflet-control-attribution a{color:#555}
.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}
.leaflet-popup-content-wrapper{padding:1px;text-align:start;border-radius:12px;background:#fff;box-shadow:var(--shadow-2)}
.leaflet-popup-content{margin:12px 14px;line-height:1.4;min-height:1px;font-size:12.5px}
.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}
.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg);background:#fff}
.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}
.leaflet-tooltip{position:absolute;padding:4px 7px;background:#fff;border-radius:6px;color:var(--ink);white-space:nowrap;pointer-events:none;box-shadow:var(--shadow-1);font-size:11px}
.leaflet-div-icon{background:transparent;border:none}
.tiles-muted .leaflet-tile-pane{filter:grayscale(.85) contrast(.92) brightness(1.04);opacity:.75}

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-r { grid-template-columns: minmax(0, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span3 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .2s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0) !important; box-shadow: var(--shadow-3); }
  .topbar .burger { display: grid; }
  .topbar .search, .topbar .clock, .userchip .meta { display: none; }
  .main { padding: 16px 16px 40px; }
}
@media (max-width: 640px) {
  .g2, .g3, .g4, .g6 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head .actions { margin-inline-start: 0; width: 100%; }
  .kpi .value { font-size: 20px; }
  .langbtn b { display: none; }
  .crumbs b { white-space: normal; font-size: 14px; line-height: 1.25; }
  .map { height: 380px; }
  .phone { transform: scale(.9); transform-origin: top center; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- delivery-company additions ---------- */
.nav a .step-n { width: 20px; height: 20px; border-radius: 6px; background: rgba(255,255,255,.08); color: #DCE6E2; font-family: var(--mono); font-size: 11px; font-weight: 600; display: grid; place-items: center; flex: none; }
.nav a.active .step-n { background: var(--brand); color: #fff; }
/* kanban board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-3); border-radius: var(--r-lg); padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 290px); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; font-weight: 600; font-size: var(--fs-sm); position: sticky; top: 0; }
.col-h .count { margin-inline-start: auto; font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); background: var(--surface); padding: 1px 7px; border-radius: 999px; }
.col-b { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.ocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; box-shadow: var(--shadow-1); border-inline-start: 3px solid var(--line); }
.ocard:hover { border-color: var(--brand-line); box-shadow: var(--shadow-2); }
.ocard.late { border-inline-start-color: var(--bad); }
.ocard.soon { border-inline-start-color: var(--warn); }
.ocard .oid { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ocard .oid .sla { margin-inline-start: auto; font-weight: 600; }
.ocard .sla.late { color: var(--bad); }
.ocard .sla.soon { color: var(--warn); }
.ocard .route { font-size: var(--fs-sm); display: grid; grid-template-columns: 14px 1fr; gap: 2px 6px; align-items: center; }
.ocard .route svg { width: 13px; height: 13px; color: var(--faint); }
.ocard .foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ocard .foot .who { margin-inline-start: auto; }
/* status pipeline */
.pipe { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 6px; }
.pipe .p { flex: 1; min-width: 72px; text-align: center; padding: 6px 4px; border-radius: 8px; background: var(--surface-3); font-size: var(--fs-xs); color: var(--muted); position: relative; }
.pipe .p b { display: block; font-family: var(--mono); font-size: var(--fs-md); color: var(--ink); }
.pipe .p.on { background: var(--brand-soft); color: var(--brand-ink); }
.pipe .p.on b { color: var(--brand-ink); }
/* order timeline statuses */
.tl .pt.good { background: var(--good); border-color: var(--good-line); }
.tl .pt.bad { background: var(--bad); border-color: var(--bad-line); }
.tl .pt.warn { background: var(--warn); border-color: var(--warn-line); }
.tl .pt.idle { background: var(--faint); border-color: var(--line); }
/* candidate list */
.cand { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.cand.best { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.cand .rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.cand.best .rank { background: var(--brand); color: #fff; }
.cand .m { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-2); text-align: center; line-height: 1.2; }
.cand .m small { display: block; font-family: var(--font); color: var(--muted); font-size: 10px; }
/* OTP boxes */
.otp { display: flex; gap: 8px; direction: ltr; justify-content: center; }
.otp i { width: 44px; height: 52px; border: 1.5px solid var(--line); border-radius: 10px; display: grid; place-items: center; font: 600 22px var(--mono); background: var(--surface); font-style: normal; }
.otp i.on { border-color: var(--brand); background: var(--brand-soft); }
/* code block */
.code { background: #0F1C1A; color: #D7E4E0; border-radius: var(--r); padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.55; overflow-x: auto; direction: ltr; text-align: left; white-space: pre; }
.code .k { color: #7FE0CC; } .code .s { color: #F6D28A; } .code .n { color: #9FB6FF; } .code .c { color: #7E918C; }
@media (max-width: 900px) { .col { max-height: none; } .board { grid-auto-columns: minmax(230px, 80vw); } }
