:root {
  --ink: #182430;
  --ink-soft: #5b6b78;
  --ink-faint: #8b98a3;
  --bg: #eef1f4;
  --surface: #ffffff;
  --line: #dce2e7;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --success: #1e8e5a;
  --success-bg: #e4f5ec;
  --warning: #b8790e;
  --warning-bg: #fdf0dd;
  --danger: #c6403a;
  --danger-bg: #fbe9e8;
  --accent-bg: #eef2ff;
  --accent-bg-hover: #e3ecff;
  --accent-line: #d6e0fb;
  --ink-inverse-bg: #182430;
  --ink-inverse-text: #ffffff;
  --radius: 10px;
  /* Was reusing --bg (#eef1f4 vs --surface #ffffff) — too close to tell the
     alternating cart rows apart at a glance (confirmed 2026-09-12). */
  --cart-line-alt-bg: #dde3e9;
}

/* Manual toggle (header button, persisted in localStorage as cc_theme) —
   not tied to the OS theme, since this is an internal work tool agents
   switch explicitly, not a page that should silently follow the system. */
html[data-theme="dark"] {
  --ink: #e8ecf0;
  --ink-soft: #a3aeb8;
  --ink-faint: #707b85;
  --bg: #10161d;
  --surface: #1a222b;
  --line: #2b3641;
  --accent: #5b93f5;
  --accent-ink: #0b1420;
  --success: #4fbf88;
  --success-bg: #133228;
  --warning: #e0ab5c;
  --warning-bg: #3a2c15;
  --danger: #e2726a;
  --danger-bg: #3a1f1e;
  --accent-bg: #1b2740;
  --accent-bg-hover: #23304d;
  --accent-line: #33456e;
  --ink-inverse-bg: #050708;
  --ink-inverse-text: #f2f4f6;
  /* --bg/--surface already contrast well here (#10161d vs #1a222b) — no
     separate value needed in this theme. */
  --cart-line-alt-bg: var(--bg);
}
html[data-theme="dark"] .item-thumb-placeholder,
html[data-theme="dark"] .menu-empty-state span { filter: brightness(0.85); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: 15px;
}

.mono, #t-subtotal, #t-delivery, #t-tax, #t-grand, .money {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
}
.btn:hover { background: #f5f7f9; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-line); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  min-height: 44px;
}
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Login ---------- */
.login-screen {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px;
  width: min(360px, 90vw);
  box-shadow: 0 10px 40px -12px rgba(20, 30, 45, .18);
}
.login-card h1 { margin: 0 0 4px; font-size: 1.4rem; }
.login-sub { color: var(--ink-soft); margin: 0 0 20px; font-size: 13px; }
.login-card label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ---------- App shell ---------- */
#app-shell { height: 100%; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
}
/* Minimal topbar (order screen only) — just 4 buttons, no brand/tabs/agent
   info, so it can sit at a fraction of the old bar's height and give the
   order screen back the vertical space that used to go to the nav row. */
.topbar-minimal { padding: 6px 16px; gap: 10px; }
.topbar-minimal .btn, .topbar-minimal .tab-btn { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.topbar-minimal #logout-btn { margin-inline-start: auto; }
.topbar-brand { font-weight: 700; font-size: 1.05rem; flex: none; white-space: nowrap; }
/* Tabs scroll horizontally instead of wrapping/squeezing their own text onto
   two lines once the window gets narrower than they need — a real, visible
   bug at 1024px confirmed 2026-09-10 (every label was breaking mid-word). */
.topbar-tabs { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 40px;
  white-space: nowrap;
  flex: none;
}
.tab-btn.active { background: var(--bg); color: var(--accent); }
.topbar-agent { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); flex: none; white-space: nowrap; }
#command-palette-btn { white-space: nowrap; }

@media (max-width: 1150px) {
  .topbar { gap: 10px; padding: 8px 14px; }
  .tab-btn { padding: 8px 10px; font-size: 13px; }
  .kbd-hint { display: none; }
}
@media (max-width: 980px) {
  #command-palette-btn .cp-btn-label { display: none; }
  #agent-name { display: none; }
}
.role-badge {
  background: var(--bg); border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600;
}

/* The item grid is the main work area — every other section is deliberately
   compact (flex:none) so it never competes with it for height. */
.view { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.view > * { flex: none; }
.view > .order-screen-v2 { flex: 1 1 auto; min-height: 0; }

/* ---------- Home screen (landing view after login) ---------- */
.home-view { align-items: center; justify-content: center; }
.home-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 32px; width: 100%; max-width: 380px; text-align: center;
  display: flex; flex-direction: column; gap: 14px;
}
.home-card h2 { margin: 0; font-size: 1.15rem; }
#home-agent-role { margin-top: -10px; }
.home-nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.home-nav-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 8px; font-weight: 600; color: var(--ink); min-height: 44px; white-space: normal; }
.home-nav-btn:hover { background: var(--accent-bg); }
.home-footer-row { display: flex; justify-content: center; gap: 8px; margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 12px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.panel h3 { margin: 0 0 8px; font-size: .95rem; }

.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }

/* ---------- Customer search ---------- */
/* min-width was 220px, tuned back when this bar spanned a full-width row —
   it now lives in a ~300px rail column, where 220px plus two buttons cannot
   share one line and were wrapping into an unnecessarily tall two-row block
   (confirmed live 2026-09-10: 120px tall for what should be ~44px). */
.customer-search-bar { display: flex; gap: 6px; align-items: center; position: relative; flex-wrap: wrap; }
.customer-search-bar input { flex: 1 1 100px; min-width: 90px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); min-height: 34px; font-size: 13px; }
.customer-search-bar .btn { padding: 7px 12px; font-size: 12.5px; min-height: 34px; }
.search-results {
  position: absolute; top: 100%; right: 0; left: 0; margin-top: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px -8px rgba(20,30,45,.2); z-index: 20; max-height: 280px; overflow-y: auto;
}
.search-result-row { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover { background: var(--bg); cursor: pointer; }

.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.field-row input, .field-row select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; flex: 1; min-width: 140px; min-height: 40px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }

.status-badge { font-size: 11px; padding: 2px 10px; border-radius: 999px; background: var(--success-bg); color: var(--success); font-weight: 700; }
.status-badge.Vip { background: var(--warning-bg); color: var(--warning); }

.important-notes { display: inline-flex; }
.important-notes-badge {
  background: var(--warning-bg); color: var(--warning); border: none; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.important-notes-badge:hover { filter: brightness(0.95); }

.customer-notes-banner { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; margin: 0 0 6px; }
.customer-notes-banner-item {
  background: var(--warning-bg); color: var(--warning); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-weight: 600;
}

.cust-details-open-btn { flex: none; }

.cdm-tabs { display: flex; gap: 6px; margin-top: 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.cdm-tab-btn {
  border: none; background: none; padding: 8px 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid transparent; white-space: nowrap; margin-inline-end: 14px;
}
.cdm-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.customer-collapsibles { margin-top: 10px; font-size: 13px; }
.cdm-tab-panel ul { padding-inline-start: 18px; margin: 6px 0; }

.cust-orders-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; margin-top: 6px; }
.cust-order-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px;
}
.cust-order-row:hover { border-color: var(--accent); }
.cust-order-row-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.addresses-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; margin-top: 6px; }
.address-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; cursor: pointer;
}
.address-card.selected { border-color: var(--accent); background: var(--accent-bg); }
.address-card b { display: block; margin-bottom: 2px; }
.address-form { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.address-form-title { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); }
.address-card { position: relative; }
.address-card-actions { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; }
.address-card-actions button { border: none; background: none; font-size: 12px; padding: 2px 4px; color: var(--ink-soft); }
.address-card-actions button:hover { color: var(--accent); }
.address-card-actions .address-delete-btn:hover { color: var(--danger); }

.address-picker-list { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.address-pick-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font: inherit; text-align: right;
  background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 140px;
}
.address-pick-card b { font-size: 13px; }
.address-pick-card.selected { border-color: var(--accent); background: var(--accent-bg); }
.address-pick-card:hover { border-color: var(--accent); }

/* ---------- Order setup ---------- */
.order-type-row, .branch-setup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.order-type-row:last-child, .branch-setup:last-child { margin-bottom: 0; }
.label-inline { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.order-type-row select, .branch-setup select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; min-height: 40px; }
.zone-results { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; width: 100%; }
.zone-option {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; cursor: pointer; background: var(--surface);
}
.zone-option:hover { border-color: var(--accent); }
.zone-option.selected { border-color: var(--accent); background: var(--accent-bg); }
.selected-branch-line { font-size: 13px; background: var(--success-bg); color: var(--success); padding: 8px 12px; border-radius: 8px; font-weight: 600; }

/* ---------- Order screen v2 (2026-09-15, user-specified pixel layout) ----------
   Built bottom-up per exact spec: items grid (1024x235, grows taller on a
   bigger screen), category tabs (1024x60) above it, and above both a fixed
   260px-tall row of three boxes — customer/branch (right, 380), cart+totals
   (middle, 400), quantity keypad (left, 240) — sized for a 1024x768 screen
   and never reflowing/stacking at that width the way the old breakpoint
   used to; only the items grid stretches to fill a taller viewport. */
.order-screen-v2 { display: flex; flex-direction: column; gap: 8px; min-height: 0; width: 100%; }
/* Grows to absorb whatever height order-menu-stack no longer takes (that one
   is now fixed at 330 — 2026-09-15) instead of leaving it as dead space
   below the menu; 260 stays the floor on the 1024x768 baseline. */
