/* ── Theme tokens ─────────────────────────────────────────────────────
   One dark palette, carrying the American Reclamation brand red.

   The website (american-reclamation.com) is white with #A6192E crimson, but
   it lightens that red to #E9737F on its own dark sections — dark crimson on
   a near-black ground is unreadable. The app is dark throughout, so it uses
   the same two reds the site does: #E9737F for text, icons and rules, and
   #C8102E for solid fills with white on top. */

:root {
  /* Grounds and ink come straight from the website's dark sections:
     --ink #0C0F11, --ink-2 #14181B, --ink-3 #1D2226, with near-white text.
     The design system's original grounds were blue-tinted navy, which read as
     a different brand next to the site's neutral near-black. */
  --ink-rgb: 236, 238, 239;      /* the site's --paper-3, used as on-dark text */
  --accent-rgb: 233, 115, 127;   /* the brand red, as the site uses it on dark */
  --ok-rgb: 127, 184, 160;
  --warn-rgb: 217, 177, 132;
  --danger-rgb: 217, 154, 132;
  --muted-rgb: 155, 165, 171;    /* the site's --muted-d */
  --ground-rgb: 12, 15, 17;

  --ground: #0C0F11;
  --brand: #E9737F;              /* lines, icons, accents */
  --brand-ink: #E9737F;          /* accent text */
  --brand-solid: #C8102E;        /* solid fills — buttons, meters, chips */
  --brand-hover: #D8394C;
  --on-brand: #FFFFFF;           /* text on a solid fill */
  --ok: #8fcdb3;
  --warn: #d9b184;
  --danger: #d99a84;
  --muted-ink: #9BA5AB;
  --text-faint: #9BA5AB;
  --text-faintest: #5D666C;

  --radius-card: 14px;
  --radius-ctl: 8px;
  --card-shadow: none;

  /* Design-system tokens the components read directly. */
  --color-bg: #14181B;           /* cards and panels — the site's --ink-2 */
  --color-surface: #1D2226;      /* inputs and secondary fills — --ink-3 */
  --color-text: #ECEEEF;
  --color-accent: #E9737F;
  --color-accent-200: #F3A3AB;
  --color-accent-300: #EE8B95;
  --color-accent-400: #D8394C;
}

/* Application layer on top of the Nocturne design system.
   Everything here takes its colours, spacing and radii from nocturne.css
   variables — no new palette. */

:root {
  --pill-accent-bg: rgba(var(--accent-rgb), .16);
  --pill-accent-fg: var(--brand-ink);
  --pill-green-bg: rgba(var(--ok-rgb), .15);
  --pill-green-fg: var(--ok);
  --pill-amber-bg: rgba(var(--warn-rgb), .15);
  --pill-amber-fg: var(--warn);
  --pill-muted-bg: rgba(var(--muted-rgb), .14);
  --pill-muted-fg: var(--muted-ink);
  --hairline: rgba(var(--ink-rgb), .10);
  --hairline-strong: rgba(var(--ink-rgb), .18);
  --nav-h: 62px;
  --shell-max: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--ground); }
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-300, var(--brand-ink)); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
.scroll::-webkit-scrollbar { width: 0; height: 0; }
.scroll { scrollbar-width: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Boot ─────────────────────────────────────────────────────────── */
.app-loading { display: grid; place-items: center; min-height: 100dvh; }
.boot { text-align: center; color: var(--color-neutral-500, var(--text-faint)); }
.boot svg { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

/* ── Sign in ──────────────────────────────────────────────────────── */
.auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.auth-card {
  width: min(400px, 100%); background: var(--color-bg);
  border: 1px solid var(--hairline); border-radius: var(--radius-card);
  padding: 30px 26px; box-shadow: var(--shadow-md);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand h1 { font-size: 17px; margin: 0; letter-spacing: .01em; }
.auth-brand .sub { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--color-accent); }
.auth-hint {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline);
  font-size: 12px; line-height: 1.6; color: rgba(var(--ink-rgb), .5);
}

/* ── Shell ────────────────────────────────────────────────────────── */
.shell { min-height: 100dvh; display: flex; flex-direction: column; background: var(--ground); }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; background: rgba(var(--ground-rgb), .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.topbar .brand small {
  display: block; font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--color-accent); font-weight: 500;
}
.topbar .spacer { flex: 1; }

.icon-btn {
  /* Positioned so the unread .dot is contained. Without this the dot resolves
     against a far-off ancestor and drags the page's scroll width with it. */
  position: relative;
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--radius-ctl); border: 1px solid transparent;
  background: transparent; color: rgba(var(--ink-rgb), .72); font-size: 18px;
}
.icon-btn:hover { background: rgba(var(--ink-rgb), .07); color: var(--color-text); }
.icon-btn:active { background: rgba(var(--accent-rgb), .2); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--brand-solid);
}

