/* merchant.dasurv.app: the Dasurv design system (the "Dasurv" Design System artifact: tokens.json + the kit in
   components/bundle.css) for the web. Grey page, white cards without borders, black pill actions, red only as a
   small accent, one colour per order status. Light and dark use the same token names.
   Phones: the app's bottom tabs. 900 px and wider: a left navigation rail (Claude's number). */

/* ── Tokens ─────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --page: #f4f4f5;
  --card: #ffffff;
  --sunken: #f4f4f5;
  --track: #e4e4e7;
  --ink: #111111;
  --ink-soft: #52525b;
  --ink-faint: #a1a1aa;
  --rule: #e4e4e7;
  --on-ink: #ffffff;
  --accent: #ff1500;
  --accent-soft: #fff1ee;
  --alarm: #dc2626;
  --alarm-soft: #fef2f2;
  --danger-fill: #dc2626;
  --on-danger: #ffffff;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --points: #f5b301;
  --on-dark: #ffffff;
  --scrim: rgba(0, 0, 0, 0.45);

  --font: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px; --space-xl: 24px; --space-2xl: 32px;
  --radius-chip: 8px; --radius-inner: 12px; --radius-card: 16px; --radius-sheet: 20px; --radius-pill: 999px;
  --tap: 48px;
  --dur-fast: 160ms; --dur-base: 220ms; --dur-slide: 280ms; --dur-exit: 200ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --rail: 256px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0d; --page: #0c0c0d; --card: #161618; --sunken: #1c1c1f; --track: #2a2a2f; --ink: #f4f4f5;
    --ink-soft: #a1a1aa; --ink-faint: #71717a; --rule: #27272a; --on-ink: #111111; --accent-soft: #2b120d;
    --alarm: #f87171; --alarm-soft: #2a1414; --ok: #4ade80; --ok-soft: #10261a; --warn: #fbbf24; --warn-soft: #2b2009;
    --info: #60a5fa; --info-soft: #0f1d33; --scrim: rgba(0, 0, 0, 0.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0d; --page: #0c0c0d; --card: #161618; --sunken: #1c1c1f; --track: #2a2a2f; --ink: #f4f4f5;
  --ink-soft: #a1a1aa; --ink-faint: #71717a; --rule: #27272a; --on-ink: #111111; --accent-soft: #2b120d;
  --alarm: #f87171; --alarm-soft: #2a1414; --ok: #4ade80; --ok-soft: #10261a; --warn: #fbbf24; --warn-soft: #2b2009;
  --info: #60a5fa; --info-soft: #0f1d33; --scrim: rgba(0, 0, 0, 0.6); color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; min-height: 100dvh; background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 21px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.num, .value, .price { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

h1, .large-title { font-size: 26px; line-height: 32px; font-weight: 700; margin: 0; letter-spacing: -0.3px; }
h2, .title { font-size: 20px; line-height: 26px; font-weight: 600; margin: 0; }
.heading { font-size: 16px; line-height: 22px; font-weight: 600; margin: 0; }
.meta { font-size: 13px; line-height: 18px; color: var(--ink-soft); margin: 0; }
.micro { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.t-soft { color: var(--ink-soft); } .t-faint { color: var(--ink-faint); } .t-alarm { color: var(--alarm); } .t-ok { color: var(--ok); }
p { margin: 0; }

.ico { width: 22px; height: 22px; fill: currentColor; flex: none; }
.ico.sm { width: 18px; height: 18px; }
.ico.lg { width: 28px; height: 28px; }
.chev { color: var(--ink-faint); }

/* ── Buttons ────────────────────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  min-height: var(--tap); padding: 0 22px; border-radius: var(--radius-pill); border: 1px solid transparent;
  font: 600 15px/21px var(--font); background: var(--ink); color: var(--on-ink); cursor: pointer; white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.btn:hover { opacity: 0.88; }
.btn:active { opacity: 0.7; }
.btn.block { display: flex; width: 100%; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--rule); }
.btn.ghost { background: transparent; color: var(--ink); padding: 0 12px; }
.btn.danger { background: var(--danger-fill); color: var(--on-danger); }
.btn.danger-text { background: transparent; color: var(--alarm); border-color: var(--rule); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn[disabled] { background: var(--track); color: var(--ink-faint); border-color: transparent; cursor: default; opacity: 1; }
.btn .btn-text:empty { display: none; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin 0.8s linear infinite; flex: none; }
.spin.big { width: 28px; height: 28px; border-width: 3px; color: var(--ink-soft); }
@keyframes spin { to { transform: rotate(360deg); } }
.link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; border: none; background: none;
  font: 500 14px/18px var(--font); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link.danger { color: var(--alarm); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: none;
  border-radius: var(--radius-pill); background: transparent; color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--sunken); }
.icon-btn.round { width: 36px; height: 36px; background: var(--sunken); }

/* ── Card, Section, Row ─────────────────────────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius-card); padding: var(--space-lg); }
.section { margin-top: var(--space-xl); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding: 0 4px var(--space-sm); }
.section-label { font: 700 16px/22px var(--font); color: var(--ink); margin: 0; }
.rows { background: var(--card); border-radius: var(--radius-card); overflow: hidden; }
.sheet .card, .sheet .rows { border: 1px solid var(--rule); }
.row { display: flex; align-items: center; gap: var(--space-md); min-height: 56px; padding: 10px var(--space-lg); width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--rule); }
.row-btn { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }
.row-btn:hover { background: var(--sunken); }
.row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .label { font: 400 15px/21px var(--font); }
.row .sub { font: 400 13px/18px var(--font); color: var(--ink-soft); }
.row .value { font: 600 15px/21px var(--font); }
.row .value-text { font: 400 14px/20px var(--font); color: var(--ink-soft); text-align: right; max-width: 60%; overflow-wrap: anywhere; }
.row-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.row-icon .ico { width: 20px; height: 20px; }
.row-icon.danger { background: var(--alarm-soft); color: var(--alarm); }
.info-row { display: flex; gap: var(--space-md); align-items: flex-start; padding: 12px 0; }
.info-row + .info-row { border-top: 1px solid var(--rule); }
.info-row .ico { color: var(--ink-faint); width: 20px; height: 20px; margin-top: 1px; }
.info-row .k { font-size: 13px; color: var(--ink-soft); width: 96px; flex: none; }
.info-row .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-md); }
.card-head .heading { display: flex; align-items: center; gap: var(--space-sm); }
.stack > * + * { margin-top: var(--space-md); }

/* ── Badge, chips, counts ───────────────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill);
  font: 600 11px/14px var(--font); letter-spacing: 0.02em; background: var(--sunken); color: var(--ink-soft); white-space: nowrap; }
.badge .ico { width: 14px; height: 14px; }
.badge.ink { background: var(--ink); color: var(--on-ink); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.alarm { background: var(--alarm-soft); color: var(--alarm); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.promo { background: var(--accent-soft); color: var(--ink); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-sm); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--rule); background: var(--card); font: 500 13px/18px var(--font); color: var(--ink); cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent);
  color: var(--on-dark); font: 700 11px/18px var(--font); text-align: center; }

/* ── Fields ─────────────────────────────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--space-md); }
.flabel { font: 500 13px/18px var(--font); color: var(--ink-soft); }
.input { min-height: var(--tap); width: 100%; padding: 0 14px; border-radius: var(--radius-inner); border: 1px solid transparent;
  background: var(--sunken); color: var(--ink); font: 400 15px/21px var(--font);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; }
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.input.error { border-color: var(--alarm); box-shadow: 0 0 0 1px var(--alarm); }
.input:disabled { opacity: 0.6; }
.page-field .input { background: var(--card); }
.help { font: 400 13px/18px var(--font); color: var(--ink-soft); min-height: 0; }
.help:empty { display: none; }
.help.err { color: var(--alarm); }
.help.ok { color: var(--ok); }
.input-prefix { display: flex; align-items: center; border-radius: var(--radius-inner); background: var(--sunken); }
.input-prefix .prefix { padding-left: 14px; color: var(--ink-soft); }
.input-prefix .input { background: transparent; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-pill); background: var(--sunken); gap: 2px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius-pill); background: transparent;
  font: 500 13px/18px var(--font); color: var(--ink-soft); cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.seg button.on { background: var(--card); color: var(--ink); border-color: var(--rule); font-weight: 600; }

/* Phone number field with the flag button */
.phone-row { display: flex; align-items: stretch; gap: 0; border-radius: var(--radius-inner); background: var(--sunken);
  border: 1px solid transparent; transition: border-color var(--dur-fast) var(--ease-out); }
