/* Design tokens. Every component below uses these and nothing else. */
:root {
  /* Colour: "Jadran". Dark is the default theme; light is chosen in settings (data-theme="light", below). */
  --bg: #0d1719;
  --surface: #162427;
  --text: #eaf4f5;
  --muted: #93aab0;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #5cc7d6;
  --on-accent: #06262b;
  --accent-soft: #18363b;
  --hero: linear-gradient(155deg, #1a7f90, #115d6b);
  --on-hero: #ffffff;
  --warn: #ff9a7e;
  --track: rgba(255, 255, 255, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 20px -14px rgba(0, 0, 0, 0.7);
  --shadow-float: 0 14px 32px -14px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line);
  --scrim: rgba(0, 0, 0, 0.62);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 10px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 20px;
  --space-7: 28px;

  /* Radius */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Type: body 15-16 px, small meta 13 px, labels 12 px */
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 26px;

  /* Sizes and motion */
  --tap: 44px;
  --tap-lg: 48px;
  --tabbar: 56px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 240ms;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f8f8;
  --surface: #ffffff;
  --text: #14262b;
  --muted: #5d7176;
  --line: rgba(10, 40, 50, 0.09);
  --accent: #0e7384;
  --on-accent: #ffffff;
  --accent-soft: #dcf0f2;
  --hero: linear-gradient(155deg, #0f7f90, #0a5663);
  --warn: #b4441f;
  --track: rgba(10, 40, 50, 0.1);
  --shadow: 0 1px 2px rgba(10, 40, 50, 0.06), 0 8px 18px -12px rgba(10, 40, 50, 0.25);
  --shadow-float: 0 14px 32px -14px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--line);
  --scrim: rgba(8, 24, 28, 0.45);
  color-scheme: light;
}

@font-face {
  font-family: "Figtree";
  font-weight: 300 900;
  src: url("lib/fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  font-weight: 300 900;
  src: url("lib/fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font: 500 var(--text-md) / 1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast), opacity var(--dur-fast); }
button:active:not(:disabled), a:active { transform: scale(0.97); }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
h1, h2, p { margin: 0; }

/* --app-h and --vv-top follow the visible area (js/viewport.js), so the keyboard never covers the bottom of the screen */
#app { position: fixed; top: var(--vv-top, 0px); left: 0; right: 0; display: flex; flex-direction: column; width: 100%; max-width: 560px; height: var(--app-h, 100dvh); margin: 0 auto; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.screen { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.body { flex: 1; overflow-y: auto; padding: var(--space-1) var(--space-5) var(--space-6); overscroll-behavior: contain; }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Typography ---------- */
.heading { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; padding: calc(var(--space-6) + env(safe-area-inset-top)) 0 var(--space-1); }
.h1 { margin: var(--space-2) 0 var(--space-1); font-size: var(--text-2xl); font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
.lead { color: var(--muted); font-size: var(--text-md); margin-bottom: var(--space-5); }
.section { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: var(--space-6) var(--space-1) var(--space-2); }
.hint { color: var(--muted); font-size: var(--text-sm); }
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); color: var(--muted); text-align: center; padding: var(--space-6) var(--space-5); }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.empty-icon .icon { width: 26px; height: 26px; }
.centered { text-align: center; }

/* ---------- Header, bottom bar ---------- */
.top { flex: none; display: flex; align-items: center; gap: var(--space-3); padding: calc(var(--space-4) + env(safe-area-inset-top)) var(--space-5) var(--space-3); }
.top .title { flex: 1; min-width: 0; font-size: var(--text-2xl); font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.top .title small { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--muted); letter-spacing: 0; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; flex: none; }

.tabbar { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar); color: var(--muted); font-size: var(--text-xs); font-weight: 650; }
.tabbar button[aria-pressed="true"] { color: var(--accent); }
.kb .tabbar { display: none; }

.seg { flex: none; display: flex; padding: 3px; margin: 0 0 var(--space-3); border-radius: var(--radius-md); background: color-mix(in srgb, var(--text) 7%, transparent); }
.seg button { flex: 1; min-height: 38px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 650; font-size: var(--text-md); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg.on-surface { background: var(--surface); box-shadow: var(--shadow); }
.seg.households { margin: 0 var(--space-5) var(--space-1); }
.add-place { display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; margin-top: var(--space-4); }
.add-household { display: flex; align-items: center; justify-content: center; gap: var(--space-2); }

/* ---------- Buttons and fields ---------- */
.cta { display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; min-height: var(--tap-lg); margin-top: var(--space-5); border-radius: var(--radius-md); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: var(--text-lg); }
.cta:disabled { opacity: 0.4; }
.cta.ghost { background: none; color: var(--muted); min-height: var(--tap); font-size: var(--text-md); margin-top: var(--space-1); }
.cta.danger { background: none; color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.cta.plain { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cta.plain[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.text-btn { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-5); border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--text-md); white-space: nowrap; }

.search { display: flex; align-items: center; gap: var(--space-3); height: var(--tap-lg); padding: 0 var(--space-1) 0 var(--space-5); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font-size: var(--text-lg); font-weight: 600; outline: none; }
.search input::placeholder { color: var(--muted); font-weight: 500; }
.search .clear { width: 40px; height: 40px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; }

.field { width: 100%; height: var(--tap-lg); padding: 0 var(--space-5); border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); font-size: var(--text-lg); font-weight: 600; }
.field:focus { outline: none; border-color: var(--accent); }
.field::placeholder { color: var(--muted); font-weight: 500; }
.label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: var(--space-5) var(--space-1) var(--space-2); }
.label em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ---------- Home ---------- */
.hero { position: relative; display: block; padding: var(--space-5); margin-bottom: var(--space-3); border-radius: var(--radius-lg); background: var(--hero); color: var(--on-hero); box-shadow: var(--shadow); }
.hero .name { font-size: var(--text-2xl); font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; padding-right: 48px; }
.hero .preview { margin-top: var(--space-1); font-size: var(--text-md); opacity: 0.9; line-height: 1.35; }
.count { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill); font-size: var(--text-md); font-weight: 750; }
.hero .count { position: absolute; right: var(--space-5); top: var(--space-5); background: rgba(255, 255, 255, 0.22); }

.place-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-3); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.place-card .badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); flex: none; }
.place-card .grow { flex: 1; min-width: 0; }
.place-card .name { font-size: var(--text-lg); font-weight: 700; line-height: 1.2; }
.place-card .preview { color: var(--muted); font-size: var(--text-sm); margin-top: 2px; }
.place-card .count { color: var(--accent); background: var(--accent-soft); }

