/* Servewell — interface. Tokens come from the brand guide (02-marca/GUIA-DA-MARCA.html).
   Roles, not palette names: components only use the variables below. */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15122E;          /* the function room at night */
  --surface: #1D1942;
  --raised: #29245A;
  --line: #3C3679;        /* dividers only, never text */
  --text: #F6F1E7;        /* linen */
  --dim: #BDB7DC;
  --faint: #9C96C6;
  --done: #00D0B3;        /* AURA turquoise: complete / served */
  --done-fill: #00D0B3;
  --done-ink: #082B27;
  --part: #F2BD5E;        /* candle amber: in progress */
  --part-ink: #2A1C00;
  --empty: #9C96C6;
  --sel-bg: #F6F1E7;      /* a chosen dish turns linen, like a plate on the table */
  --sel-ink: #15122E;
  --danger: #FF9585;
  --danger-ink: #2A0B06;
  --primary-bg: #F6F1E7;
  --primary-ink: #15122E;
  --table-top: #2E2866;
  --seat-off: #6F67C2;
  --focus: #00D0B3;
  --shadow: 0 10px 30px rgba(5, 3, 20, .45);
  --brand-grad: linear-gradient(140deg, #6A4DF0 0%, #3A2F9A 38%, #2B2770 62%, #15122E 100%);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F4FB;
  --surface: #FFFFFF;
  --raised: #ECE9F7;
  --line: #D6D1EB;
  --text: #1E1A4A;
  --dim: #4E4979;
  --faint: #5F5A88;
  --done: #00735F;
  --done-fill: #00977F;
  --done-ink: #04231F;
  --part: #8F5E00;
  --part-ink: #FFFFFF;
  --empty: #5F5A88;
  --sel-bg: #2B2770;
  --sel-ink: #FFFFFF;
  --danger: #B4372A;
  --danger-ink: #FFFFFF;
  --primary-bg: #2B2770;
  --primary-ink: #FFFFFF;
  --table-top: #E4E0F5;
  --seat-off: #857EB8;
  --focus: #5B3FD9;
  --shadow: 0 10px 30px rgba(30, 26, 74, .12);
}

:root {
  --f-display: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --tap: 52px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--f-body);
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--dim); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- long words never push the page sideways (P3) ---------- */
.ev h2, .ev p, .dish-opt b, .nm, .note-tag, .chip, .pick-name, .seat-line, .k-dish .nm, .sheet-table h3, .title p, .choice strong, .choice span, .empty strong, .banner, .progress-big .of, .course-block h3, .k-top h1 { overflow-wrap: anywhere; min-width: 0; }
.dish-opt > *, .ev > *, .lib-item > *, .k-dish > *, .dish-total > * { min-width: 0; }

/* ---------- shell ---------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap.wide { max-width: 1180px; }
main { flex: 1; padding-bottom: 32px; }

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.top .title { flex: 1; min-width: 0; }
.top .title h1 { font-size: 1.15rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top .title p { font-size: .8125rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .logo { height: 30px; width: auto; display: block; }

.icon-btn {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--raised); }

.brand-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 0 26px; color: var(--faint); font-size: .8125rem;
}
.brand-foot img { opacity: .9; }

.top-mark { display: inline-flex; margin: 0 4px 0 2px; }
.theme-light-only { display: none; }
:root[data-theme="light"] .theme-light-only { display: inline; }
:root[data-theme="light"] .theme-dark-only { display: none; }

/* ---------- buttons & fields ---------- */
.btn {
  min-height: var(--tap); padding: 0 20px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary-bg); color: var(--primary-ink); border-color: var(--primary-bg); }