.phone-row:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.phone-row .flag-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 14px; border: none; background: none;
  cursor: pointer; border-right: 1px solid var(--rule); min-height: var(--tap); font-weight: 500; }
.phone-row .flag { font-size: 20px; line-height: 1; }
.phone-row .input { background: transparent; border: none; box-shadow: none; }
.country-list { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.country-list .row .flag { font-size: 22px; }

/* PIN and code boxes: one real input drawn as boxes */
.code-input { letter-spacing: 0.6em; text-align: center; font: 600 24px/32px var(--font); min-height: 56px; padding-left: 0.6em; }
.code-input.pin { -webkit-text-security: disc; }

/* ── Banners, empty, skeleton ───────────────────────────────────────────────────────────────────────── */
.banner { display: flex; align-items: center; gap: var(--space-md); border-radius: var(--radius-card); padding: 12px var(--space-lg);
  font: 400 13px/18px var(--font); color: var(--ink); }
.banner .ico { width: 20px; height: 20px; }
.banner.alarm { background: var(--alarm-soft); } .banner.alarm .ico, .banner.alarm .lead { color: var(--alarm); }
.banner.warn { background: var(--warn-soft); } .banner.warn .ico, .banner.warn .lead { color: var(--warn); }
.banner.info { background: var(--info-soft); } .banner.info .ico, .banner.info .lead { color: var(--info); }
.banner.ok { background: var(--ok-soft); } .banner.ok .ico, .banner.ok .lead { color: var(--ok); }
.banner .grow { flex: 1; }
.banner .lead { font-weight: 600; }
.banner .link { min-height: 32px; }
.empty { text-align: center; padding: var(--space-2xl) var(--space-lg); display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); }
.empty .ring { width: 56px; height: 56px; border-radius: 50%; background: var(--sunken); display: flex; align-items: center;
  justify-content: center; color: var(--ink-soft); margin-bottom: var(--space-sm); }