.order-top-row { display: flex; gap: 8px; flex: 1 1 260px; min-height: 260px; }
.order-customer-box, .order-cart-box, .order-keypad-box { flex: none; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.order-customer-box { width: 380px; }
.order-cart-box { width: 400px; }
.order-keypad-box { width: 240px; align-items: stretch; }
.order-customer-box-reset { margin-top: auto; align-self: flex-start; }

.customer-context { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12.5px; }
.customer-context-row1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Truncates instead of wrapping to a second line — an address can be much
   longer than the rest of this box's short fields. */
.cust-default-address { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.order-menu-stack { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: none; height: var(--menu-stack-height, 370px); }
.order-menu-stack > .menu-area { flex: 1 1 auto; min-height: 0; }

/* ---------- Quantity keypad ----------
   Type a qty here, then tap an item card to add it at that quantity in one
   line — same "keypad first, then the item" flow as Helper POS's own
   register screen, so it feels familiar rather than inventing a new one. */
.keypad-readout {
  flex: none; font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 700; text-align: center;
  padding: 6px; margin-bottom: 8px; background: var(--bg); border-radius: 8px; color: var(--accent);
}
.keypad-grid { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); gap: 6px; }
.keypad-btn {
  min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.keypad-btn:hover { border-color: var(--accent); color: var(--accent); }
.keypad-clear { color: var(--danger); }
.keypad-hint { text-align: center; margin: 8px 0 0; }


/* ---------- Menu ---------- */
.menu-area { display: flex; flex-direction: column; min-height: 0; }
.menu-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
/* Search+settings and the customer's favorites now share one row instead of
   two stacked ones (user request 2026-09-15) — the search box keeps a fixed
   width so the favorites chip strip gets whatever room is left. */
.menu-toolbar-row { flex: none; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.menu-search-row { flex: 0 0 260px; display: flex; gap: 6px; position: relative; }
.menu-toolbar-row .favorite-items-row { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }

.settings-popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px; width: 240px;
  box-shadow: 0 6px 20px rgba(20,30,45,.18);
}
.settings-popover h5 { margin: 0 0 10px; font-size: 13px; }
.settings-popover .settings-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.settings-popover .settings-row:last-child { margin-bottom: 0; }
.settings-popover label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.settings-popover .segmented { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.settings-popover .segmented button {
  flex: 1; border: none; background: var(--surface); padding: 7px 4px; font-size: 12px; cursor: pointer;
  border-inline-start: 1px solid var(--line);
}
.settings-popover .segmented button:first-child { border-inline-start: none; }
.settings-popover .segmented button.active { background: var(--accent); color: var(--accent-ink); }
.settings-popover .toggle-row { display: flex; align-items: center; justify-content: space-between; }
.menu-search-row input {
  flex: 1; width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; min-height: 44px;
}
#lang-toggle-btn { flex: none; min-width: 44px; font-weight: 700; }
.menu-empty-state {
  align-items: center; justify-content: center; text-align: center; gap: 8px;
  color: var(--ink-faint); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  flex: 0 0 auto; max-height: 180px; padding: 20px;
}
.menu-empty-state span { font-size: 28px; }
.menu-empty-state p { margin: 0; font-size: 13px; }
.menu-empty-quick-branches { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6px; }
.menu-empty-branch-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.menu-empty-branch-chip { min-height: 36px; padding: 6px 16px; }
.category-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; flex: none; padding-bottom: 4px; }
.category-tab {
  flex: none; border: 1px solid var(--line); background: var(--surface); padding: 8px 16px;
  border-radius: 999px; font-weight: 600; font-size: 13px; min-height: 40px;
}
.category-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.favorite-items-row { display: flex; gap: 8px; align-items: center; overflow-x: auto; margin-bottom: 12px; flex: none; padding-bottom: 4px; }
.favorite-items-label { flex: none; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.favorite-item-btn {
  flex: none; border: 1px solid var(--accent-line); background: var(--accent-bg); color: var(--accent);
  padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
}
.favorite-item-btn:hover { background: var(--accent-bg-hover); }

.items-grid {
  --item-min: 140px; --item-min-h: 96px; --item-thumb-h: 56px; --item-name-fs: 13.5px; --item-price-fs: 13px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--item-min), 1fr)); gap: 10px;
  overflow-y: auto; align-content: start;
  /* 235px is the 1024x768 baseline (user-specified 2026-09-15); grows to
     fill a taller viewport instead of leaving dead space below it. */
  flex: 1 1 235px; min-height: 235px;
}
.items-grid[data-size="small"] { --item-min: 108px; --item-min-h: 74px; --item-thumb-h: 38px; }
.items-grid[data-size="large"] { --item-min: 180px; --item-min-h: 128px; --item-thumb-h: 84px; }
.items-grid[data-font="small"] { --item-name-fs: 12px; --item-price-fs: 11.5px; }
.items-grid[data-font="large"] { --item-name-fs: 15.5px; --item-price-fs: 14.5px; }
.items-grid.hide-images .item-thumb, .items-grid.hide-images .item-thumb-placeholder { display: none; }
.item-card-wrap { position: relative; }
.item-card {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: var(--surface);
  text-align: right; min-height: var(--item-min-h, 96px); display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
}
.item-card:hover { border-color: var(--accent); }
.item-card:disabled { opacity: .45; }
.item-card .item-name { font-weight: 600; font-size: var(--item-name-fs, 13.5px); }
.item-card .item-price { color: var(--accent); font-weight: 700; font-size: var(--item-price-fs, 13px); }
.item-thumb { width: 100%; height: var(--item-thumb-h, 56px); object-fit: cover; border-radius: 6px; margin-bottom: 4px; }
.item-thumb-placeholder {
  display: flex; align-items: center; justify-content: center; background: var(--bg);
  font-size: 26px; height: var(--item-thumb-h, 56px);
}
.item-info-btn {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.9); color: var(--ink-soft); font-size: 12px; line-height: 1;
  box-shadow: 0 1px 3px rgba(20,30,45,.25);
}
.item-info-btn:hover { color: var(--accent); }