.desknav { display: none; gap: 4px; }
.desknav a {
  padding: 7px 13px; border-radius: var(--radius-ctl); font-size: 13px;
  color: rgba(var(--ink-rgb), .62); font-weight: 500;
}
.desknav a:hover { background: rgba(var(--ink-rgb), .06); color: var(--color-text); }
.desknav a.active { background: rgba(var(--accent-rgb), .14); color: var(--pill-accent-fg); }

.main { flex: 1; min-width: 0; width: 100%; max-width: var(--shell-max); margin: 0 auto; padding: 18px 16px 96px; }
.main.wide { max-width: 1400px; }

/* Bottom tab bar — the phone surface */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: rgba(var(--ground-rgb), .95); backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tabbar a {
  display: grid; justify-items: center; gap: 3px; padding: 5px 0;
  font-size: 10px; color: var(--color-neutral-600, var(--text-faint)); font-weight: 500;
  border-radius: var(--radius-ctl);
}
.tabbar a i { font-size: 21px; }
.tabbar a.active { color: var(--color-accent); }
.tabbar a:hover { color: var(--color-text); }

@media (min-width: 860px) {
  .desknav { display: flex; }
  .tabbar { display: none; }
  .main { padding: 26px 24px 60px; }
}

/* ── Type & layout primitives ─────────────────────────────────────── */
.page-title { font-size: 23px; margin: 4px 0 2px; }
.page-sub { font-size: 13px; color: rgba(var(--ink-rgb), .55); margin: 0 0 18px; }
.kicker {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(var(--ink-rgb), .42); margin: 22px 0 10px; font-weight: 600;
}
.kicker:first-child { margin-top: 0; }
.muted { color: rgba(var(--ink-rgb), .55); }
.small { font-size: 12px; }
.stack { display: grid; gap: 10px; }
.stack-lg { display: grid; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; gap: 12px; }
.grid-3 { display: grid; gap: 12px; }
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.split { display: grid; gap: 18px; }
@media (min-width: 980px) { .split { grid-template-columns: 1.35fr 1fr; align-items: start; } }