.empty .meta { max-width: 360px; }
.empty .btn { margin-top: var(--space-sm); }
.sk { background: var(--sunken); border-radius: var(--radius-chip); display: block; animation: shimmer 1.6s ease-in-out infinite; }
.sk-dot { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.sk-line { height: 12px; width: 70%; margin: 4px 0; }
.sk-line.short { width: 40%; }
.sk-block { height: 120px; border-radius: var(--radius-card); }
@keyframes shimmer { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ── Sheet (bottom on phones, right panel on desktops), dialog, toast ───────────────────────────────── */
.scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--dur-exit) var(--ease-in); }
.sheet-layer { position: fixed; inset: 0; z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; padding: 10px 0 0;
  transform: translateY(100%); transition: transform var(--dur-exit) var(--ease-in); outline: none; }
.sheet-layer.open .scrim { opacity: 1; transition: opacity var(--dur-slide) var(--ease-out); }
.sheet-layer.open .sheet { transform: none; transition: transform var(--dur-slide) var(--ease-out); }
.grab { width: 40px; height: 4px; border-radius: 999px; background: var(--track); margin: 0 auto 10px; flex: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-md); padding: 0 var(--space-lg) var(--space-md); }
.sheet-head .main { min-width: 0; }
.sheet-head .meta { margin-top: 2px; }
.sheet-body { flex: 1; overflow: auto; padding: 0 var(--space-lg) var(--space-lg); }
.sheet-foot { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md) var(--space-lg) calc(var(--space-lg) + var(--safe-b));
  border-top: 1px solid var(--rule); }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; bottom: 0; width: 440px; max-height: none; border-radius: var(--radius-sheet) 0 0 var(--radius-sheet);
    transform: translateX(100%); padding-top: var(--space-lg); }
  .grab { display: none; }
}
#dialog-host { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#dialog-host:not(:empty) { pointer-events: auto; }
.dialog { position: fixed; left: 50%; top: 50%; width: min(400px, calc(100vw - 48px)); background: var(--card);
  border-radius: var(--radius-sheet); padding: var(--space-xl) var(--space-lg) var(--space-lg); text-align: center;
  transform: translate(-50%, -50%) scale(0.96); opacity: 0; transition: opacity var(--dur-exit) var(--ease-in), transform var(--dur-exit) var(--ease-in); }