.group { border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.group a { display: flex; align-items: center; gap: var(--space-4); min-height: var(--tap-lg); padding: 0 var(--space-4) 0 var(--space-5); font-size: var(--text-lg); font-weight: 600; }
.group a + a { border-top: 1px solid var(--line); }
.group a span { flex: 1; }
.group a .icon:first-child { color: var(--accent); }
.group a .icon:last-child { color: var(--muted); opacity: 0.7; width: 18px; height: 18px; }
.link { display: block; text-align: center; color: var(--accent); font-weight: 700; padding: var(--space-5) 0; }

/* ---------- Suggestions and rows ---------- */
.suggestions { margin-top: var(--space-3); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.suggestions > * + * { border-top: 1px solid var(--line); }
.suggestions .main { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 52px; padding: var(--space-2) var(--space-5); text-align: left; }
.suggestions b { font-size: var(--text-lg); font-weight: 650; line-height: 1.2; }
.suggestions b em { font-style: normal; color: var(--accent); }
.suggestions small { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.suggestions .new { display: flex; align-items: center; width: 100%; justify-content: center; gap: var(--space-2); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: var(--text-lg); min-height: var(--tap-lg); }
.tag { padding: 2px var(--space-3); border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }

.card { border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--space-4); width: 100%; min-height: 54px; padding: var(--space-2) var(--space-5); text-align: left; user-select: none; -webkit-touch-callout: none; }
.row + .row { border-top: 1px solid var(--line); }
.row .name { display: block; flex: 1; min-width: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.row small { display: block; margin-top: 1px; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.row .price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row > .icon:last-child { color: var(--muted); width: 18px; height: 18px; }
.check { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 35%, transparent); color: var(--on-accent); flex: none; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.check .icon { width: 16px; height: 16px; stroke-width: 3; }
.row.done .check { background: var(--accent); border-color: var(--accent); }
.row.done .name, .row.done .price { color: var(--muted); font-weight: 500; }
.row.done .title, .row.done .price { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.row.just .check { animation: pop var(--dur) var(--ease); }
.category-head { display: flex; justify-content: space-between; margin: var(--space-6) var(--space-1) var(--space-2); color: var(--muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Kupujem: progress and total ---------- */
.progress { flex: none; padding: 0 var(--space-5) var(--space-3); }
.progress-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.progress-row.end { justify-content: flex-end; }
.progress b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.progress b small { color: var(--muted); font-size: var(--text-lg); font-weight: 600; letter-spacing: 0; }
.progress span { display: block; margin-top: var(--space-1); color: var(--muted); font-size: var(--text-sm); }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width var(--dur) var(--ease); }
.total { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 0 var(--space-5) var(--space-3); padding: var(--space-3) var(--space-5); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-float); }
.total small { display: block; color: var(--muted); font-size: var(--text-sm); }
.total b { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* ---------- Ljekarna ---------- */
.person { display: flex; align-items: center; gap: var(--space-4); width: 100%; min-height: 56px; padding: 0 var(--space-5); margin-bottom: var(--space-3); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow), 0 0 0 2px transparent; text-align: left; }
.person b { flex: 1; font-size: var(--text-xl); font-weight: 700; }
.person small { color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.person[aria-pressed="true"] { background: var(--accent-soft); box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.person[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); }
.person:disabled { opacity: 0.6; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.chip { min-height: var(--tap); padding: 0 var(--space-5); border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow); font-weight: 650; font-size: var(--text-md); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- Sheet and full-screen choices ---------- */
.scrim { position: fixed; top: var(--vv-top, 0px); left: 0; right: 0; height: var(--app-h, 100dvh); z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); animation: fade-in var(--dur) var(--ease); }
.sheet { width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--bg); box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.25); animation: slide-up var(--dur) var(--ease); }
.sheet::before { content: ""; display: block; width: 36px; height: 4px; margin: -6px auto var(--space-4); border-radius: var(--radius-pill); background: var(--line); }
.sheet h2 { font-size: var(--text-xl); font-weight: 750; letter-spacing: -0.01em; line-height: 1.2; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sheet-head h2 { min-width: 0; overflow-wrap: anywhere; }
.text-btn.warn { background: none; color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.sheet .category { margin: 2px 0 0; color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.sheet .label:first-of-type { margin-top: var(--space-4); }
.stepper { display: flex; align-items: center; gap: var(--space-3); }
.stepper button { display: grid; place-items: center; width: var(--tap-lg); height: var(--tap-lg); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow); flex: none; }
.stepper input { flex: 1; min-width: 0; height: var(--tap-lg); border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); text-align: center; font-size: var(--text-2xl); font-weight: 750; }
.stepper input:focus { outline: none; border-color: var(--accent); }
.units { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-2); }
.units button { min-height: var(--tap); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); font-weight: 650; font-size: var(--text-md); }
.units button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.quick { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
.quick .stepper button, .quick .stepper input, .quick .field { height: var(--tap); }
.quick-extras { display: flex; gap: var(--space-2); }
.quick-extras .field { min-width: 0; padding: 0 var(--space-4); }
.quick-extras .field:first-child { flex: 3; }
.quick-extras .field:last-child { flex: 2; }
.sheet .quick + .cta { margin-top: var(--space-4); }
.scrim.leaving, .scrim.leaving .sheet { animation-duration: var(--dur-fast); animation-fill-mode: forwards; }
.scrim.leaving { animation-name: fade-out; }
.scrim.leaving .sheet { animation-name: slide-down; }

.fullscreen { position: fixed; top: var(--vv-top, 0px); left: 0; right: 0; height: var(--app-h, 100dvh); z-index: 20; display: flex; flex-direction: column; justify-content: center; gap: var(--space-3); max-width: 560px; margin: 0 auto; padding: var(--space-6) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom)); background: var(--bg); animation: fade-in var(--dur) var(--ease); }
.fullscreen h2 { margin-bottom: var(--space-3); font-size: var(--text-2xl); font-weight: 750; text-align: center; }
.fullscreen .cta { margin-top: 0; }
.picker { justify-content: flex-start; overflow-y: auto; }

/* ---------- Settings sheet ---------- */
.settings .label { margin-top: var(--space-5); }
.settings .switch-row { margin-top: var(--space-5); }
.settings .cta { margin-top: var(--space-5); }
.settings .households { margin-top: var(--space-2); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow); }
.settings .household-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 52px; padding: 0 var(--space-2) 0 var(--space-5); }
.settings .household-row + .household-row { border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.settings .household-row b { font-size: var(--text-lg); font-weight: 650; }
.link-btn { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; font-size: var(--text-sm); }
.link-btn .icon { width: 16px; height: 16px; }
.settings .add-household { margin-top: var(--space-3); }
.cta.soft-danger { min-height: var(--tap); font-size: var(--text-md); background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.settings .cta.soft-danger { margin-top: var(--space-3); }
.cta.destructive { background: var(--warn); color: var(--on-accent); }
.fullscreen { justify-content: safe center; overflow-y: auto; }
.fullscreen .lead-text { margin: 0 0 var(--space-4); color: var(--muted); font-size: var(--text-md); line-height: 1.45; text-align: center; }
.fullscreen .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.fullscreen .btn-col { display: grid; gap: var(--space-3); }
.fullscreen .btn-row .cta, .fullscreen .btn-col .cta { margin: 0; font-size: var(--text-md); }
.fullscreen .btn-col .lead-text { margin: var(--space-3) 0 0; font-size: var(--text-sm); }

/* ---------- Reorder ---------- */
.banner { flex: none; margin: 0 var(--space-5) var(--space-3); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent); font-size: var(--text-md); font-weight: 600; line-height: 1.35; }
.order-row { display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: var(--space-1) var(--space-2); margin-bottom: var(--space-2); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow); }
.order-row.dragging { transform: scale(1.02); box-shadow: var(--shadow-float); position: relative; z-index: 2; }
.order-row .grip { display: grid; place-items: center; width: 32px; height: var(--tap); color: var(--muted); cursor: grab; touch-action: none; }
.order-row .name { flex: 1; min-width: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.2; }
.order-row small { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.order-row .move { display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--text) 7%, transparent); flex: none; }
.order-row .move:disabled { opacity: 0.3; }
.order-actions { flex: none; padding: var(--space-2) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); }