/* ── Surfaces ─────────────────────────────────────────────────────── */
.panel {
  background: var(--color-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); padding: 16px;
}
.panel.tight { padding: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { font-size: 15px; margin: 0; }

.tile {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--color-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); padding: 13px 14px; color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.tile:hover { border-color: var(--hairline-strong); background: var(--color-surface); }
.tile:active { border-color: var(--color-accent); }
.tile .glyph {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px;
  border-radius: 11px; background: rgba(var(--accent-rgb), .13); color: var(--color-accent);
  font-size: 19px;
}
.tile .body { flex: 1; min-width: 0; }
.tile .body strong { display: block; font-size: 14px; font-weight: 600; }
.tile .body span { display: block; font-size: 12px; color: rgba(var(--ink-rgb), .5); margin-top: 2px; }
.tile .trail { flex: none; text-align: right; font-size: 13px; }
.tile .chev { color: rgba(var(--ink-rgb), .3); font-size: 16px; }

.selectable {
  display: flex; gap: 12px; width: 100%; text-align: left; align-items: flex-start;
  background: var(--color-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); padding: 14px; color: inherit;
}
.selectable:hover { background: var(--color-surface); }
.selectable.on { border-color: var(--color-accent); background: rgba(var(--accent-rgb), .07); }
.selectable .mark { font-size: 20px; color: var(--color-neutral-700, var(--text-faintest)); flex: none; margin-top: 1px; }
.selectable.on .mark { color: var(--color-accent); }
.selectable strong { display: block; font-size: 14px; font-weight: 600; }
.selectable span { display: block; font-size: 12px; color: rgba(var(--ink-rgb), .5); margin-top: 3px; line-height: 1.5; }
.selectable .rate { font-size: 12px; color: var(--pill-accent-fg); margin-top: 6px; display: block; }

/* ── Pills, chips, stats ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 100px; font-size: 11px; font-weight: 600;
  background: var(--pill-muted-bg); color: var(--pill-muted-fg); white-space: nowrap;
}
.pill.accent { background: var(--pill-accent-bg); color: var(--pill-accent-fg); }
.pill.green { background: var(--pill-green-bg); color: var(--pill-green-fg); }
.pill.amber { background: var(--pill-amber-bg); color: var(--pill-amber-fg); }

.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 100px; font-size: 12px; font-weight: 500;
  background: var(--color-surface); border: 1px solid var(--hairline);
  color: rgba(var(--ink-rgb), .7);
}
.chip:hover { border-color: var(--hairline-strong); color: var(--color-text); }
.chip.on { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); }

.stat { background: var(--color-bg); border: 1px solid var(--hairline); border-radius: var(--radius-card); padding: 14px; }
.stat .label { font-size: 11px; color: rgba(var(--ink-rgb), .5); }
.stat .value { font-size: 21px; margin: 5px 0 1px; font-family: var(--font-heading); }
.stat .sub { font-size: 11px; color: rgba(var(--ink-rgb), .4); }
.stat.positive .value { color: var(--pill-green-fg); }

.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.kpi { background: var(--color-bg); border: 1px solid var(--hairline); border-radius: var(--radius-card); padding: 13px; }
.kpi i { font-size: 17px; color: var(--color-accent); }
.kpi .v { font-size: 22px; font-family: var(--font-heading); margin: 6px 0 1px; }
.kpi .l { font-size: 12px; }
.kpi .s { font-size: 10px; color: rgba(var(--ink-rgb), .4); }

/* ── Meters ───────────────────────────────────────────────────────── */
.meter { height: 7px; border-radius: 100px; background: rgba(var(--ink-rgb), .09); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 100px; background: var(--brand-solid); transition: width .3s ease; }
.meter.due > i { background: var(--warn); }
.meter.thin { height: 5px; }

/* ── Forms ────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; color: rgba(var(--ink-rgb), .62); font-weight: 500; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; font-size: 14px;
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--hairline); border-radius: var(--radius-ctl);
  caret-color: var(--color-accent);
}
.input::placeholder { color: rgba(var(--ink-rgb), .32); }
.input:focus { border-color: var(--color-accent); outline: none; }
textarea.input { min-height: 92px; resize: vertical; line-height: 1.55; }
.field-error { font-size: 12px; color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-ctl); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; background: transparent; color: var(--color-text);
  transition: background .12s ease, border-color .12s ease;
}
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { border-color: var(--color-accent); color: var(--pill-accent-fg); }
.btn-primary:hover { background: rgba(var(--accent-rgb), .12); }
.btn-primary:active { background: rgba(var(--accent-rgb), .22); }
.btn-solid { background: var(--brand-solid); color: var(--on-brand); border-color: var(--brand-solid); }
.btn-solid:hover { background: var(--color-accent-400, var(--brand-hover)); }
.btn-secondary { border-color: var(--hairline-strong); color: rgba(var(--ink-rgb), .8); }
.btn-secondary:hover { background: rgba(var(--ink-rgb), .06); }
.btn-ghost { color: var(--color-accent); padding-inline: 6px; }
.btn-danger { border-color: rgba(var(--danger-rgb), .5); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

/* ── Wizard ───────────────────────────────────────────────────────── */
.steps { display: grid; grid-auto-flow: column; gap: 5px; margin-bottom: 18px; }
.steps i { height: 3px; border-radius: 100px; background: rgba(var(--ink-rgb), .12); }
.steps i.on { background: var(--brand-solid); }
.wizard-actions {
  position: sticky; bottom: calc(var(--nav-h) + 8px); z-index: 20;
  display: flex; gap: 10px; margin-top: 22px; padding: 12px 0;
  background: linear-gradient(to top, var(--ground) 62%, transparent);
}
@media (min-width: 860px) { .wizard-actions { bottom: 0; } }

.estimate {
  background: rgba(var(--accent-rgb), .08); border: 1px solid rgba(var(--accent-rgb), .28);
  border-radius: var(--radius-card); padding: 15px;
}
.estimate .line { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 5px 0; }
.estimate .total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid rgba(var(--accent-rgb), .24);
}
.estimate .total b { font-size: 24px; font-family: var(--font-heading); font-weight: 500; color: var(--pill-accent-fg); }