#dialog-host.open .scrim { opacity: 1; transition: opacity var(--dur-base) var(--ease-out); }
#dialog-host.open .dialog { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.dialog .dialog-text { margin-top: var(--space-sm); font-size: 14px; line-height: 20px; }
.dialog .actions { display: flex; gap: var(--space-sm); margin-top: var(--space-lg); }
.dialog .actions .btn { flex: 1; padding: 0 12px; }
.dialog .actions.stacked { flex-direction: column-reverse; }
#toast-host { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + var(--safe-b)); z-index: 70; transform: translate(-50%, 16px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-exit) var(--ease-in), transform var(--dur-exit) var(--ease-in); }
#toast-host.show { opacity: 1; transform: translate(-50%, 0); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.toast { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: var(--on-ink); border-radius: var(--radius-pill);
  padding: 12px 18px; font: 500 13px/18px var(--font); white-space: nowrap; }
.toast .ico { width: 18px; height: 18px; }
@media (min-width: 900px) { #toast-host { bottom: 24px; left: calc(50% + var(--rail) / 2); } }

/* ── App shell ──────────────────────────────────────────────────────────────────────────────────────── */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: var(--space-lg); }
.logo { font: 700 22px/28px var(--font); letter-spacing: -0.4px; display: inline-flex; align-items: baseline; }
.logo i { display: inline-block; width: 7px; height: 7px; margin-left: 2px; border-radius: 50%; background: var(--accent); }
.logo small { font: 500 13px/18px var(--font); color: var(--ink-soft); margin-left: 8px; letter-spacing: 0; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-sm); min-height: 64px;
  padding: 8px var(--space-sm) 8px var(--space-lg); background: var(--bg); border-bottom: 1px solid var(--rule); }
.branch-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-md); border: none; background: none; padding: 4px 0;
  cursor: pointer; text-align: left; border-radius: var(--radius-inner); }
.branch-btn .main { min-width: 0; display: flex; flex-direction: column; }
.branch-btn .name { font: 600 16px/22px var(--font); display: flex; align-items: center; gap: 4px; min-width: 0; }
.branch-btn .name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.branch-btn .badge-ico { flex: none; }
.branch-btn .addr { font: 400 13px/18px var(--font); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-btn .badge-ico { color: var(--accent); width: 18px; height: 18px; }
.store-logo { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--sunken); display: inline-flex;
  align-items: center; justify-content: center; color: var(--ink-soft); flex: none; }
.store-logo img { width: 100%; height: 100%; object-fit: cover; }
.store-logo.lg { width: 56px; height: 56px; border-radius: var(--radius-inner); }
.avatar { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--ink); color: var(--on-ink);
  display: inline-flex; align-items: center; justify-content: center; font: 700 20px/1 var(--font); flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--bg); border-top: 1px solid var(--rule);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none;
  font: 500 11px/14px var(--font); color: var(--ink-faint); position: relative; min-width: 0; }
.tabs a.on { color: var(--ink); font-weight: 600; }
.tabs a .count { position: absolute; top: 8px; left: 54%; }

