:root {
  color-scheme: light dark;
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --ink: #0b1220;
  --ink-2: #475467;
  --line: #d6dae1;
  --primary: #0b1220;
  --on-primary: #ffffff;
  --accent: #0a7d4f;
  --accent-soft: #e0f4ea;
  --warn: #9a3412;
  --warn-soft: #ffedd5;
  --danger: #b42318;
  --focus: #1d4ed8;
  --shadow: 0 1px 2px rgb(16 24 40 / 8%), 0 4px 14px rgb(16 24 40 / 6%);
  --radius: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* set by app.js */
  --kb: 0px;
  --dock-h: 0px;
  --bar-h: 0px;
  /* layout */
  --col-w: 712px; /* one phone-style column (680 + gutters) */
  --side-w: 440px;
  --zoom: 1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --surface: #161a22;
    --surface-2: #1d222c;
    --ink: #f2f4f7;
    --ink-2: #a4adbb;
    --line: #2b3240;
    --primary: #f2f4f7;
    --on-primary: #0b0d12;
    --accent: #4ade9a;
    --accent-soft: #11301f;
    --warn: #fdba74;
    --warn-soft: #3a2410;
    --danger: #ff8a80;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 80px);
  scroll-padding-bottom: calc(var(--dock-h) + var(--kb) + 24px);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: calc(100dvh / var(--zoom));
  padding-bottom: calc(var(--dock-h) + var(--kb));
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.35 var(--font);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 8vw, 40px); line-height: 1.05; font-weight: 850; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 1.15; font-weight: 800; }
h1:focus, h2:focus { outline: none; }

/* ---------- Shell ---------- */
.app { max-width: var(--col-w); margin: 0 auto; padding: 0 calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); }
.layout { display: block; }
.main { padding: 14px 0 24px; outline: none; }
.side { padding: 14px 0 24px; }
body[data-view="list"] .main { display: none; }
.view { display: flex; flex-direction: column; gap: 14px; }
.loading { color: var(--ink-2); padding: 40px 0; }
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.hint { color: var(--ink-2); font-weight: 600; }

/* ---------- Header bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar-in {
  max-width: var(--col-w); margin: 0 auto;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) calc(16px + var(--safe-r)) 8px calc(16px + var(--safe-l));
}
.bar-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.bar-home { width: 48px; padding: 0; justify-content: center; }
.bar-home .chev { font-size: 32px; line-height: 1; margin-top: -4px; }
.bar-spot {
  display: flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 52px; min-width: 0; text-align: left;
  padding: 4px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
}
.bar-spot.static { border-color: transparent; background: transparent; padding-left: 4px; }
.bar-spot-name { font-size: 22px; font-weight: 850; line-height: 1.1; overflow-wrap: anywhere; }
.bar-kicker { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.caret { color: var(--ink-2); font-weight: 600; }
.badge { min-width: 28px; height: 28px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 15px; }
.bar-list, .bar-total { flex-direction: column; justify-content: center; gap: 2px; padding: 4px 10px; min-width: 64px; }
.bar-total { display: flex; align-items: center; min-height: 52px; }
.bar-list:disabled { opacity: 0.55; cursor: default; }
.bar-list-label { font-size: 11px; font-weight: 800; color: var(--ink-2); line-height: 1; white-space: nowrap; }

/* ---------- Buttons / inputs ---------- */
.primary, .secondary {
  min-height: 56px; padding: 0 20px; border-radius: 16px; font-weight: 800; font-size: 18px; line-height: 1.15;
  border: 2px solid var(--primary); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.primary { background: var(--primary); color: var(--on-primary); }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.secondary:disabled { color: var(--ink-2); background: var(--surface-2); border-style: dashed; cursor: not-allowed; }
.primary:active:not(:disabled), .secondary:active:not(:disabled) { transform: scale(0.985); }
.xl { min-height: 72px; width: 100%; font-size: 23px; flex-direction: column; gap: 2px; border-radius: 20px; }
.xl small { font-size: 14px; font-weight: 600; opacity: 0.85; display: block; line-height: 1.2; }
.big { width: 100%; }
.link { background: none; border: 0; padding: 12px 4px; min-height: 48px; color: var(--ink-2); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 15px; }
.field.grow { flex: 1; }
input[type="text"], input[type="search"], input[type="date"], select {
  width: 100%; min-height: 56px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 18px; font-weight: 600;
}
input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }

/* ---------- Bottom dock (the one place actions live) ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: var(--kb); z-index: 30;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 10px 0 calc(10px + var(--safe-b));
}
.dock-in { max-width: var(--col-w); margin: 0 auto; padding: 0 calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); }
.dock-hint { text-align: center; font-size: 15px; font-weight: 700; color: var(--warn); padding: 0 0 8px; }
/* Buttons never wrap their label: they share the row, and drop to a second row only if they truly cannot fit. */
.dock-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dock-actions > * { flex: 1 1 0; min-width: max-content; white-space: nowrap; }
.dock-actions .primary, .dock-actions .secondary { min-height: 60px; padding: 0 14px; }
.dock-actions .xl { min-height: 68px; }
body[data-view="amount"] .dock-actions > .save { flex-grow: 2; }
body[data-view="finish"] .dock-actions > .primary { flex-grow: 1.4; }
body[data-view="list"] .dock-actions > .primary:first-child:not(:only-child) { flex-grow: 1.4; }
.side-actions > * { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.save { font-size: 21px; }

/* ---------- Start ---------- */
.q { margin-top: 10px; font-size: 20px; }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pick {
  min-height: 60px; padding: 0 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  font-weight: 800; font-size: 19px;
}
.pick.on, .chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pick:disabled { opacity: 0.45; cursor: default; }
.greyed { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-height: 52px; padding: 0 20px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 17px; }
.quiet-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.date-note { color: var(--ink-2); font-size: 15px; font-weight: 600; }
.notice { padding: 14px 16px; border-radius: 14px; font-size: 16px; }
.notice.good { background: var(--accent-soft); color: var(--accent); }
.notice.finished { display: flex; flex-direction: column; gap: 4px; font-size: 17px; padding: 18px; }
.notice.finished strong { font-size: 24px; line-height: 1.1; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.warn.soft { font-weight: 600; }
.stray-remove { width: 100%; margin: 0 0 8px; }

.start-body { display: flex; flex-direction: column; gap: 14px; }
.start-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.start-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 20px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); }
.start-card.continue { border-color: var(--accent); background: var(--accent-soft); }
.start-card.fresh { display: none; }
.start-card-title { font-size: 24px; line-height: 1.1; font-weight: 850; }
.start-card.continue .eyebrow, .start-card.continue .start-facts { color: var(--accent); }
.start-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 700; color: var(--ink-2); }
.start-card .dock-hint { padding: 8px 0 0; text-align: left; }
.start-card .xl { margin-top: 10px; }