.btn.ghost { background: transparent; }
.btn.warn { background: var(--part); color: var(--part-ink); border-color: var(--part); }
.btn.danger { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: .9375rem; }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .9375rem; }
.field small { color: var(--dim); font-size: .8125rem; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border-radius: var(--r-s); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 1.0625rem;
}
.field textarea { min-height: 88px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.code-input { font-family: var(--f-display); letter-spacing: .3em; text-transform: uppercase; font-size: 1.5rem !important; text-align: center; }
.err { color: var(--danger); font-weight: 600; font-size: .9375rem; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.spacer { flex: 1; }

/* ---------- status (word + icon, never colour alone) ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: .875rem; white-space: nowrap; }
.st .i { width: 18px; height: 18px; }
.st-ok { color: var(--done); }
.st-part { color: var(--part); }
.st-empty { color: var(--empty); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--raised); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.pill .i { width: 16px; height: 16px; }
.pill.locked { background: color-mix(in srgb, var(--part) 20%, var(--surface)); color: var(--part); }
.pill.open { background: color-mix(in srgb, var(--done) 16%, var(--surface)); color: var(--done); }

/* ---------- entry / home ---------- */
.hero {
  background: var(--brand-grad); color: #F6F1E7;
  padding: 40px var(--gutter) 30px; position: relative; overflow: hidden;
}
.hero .wrap { position: relative; z-index: 1; }
.hero img.logo { height: 46px; width: auto; }
.hero h1 { margin-top: 26px; font-size: 1.75rem; max-width: 18ch; }
.entry { padding-top: 22px; }
.choice {
  display: grid; grid-template-columns: 56px 1fr 24px; gap: 14px; align-items: center;
  width: 100%; text-align: left; padding: 18px; min-height: 92px;
  border-radius: var(--r-l); border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
}
.choice:hover { border-color: var(--dim); }
.choice .badge { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--raised); }
.choice .badge img { width: 40px; height: 40px; }
.choice strong { display: block; font-family: var(--f-display); font-size: 1.15rem; }
.choice span { color: var(--dim); font-size: .9375rem; }

/* ---------- sync & live indicators ---------- */
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--dim); white-space: nowrap; }
.sync .i { width: 18px; height: 18px; }
.sync.ok { color: var(--done); }
.sync.wait { color: var(--part); }
.livedot { width: 8px; height: 8px; border-radius: 50%; background: var(--empty); display: inline-block; }
.livedot.on { background: var(--done); box-shadow: 0 0 0 0 color-mix(in srgb, var(--done) 60%, transparent); animation: beat 2.4s ease-out infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--done) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 14px 0 0;
  border-radius: var(--r-m); background: color-mix(in srgb, var(--part) 16%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--part) 50%, transparent);
}
.banner .i { color: var(--part); margin-top: 2px; }
.banner strong { display: block; }

/* ---------- round tabs (segmented) ---------- */
.rounds { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.rounds::-webkit-scrollbar { display: none; }
.round {
  flex: 1 0 auto; min-height: 48px; padding: 6px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: transparent; color: var(--text); display: grid; justify-items: center; line-height: 1.15;
}
.round b { font-size: .9375rem; }
.round small { font-size: .75rem; color: var(--dim); font-weight: 600; }
.round[aria-selected="true"] { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--sel-bg); }
.round[aria-selected="true"] small { color: inherit; opacity: .8; }

/* ---------- table grid (rings) ---------- */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 12px; }
.tcell {
  display: grid; justify-items: center; gap: 2px; padding: 10px 4px 12px; border-radius: var(--r-m);
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text); min-height: 150px; text-align: center;
}
button.tcell:hover { border-color: var(--dim); }
.tcell.is-ok { border-color: color-mix(in srgb, var(--done) 55%, var(--line)); }
.tcell .st { font-size: .8125rem; }
.ring .ring-top { fill: var(--table-top); }
.ring .seat { fill: var(--seat-off); }
.ring .seat.on { fill: var(--done-fill); }
.ring.ring-part .seat.on { fill: var(--part); }
.ring .ring-label { fill: var(--text); font-family: var(--f-display); font-weight: 700; }
.ring-arc-track { fill: none; stroke: var(--seat-off); stroke-width: 7; }
.ring-arc { fill: none; stroke: var(--done-fill); stroke-width: 7; stroke-linecap: round; }
.ring.ring-part .ring-arc { stroke: var(--part); }