/* ── Detail rows ──────────────────────────────────────────────────── */
.rows { display: grid; }
.rows > div {
  display: flex; justify-content: space-between; gap: 14px; padding: 11px 0;
  border-bottom: 1px solid var(--hairline); font-size: 13px;
}
.rows > div:last-child { border-bottom: 0; }
.rows .k { color: rgba(var(--ink-rgb), .5); }
.rows .v { text-align: right; }
.breakdown > div { display: flex; justify-content: space-between; padding: 9px 0; font-size: 13px; }
.breakdown .total {
  margin-top: 4px; padding: 12px; border-radius: var(--radius-ctl);
  background: rgba(var(--ok-rgb), .1); color: var(--pill-green-fg); font-weight: 600;
}

/* ── Messages ─────────────────────────────────────────────────────── */
.thread { display: grid; gap: 10px; padding: 6px 0 14px; }
.bubble { max-width: 78%; padding: 10px 13px; font-size: 13.5px; line-height: 1.5; border-radius: 15px; }
.bubble.them { justify-self: start; background: var(--color-surface); border-bottom-left-radius: 5px; }
.bubble.mine { justify-self: end; background: var(--brand-solid); color: var(--on-brand); border-bottom-right-radius: 5px; }
.bubble .who { display: block; font-size: 10.5px; opacity: .6; margin-bottom: 3px; font-weight: 600; }
.bubble .when { display: block; font-size: 10px; opacity: .55; margin-top: 4px; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; padding: 10px 0; background: var(--ground); }
.composer textarea { min-height: 44px; max-height: 130px; }