/* ---------- Where ---------- */
.where-area { display: flex; flex-direction: column; gap: 10px; }
.area-title { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-top: 6px; }
.where-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.where-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-height: 84px; padding: 12px 52px 12px 20px; text-align: left; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
}
.where-btn.current { border-color: var(--primary); }
.where-btn.done { background: var(--accent-soft); border-color: transparent; }
.where-name { font-size: 24px; font-weight: 850; line-height: 1.1; }
.where-meta { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.where-btn.done .where-meta { color: var(--accent); }
.where-check { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 28px; font-weight: 900; color: var(--accent); }

/* ---------- Search ---------- */
.search-box { position: sticky; top: var(--bar-h); z-index: 10; padding: 8px 0; background: var(--bg); }
.search-box input { min-height: 64px; padding: 0 56px 0 20px; font-size: 22px; font-weight: 700; border-radius: 18px; -webkit-appearance: none; appearance: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 6px; top: 14px; width: 52px; height: 52px; border: 0; border-radius: 50%; background: transparent; font-size: 30px; color: var(--ink-2); }
.results { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
.res-head { grid-column: 1 / -1; font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-top: 6px; }
.res-count { font-weight: 700; }
.card {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 10px 14px 10px 14px; text-align: left;
  border-radius: var(--radius); border: 2px solid transparent; background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  box-shadow: var(--shadow); position: relative;
}
.card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 5px; border-radius: 0 4px 4px 0; background: var(--brand); }
.card.counted { border-color: var(--accent); }
button.card:active { transform: scale(0.99); }
.card.multi { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 12px 12px 16px; }
.card-top { display: flex; align-items: center; gap: 14px; }
.tile { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 20px; letter-spacing: -0.02em; }
.tile.lg { width: 64px; height: 64px; font-size: 25px; border-radius: 18px; }
.tile.sm { width: 40px; height: 40px; font-size: 16px; border-radius: 12px; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-name { font-size: 21px; font-weight: 850; line-height: 1.12; overflow-wrap: anywhere; }
.card-meta { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.card-meta:empty { display: none; }
.fmt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fmt-btn {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 16px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 17px; line-height: 1.1;
}
.fmt-btn:active { transform: scale(0.98); }
.fmt-btn.has { border-color: var(--accent); }
.fmt-btn b { font-weight: 900; padding: 1px 9px; border-radius: 999px; background: var(--accent); color: var(--bg); font-size: 15px; }
.card-go { color: var(--ink-2); font-size: 30px; line-height: 1; }
.card-saved { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; color: var(--accent); }
.card-saved b { font-size: 26px; font-weight: 900; }
.card-saved small { font-size: 12px; font-weight: 700; }
.search-extra { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 12px; }
.no-match { display: flex; flex-direction: column; align-items: stretch; gap: 10px; color: var(--ink-2); font-weight: 600; padding: 4px 0; }
.more-note { color: var(--ink-2); text-align: center; padding: 8px; grid-column: 1 / -1; }

/* ---------- Format (fallback) ---------- */
.format-head { display: flex; align-items: center; gap: 14px; }
.format-list { display: grid; gap: 12px; }
.format-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 80px; padding: 12px 20px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.format-btn.counted { border-color: var(--accent); }
.format-name { font-size: 24px; font-weight: 850; }

/* ---------- Amount ---------- */
.amount-head { display: flex; align-items: center; gap: 14px; }
.amount-titles { min-width: 0; }
.amount-sub { color: var(--ink-2); font-weight: 600; font-size: 15px; margin-top: 2px; }
.amount-sub.recount { color: var(--accent); font-weight: 700; font-size: 17px; }
.custom-fields { display: flex; flex-direction: column; gap: 12px; }
.amount-top { display: flex; flex-direction: column; gap: 14px; }
.total { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); min-height: 104px; justify-content: center; }
.total-main { font-size: 22px; font-weight: 700; color: var(--ink-2); }
.total-main b { font-size: 54px; font-weight: 900; color: var(--ink); line-height: 1; letter-spacing: -0.03em; }
.total-sentence { font-size: 17px; font-weight: 700; color: var(--accent); min-height: 1.4em; }
.stepper { display: grid; grid-template-columns: 84px 1fr 84px; gap: 10px; }
.step { min-height: 84px; border-radius: 20px; border: 2px solid var(--primary); background: var(--primary); color: var(--on-primary); font-size: 44px; font-weight: 600; line-height: 1; }
.step:first-child { background: var(--surface); color: var(--ink); border-color: var(--line); }
.step:active { transform: scale(0.96); }
.stepper-input input { min-height: 84px; text-align: center; font-size: 42px; font-weight: 900; border-radius: 20px; padding: 0 8px; }
.stepper-cap { text-align: center; color: var(--ink-2); font-weight: 600; font-size: 14px; margin-top: 6px; }
.total-sentence { color: var(--ink-2); }
.weight-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.weight-row input { min-height: 84px; font-size: 40px; font-weight: 900; text-align: center; }
.weight-row select { min-height: 84px; font-size: 24px; font-weight: 800; }
.cases { display: flex; flex-direction: column; gap: 10px; }
.case-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.case-cell { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 6px; }
.case-add {
  position: relative; min-height: 64px; padding: 0 6px; border-radius: 16px; border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent);
  font-weight: 850; font-size: 17px; line-height: 1.1; display: flex; align-items: center; justify-content: center; gap: 4px; text-align: center;
}
.case-cell.on .case-add { background: var(--accent); color: var(--bg); }
.case-add .plus { font-size: 24px; font-weight: 900; }
.case-short { display: none; }
.case-long, .case-short { white-space: nowrap; }
.case-n { position: absolute; top: -9px; right: -4px; min-width: 28px; padding: 1px 7px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 900; line-height: 1.3; }
.case-n:empty { display: none; }
.case-minus { border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-size: 26px; font-weight: 700; }
.case-minus:disabled { opacity: 0.4; cursor: default; }
.other-size { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.other-size input { min-height: 56px; }
.other-size .secondary { min-height: 56px; font-size: 16px; padding: 0 16px; }
.more { display: flex; flex-direction: column; align-items: flex-start; }
.more-body { width: 100%; display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 700; }
.check input { width: 28px; height: 28px; accent-color: var(--primary); }
.custom-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

/* ---------- List / side ---------- */
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.side-count { color: var(--ink-2); font-weight: 700; }
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.entry { display: grid; grid-template-columns: 1fr 52px; gap: 6px; }
.entry-main { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 12px; text-align: left; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); width: 100%; }
.entry-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-name { font-weight: 800; font-size: 17px; line-height: 1.15; overflow-wrap: anywhere; }
.entry-note { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.entry-amt { flex: none; font-weight: 900; font-size: 18px; text-align: right; }
.icon-btn { border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 28px; line-height: 1; color: var(--ink-2); }
.icon-btn.danger:hover, .icon-btn.danger:active { color: var(--danger); border-color: var(--danger); }
.empty { color: var(--ink-2); font-weight: 600; padding: 18px 0; }
.side-actions { display: none; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- Finish ---------- */
.finish-lead { font-size: 21px; line-height: 1.3; }
.finish-date { color: var(--ink-2); font-weight: 700; margin-top: -6px; }
.finish-sub { color: var(--ink-2); }
.zero-details { border-radius: 14px; background: var(--surface); padding: 4px 14px 12px; }
.zero-details summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; cursor: pointer; list-style: none; }
.zero-details summary::-webkit-details-marker { display: none; }
.chev-d { width: 10px; height: 10px; border-right: 3px solid var(--ink-2); border-bottom: 3px solid var(--ink-2); transform: rotate(45deg) translate(-2px, -2px); transition: transform 120ms; margin-right: 6px; }
.zero-details[open] .chev-d { transform: rotate(-135deg) translate(-2px, -2px); }
.zero-head { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin: 12px 0 4px; }
.zero-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; font-size: 15px; line-height: 1.25; }
.zero-list li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.zero-fmt { color: var(--ink-2); }
.zero-more { margin-top: 12px; min-height: 48px; width: 100%; }

/* ---------- Toast ---------- */
.toast-region { position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + var(--kb)); z-index: 50; padding: 0 calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); pointer-events: none; display: flex; justify-content: center; }
body.has-dock .toast-region { padding-bottom: 8px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 2px; width: 100%; max-width: 560px; min-height: 48px; padding: 0 2px 0 14px; border-radius: 14px; background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 28px rgb(0 0 0 / 30%); animation: rise 160ms ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast-text { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; line-height: 1.2; padding: 4px 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.toast-undo { min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--on-primary) 18%, transparent); color: inherit; font-weight: 850; text-decoration: underline; }
.toast-x { width: 40px; min-height: 44px; border: 0; background: transparent; color: inherit; font-size: 26px; opacity: 0.7; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Small phones ---------- */
@media (max-width: 359px) {
  .stepper { grid-template-columns: 68px 1fr 68px; }
  .pick { font-size: 17px; }
  .bar-spot-name { font-size: 20px; }
  .case-add { font-size: 15px; padding: 0 4px; }
  .case-add .plus { font-size: 20px; }
  .case-cell { grid-template-columns: minmax(0, 1fr) 44px; }
  .total-main b { font-size: 48px; }
}
@media (max-width: 440px) {
  .dock-actions .primary, .dock-actions .secondary { font-size: 16px; padding: 0 10px; }
  .dock-actions { gap: 8px; }
}
@media (max-width: 340px) {
  .dock-actions .primary, .dock-actions .secondary { font-size: 15px; padding: 0 6px; }
  .dock-actions { gap: 6px; }
  .toast-undo { padding: 0 8px; }
}
@media (max-width: 380px) {
  .case-long { display: none; }
  .case-short { display: inline; font-size: 20px; font-weight: 900; }
  .case-add .plus { font-size: 22px; }
}
@media (min-width: 560px) {
  .results { grid-template-columns: repeat(2, 1fr); }
  .where-grid { grid-template-columns: repeat(2, 1fr); }
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Short landscape (phones on their side) ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .bar-in { padding-top: calc(4px + var(--safe-t)); padding-bottom: 4px; gap: 6px; }
  .bar-btn, .bar-spot, .bar-total { min-height: 44px; }
  .bar-home { width: 44px; }
  .bar-spot { padding: 2px 10px; }
  .bar-spot-name { font-size: 18px; }
  .bar-spot-name, .bar-kicker { display: inline; }
  .bar-spot { display: block; }
  .bar-kicker { margin-left: 8px; }
  .bar-list, .bar-total { flex-direction: row; gap: 6px; padding: 2px 10px; }
  .main, .side { padding-top: 8px; padding-bottom: 12px; }
  .view { gap: 10px; }
  h1 { font-size: 26px; }
  .dock { padding-top: 6px; padding-bottom: calc(6px + var(--safe-b)); }
  .dock-actions .primary, .dock-actions .secondary { min-height: 48px; font-size: 17px; }
  .dock-actions .xl { min-height: 52px; flex-direction: row; gap: 12px; font-size: 19px; }
  .dock-actions .xl small { display: inline; }
  .amount-head .tile { width: 44px; height: 44px; font-size: 18px; }
  .amount-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; }
  .total { min-height: 0; padding: 8px 14px; }
  .total-main b { font-size: 40px; }
  .step, .stepper-input input { min-height: 60px; }
  .step { font-size: 36px; }
  .case-add, .case-minus { min-height: 52px; }
  .search-box input { min-height: 52px; font-size: 20px; }
  .search-clear { top: 10px; width: 44px; height: 44px; }
  .card { min-height: 64px; }
  .tile { width: 44px; height: 44px; }
  .where-btn { min-height: 68px; }
  .xl { min-height: 56px; }
}