/* ---------- the table (seat picker) ---------- */
.table-head { display: flex; align-items: center; gap: 12px; padding-top: 14px; }
.table-head .spacer { flex: 1; }
.seatmap { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 6px auto 0; }
.seatmap.small { width: min(100%, 236px); }
.seatmap .top-disc {
  position: absolute; inset: 25%; border-radius: 50%; background: var(--table-top);
  display: grid; place-items: center; text-align: center; padding: 8px;
}
.seatmap .top-disc > div { min-width: 0; max-width: 100%; }
.seatmap .top-disc b { font-family: var(--f-display); font-size: 1.35rem; display: block; overflow-wrap: anywhere; line-height: 1.1; }
.seatmap .top-disc b.long { font-size: .95rem; }
.seatmap .top-disc span { font-size: .8125rem; color: var(--dim); }
.seat-btn {
  position: absolute; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  border: 2px solid var(--seat-off); background: var(--surface); color: var(--text);
  font-weight: 750; font-size: 1rem; display: grid; place-items: center; padding: 0;
  transition: transform .12s ease, background .15s ease;
}
.seat-btn.has { background: var(--done-fill); border-color: var(--done-fill); color: var(--done-ink); }
.seat-btn[aria-pressed="true"] { outline: 3px solid var(--text); outline-offset: 3px; transform: scale(1.08); }
.seat-btn .lbl {
  position: absolute; top: 100%; margin-top: 3px; z-index: 2; font-size: .8125rem; line-height: 1.3; font-weight: 650;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); padding: 0 6px; border-radius: 6px;
  white-space: nowrap; max-width: 92px; overflow: hidden; text-overflow: ellipsis;
}
.seat-btn .lbl.up { top: auto; bottom: 100%; margin: 0 0 3px; }
.seatmap.has-labels { margin-top: 26px; margin-bottom: 26px; }
.seatmap.large { width: min(100%, 344px); }
.seatmap.large .seat-btn { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
.seat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; margin-top: 12px; }
.seat-list .seat-btn { position: static; margin: 0; width: 100%; height: 56px; border-radius: 14px; }
.seat-list .seat-btn .lbl { display: none; }

.seat-card { margin-top: 18px; padding: 16px; border-radius: var(--r-l); background: var(--surface); border: 1.5px solid var(--line); }
.seat-card header { display: flex; align-items: center; gap: 10px; }
.seat-card header h2 { flex: 1; }
.label-in { margin-top: 16px; }
.dish-opts { display: grid; gap: 8px; margin-top: 14px; }
.dish-opt {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  min-height: 60px; padding: 10px 14px; border-radius: var(--r-m); text-align: left;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
}
.dish-opt .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--faint); display: grid; place-items: center; }
.dish-opt .tick .i { width: 18px; height: 18px; opacity: 0; }
.dish-opt b { font-size: 1.0625rem; font-weight: 650; }
.dish-opt[aria-checked="true"] { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--sel-bg); }
.dish-opt[aria-checked="true"] .tick { border-color: currentColor; background: currentColor; }
.dish-opt[aria-checked="true"] .tick .i { opacity: 1; color: var(--sel-bg); }
.tags { display: inline-flex; gap: 4px; }
.tag { font-size: .6875rem; font-weight: 750; padding: 2px 6px; border-radius: 6px; border: 1.5px solid currentColor; opacity: .85; }

.notes-zone { margin-top: 16px; }
.notes-zone h3 { font-size: .9375rem; color: var(--dim); font-family: var(--f-body); font-weight: 650; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: transparent; color: var(--text); font-weight: 600; font-size: .9375rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--part) 22%, var(--surface)); border-color: var(--part); color: var(--text); }
.chip[aria-pressed="true"] .i { color: var(--part); }
.chip .i { width: 16px; height: 16px; }
.chip.free { border-style: dashed; }
.other-row { display: flex; gap: 8px; margin-top: 10px; }
.other-row input { flex: 1; min-width: 0; }