/* Settings → Menu admin grid — same tile look as the order screen's
   .items-grid/.item-card (image, name, price) so an admin recognizes the
   catalog they're managing, with management actions added below each tile
   instead of the order screen's single "add to cart" click. */
.menu-admin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
  padding: 10px 0;
}
.menu-admin-card-wrap {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
.menu-admin-card-wrap.item-unavailable { opacity: .55; }
.menu-admin-card { padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 4px; }
.menu-admin-card .item-name { font-weight: 600; font-size: 13.5px; }
.menu-admin-card .item-price { color: var(--accent); font-weight: 700; font-size: 13px; }
.menu-admin-card-actions {
  display: flex; border-top: 1px solid var(--line);
}
.menu-admin-card-actions button {
  flex: 1; border: none; background: none; padding: 6px 4px; font-size: 12px; color: var(--ink-soft); cursor: pointer;
}
.menu-admin-card-actions button:not(:last-child) { border-left: 1px solid var(--line); }
.menu-admin-card-actions button:hover { background: var(--bg); color: var(--accent); }

.unit-picker { position: fixed; inset: 0; background: rgba(20,30,45,.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.unit-picker-card { background: var(--surface); border-radius: 14px; padding: 20px; width: min(320px, 90vw); max-height: 85vh; overflow-y: auto; }
/* Wider variant for the customer-details popup (addresses/notes/history/
   timeline) — must come after .unit-picker-card since both are single-class
   selectors of equal specificity and the later rule in the file wins. */
.customer-details-card { width: min(860px, 96vw); max-height: 95vh; text-align: right; display: flex; flex-direction: column; }
.customer-details-card .customer-collapsibles { flex: 1; min-height: 0; overflow-y: auto; }
.cdm-header-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
/* Six disparate stats read as one wall of muted text stacked on three lines
   before this — a scannable grid of small labeled tiles instead, matching
   the same tile pattern used for dashboard stats elsewhere in the app. */
.cdm-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.cdm-stat { background: var(--bg); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cdm-stat-label { font-size: 11px; color: var(--ink-soft); }
.cdm-stat-value { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-picker-card { width: min(420px, 92vw); text-align: right; }
.edit-item-card { width: min(480px, 92vw); max-height: 88vh; overflow-y: auto; text-align: right; }
.new-customer-card { width: min(520px, 92vw); text-align: right; }
.canned-note-order-btns { display: inline-flex; gap: 2px; margin-left: 8px; }
.cn-move-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 4px; font-size: 10px; padding: 1px 4px; cursor: pointer; color: var(--ink-soft); }
.cn-move-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.cn-move-btn:disabled { opacity: .3; cursor: default; }
.edit-unit-row { align-items: center; }
.branch-picker-card .branch-setup { margin-bottom: 0; }
.unit-picker-card h4 { margin: 0 0 12px; }
.item-detail-image { width: 100%; max-height: 160px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.item-detail-description { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.7; }
.unit-option { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.unit-option:hover { border-color: var(--accent); }
.unit-option.selected { border-color: var(--accent); background: var(--accent-bg); }

/* ---------- Smart Order Entry: modifier groups ---------- */
.modifier-group-block { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.modifier-group-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.modifier-option-row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 13px; cursor: pointer; }
.modifier-option-row span:first-of-type { flex: 1; }
.cart-line-modifiers { font-size: 11.5px; color: var(--accent); margin-top: 2px; }

.cart-panel { display: flex; flex-direction: column; min-height: 0; }
.cart-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; position: relative; }
.cart-panel-head h3 { margin: 0; flex: 1; }
.cart-panel-head .btn-sm { font-size: 12px; }
#held-orders-count { font-weight: 700; }
.held-orders-popover { top: calc(100% + 6px); left: auto; right: 0; width: 280px; max-height: 320px; overflow-y: auto; }
.held-order-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.held-order-row:last-child { margin-bottom: 0; }
.held-order-row-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; }
.held-order-row .muted { font-size: 11.5px; }
.held-order-row-actions { display: flex; gap: 6px; margin-top: 6px; }
.held-order-row-actions .btn { flex: 1; font-size: 11.5px; padding: 5px 6px; min-height: 28px; }
.cart-lines { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.cart-line { border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; background: var(--surface); cursor: pointer; }
.cart-line:nth-child(even) { background: var(--cart-line-alt-bg); }
.cart-line.selected { border-color: #1e40af; background: #1e40af; }
.cart-line.selected .cart-line-name,
.cart-line.selected .cart-line-unit,
.cart-line.selected .cart-line-total,
.cart-line.selected .price-display,
.cart-line.selected .price-display-locked,
.cart-line.selected .cart-line-modifiers,
.cart-line.selected .cart-line-note-text,
.cart-line.selected .price-original-strike { color: #ffffff; }
.cart-line-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.cart-line-actions .btn { flex: 1 1 auto; }
.cart-line-delete-btn { color: var(--danger); }
.cart-line-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cart-line-name { font-weight: 600; font-size: 13px; }
.cart-line-unit { color: var(--ink-soft); font-size: 12px; }
.price-display {
  border: none; background: none; padding: 0 2px; color: inherit; font: inherit; cursor: pointer;
  border-bottom: 1px dashed var(--ink-faint);
}
.price-display:hover { color: var(--accent); border-color: var(--accent); }
.price-display.overridden { color: var(--warning); border-color: var(--warning); font-weight: 700; }
.price-display-locked { padding: 0 2px; color: var(--ink-soft); cursor: default; }
.price-original-strike { text-decoration: line-through; color: var(--ink-faint); margin-left: 3px; }
.cart-line-qty-total { display: flex; align-items: center; gap: 10px; flex: none; }
.qty-control { display: flex; align-items: center; gap: 6px; }
.qty-control button { width: 21px; height: 21px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); padding: 0; font-weight: 700; }
.qty-display { width: auto !important; min-width: 21px; padding: 0 4px !important; color: var(--accent); }
.qty-display:hover { border-color: var(--accent); }
.cart-line-total { font-size: 13px; font-weight: 700; }

/* ---------- Quantity keypad ---------- */
.qty-keypad-card { width: min(280px, 90vw); text-align: center; }
.qty-keypad-display {
  font-family: 'IBM Plex Mono', monospace; font-size: 32px; font-weight: 700; text-align: center;
  padding: 10px; margin-bottom: 12px; background: var(--bg); border-radius: 8px; min-height: 52px;
}
.qty-keypad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.qty-keypad-btn {
  min-height: 52px; font-size: 20px; font-weight: 700; border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; color: var(--ink);
}
.qty-keypad-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-keypad-btn[data-key="✓"] { background: var(--success); color: #fff; border-color: var(--success); }
.qty-keypad-btn[data-key="⌫"] { background: var(--danger-bg); color: var(--danger); }
.cart-line-note-text {
  color: var(--accent); background: var(--accent-bg); border-radius: 6px; padding: 4px 8px;
  font-size: 11.5px; margin-top: 6px; overflow-wrap: break-word;
}
.cart-line-bottom { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cart-line-note-btn {
  flex: 1 1 auto; border: 1px dashed var(--line); background: var(--bg); color: var(--ink-soft);
  border-radius: 6px; padding: 6px 8px; font-size: 12px; font-weight: 600; min-height: 30px;
}
.cart-line-note-btn:hover { border-color: var(--accent); color: var(--accent); }
.remove-line-btn {
  flex: 1 1 auto; color: var(--danger); border: 1px dashed var(--danger-bg); background: var(--danger-bg);
  font-size: 12px; font-weight: 600; border-radius: 6px; padding: 6px 8px; min-height: 30px;
}
.remove-line-btn:hover { border-color: var(--danger); }

/* ---------- Item note modal: every note is a button ---------- */
.note-modal-group-label { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; margin: 10px 0 6px; }
.note-modal-card { width: min(680px, 94vw); max-height: 90vh; }
.note-modal-actions { justify-content: space-between; gap: 40px; margin-top: 16px; }
.note-modal-actions #note-modal-save { flex: 1; }
.note-modal-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.note-modal-btn {
  border: 1px solid var(--accent-line); background: var(--accent-bg); color: var(--accent); border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600; min-height: 42px;
}
.note-modal-btn:hover { background: var(--accent-bg-hover); }
#note-modal-text { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; font-size: 14px; }

/* ---------- Announcements admin ---------- */
.announcement-admin-row { cursor: default; display: flex; flex-direction: column; gap: 6px; }
.announcement-admin-text { white-space: pre-wrap; font-size: 13.5px; }
.announcement-admin-actions { display: flex; gap: 8px; }
#announcements-admin-list.addresses-list { max-height: 420px; }
.announcement-ack-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; margin: 10px 0; }

/* ---------- Mandatory announcement modal ---------- */
.announcement-modal-card { width: min(480px, 92vw); }
.announcement-message {
  white-space: pre-wrap; background: var(--accent-bg); border: 1px solid var(--accent-line); border-radius: 10px;
  padding: 14px; font-size: 15px; line-height: 1.6; margin: 12px 0 16px;
}
#announcement-ack-btn { width: 100%; }

#order-notes { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; margin-top: auto; }

.totals { border-top: 1px solid var(--line); padding-top: 4px; margin-bottom: 4px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
.totals-row { display: flex; justify-content: space-between; align-items: center; padding: 1px 0; font-size: 11.5px; min-width: 0; }
.totals-row input { width: 90px; text-align: left; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; min-height: 0; }
.totals-row.grand { grid-column: 1 / -1; font-weight: 700; font-size: 0.9rem; border-top: 1px dashed var(--line); margin-top: 2px; padding-top: 3px; }
.discount-input-group { display: flex; gap: 4px; }
.discount-input-group input { width: 56px; }
.discount-input-group select { width: 52px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; min-height: 0; }

.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ---------- Orders list ---------- */
.orders-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.orders-filters select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; min-height: 40px; }
.of-search-input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; min-height: 40px; width: 160px; }
#orders-list-view { overflow-x: auto; }
.orders-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13.5px; }
.orders-table th { text-align: right; padding: 8px 10px; border-bottom: 2px solid var(--line); color: var(--ink-soft); font-size: 12px; }
.orders-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.orders-actions-cell { display: flex; align-items: center; gap: 6px; }
.order-status-pill { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg); }
.order-status-pill.Delivered, .order-status-pill.Completed { background: var(--success-bg); color: var(--success); }
.order-status-pill.Cancelled, .order-status-pill.Rejected { background: var(--danger-bg); color: var(--danger); }
.order-status-pill.Pending, .order-status-pill.SentToBranch { background: var(--warning-bg); color: var(--warning); }
.status-select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; }
.order-row { cursor: pointer; }
.order-row:hover { background: var(--bg); }

/* ---------- Order details modal ---------- */
.order-details-card { width: min(480px, 92vw); max-height: 88vh; overflow-y: auto; text-align: right; }
.order-details-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-details-head h4 { margin: 0; }
.rush-badge { color: var(--danger); font-size: 12px; font-weight: 700; }
.scheduled-badge { background: var(--bg); color: var(--ink-soft); border-radius: 8px; padding: 4px 10px; font-size: 12px; margin-bottom: 8px; display: inline-block; }
.sync-badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.sync-badge.failed { background: var(--danger-bg); color: var(--danger); }
.sync-badge.ok { background: var(--success-bg); color: var(--success); }
.order-details-meta { font-size: 13px; display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.delivery-tracking-block { font-size: 13px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.delivery-tracking-block h4 { margin: 0 0 8px; font-size: .9rem; }
.delivery-tracking-times { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.delivery-performance-badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; margin-top: 4px; }
.delivery-performance-badge.ontime { background: var(--success-bg); color: var(--success); }
.delivery-performance-badge.late { background: var(--warning-bg); color: var(--warning); }
.order-details-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; max-height: 320px; overflow-y: auto; }
.order-details-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }

.order-add-item-panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--bg); }
.order-add-item-panel input[type="text"] { width: 100%; margin-bottom: 8px; }
.order-add-item-results { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.order-add-item-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; text-align: right;
  background: var(--surface); cursor: pointer;
}
.order-add-item-row:hover:not(:disabled) { border-color: var(--accent); }
.order-add-item-row:disabled { opacity: .5; cursor: not-allowed; }
.order-details-timeline { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.order-details-timeline h4 { margin: 0 0 8px; font-size: .9rem; }
.order-status-history-row {
  display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0;
}
.order-rating-block { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.order-rating-block h4 { margin: 0 0 8px; font-size: .9rem; }
.rating-stars { display: flex; gap: 4px; margin-bottom: 8px; }
.rating-star { border: none; background: none; font-size: 24px; padding: 0; line-height: 1; color: var(--warning); }
.order-rating-display { font-size: 20px; letter-spacing: 2px; color: var(--warning); }
#order-rating-comment { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }

.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-inline-start: auto; }
.view-toggle-btn { border: none; background: var(--surface); color: var(--ink-soft); padding: 8px 14px; font-size: 13px; font-weight: 600; min-height: 40px; }
.view-toggle-btn.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Orders board (Kanban) ----------
   Real call-center software (Foodics' Call Center console, researched
   2026-09-10) shows orders as status columns rather than only a flat table —
   good for a dispatcher scanning "what's stuck where" at a glance. Columns
   group this app's more granular CallCenterOrderStatus into the same
   buckets a phone agent actually thinks in. */
.order-board { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 10px; overflow-x: auto; align-items: start; }
.order-board-column { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-width: 200px; }
.order-board-column-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 700; font-size: 12.5px; color: var(--ink-soft); }
.order-board-column-head .count { background: var(--bg); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.order-board-cards { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.order-board-card { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 12px; border-inline-start: 4px solid var(--ink-faint); }
.order-board-card.onTime { border-inline-start-color: var(--success); }
.order-board-card.late { border-inline-start-color: var(--warning); }
.order-board-card.veryLate { border-inline-start-color: var(--danger); }
.order-board-card-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 3px; }
.order-board-card-row { color: var(--ink-soft); margin-bottom: 2px; }
.order-board-card select { width: 100%; margin-top: 6px; font-size: 11px; padding: 3px 4px; }
.order-board-empty { color: var(--ink-faint); font-size: 12px; text-align: center; padding: 16px 4px; }

@media (max-width: 1100px) {
  .order-board { grid-template-columns: repeat(3, minmax(200px, 1fr)); }
}
@media (max-width: 700px) {
  .order-board { grid-template-columns: 1fr; }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink-inverse-bg); color: var(--ink-inverse-text); padding: 12px 22px; border-radius: 10px; font-size: 13.5px; z-index: 100;
}
.toast.error { background: var(--danger); color: #fff; }

@media (max-width: 900px) {
  .customer-collapsibles { flex-direction: column; gap: 4px; }
}

/* ---------- Admin: Users & Settings ---------- */
.settings-subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtab-btn {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 16px;
  border-radius: 999px; font-weight: 600; font-size: 13px; min-height: 40px;
}
.subtab-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.settings-subview { display: flex; flex-direction: column; gap: 8px; }

.menu-cat-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 10px 0 0; padding-bottom: 0; }
.menu-cat-tab-btn {
  border: 1px solid var(--line); border-bottom: none; background: var(--bg); color: var(--ink-soft);
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; border-radius: 8px 8px 0 0;
}
.menu-cat-tab-btn.active { background: var(--surface); color: var(--accent); border-color: var(--line); position: relative; top: 1px; }
.menu-cat-panel { border: 1px solid var(--line); border-top: none; border-radius: 0 0 10px 10px; padding: 12px; }
.menu-branch-category { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.menu-branch-category-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.menu-branch-item-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line-soft); font-size: 13px;
}
.menu-branch-item-row:first-of-type { border-top: none; }
.menu-branch-item-row .grow { flex: 1; }
.menu-branch-item-units { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: 12px; }
.unit-chip { background: var(--chip-bg, var(--bg)); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; }