/* ── Cart ─────────────────────────────────────────────────────────── */
.product { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.product:last-child { border-bottom: 0; }
.product .glyph {
  display: grid; place-items: center; flex: none; width: 42px; height: 42px;
  border-radius: 11px; background: var(--color-surface); color: var(--color-accent); font-size: 20px;
}
.product .info { flex: 1; min-width: 0; }
.product .info strong { font-size: 14px; }
.product .info .spec { font-size: 12px; color: rgba(var(--ink-rgb), .5); margin-top: 2px; }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.size {
  padding: 5px 10px; border-radius: var(--radius-ctl); font-size: 11.5px;
  border: 1px solid var(--hairline-strong); background: transparent; color: rgba(var(--ink-rgb), .72);
}
.size.on { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 30px; height: 30px; border-radius: 9px; font-size: 15px;
  border: 1px solid var(--hairline-strong); background: transparent; color: var(--color-text);
}
.qty button:hover { border-color: var(--color-accent); color: var(--pill-accent-fg); }
.qty .n { min-width: 20px; text-align: center; font-size: 14px; font-weight: 600; }
.vendor-note {
  font-size: 11.5px; color: rgba(var(--ink-rgb), .45); line-height: 1.55;
  padding: 11px; border-radius: var(--radius-ctl); background: rgba(var(--ink-rgb), .03);
  border: 1px solid var(--hairline);
}

/* ── Overlay sheets & dialogs ─────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(var(--ground-rgb), .72);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .16s ease;
}
@media (min-width: 700px) { .backdrop { align-items: center; padding: 24px; } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--color-bg); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-card) var(--radius-lg) 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); animation: rise .2s ease;
}
@media (min-width: 700px) { .sheet { border-radius: var(--radius-card); padding-bottom: 22px; } }
@keyframes rise { from { transform: translateY(18px); opacity: .4 } to { transform: none; opacity: 1 } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 18px; margin: 0 0 3px; }
.sheet-head .sub { font-size: 12.5px; color: rgba(var(--ink-rgb), .5); }

/* ── Toast ────────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); z-index: 200;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: min(440px, calc(100vw - 32px));
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast .msg {
  padding: 11px 16px; border-radius: 100px; font-size: 13px; font-weight: 500;
  background: var(--color-surface); border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-md);
}
#toast .msg.error { border-color: rgba(var(--danger-rgb), .55); color: var(--danger); }
#toast .msg.good { border-color: rgba(var(--ok-rgb), .5); color: var(--pill-green-fg); }
@media (min-width: 860px) { #toast { bottom: 26px; } }

/* ── Empty & loading states ───────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: rgba(var(--ink-rgb), .42); }
.empty i { font-size: 30px; display: block; margin-bottom: 10px; opacity: .55; }
.empty p { font-size: 13px; margin: 0; }
.skeleton { display: grid; gap: 10px; }
.skeleton > i {
  display: block; height: 62px; border-radius: var(--radius-card);
  background: linear-gradient(90deg, rgba(var(--ink-rgb), .04), rgba(var(--ink-rgb), .08), rgba(var(--ink-rgb), .04));
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ── Admin ────────────────────────────────────────────────────────── */
.admin-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .admin-layout { grid-template-columns: 300px 1fr; align-items: start; } }
.list-panel { background: var(--color-bg); border: 1px solid var(--hairline); border-radius: var(--radius-card); overflow: hidden; }
.list-panel button {
  display: flex; gap: 11px; width: 100%; text-align: left; padding: 13px 14px;
  background: transparent; border: 0; border-bottom: 1px solid var(--hairline); color: inherit;
}
.list-panel button:last-child { border-bottom: 0; }
.list-panel button:hover { background: var(--color-surface); }
.list-panel button.on { background: rgba(var(--accent-rgb), .12); }
.avatar {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(var(--accent-rgb), .16); color: var(--pill-accent-fg); font-size: 12px; font-weight: 700;
}
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
table.data th {
  text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(var(--ink-rgb), .42); font-weight: 600; padding: 9px 12px;
  border-bottom: 1px solid var(--hairline-strong);
}
table.data td { padding: 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(var(--ink-rgb), .025); }

.routemap {
  width: 100%; border-radius: var(--radius-card); background: var(--color-surface);
  border: 1px solid var(--hairline); display: block;
}
.routemap .leg { stroke: var(--color-accent); stroke-width: .7; fill: none; stroke-dasharray: 2 1.6; }
.routemap .stop { fill: var(--color-accent); }
.routemap .stop-n { fill: var(--on-brand); font-size: 2.6px; font-weight: 700; text-anchor: middle; }
.routemap .depot { fill: none; stroke: var(--warn); stroke-width: .8; }
.routemap .depot-label { fill: var(--warn); font-size: 2.4px; text-anchor: middle; }

.itinerary { display: grid; gap: 2px; }
.itinerary .stop-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hairline); }
.itinerary .stop-row:last-child { border-bottom: 0; }
.itinerary .n {
  display: grid; place-items: center; flex: none; width: 25px; height: 25px; border-radius: 8px;
  background: var(--brand-solid); color: var(--on-brand); font-size: 12px; font-weight: 700;
}

/* Respect reduced-motion for every animation above. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Narrow-screen swaps ──────────────────────────────────────────────
   Some layouts genuinely cannot compress: a seven-column data table on a
   375px phone is unreadable however it is styled. Those views render twice
   — stacked cards for phones, the table for wider screens — and these two
   rules pick one. */
.only-narrow { display: grid; }
.only-wide { display: none; }

@media (min-width: 820px) {
  .only-narrow { display: none; }
  .only-wide { display: block; }
}

/* ── Installed to the home screen ─────────────────────────────────────
   In standalone mode there is no browser chrome, so the header sits under
   the notch and the tab bar under the home indicator. These pad for both;
   on a normal browser tab the insets are zero and nothing changes. */
.topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
.main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

@media (display-mode: standalone) {
  /* No pull-to-refresh bounce revealing a white gap behind the app. */
  html, body { overscroll-behavior-y: none; background: var(--ground); }
}