.seat-nav { position: sticky; bottom: 0; z-index: 15; margin-top: 18px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.seat-nav .wrap { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; padding: 0; }

/* ---------- manager ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  min-height: 48px; padding: 0 12px; border: 0; background: transparent; color: var(--dim); font-weight: 650;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--done); }
.section { margin-top: 22px; }
.section > header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.section > header h2 { flex: 1; }

.ev-list { display: grid; gap: 10px; margin-top: 16px; }
.ev {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; text-align: left;
  padding: 16px; border-radius: var(--r-m); border: 1.5px solid var(--line); background: var(--surface); color: var(--text); width: 100%;
}
.ev:hover { border-color: var(--dim); }
.ev h2 { font-size: 1.125rem; }
.ev p { color: var(--dim); font-size: .875rem; grid-column: 1; }
.ev .pill { grid-row: 1; grid-column: 2; }

.progress-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.progress-big .n { font-family: var(--f-display); font-size: 3rem; font-weight: 800; line-height: 1; }
.progress-big .of { font-size: 1.25rem; color: var(--dim); font-weight: 650; }
.bar { height: 10px; border-radius: 999px; background: var(--raised); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--done-fill); border-radius: inherit; transition: width .4s ease; }

.totals { display: grid; gap: 14px; }
.course-block h3 { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.course-block h3 small { color: var(--dim); font-family: var(--f-body); font-weight: 600; font-size: .8125rem; }
.dish-total { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.dish-total .q { font-family: var(--f-display); font-size: 1.6rem; font-weight: 800; text-align: right; }
.dish-total .q.zero { color: var(--faint); }
.dish-total .nm { font-weight: 600; }
.dish-total .nt { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.note-tag { font-size: .8125rem; padding: 3px 9px; border-radius: 8px; background: color-mix(in srgb, var(--part) 18%, var(--surface)); color: var(--text); border-left: 3px solid var(--part); }
.note-tag b { font-weight: 750; }

.grid-2 { display: grid; gap: 22px; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .tgrid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}

.share { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-l); background: var(--surface); border: 1.5px solid var(--line); }
.share .codebig { font-family: var(--f-display); font-size: 2rem; letter-spacing: .18em; font-weight: 800; }
.share .qr { background: #fff; padding: 10px; border-radius: 12px; width: 168px; height: 168px; }
.share .qr svg { width: 100%; height: 100%; display: block; }
.share .url { font-size: .875rem; color: var(--dim); word-break: break-all; }
@media (min-width: 560px) { .share { grid-template-columns: 1fr auto; align-items: center; } .share .qr { grid-row: span 3; grid-column: 2; } }

/* forms in new event */
.form-sec { padding: 18px 0; border-bottom: 1px solid var(--line); }
.form-sec > h2 { margin-bottom: 4px; }
.form-sec > p { color: var(--dim); font-size: .9375rem; margin-bottom: 12px; }
.toggle-chips .chip[aria-pressed="true"] { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--sel-bg); }
.toggle-chips .chip[aria-pressed="true"] .i { color: inherit; }
.pick-list { display: grid; gap: 8px; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: var(--r-s); border: 1.5px solid var(--line); background: var(--surface); }
.pick input { width: 22px; height: 22px; accent-color: var(--done-fill); }
.pick .pick-name { flex: 1; font-weight: 600; }
.quick-tables { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quick-tables input { width: 76px; text-align: center; }
.tbl-rows { display: grid; gap: 8px; margin-top: 12px; }
.tbl-row { display: grid; grid-template-columns: 1fr 96px 48px; gap: 8px; align-items: center; }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.stepper button { height: 48px; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; }
.stepper output { text-align: center; font-weight: 700; }
.sum-line { color: var(--dim); font-weight: 600; margin-top: 10px; }
.sticky-act { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 75%, transparent); }

/* library */
.lib-item { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 6px 4px 6px 12px; border-bottom: 1px solid var(--line); }
.lib-item .nm { flex: 1; min-width: 0; font-weight: 600; }
.lib-item.off .nm { color: var(--faint); text-decoration: line-through; }
.lib-item input.input { min-height: 44px; padding: 8px 10px; }
.preset-add { grid-template-columns: 1fr auto auto; }
.preset-row select { flex: none; }
@media (max-width: 559px) {
  .preset-row { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; row-gap: 4px; }
  .preset-row .nm { flex: 1 1 100%; }
  .preset-row { column-gap: 2px; }
  .preset-row select { margin-right: auto; max-width: 140px; padding-left: 10px; padding-right: 6px; }
  .preset-add { grid-template-columns: 1fr auto; }
  .preset-add input { grid-column: 1 / -1; }
}
.add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.tag-toggles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag-toggles .chip { min-height: 44px; min-width: 48px; justify-content: center; }