.hall-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.hall-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.table-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.table-chip { background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }

.branch-checkbox-list { display: flex; gap: 10px; flex-wrap: wrap; }
.branch-checkbox-list label { display: flex; align-items: center; gap: 4px; font-size: 13px; }

.permission-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; padding: 8px 0; }
.permission-checkbox-grid label { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- Command palette (Ctrl+K global search) ----------
   Pattern confirmed across Salesforce/Streak/NetSuite/Zoho (researched
   2026-09-10): one keyboard shortcut opens a universal search over
   everything, invoked on demand — it costs zero permanent screen space,
   which is exactly what this project's order screen has no room to spare
   after [[feedback-ui-density-and-scope]]. */
.kbd-hint {
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 10px;
  color: var(--ink-faint); margin-inline-start: 4px; font-family: 'IBM Plex Mono', monospace;
}
.command-palette-overlay {
  position: fixed; inset: 0; background: rgba(20,30,45,.45); display: flex;
  align-items: flex-start; justify-content: center; padding-top: 10vh; z-index: 200;
}
.command-palette-card {
  background: var(--surface); border-radius: 14px; width: min(560px, 92vw); max-height: 70vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px -12px rgba(20,30,45,.35); overflow: hidden;
}
.command-palette-input {
  border: none; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 16px;
  width: 100%; outline: none;
}
.command-palette-results { overflow-y: auto; flex: 1; padding: 6px; }
.command-palette-group-label { font-size: 11px; color: var(--ink-faint); font-weight: 700; padding: 8px 10px 4px; }
.command-palette-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.command-palette-item:hover, .command-palette-item.active { background: var(--bg); }
.command-palette-item .cp-icon { flex: none; font-size: 16px; }
.command-palette-item .cp-main { flex: 1; }
.command-palette-item .cp-sub { color: var(--ink-soft); font-size: 12px; }
.command-palette-empty { padding: 24px; text-align: center; color: var(--ink-faint); font-size: 13px; }
.command-palette-footer { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 11px; color: var(--ink-faint); display: flex; gap: 14px; }

/* ---------- Agent status ---------- */
.agent-status-select {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 12.5px;
  font-weight: 600; min-height: 32px; background: var(--bg); color: var(--ink);
}

/* ---------- Customer tags ---------- */
.cust-tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.cust-tag-chip {
  background: var(--accent-bg); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.cust-tag-chip button { border: none; background: none; color: var(--accent); font-size: 12px; padding: 0; line-height: 1; }
.note-delete-btn { border: none; background: none; color: var(--danger); font-size: 12px; padding: 0 4px; line-height: 1; cursor: pointer; }
.cust-tag-add-btn {
  border: 1px dashed var(--line); background: none; color: var(--ink-soft); border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px;
}

.cust-timeline-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; margin-top: 6px; }
.timeline-row { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 6px 8px; border-radius: 6px; background: var(--bg); }
.timeline-icon { flex: none; }
.timeline-title { font-weight: 600; }
.timeline-meta { color: var(--ink-soft); font-size: 11.5px; }

/* ---------- Branch allocation ---------- */
.branch-picker-hint { margin: 2px 0 8px; }
.allocation-reason-line { font-size: 12.5px; color: var(--ink-soft); background: var(--bg); padding: 6px 12px; border-radius: 8px; }
.branch-status-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-inline-start: 6px; }
.branch-status-pill.Open { background: var(--success-bg); color: var(--success); }
.branch-status-pill.Busy { background: var(--warning-bg); color: var(--warning); }
.branch-status-pill.Closed, .branch-status-pill.Suspended { background: var(--danger-bg); color: var(--danger); }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-card .kpi-value { font-size: 1.6rem; font-weight: 700; font-family: 'IBM Plex Mono', monospace; }
.kpi-card .kpi-label { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.kpi-card.warn .kpi-value { color: var(--warning); }
.kpi-card.danger .kpi-value { color: var(--danger); }
.dashboard-branches { display: flex; flex-direction: column; gap: 6px; }
.dashboard-branch-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.dashboard-branch-row .grow { flex: 1; }
.status-breakdown { display: flex; flex-wrap: wrap; gap: 8px; }
.status-breakdown-item { background: var(--bg); border-radius: 8px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; }

/* ---------- Reports: peak-hours mini bar chart (no charting library —
   24 simple divs sized by count, readable at a glance) ---------- */
.peak-hours-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 20px; }
.peak-hour-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.peak-hour-bar-fill { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.peak-hour-bar-count { font-size: 10px; color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; }
.peak-hour-bar-label { font-size: 9.5px; color: var(--ink-faint); }

.fulfillment-times-row { display: flex; gap: 16px; flex-wrap: wrap; }
.fulfillment-stat { flex: 1 1 180px; background: var(--bg); border-radius: 10px; padding: 14px 16px; text-align: center; }
.fulfillment-stat .big-number { font-size: 1.8rem; font-weight: 700; color: var(--accent); font-family: 'IBM Plex Mono', monospace; }
.fulfillment-stat .stat-label { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.fulfillment-stat .stat-sample { font-size: 11px; color: var(--ink-faint); }

/* ---------- Delivery board ---------- */
.delivery-board-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.delivery-card { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--ink-faint); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.delivery-card.onTime { border-inline-start-color: var(--success); }
.delivery-card.late { border-inline-start-color: var(--warning); }
.delivery-card.veryLate { border-inline-start-color: var(--danger); background: var(--danger-bg); }
.delivery-card-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.delivery-card-row { color: var(--ink-soft); margin-bottom: 2px; }

/* ---------- Tickets ---------- */
.tickets-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.ticket-card.breached { border-color: var(--danger); background: var(--danger-bg); }
.ticket-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket-card-head .grow { flex: 1; }
.priority-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); }
.priority-pill.High, .priority-pill.Urgent { background: var(--danger-bg); color: var(--danger); }
.priority-pill.Normal { background: var(--bg); color: var(--ink-soft); }
.priority-pill.Low { background: var(--success-bg); color: var(--success); }
.ticket-status-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); }
.ticket-status-pill.Escalated { background: var(--danger-bg); color: var(--danger); }
.ticket-status-pill.Resolved, .ticket-status-pill.Closed { background: var(--success-bg); color: var(--success); }
.ticket-comments { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.ticket-comment-row { font-size: 12px; color: var(--ink-soft); }
.ticket-actions-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Map picker ---------- */

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .delivery-board-list { grid-template-columns: 1fr; }
}