main#view { display: block; padding: var(--space-lg) var(--space-lg) calc(var(--tabs-h) + var(--space-2xl) + var(--safe-b)); max-width: 760px; margin: 0 auto; outline: none; }
main#view.wide { max-width: 1200px; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); margin: var(--space-sm) 0 var(--space-lg); }
.page-title .meta { margin-top: 4px; }
.screen-header { display: flex; align-items: center; gap: var(--space-sm); margin: 0 0 var(--space-lg) -8px; }
.screen-header h1 { font-size: 20px; line-height: 26px; font-weight: 600; }

.rail { display: none; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
  .topbar, .tabs { display: none; }
  .rail { display: flex; flex-direction: column; gap: var(--space-lg); position: sticky; top: 0; height: 100vh; overflow: auto;
    padding: var(--space-xl) var(--space-lg); background: var(--bg); border-right: 1px solid var(--rule); }
  .rail .branch-btn { flex: none; padding: 10px; background: var(--sunken); }
  .rail nav { display: flex; flex-direction: column; gap: 2px; }
  .rail nav .group-label { margin: var(--space-lg) 12px var(--space-sm); color: var(--ink-faint); }
  .rail nav a { display: flex; align-items: center; gap: var(--space-md); min-height: 44px; padding: 0 12px; border-radius: var(--radius-inner);
    text-decoration: none; color: var(--ink-soft); font: 500 15px/21px var(--font); }
  .rail nav a:hover { background: var(--sunken); color: var(--ink); }
  .rail nav a.on { background: var(--ink); color: var(--on-ink); font-weight: 600; }
  .rail .rail-foot { margin-top: auto; }
  main#view { padding: var(--space-2xl) var(--space-xl) var(--space-2xl); }
}

/* ── Login ──────────────────────────────────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-xl) var(--space-lg); gap: var(--space-xl); }
.auth .card { width: 100%; max-width: 420px; padding: var(--space-xl); }
.auth h1 { font-size: 22px; line-height: 28px; }
.auth .lead-text { margin: 6px 0 var(--space-xl); }
.auth .who-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding: 12px 14px;
  border-radius: var(--radius-inner); background: var(--sunken); margin-bottom: var(--space-lg); }
.auth .who-card .main { display: flex; flex-direction: column; min-width: 0; }
.auth .foot-links { display: flex; gap: var(--space-lg); justify-content: center; }
.auth .shake { animation: shake 320ms var(--ease-out); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth .btn.block { margin-top: var(--space-lg); }
.auth .row-actions { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-sm); }

/* ── Branches ───────────────────────────────────────────────────────────────────────────────────────── */
.branch-row { align-items: flex-start; }
.branch-row .store-logo { width: 48px; height: 48px; border-radius: var(--radius-inner); }
.branch-row .name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.open-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.open-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.open-dot.closed::before { background: var(--ink-faint); }