/* kitchen list + service sheet (screen) */
.k-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sheet-table { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-m); background: var(--surface); border: 1.5px solid var(--line); break-inside: avoid; }
.sheet-table header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sheet-table header h3 { flex: 1; font-size: 1.15rem; }
.seat-line { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.seat-line .sn { width: 30px; height: 30px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; font-weight: 750; font-size: .875rem; }
.seat-line .who { font-weight: 700; }
.seat-line .picks { display: grid; gap: 2px; font-size: .9375rem; }
.seat-line .pick-row { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: baseline; }
.seat-line .picks .c { color: var(--dim); font-size: .8125rem; font-weight: 600; }
.seat-line .missing { color: var(--faint); font-style: italic; }
.seat-line .nn { color: var(--part); font-weight: 650; }

/* ---------- dialogs, toast ---------- */
dialog.sheet {
  border: 0; padding: 22px; border-radius: var(--r-l); background: var(--surface); color: var(--text);
  width: min(92vw, 440px); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(8, 6, 24, .6); }
dialog.sheet p { color: var(--dim); margin-top: 8px; }
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 650;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- app update bar ---------- */
#update-bar {
  position: fixed; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--done); box-shadow: var(--shadow); font-weight: 650;
  max-width: calc(100vw - 24px); font-size: .9375rem;
}
#update-bar span { white-space: nowrap; }
#update-bar .btn { flex: none; }

/* ---------- empty state ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 36px 16px; color: var(--dim); }
.empty img { width: 120px; height: 120px; opacity: .9; }
.empty strong { color: var(--text); font-family: var(--f-display); font-size: 1.15rem; }

/* ---------- kitchen screen (TV / tablet) ---------- */
body.kitchen-mode { background: var(--bg); }
body.kitchen-mode .wrap.wide { max-width: 1880px; }
@media (min-width: 1600px) { body.kitchen-mode .k-cols { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 22px; } body.kitchen-mode .k-dish .q { font-size: clamp(3rem, 4vw, 4.6rem); } body.kitchen-mode .k-dish .nm { font-size: clamp(1.4rem, 1.6vw, 1.9rem); } }
.k-top { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.k-top h1 { font-size: clamp(1.2rem, 2.4vw, 2rem); }
.k-top .spacer { flex: 1; }
.k-prog { display: flex; align-items: baseline; gap: 8px; }
.k-prog .n { font-family: var(--f-display); font-size: clamp(2rem, 4.5vw, 3.6rem); font-weight: 800; line-height: 1; }
.k-prog .of { color: var(--dim); font-size: clamp(1rem, 1.6vw, 1.3rem); font-weight: 650; }
.k-ready { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.k-ready b { margin-right: 4px; }
.k-ready .t { padding: 6px 12px; border-radius: 10px; background: color-mix(in srgb, var(--done) 18%, var(--surface)); color: var(--done); font-weight: 750; display: inline-flex; gap: 6px; align-items: center; }
.k-cols { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.k-col { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; }
.k-col h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: clamp(1.15rem, 1.8vw, 1.6rem); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.k-col h2 small { font-family: var(--f-body); font-size: .875rem; color: var(--dim); font-weight: 650; }
.k-dish { display: grid; grid-template-columns: minmax(64px, auto) 1fr; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.k-dish .q { font-family: var(--f-display); font-size: clamp(2.2rem, 4.2vw, 3.6rem); font-weight: 800; line-height: 1; text-align: right; border-radius: 10px; padding: 0 4px; }
.k-dish .nm { font-size: clamp(1.05rem, 1.6vw, 1.4rem); font-weight: 650; }
.k-dish .nt { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.k-dish .nt .note-tag { font-size: clamp(.875rem, 1.2vw, 1.05rem); }
.k-dish.bump .q { animation: bump 1.6s ease-out; }
@keyframes bump { 0% { background: var(--done-fill); color: var(--done-ink); } 100% { background: transparent; color: inherit; } }
.k-tabs { margin-top: 12px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print: kitchen list & service sheet ---------- */
@media print {
  :root, :root[data-theme] {
    --bg: #fff; --surface: #fff; --raised: #eee; --line: #bbb; --text: #000; --dim: #333; --faint: #555;
    --part: #000; --done: #000; --done-fill: #000; color-scheme: light;
  }
  body { font-size: 12pt; background: #fff; }
  .top, .tabs, .k-actions, .brand-foot, .no-print, #toast, .seat-nav, .sticky-act { display: none !important; }
  .print-only { display: block !important; }
  .sheet-table, .k-col, .course-block { border: 0; padding: 0; break-inside: avoid; }
  .note-tag { border: 1px solid #000; background: none; }
  .dish-total .q { font-size: 16pt; }
  a { color: #000; text-decoration: none; }
}
.print-only { display: none; }
