/* Wassalha Merchant — redesign prototype
   Layout: prototype bar on top; device frame (auto / laptop / iPad / phone) holding the app,
   which adapts to its own width with container queries; design-notes column beside it. */
:root {
  --bg: #F1F5F3;
  --surface: #FFFFFF;
  --surface-2: #F7FAF9;
  --line: #DCE5E1;
  --line-strong: #C2D0CB;
  --ink: #0F2620;
  --ink-2: #3D534D;
  --muted: #667A74;
  --brand: #0B7F55;
  --brand-hover: #096C48;
  --brand-ink: #FFFFFF;
  --brand-soft: #E2F2EA;
  --navy: #1C4A93;
  --navy-soft: #E7EEFA;
  --ok: #12784D; --ok-soft: #E0F3E9;
  --warn: #8F5B00; --warn-soft: #FCF0D9;
  --crit: #B1351E; --crit-soft: #FBE6E1;
  --info: #1B5DAE; --info-soft: #E4EEFB;
  --neutral: #55655F; --neutral-soft: #EBF0EE;
  --chart-a: #12895C; --chart-b: #C9821B; --grid: #E4ECE8;
  --side-bg: #0E2A23; --side-fg: #BFD6CD; --side-active: #1A4237; --side-ink: #FFFFFF;
  --bar-bg: #0B1A16; --bar-fg: #D7E6E0; --bar-line: #23382F;
  --scrim: rgba(8, 20, 16, .45);
  --shadow: 0 1px 2px rgba(15, 38, 32, .06), 0 10px 30px rgba(15, 38, 32, .08);
  --shadow-lg: 0 20px 60px rgba(8, 20, 16, .22);
  --f-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --bar-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1412; --surface: #111D1A; --surface-2: #152420; --line: #22332E; --line-strong: #31453F;
    --ink: #E3EEEA; --ink-2: #B2C4BE; --muted: #82968F;
    --brand: #2FB37F; --brand-hover: #3CC28C; --brand-ink: #03140D; --brand-soft: #12302A;
    --navy: #86ACEE; --navy-soft: #16253B;
    --ok: #4CC98F; --ok-soft: #102F21; --warn: #E3A447; --warn-soft: #33260F;
    --crit: #F08670; --crit-soft: #3A1C16; --info: #86B3F2; --info-soft: #15253B;
    --neutral: #A3B4AE; --neutral-soft: #1B2A26;
    --chart-a: #24A56F; --chart-b: #C5761C; --grid: #1D2C28;
    --side-bg: #08120F; --side-fg: #9DB5AC; --side-active: #15302A; --side-ink: #FFFFFF;
    --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1412; --surface: #111D1A; --surface-2: #152420; --line: #22332E; --line-strong: #31453F;
  --ink: #E3EEEA; --ink-2: #B2C4BE; --muted: #82968F;
  --brand: #2FB37F; --brand-hover: #3CC28C; --brand-ink: #03140D; --brand-soft: #12302A;
  --navy: #86ACEE; --navy-soft: #16253B;
  --ok: #4CC98F; --ok-soft: #102F21; --warn: #E3A447; --warn-soft: #33260F;
  --crit: #F08670; --crit-soft: #3A1C16; --info: #86B3F2; --info-soft: #15253B;
  --neutral: #A3B4AE; --neutral-soft: #1B2A26;
  --chart-a: #24A56F; --chart-b: #C5761C; --grid: #1D2C28;
  --side-bg: #08120F; --side-fg: #9DB5AC; --side-active: #15302A; --side-ink: #FFFFFF;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bar-bg); color: var(--ink); font: 14px/1.5 var(--f-body); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.num { font-variant-numeric: tabular-nums; }
.bc { font-family: var(--f-mono); font-size: .93em; letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Prototype stage ---------- */
.stage { height: 100%; display: flex; flex-direction: column; }
.pbar { height: var(--bar-h); flex: none; display: flex; align-items: center; gap: 12px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); background: var(--bar-bg); color: var(--bar-fg); border-bottom: 1px solid var(--bar-line); }
.pbar-title { display: flex; align-items: center; gap: 10px; font: 600 14px/1.2 var(--f-display); white-space: nowrap; }
.pbar-title small { display: block; font: 400 11px/1.3 var(--f-body); opacity: .65; }
.pbar-sp { flex: 1; }
.pbar select { background: #12251F; border: 1px solid var(--bar-line); color: var(--bar-fg); border-radius: 8px; height: 34px; padding-inline: 10px; max-width: 220px; }
.pseg { display: flex; background: #12251F; border: 1px solid var(--bar-line); border-radius: 9px; padding: 2px; }
.pseg button { background: none; border: 0; color: var(--bar-fg); height: 28px; min-width: 32px; padding-inline: 8px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; }
.pseg button.on { background: #2A4A40; color: #fff; }
.pbtn { background: #12251F; border: 1px solid var(--bar-line); color: var(--bar-fg); height: 34px; padding-inline: 12px; border-radius: 9px; display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }
.pbtn.on { background: #E9F6EF; color: #0B3B2C; border-color: #E9F6EF; }
@media (max-width: 760px) {
  .pbar-title small, .pbar .dev-switch, .pbar .screens, .pbtn .lbl { display: none; }
}

.stage-body { flex: 1; min-height: 0; display: flex; }
.viewport { flex: 1; min-width: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 20px; background: radial-gradient(circle at 30% 0%, #183A30 0, var(--bar-bg) 60%); }
.device { position: relative; overflow: hidden; background: var(--bg); flex: none; }
.device-auto { width: 100%; height: 100%; }
.stage[data-device="auto"] .viewport { padding: 0; }
.device-laptop { width: min(1366px, 100%); height: min(840px, calc(100vh - var(--bar-h) - 40px)); border: 10px solid #1A1F1D; border-bottom-width: 18px; border-radius: 14px; box-shadow: var(--shadow-lg); }
.device-tablet { width: 820px; max-width: 100%; height: min(1180px, calc(100vh - var(--bar-h) - 40px)); border: 14px solid #1A1F1D; border-radius: 34px; box-shadow: var(--shadow-lg); }
.device-phone { width: 390px; max-width: 100%; height: min(844px, calc(100vh - var(--bar-h) - 40px)); border: 11px solid #1A1F1D; border-radius: 46px; box-shadow: var(--shadow-lg); }
.dev-caption { position: absolute; }

.notes { width: 380px; flex: none; overflow: auto; background: var(--surface); color: var(--ink); border-inline-start: 1px solid var(--line); padding: 20px 22px 40px; }
@media (max-width: 1100px) { .notes { position: fixed; top: var(--bar-h); bottom: 0; inset-inline-end: 0; width: min(420px, 100%); z-index: 50; box-shadow: var(--shadow-lg); } }
.notes h2 { font: 600 18px/1.3 var(--f-display); margin: 6px 0 4px; text-wrap: balance; }
.notes h3 { font: 600 11.5px/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
[dir="rtl"] .notes h3 { letter-spacing: 0; }
.notes ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 7px; color: var(--ink-2); }
.notes .was li::marker { color: var(--crit); }
.notes .now li::marker { color: var(--brand); }
.notes .rec { background: var(--navy-soft); border-radius: var(--r); padding: 12px 14px 12px 32px; }
[dir="rtl"] .notes .rec { padding: 12px 32px 12px 14px; }
.notes .rec li::marker { color: var(--navy); }
.notes-close { float: inline-end; }

/* ---------- App ---------- */
.app { container: app / inline-size; position: relative; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100%; }
.side { background: var(--side-bg); color: var(--side-fg); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; text-decoration: none; color: var(--side-ink); }
.logo-mark { width: 34px; height: 34px; flex: none; }
.logo-word { display: flex; flex-direction: column; line-height: 1.05; }
.logo-word b { font: 600 18px/1.05 var(--f-display); letter-spacing: -.01em; }
.logo-word span { font: 500 12px/1.3 var(--f-display); opacity: .75; }
.side-merchant { margin: 4px 12px 10px; padding: 10px 12px; border-radius: var(--r); background: rgba(255, 255, 255, .05); display: flex; align-items: center; gap: 10px; color: var(--side-ink); }
.side-merchant small { display: block; color: var(--side-fg); font-size: 11.5px; }
.grp-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; padding: 14px 20px 6px; opacity: .6; }
[dir="rtl"] .grp-title { letter-spacing: 0; font-size: 11.5px; }
.nav-item { display: flex; align-items: center; gap: 12px; margin: 1px 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--side-fg); position: relative; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--side-ink); }
.nav-item.on { background: var(--side-active); color: var(--side-ink); }
.nav-item.on .ic { color: #5FD3A2; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-new { font-size: 9.5px; font-weight: 600; letter-spacing: .06em; color: #7FE0B5; border: 1px solid rgba(127, 224, 181, .35); border-radius: 99px; padding: 0 6px; line-height: 16px; }
.side-foot { margin-top: auto; padding: 16px 20px 18px; font-size: 11px; opacity: .55; line-height: 1.5; }

.mainwrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding-inline: 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-logo { display: none; text-decoration: none; color: var(--ink); align-items: center; gap: 8px; }
.gsearch { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.gsearch .ic { position: absolute; inset-inline-start: 12px; color: var(--muted); }
.gsearch input { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding-inline: 38px 44px; }
.gsearch kbd { position: absolute; inset-inline-end: 10px; font: 500 11px var(--f-mono); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }
.top-sp { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; position: relative; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--crit); border: 2px solid var(--surface); }
.lang-btn { font: 600 13px var(--f-display); width: auto; padding-inline: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 600 13px var(--f-display); background: var(--brand-soft); color: var(--brand); flex: none; }
.avatar-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 2px; border-radius: 99px; text-align: start; }
.avatar-btn b { display: block; font-size: 13px; line-height: 1.2; }
.avatar-btn small { color: var(--muted); font-size: 11.5px; }
.main { flex: 1; min-height: 0; overflow: auto; padding: 26px 32px 56px; scroll-behavior: smooth; }
.page { max-width: 1240px; margin-inline: auto; display: grid; gap: 20px; }

.bottom { display: none; }

/* Tablet: icon rail */
@container app (max-width: 1099px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .side .nav-label, .side .grp-title, .side .side-foot, .side .logo-word, .side .side-merchant, .side .nav-new { display: none; }
  .side-logo { justify-content: center; padding: 16px 0 12px; }
  .nav-item { justify-content: center; margin: 2px 12px; padding: 12px 0; }
  .side nav { padding-top: 8px; display: grid; gap: 2px; }
  .avatar-btn .who { display: none; }
  .main { padding: 22px 22px 48px; }
  .top { padding-inline: 18px; }
}
/* Phone: bottom navigation */
@container app (max-width: 699px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .side { display: none; }
  .top { height: 56px; padding-inline: 14px; gap: 6px; }
  .top-logo { display: flex; }
  .top-logo .logo-word b { font-size: 16px; }
  .top-logo .logo-word span { display: none; }
  .gsearch, .hide-narrow { display: none !important; }
  .icon-btn { width: 38px; height: 38px; }
  .main { padding: 16px 16px 32px; }
  .page { gap: 16px; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bottom a, .bottom button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 0; }
  .bottom .on { color: var(--brand); }
  .bottom .fab span:first-child { width: 48px; height: 48px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 6px 18px rgba(11, 127, 85, .35); }
}
.only-narrow { display: none !important; }
@container app (max-width: 699px) { .only-narrow { display: inline-flex !important; } .hide-n { display: none !important; } }
@container app (max-width: 1099px) { .hide-mid { display: none !important; } }

/* ---------- Page header ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ph-text { min-width: 0; }
.ph h1 { font: 600 26px/1.2 var(--f-display); margin: 6px 0 4px; letter-spacing: -.01em; text-wrap: balance; }
.ph p { margin: 0; color: var(--muted); max-width: 62ch; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@container app (max-width: 699px) { .ph h1 { font-size: 22px; } .ph-actions { width: 100%; } .ph-actions .btn { flex: 1; justify-content: center; } }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; border-radius: 99px; padding: 2px 9px; }
.tag-new { background: var(--navy-soft); color: var(--navy); }
.tag-re { background: var(--brand-soft); color: var(--brand); }

/* ---------- Controls ---------- */
.btn { height: 40px; padding-inline: 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-danger { color: var(--crit); }
.btn-sm { height: 32px; padding-inline: 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { color: var(--brand); background: none; border: 0; padding: 0; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { height: 32px; padding-inline: 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip[disabled] { opacity: .45; cursor: not-allowed; }

.seg { display: inline-flex; background: var(--neutral-soft); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; height: 34px; padding-inline: 14px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 500; }

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.req::after { content: " *"; color: var(--crit); }
.input, .select, .textarea { width: 100%; height: 42px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding-inline: 12px; min-width: 0; }
.textarea { height: auto; min-height: 84px; padding-block: 10px; resize: vertical; }
.select { appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23778a84' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
[dir="rtl"] .select { background-position: left 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.field.bad .input, .field.bad .select, .field.bad .textarea { border-color: var(--crit); }
.hint { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.err { font-size: 12px; color: var(--crit); display: flex; gap: 6px; align-items: center; }
.affix { position: relative; display: flex; }
.affix .pre { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; display: flex; align-items: center; padding-inline: 12px; color: var(--muted); border-inline-end: 1px solid var(--line); font-size: 13px; }
.affix .input { padding-inline-start: 64px; }
.affix .suf { position: absolute; inset-inline-end: 12px; top: 0; bottom: 0; display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
@container app (max-width: 699px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; } }
@container app (min-width: 700px) and (max-width: 1099px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.switch { position: relative; width: 40px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-title { font: 600 16px/1.3 var(--f-display); margin: 0; }
.card-h p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
@container app (max-width: 699px) { .card-pad { padding: 16px; } .card-h { padding: 14px 16px; } }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 3px 10px 3px 8px; border-radius: 99px; white-space: nowrap; }
[dir="rtl"] .pill { padding: 3px 8px 3px 10px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--neutral-soft); color: var(--neutral); }
.svc { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.svc.x { color: var(--navy); border-color: color-mix(in srgb, var(--navy) 35%, transparent); }
.svc.express { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.svc.ems { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.svc.intl { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@container app (max-width: 1099px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.kpi .k-l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .k-v { font: 600 26px/1.15 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .k-d { font-size: 12px; color: var(--muted); }
.kpi .k-d b { color: var(--ok); font-weight: 600; }
@container app (max-width: 699px) { .kpi { padding: 14px; } .kpi .k-v { font-size: 21px; } }

/* Action cards */
.actions-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@container app (max-width: 1099px) { .actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container app (max-width: 699px) { .actions-grid { grid-template-columns: minmax(0, 1fr); } }
.acard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); align-content: start; }
.acard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.acard .a-ic { grid-row: span 3; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.acard.crit .a-ic { background: var(--crit-soft); color: var(--crit); }
.acard.warn .a-ic { background: var(--warn-soft); color: var(--warn); }
.acard.info .a-ic { background: var(--info-soft); color: var(--info); }
.acard.ok .a-ic { background: var(--ok-soft); color: var(--ok); }
.acard b { font: 600 15px/1.35 var(--f-display); }
.acard span { color: var(--muted); font-size: 13px; }
.acard .a-go { color: var(--brand); font-weight: 500; font-size: 13px; display: inline-flex; gap: 4px; align-items: center; margin-top: 6px; }

/* Lists (table on wide, cards on phone) */
.list { --cols: 1fr; }
.lhead, .lrow { display: grid; grid-template-columns: var(--cols); gap: 14px; align-items: center; padding: 12px 20px; }
.lhead { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; padding-block: 10px; }
[dir="rtl"] .lhead { letter-spacing: 0; font-size: 12.5px; }
.lrow { border-bottom: 1px solid var(--line); cursor: pointer; }
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: var(--surface-2); }
.lrow.sel { background: var(--brand-soft); }
.lrow.static { cursor: default; }
.cell { min-width: 0; }
.cell b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell small { color: var(--muted); display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .lab { display: none; }
.end { text-align: end; justify-self: end; }
@container app (max-width: 699px) {
  .lhead { display: none; }
  .lrow { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 16px; }
  .lrow .c-full { grid-column: 1 / -1; }
  .lrow .c-hide { display: none; }
  .lrow .end { justify-self: end; }
  .cell .lab { display: inline; color: var(--muted); font-size: 12px; margin-inline-end: 4px; }
}
.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty .e-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--neutral-soft); display: flex; align-items: center; justify-content: center; color: var(--neutral); }
.empty b { color: var(--ink); font: 600 15px var(--f-display); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 12px 14px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tab.on { color: var(--ink); border-bottom-color: var(--brand); }
.tab .count { font-size: 11.5px; font-weight: 600; background: var(--neutral-soft); color: var(--neutral); border-radius: 99px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.tab.on .count { background: var(--brand-soft); color: var(--brand); }
.tab.alert .count { background: var(--crit-soft); color: var(--crit); }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.search .ic { position: absolute; inset-inline-start: 11px; top: 11px; color: var(--muted); }
.search .input { padding-inline-start: 36px; height: 40px; }
@container app (max-width: 699px) { .toolbar { padding: 12px 16px; } .search { max-width: none; min-width: 100%; } }

.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--ink); color: var(--surface); flex-wrap: wrap; }
.bulkbar .btn { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 30%, transparent); }
.bulkbar .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* Overlays */
.scrim { position: absolute; inset: 0; background: var(--scrim); z-index: 30; animation: fade .15s ease; }
.drawer { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100%); background: var(--surface); z-index: 31; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .2s ease; }
[dir="rtl"] .drawer { animation-name: slide-rtl; }
.drawer-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { font: 600 18px/1.3 var(--f-display); margin: 0; }
.drawer-b { flex: 1; overflow: auto; padding: 20px; display: grid; gap: 20px; align-content: start; }
.drawer-f { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; justify-content: flex-end; }
.modal-wrap { position: absolute; inset: 0; z-index: 31; display: flex; align-items: center; justify-content: center; padding: 20px; pointer-events: none; }
.modal { pointer-events: auto; background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { width: min(760px, 100%); }
@container app (max-width: 699px) {
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92%; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes slide-rtl { from { transform: translateX(-30px); opacity: 0; } }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.sec-title { font: 600 12px/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; }
[dir="rtl"] .sec-title { letter-spacing: 0; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.toasts { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-size: 13.5px; animation: pop .2s ease; }
.toast .ic { color: #5FD3A2; }
.device-phone .toasts, .toasts.up { bottom: 86px; }

.popover { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; }
.popover a, .popover button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; background: none; border: 0; text-decoration: none; text-align: start; }
.popover a:hover, .popover button:hover { background: var(--surface-2); }

/* Notifications panel */
.notif-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.notif-item .a-ic { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.notif-item.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-inline-start: 8px; vertical-align: middle; }

/* Timeline */
.tl { list-style: none; margin: 0; padding: 0; display: grid; }
.tl li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 18px; }
.tl li::before { content: ""; position: absolute; inset-inline-start: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl .dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 2px solid var(--line-strong); }
.tl .done .dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tl .done::before { background: var(--brand); }
.tl .issue .dot { background: var(--crit); border-color: var(--crit); color: #fff; }
.tl .current .dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.tl .pending { color: var(--muted); }
.tl b { font-weight: 500; display: block; }
.tl small { color: var(--muted); font-size: 12.5px; }

/* Stepper */
.stepper { display: flex; gap: 0; counter-reset: s; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: start; color: var(--muted); min-width: 0; }
.step .n { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font: 600 13px var(--f-display); flex: none; background: var(--surface); }
.step .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step::after { content: ""; flex: 1; height: 2px; background: var(--line); margin-inline: 8px; min-width: 12px; }
.step:last-child { flex: none; }
.step:last-child::after { display: none; }
.step.on { color: var(--ink); }
.step.on .n { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step.done .n { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.step.done::after { background: var(--brand); }
@container app (max-width: 699px) { .step .t { display: none; } .step.on .t { display: inline; } }

/* Option cards */
.opt-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container app (max-width: 699px) { .opt-cards { grid-template-columns: minmax(0, 1fr); } }
.opt { text-align: start; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 6px; position: relative; }
.opt.on { border-color: var(--brand); background: var(--brand-soft); }
.opt.on::after { content: ""; position: absolute; top: 14px; inset-inline-end: 14px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center/14px no-repeat; }
.opt b { font: 600 16px/1.3 var(--f-display); }
.opt span { color: var(--muted); font-size: 13px; }
.opt .facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.opt .facts i { font-style: normal; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; color: var(--ink-2); }
.svc-cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.opt > .svc { justify-self: start; }
.opt .from { margin-top: 2px; font-size: 12.5px; }
.opt .from b { font: 600 13px var(--f-body, inherit); color: var(--ink); }
.addons { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.addon { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.addon.on { border-color: var(--brand); background: var(--brand-soft); }
.addon > span { display: grid; gap: 2px; flex: 1; min-width: 160px; }
.addon small { color: var(--muted); font-size: 12.5px; }
.addon input { margin-top: 3px; accent-color: var(--brand); }
.quote { display: grid; gap: 10px; }
.quote-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.quote-total b { font: 700 20px var(--f-display); color: var(--ink); }
/* Bulk upload */
.cols-help summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brand); }
.cols-help .kv { margin-top: 10px; }
.svc-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.svc-pick { display: grid; gap: 6px; justify-items: start; text-align: start; padding: 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--muted); font-size: 12.5px; }
.svc-pick.on { border-color: var(--brand); background: var(--brand-soft); }
.tpl-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 16px; }
.tpl-col { display: grid; gap: 1px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.req-dot { color: var(--crit); }
/* Failed deliveries & returns */
.dec-cards { display: grid; gap: 12px; }
.dec { padding: 16px; display: grid; gap: 10px; border-color: color-mix(in srgb, var(--crit) 30%, var(--line)); }
.dec.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.dec .end { text-align: end; }
.dec-reason { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.rider-note { margin: 0; display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-inline-start: 3px solid var(--line-strong); background: var(--bg); border-radius: 6px; font-size: 13px; color: var(--ink-2); }
.rider-note .ic { flex: none; margin-top: 2px; color: var(--muted); }
.dec-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.dec .hint { justify-content: flex-start; align-items: center; gap: 6px; }
.dec-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@container app (max-width: 520px) { .dec-opts { grid-template-columns: minmax(0, 1fr); } }
.dec-opt { display: flex; gap: 10px; align-items: flex-start; text-align: start; padding: 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.dec-opt .ic { flex: none; color: var(--muted); margin-top: 1px; }
.dec-opt span { display: grid; gap: 2px; }
.dec-opt small { color: var(--muted); font-size: 12.5px; }
.dec-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.dec-opt.on .ic { color: var(--brand); }
.bar-row { display: grid; gap: 6px; }
.bar { height: 8px; border-radius: 4px; background: var(--neutral-soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--crit); border-radius: 4px; }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--ink-2); font-size: 13px; }
.note .ic { color: var(--info); margin-top: 1px; }
.note.warn { background: var(--warn-soft); } .note.warn .ic { color: var(--warn); }
.note.crit { background: var(--crit-soft); } .note.crit .ic { color: var(--crit); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@container app (max-width: 1099px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 0; }

/* Chart */
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; height: 230px; }
.chart-y { display: flex; flex-direction: column-reverse; justify-content: space-between; font-size: 11.5px; color: var(--muted); text-align: end; padding-bottom: 22px; font-variant-numeric: tabular-nums; }
.chart-y span { line-height: 0; }
.chart-plot { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) 22px; }
.chart-grid { position: absolute; inset: 0 0 22px 0; display: flex; flex-direction: column-reverse; justify-content: space-between; pointer-events: none; }
.chart-grid i { height: 1px; background: var(--grid); }
.chart-grid i:first-child { background: var(--line-strong); }
.chart-bars { position: relative; display: flex; align-items: flex-end; gap: 6px; padding-inline: 4px; }
.cbar { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; position: relative; outline: none; justify-content: flex-start; }
.cbar .seg-a { background: var(--chart-a); border-radius: 0; }
.cbar .seg-b { background: var(--chart-b); border-radius: 4px 4px 0 0; }
.cbar:hover .seg-a, .cbar:focus .seg-a, .cbar:hover .seg-b, .cbar:focus .seg-b { filter: brightness(1.12); }
.cbar i { display: block; flex: none; }
.cbar .tip { display: none; position: absolute; top: 0; inset-inline-start: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: nowrap; z-index: 2; pointer-events: none; box-shadow: var(--shadow); }
.chart { direction: ltr; }
[dir="rtl"] .cbar .tip { direction: rtl; }
.cbar:hover .tip, .cbar:focus .tip { display: block; }
.cbar:first-child .tip, .cbar:nth-child(2) .tip { inset-inline-start: 0; transform: none; }
.cbar:last-child .tip, .cbar:nth-last-child(2) .tip { inset-inline-start: auto; inset-inline-end: 0; transform: none; }
.chart-x { display: flex; gap: 6px; padding-inline: 4px; font-size: 11px; color: var(--muted); align-items: end; }
.chart-x span { flex: 1; text-align: center; white-space: nowrap; }
@container app (max-width: 699px) { .chart-x span:nth-child(even) { visibility: hidden; } .chart-bars, .chart-x { gap: 3px; } }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 99px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.mini-table td.n, .mini-table th.n { text-align: end; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

/* Shipping label */
.label-sheet { background: #fff; color: #111; border: 1px solid #ccc; border-radius: 6px; width: 100%; max-width: 380px; margin-inline: auto; font-size: 12px; direction: ltr; }
.label-sheet .lh { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 2px solid #111; }
.label-sheet .lh b { font: 700 15px var(--f-display); }
.label-sheet .svc-big { font: 700 12px var(--f-display); border: 2px solid #111; padding: 2px 6px; }
.label-sheet .bars { display: flex; height: 64px; gap: 0; padding: 10px 16px 4px; align-items: stretch; justify-content: center; }
.label-sheet .bars i { background: #111; display: block; }
.label-sheet .bcode { text-align: center; font: 600 14px var(--f-mono); letter-spacing: .12em; padding-bottom: 8px; border-bottom: 1px solid #111; }
.label-sheet .lsec { padding: 8px 12px; border-bottom: 1px solid #111; display: grid; gap: 2px; }
.label-sheet .lsec small { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: #555; }
.label-sheet .lrow2 { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.label-sheet .lrow2 > div { padding: 8px 12px; border-inline-end: 1px solid #111; }
.label-sheet .lrow2 > div:last-child { border: 0; }
.label-sheet .ar { direction: rtl; font-family: var(--f-body); }

/* Drop zone */
.drop { border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: 34px 20px; display: grid; justify-items: center; gap: 8px; text-align: center; background: var(--surface-2); cursor: pointer; }
.drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop .e-ic { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.file-pill { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }

/* Pickup cards */
.pk-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@container app (max-width: 899px) { .pk-cards { grid-template-columns: minmax(0, 1fr); } }
.pk { padding: 18px; display: grid; gap: 14px; }
.pk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pk-when { font: 600 18px/1.25 var(--f-display); }
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.progress i { height: 5px; border-radius: 99px; background: var(--line); }
.progress i.on { background: var(--brand); }
.progress-l { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 11.5px; color: var(--muted); }
.progress-l .on { color: var(--ink); font-weight: 500; }
.rider { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r); }
.slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.day-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@container app (max-width: 699px) { .day-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .slot-grid { grid-template-columns: minmax(0, 1fr); } }
.daybtn { border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 8px 4px; display: grid; justify-items: center; gap: 0; font-size: 12px; color: var(--muted); }
.daybtn b { font: 600 18px/1.2 var(--f-display); color: var(--ink); }
.daybtn.on, .slotbtn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.slotbtn { border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 10px; font-weight: 500; }
.pick-list { border: 1px solid var(--line); border-radius: var(--r); max-height: 220px; overflow: auto; }
.pick-list label { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.pick-list label:last-child { border: 0; }

/* Support split */
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 560px; }
.split-list { border-inline-end: 1px solid var(--line); min-width: 0; }
@container app (max-width: 1099px) { .split { grid-template-columns: 300px minmax(0, 1fr); } }
@container app (max-width: 699px) { .split { grid-template-columns: minmax(0, 1fr); } .split.detail .split-list { display: none; } .split:not(.detail) .split-detail { display: none; } }
.tk { padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; gap: 4px; }
.tk:hover { background: var(--surface-2); }
.tk.on { background: var(--brand-soft); }
.tk-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.tk b { font-weight: 600; }
.thread { display: grid; gap: 12px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.msg.me { justify-self: end; background: var(--brand-soft); border-color: transparent; }
.msg small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.status-track { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.status-track span { padding: 3px 10px; border-radius: 99px; background: var(--neutral-soft); color: var(--muted); }
.status-track span.on { background: var(--brand); color: var(--brand-ink); }
.status-track span.done { background: var(--brand-soft); color: var(--brand); }

/* Location cards */
.loc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@container app (max-width: 899px) { .loc-cards { grid-template-columns: minmax(0, 1fr); } }
.map { height: 130px; border-radius: var(--r-lg) var(--r-lg) 0 0; position: relative; overflow: hidden; background-color: var(--surface-2); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px), linear-gradient(35deg, transparent 46%, var(--line-strong) 46%, var(--line-strong) 49%, transparent 49%); background-size: 26px 26px, 26px 26px, 100% 100%; }
.map .pin { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); color: var(--brand); }
.map .pin .ic { width: 34px; height: 34px; fill: var(--brand-soft); }

/* Notification matrix */
/* COD money flow */
.mflow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@container app (max-width: 699px) { .mflow { grid-template-columns: minmax(0, 1fr); } }
.mstage { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); position: relative; }
.mstage > div { display: grid; gap: 2px; min-width: 0; }
.mstage b { font: 600 22px/1.2 var(--f-display); }
.mstage .k-l, .mstage .k-d { font-size: 12.5px; color: var(--muted); }
.mstage-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--f-display); }
.mstage.info .mstage-n { background: var(--info-soft); color: var(--info); }
.mstage.warn .mstage-n { background: var(--warn-soft); color: var(--warn); }
.mstage.ok .mstage-n { background: var(--ok-soft); color: var(--ok); }
.mstage.ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.st-detail { padding: 14px 20px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.st-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@container app (max-width: 699px) { .st-grid { grid-template-columns: minmax(0, 1fr); } }
.st-brk dd { text-align: end; }
/* Settings */
.ro-val { min-height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 2px; font-weight: 500; overflow-wrap: anywhere; }
.contact { background: var(--surface-2); }
.price-table td, .price-table th { white-space: nowrap; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: start; }
.matrix th:not(:first-child), .matrix td:not(:first-child) { text-align: center; width: 90px; }
.matrix th { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Auth */
.auth { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); height: 100%; }
.auth-brand { background: linear-gradient(160deg, #0E3A2E 0%, #0B2A40 100%); color: #E8F3EE; padding: 40px; display: flex; flex-direction: column; gap: 28px; overflow: hidden; position: relative; }
.auth-brand h2 { font: 600 34px/1.15 var(--f-display); margin: 0; letter-spacing: -.015em; max-width: 14ch; text-wrap: balance; }
.auth-brand p { margin: 0; color: #B6CFC5; max-width: 40ch; }
.auth-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-brand li { display: flex; gap: 10px; align-items: center; }
.auth-brand li .ic { color: #5FD3A2; }
.auth-brand .stamp { margin-top: auto; font-size: 12px; color: #8FB0A4; }
.auth-brand .route-art { position: absolute; inset-inline-end: -60px; bottom: 60px; width: 320px; opacity: .25; }
.auth-form { overflow: auto; display: flex; flex-direction: column; padding: 28px 40px; background: var(--surface); }
.auth-form .inner { width: min(420px, 100%); margin: auto; display: grid; gap: 18px; padding-block: 24px; }
.auth-form h1 { font: 600 28px/1.2 var(--f-display); margin: 0; }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
@container app (max-width: 899px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .auth-brand { padding: 22px 20px; gap: 10px; }
  .auth-brand h2 { font-size: 22px; max-width: none; }
  .auth-brand ul, .auth-brand .stamp, .auth-brand .route-art, .auth-brand p { display: none; }
  .auth-form { padding: 16px 20px; }
}
.pw-rules { display: grid; gap: 4px; font-size: 12.5px; }
.pw-rules span { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.pw-rules span.ok { color: var(--ok); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.divider { height: 1px; background: var(--line); }

/* Page-specific layouts */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@container app (max-width: 1099px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.list-ship { --cols: 22px minmax(140px, 1.2fr) minmax(140px, 1.2fr) minmax(110px, 1fr) 100px 100px minmax(150px, 1.3fr) 96px; }
@container app (max-width: 1099px) {
  .list-ship { --cols: 22px minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(0, 1fr) 90px minmax(170px, 1.3fr); }
  .list-ship .c-svc, .list-ship .c-upd { display: none; }
}
@container app (max-width: 699px) {
  .list-ship .lrow { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 6px 10px; }
  .list-ship .c-check { grid-column: 1; grid-row: 1; }
  .list-ship .c-ship { grid-column: 2; grid-row: 1; }
  .list-ship .c-status { grid-column: 3; grid-row: 1 / span 2; justify-self: end; text-align: end; max-width: 170px; }
  .list-ship .c-cons { grid-column: 2; grid-row: 2; }
  .list-ship .c-dest { grid-column: 2; grid-row: 3; }
  .list-ship .c-cod { grid-column: 3; grid-row: 3; align-self: end; }
  .list-ship .c-dest b { display: inline; font-weight: 400; }
  .list-ship .c-dest small { display: inline; margin-inline-start: 4px; }
  .kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.c-status small { margin-top: 4px; }
@container app (min-width: 700px) and (max-width: 1099px) { .lhead, .lrow { grid-template-columns: var(--cols-mid, var(--cols)); } }
@container app (max-width: 1099px) { .c-mid { display: none !important; } }
/* Pickups (UX-only redesign of the live list) */
.pk-toolbar { flex-wrap: wrap; }
.pk-more .field { min-width: 200px; }
.pk-row .cell .link.bc { padding: 0; font-weight: 600; }
.pk-row .cell .svc { margin-top: 4px; align-self: flex-start; }
.pk-acts { gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.pk-acts .icon-btn { width: 32px; height: 32px; }
.sort-h { padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; justify-content: flex-start; }
.list-foot { padding: 10px 16px; font-size: 12.5px; border-top: 1px solid var(--line); }

/* Cards / Table slider and card view (Shipments, Pickups) */
.vt { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 10px; background: var(--neutral-soft); flex: 0 0 auto; }
.vt-thumb { position: absolute; top: 3px; bottom: 3px; inset-inline-start: 3px; width: calc(50% - 3px); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); transition: transform .2s ease; }
.vt.is-table .vt-thumb { transform: translateX(100%); }
[dir="rtl"] .vt.is-table .vt-thumb { transform: translateX(-100%); }
.vt button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding-inline: 12px; border: 0; background: none; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.vt button[aria-checked="true"] { color: var(--ink); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .vt-thumb { transition: none; } }
.vcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; padding: 12px 20px 20px; }
.vcards > .empty, .vc-selall, .vc-sort { grid-column: 1 / -1; }
.vc-selall { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.vc-sort { justify-self: start; font-size: 13px; }
.vcard { display: grid; gap: 8px; align-content: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; min-width: 0; }
.vcard:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.vcard.sel { border-color: var(--brand); background: var(--brand-soft); }
.vcard.static { cursor: default; }
.vc-top, .vc-line, .vc-foot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vc-line { color: var(--ink-2); font-size: 13px; }
.vc-line > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-gap { flex: 1; }
.vc-main { display: grid; }
.vc-main small { color: var(--ink-2); text-align: start; }
.vc-warn { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); padding: 4px 10px; border-radius: 8px; justify-self: start; }
.vc-box { display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--r); background: var(--surface-2); }
.vc-foot { padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.vcard .lab { color: var(--ink-2); font-size: 12px; }

/* Bulk upload loader */
.bk-busy { display: grid; gap: 14px; }
.bk-title { font: 600 17px/1.3 var(--f-display, inherit); }
.bk-pct { font-size: 20px; color: var(--brand); }
.bk-spin { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: bk-spin .8s linear infinite; }
@keyframes bk-spin { to { transform: rotate(360deg); } }
.bk-bar { height: 10px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.bk-bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .15s linear; }
.bk-steps { display: flex; gap: 8px 22px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 13px; }
.bk-steps li { display: inline-flex; align-items: center; gap: 8px; }
.bk-steps .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; }
.bk-steps .on { color: var(--ink); font-weight: 600; }
.bk-steps .on .dot { border-color: var(--brand); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 10px var(--brand); }
.bk-steps .done .dot { border-color: var(--brand); background: var(--brand); color: #fff; }
@media (prefers-reduced-motion: reduce) { .bk-spin { animation-duration: 2.4s; } .bk-bar span { transition: none; } }

/* Returns table (same columns as the portal's merchant Returns page) */
.ret-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ret-table th { text-align: start; padding: 10px 16px; color: var(--ink-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ret-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ret-table tr:last-child td { border-bottom: 0; }
.ret-table td small { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.ret-table .n { text-align: end; }
.ret-status { display: inline-flex; padding: 3px 10px; border-radius: 99px; color: #fff; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.ret-empty { text-align: center; color: var(--ink-2); padding: 36px 16px !important; }

/* COD: two stages that also pick the table */
.cod-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container app (max-width: 699px) { .cod-flow { grid-template-columns: minmax(0, 1fr); } }
.cod-stage { width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.cod-stage:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.cod-stage.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.ret-table tfoot td { padding: 12px 16px; border-top: 1px solid var(--line-strong); background: var(--surface-2); }

/* Pickup locations import */
.locimp-row { grid-template-columns: 64px minmax(0, 1fr) auto; }
.locimp-row small { display: block; }

/* Returns and COD tables become stacked rows on iPad and phone instead of scrolling sideways */
@container app (max-width: 899px) {
  .ret-table thead { display: none; }
  .ret-table, .ret-table tbody, .ret-table tfoot { display: block; }
  .ret-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .ret-table tbody tr:last-child { border-bottom: 0; }
  .ret-table td, .ret-table tfoot td { display: block; padding: 0 !important; border: 0 !important; background: none; text-align: start !important; min-width: 0; }
  .ret-table td[data-label]::before { content: attr(data-label); display: block; color: var(--ink-2); font-size: 11.5px; margin-bottom: 1px; }
  .ret-table .t-id { grid-column: 1; grid-row: 1; }
  .ret-table .t-st { grid-column: 2; grid-row: 1; justify-self: end; }
  .ret-table .t-wide, .ret-table .ret-empty { grid-column: 1 / -1; }
  .ret-table .t-none { display: none; }
  .ret-table tfoot tr { background: var(--surface-2); border-top: 1px solid var(--line-strong); }
}
/* Long system statuses wrap under the barcode on narrow cards */
.vc-top { flex-wrap: wrap; row-gap: 6px; }
/* Mobile numbers stay left-to-right but line up with the Arabic text */
[dir="rtl"] .ret-table small.ltr, [dir="rtl"] .vc-main small.ltr { text-align: right; }
/* Pickups table: rider and location names wrap instead of being cut */
.pk-row .cell b, .pk-row .cell small { white-space: normal; }
.pk-row .pk-acts { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.pk-row > .cell.end:last-child { justify-self: stretch; display: flex; justify-content: flex-end; }