/* ── Account ────────────────────────────────────────────────────────────────────────────────────────── */
.profile { display: flex; align-items: center; gap: var(--space-lg); }
.profile .main { min-width: 0; flex: 1; }
.profile .name { font: 600 20px/26px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-head { display: flex; align-items: center; gap: var(--space-md); padding-bottom: var(--space-md); border-bottom: 1px solid var(--rule); }
.store-head .main { min-width: 0; }
.store-head .name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.store-head .name .ico { color: var(--accent); width: 18px; height: 18px; }
.method { display: flex; align-items: center; gap: var(--space-md); padding-bottom: var(--space-sm); }
.note { font-size: 13px; line-height: 18px; color: var(--ink-soft); margin-top: var(--space-md); }
.note.warn { color: var(--warn); }
.card .btn.secondary { background: var(--sunken); border-color: transparent; }
.social-row { display: flex; align-items: center; gap: var(--space-md); }
.social-row + .social-row { margin-top: var(--space-sm); }
.social-row .ico { color: var(--ink); }
.social-row .input { flex: 1; }
.footer-meta { text-align: center; margin-top: var(--space-xl); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.footer-meta .links { display: flex; gap: var(--space-lg); }

@media (max-width: 480px) {
  body { font-size: 14px; line-height: 20px; }
  h1, .large-title { font-size: 22px; line-height: 28px; }
  .row .label { font-size: 14px; line-height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Small spacing helpers */
.mt { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* ── Home ───────────────────────────────────────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); margin-top: var(--space-md); }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; gap: 4px; text-align: left; border: none; font: inherit; color: inherit; min-width: 0; }
button.tile { cursor: pointer; }
button.tile:hover { background: var(--sunken); }
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); }
.tile-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.tile-icon .ico { width: 20px; height: 20px; }
.tile-icon.promo { background: var(--accent-soft); }
.tile-icon.warn { background: var(--warn-soft); color: var(--warn); }
.tile-icon.ok { background: var(--ok-soft); color: var(--ok); }
.tile-icon.info { background: var(--info-soft); color: var(--info); }
.tile-icon.alarm { background: var(--alarm-soft); color: var(--alarm); }
.tile-icon.points { background: var(--warn-soft); color: var(--points); }
.tile-label { font: 500 13px/18px var(--font); color: var(--ink-soft); }
.tile-value { font: 700 22px/28px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-value small { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.tile-foot { font: 400 12px/16px var(--font); color: var(--ink-soft); display: flex; align-items: flex-start; gap: 4px; min-height: 16px; }
.tile-foot .ico { width: 14px; height: 14px; }
.chart-card { padding: var(--space-lg); }
.readout { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-md); margin-bottom: var(--space-md); }
.readout-value { font-size: 18px; line-height: 24px; }
.chart-row { display: flex; gap: var(--space-sm); }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 180px; font-size: 11px; color: var(--ink-faint);
  text-align: right; min-width: 44px; padding-top: 0; transform: translateY(-6px); }
.chart-col { flex: 1; min-width: 0; }
.chart-plot { position: relative; height: 180px; touch-action: pan-y; cursor: pointer; border-radius: var(--radius-chip); }
.chart-svg { width: 100%; height: 100%; display: block; }
.chart-sel { fill: var(--sunken); }
.chart-grid { stroke: var(--sunken); stroke-width: 1; }
.chart-base { stroke: var(--rule); stroke-width: 1; }
.chart-bar { fill: var(--ink-faint); }
.chart-bar.on { fill: var(--ink); }
.chart-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink-faint); font-size: 13px; pointer-events: none; }
.chart-x { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 6px; font-size: 11px; color: var(--ink-faint); }
.chart-x span { text-align: center; white-space: nowrap; overflow: visible; }
.chart-x span.on { color: var(--ink); font-weight: 600; }
.chart-hint { margin-top: var(--space-sm); text-align: center; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 8px; vertical-align: middle;
  box-shadow: 0 0 0 0 var(--ok); animation: pulse 1.6s ease-out infinite; }
.badge .live-dot { margin: 0 2px 0 0; width: 6px; height: 6px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.45); } 100% { box-shadow: 0 0 0 8px rgba(21, 128, 61, 0); } }
.order-row .order-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pad { padding: var(--space-lg); }
.alerts-banner { margin-bottom: var(--space-md); }
.alerts-banner .btn { flex: none; }