/* ---------- PIN, offline ---------- */
.pin { width: 100%; margin: auto; padding: var(--space-6) var(--space-5); text-align: center; }
.pin .heading { padding-top: 0; }
.pin input { width: 100%; height: 64px; margin-top: var(--space-5); padding-left: 0.4em; border: 0; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow), 0 0 0 2px var(--accent); text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 0.4em; outline: none; -webkit-text-security: disc; }
.pin .error { min-height: 24px; margin-top: var(--space-3); color: var(--warn); font-weight: 700; }
.offline { flex: none; padding: var(--space-2) var(--space-3); background: var(--warn); color: var(--bg); text-align: center; font-size: var(--text-sm); font-weight: 700; }

/* ---------- Feedback, notify button, switch ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--kb, 0px) + var(--tabbar) + env(safe-area-inset-bottom) + var(--space-6)); z-index: 30; max-width: calc(100% - 2 * var(--space-5)); padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill); background: var(--text); color: var(--bg); font-weight: 650; font-size: var(--text-md); text-align: center; box-shadow: var(--shadow-float); transform: translateX(-50%); animation: toast-in var(--dur) var(--ease); }
.toast.warn { background: var(--warn); color: var(--bg); }
.toast { display: flex; align-items: center; gap: var(--space-3); }
.toast button { margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3)) calc(-1 * var(--space-2)) 0; min-height: var(--tap); padding: 0 var(--space-4); border-radius: var(--radius-pill); background: var(--bg); color: var(--text); font-weight: 750; font-size: var(--text-md); }
.repeat { display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; margin-top: var(--space-3); min-height: var(--tap-lg); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--text-lg); }
.kb .toast { bottom: calc(var(--kb, 0px) + var(--space-5)); }
.dock { flex: none; padding: var(--space-1) var(--space-5) var(--space-2); }
.dock[hidden] { display: none; }
.dock .cta { margin-top: 0; min-height: var(--tap); font-size: var(--text-md); background: var(--surface); color: var(--accent); box-shadow: var(--shadow), inset 0 0 0 1.5px var(--accent); }
.all-done { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin: var(--space-2) 0 var(--space-1); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.switch-row { margin-top: var(--space-5); }
.switch { display: flex; align-items: center; gap: var(--space-4); width: 100%; min-height: 56px; padding: var(--space-2) var(--space-5); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.switch:disabled { opacity: 0.6; }
.switch-text { flex: 1; font-weight: 650; font-size: var(--text-lg); line-height: 1.2; }
.switch-text small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.knob { position: relative; flex: none; width: 46px; height: 28px; border-radius: var(--radius-pill); background: var(--track); transition: background-color var(--dur) var(--ease); }
.knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform var(--dur) var(--ease); }
.switch[aria-checked="true"] .knob { background: var(--accent); }
.switch[aria-checked="true"] .knob::after { transform: translateX(18px); background: var(--on-accent); }

/* ---------- Motion ---------- */
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes slide-down { to { transform: translateY(100%); } }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  button:active:not(:disabled), a:active { transform: none; }
}