/* ---------- iPad / desktop landscape: work column + counted list ---------- */
@media (min-width: 1000px) and (orientation: landscape) {
  :root { --col-w: 1260px; }
  .layout { display: grid; grid-template-columns: minmax(0, 760px) var(--side-w); gap: 28px; justify-content: start; align-items: start; }
  .dock-in { display: grid; grid-template-columns: minmax(0, 760px) var(--side-w); gap: 28px; }
  .main { max-width: none; margin: 0; }
  .side { position: sticky; top: calc(var(--bar-h) + 14px); max-height: calc(100dvh - var(--bar-h) - var(--dock-h) - 28px); overflow: auto; padding: 16px; border-radius: 24px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 14px; }
  .side-actions { display: flex; }
  .bar-in { grid-template-columns: auto minmax(0, 704px) 1fr; }
  .bar-list { display: none; }
  .bar-total { justify-self: end; }
  .results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .where-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dock-actions .xl { min-height: 64px; }
  /* Start: the same two columns as every other screen. Form where the work column is, card where the list panel is. */
  body[data-view="start"] .main { grid-column: 1 / -1; }
  .start-body { display: grid; grid-template-columns: minmax(0, 760px) var(--side-w); gap: 28px; align-items: start; margin-top: 8px; }
  .start-main { grid-column: 1; grid-row: 1; }
  .start-card, .start-card.fresh { display: flex; grid-column: 2; grid-row: 1; position: sticky; top: 24px; padding: 24px; }
}
@media (min-width: 1000px) and (max-width: 1100px) and (orientation: landscape) { :root { --side-w: 380px; } }

/* ---------- Tall portrait screens (1080x1920 kiosks): scale up, three columns ---------- */
@media (min-width: 1000px) and (orientation: portrait) {
  :root { --zoom: 1.3; --col-w: 880px; }
  html { zoom: 1.3; }
  .results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .where-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
}