/* ── Orders ─────────────────────────────────────────────────────────────────────────────────────────── */
.orders-layout { display: block; }
.orders-detail-pane { display: none; }
.orders-layout.has-detail .orders-list-pane { display: none; }
.orders-layout.has-detail .orders-detail-pane { display: block; }
@media (min-width: 1100px) {
  .orders-layout { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
  .orders-layout .orders-list-pane, .orders-layout.has-detail .orders-list-pane { display: block; }
  .orders-layout .orders-detail-pane { display: block; position: sticky; top: var(--space-lg); max-height: calc(100vh - 2 * var(--space-lg)); overflow: auto; padding-right: 4px; }
  .detail-back { display: none; }
}
.orders-count { display: flex; align-items: center; gap: var(--space-sm); }
.search-box { position: relative; display: block; margin-bottom: var(--space-md); }
.search-box .ico { position: absolute; left: 16px; top: 50%; margin-top: -11px; color: var(--ink-faint); pointer-events: none; }
.search-box .input { padding-left: 46px; border-radius: var(--radius-pill); background: var(--card); }
.filter-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: var(--space-md); scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips .chip { flex: none; }
.orders-list { display: flex; flex-direction: column; gap: var(--space-md); }
.order-card { display: flex; flex-direction: column; gap: var(--space-sm); width: 100%; text-align: left; border: 2px solid transparent; font: inherit; color: inherit; cursor: pointer; }
.order-card:hover { border-color: var(--rule); }
.order-card.selected { border-color: var(--ink); }
.order-head { display: flex; align-items: center; gap: var(--space-md); min-width: 0; }
.order-head .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-items { font-size: 14px; line-height: 20px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.order-note { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; }
.order-note.warn { color: var(--warn); }
.order-note.alarm { color: var(--alarm); }
.order-note .ico { width: 16px; height: 16px; }
.order-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding-top: var(--space-sm); border-top: 1px solid var(--rule); }
.struck { text-decoration: line-through; color: var(--ink-faint); }
.more-box { display: flex; justify-content: center; padding: var(--space-lg) 0; min-height: 40px; }
.badge.lg { height: 28px; padding: 0 12px; font-size: 12px; }
.avatar.alt { background: var(--sunken); color: var(--ink-soft); }
.detail-card { margin-top: var(--space-md); }
.detail-empty { margin-top: 0; }
.status-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hero-amount { font: 700 26px/32px var(--font); }
.banner.block { align-items: flex-start; margin-top: var(--space-md); }
.banner.block p + p { margin-top: 4px; }
.person-row { display: flex; align-items: center; gap: var(--space-md); }
.person-row .main { display: flex; flex-direction: column; min-width: 0; }
.person-head { display: flex; justify-content: space-between; gap: var(--space-md); padding: var(--space-md) 0 4px; margin-top: var(--space-sm); border-top: 1px solid var(--rule); }
.item-row { display: flex; gap: var(--space-md); padding: var(--space-md) 0; }
.item-row + .item-row { border-top: 1px solid var(--rule); }
.item-pic { position: relative; width: 56px; height: 56px; border-radius: var(--radius-chip); overflow: hidden; background: var(--sunken); flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--ink-faint); }
.item-pic img { width: 100%; height: 100%; object-fit: cover; }
.item-pic.dim img { opacity: 0.4; }
.item-pic-x { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); color: #fff; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.item-top { display: flex; gap: var(--space-sm); width: 100%; align-items: baseline; font-weight: 500; }
.item-qty { flex: none; font-weight: 700; }
.item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-top.struck { text-decoration: line-through; color: var(--ink-faint); }
.repl-box { width: 100%; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-inner); background: var(--ok-soft); margin-top: 4px; }
.note-box { display: flex; gap: 6px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-inner); font-size: 13px; line-height: 18px; width: 100%; }
.note-box.warn { background: var(--warn-soft); color: var(--ink); }
.note-box.warn .ico { color: var(--warn); width: 16px; height: 16px; flex: none; margin-top: 1px; }
.note-box.dim { opacity: 0.6; }
.sum-row { display: flex; justify-content: space-between; gap: var(--space-md); padding: 6px 0; font-size: 14px; }
.sum-row.muted { color: var(--ink-soft); }
.sum-row.bold { font-weight: 700; font-size: 15px; }
.detail-card hr { border: none; border-top: 1px solid var(--rule); margin: 6px 0; }
.chip.static { cursor: default; }
.screen-header .main { flex: 1; min-width: 0; }
.screen-header h1 { font-size: 20px; line-height: 26px; font-weight: 700; }

/* A screen's title gets focus after navigation (for screen readers); no outline for that. */
h1[tabindex='-1']:focus { outline: none; }
@media (min-width: 1100px) { .orders-detail-pane .screen-header { margin-left: 0; } }
a.btn { text-decoration: none; }
