:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --border: #dde2e9;
  --accent: #1f5fae;
  --accent-text: #ffffff;
  --accent-soft: #e5eefa;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --text: #e7ebf0;
    --muted: #9aa5b4;
    --border: #2d3540;
    --accent: #6ea8ef;
    --accent-text: #0d1117;
    --accent-soft: #1d2b3d;
    --ok: #6fd39b;
    --ok-soft: #173023;
    --warn: #f0b85a;
    --warn-soft: #33270f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }

.testbar {
  background: var(--warn-soft); color: var(--warn); font-size: 0.85rem; font-weight: 600;
  text-align: center; padding: 6px 16px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.topbar .brand { font-weight: 650; text-decoration: none; color: var(--text); }
.topbar form { margin: 0; }
.linkbutton { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }
main.wide { max-width: 1100px; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.card.link { display: block; text-decoration: none; color: inherit; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 600; border-radius: 999px; padding: 2px 10px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.messages { list-style: none; padding: 0; margin: 0 0 8px; }
.messages li { background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: 10px 14px; font-weight: 600; }

/* Answer form: radio buttons and checkboxes as large tap targets */
.question { margin: 12px 0 0; }
.question > label, .question legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices div { display: contents; }
.choices input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.choices label {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer;
  font-weight: 500; user-select: none;
}
.choices label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.choices label:has(input:focus-visible) { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
input[type=number], textarea, input[type=text], input[type=email], input[type=search] {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input[type=number] { max-width: 120px; }
.errorlist { color: #c0392b; list-style: none; padding: 0; margin: 4px 0; font-size: 0.9rem; }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 22px;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.button.secondary { background: var(--accent-soft); color: var(--accent); }
.button.block { width: 100%; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.savebar .inner { max-width: 720px; margin: 0 auto; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.changed td { background: var(--warn-soft); }
details summary { cursor: pointer; font-weight: 600; margin: 8px 0; }

[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Report page, made for the kitchen: the day's numbers big, then name lists to tick off. */
.print-only { display: none; }
.kicker {
  margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
}
.report-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 16px;
  margin: 4px 0 16px;
}
.report-head h1 { margin: 2px 0; }
.report-head p { margin: 0; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report-actions .button { min-height: 44px; padding: 8px 18px; }

.day-sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.day-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.day-title { flex: 1; min-width: 0; text-align: center; }
.day-title h2 { font-size: 1.35rem; margin: 0; }
.day-title p { margin: 2px 0 0; }
.when {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 2px 8px;
  vertical-align: 0.2em; margin-right: 4px;
}
.day-step {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 1.7rem; line-height: 1;
  text-decoration: none; padding-bottom: 3px;
}
.day-step.off { visibility: hidden; }

.tiles { display: grid; gap: 10px; margin: 0 0 10px; }
.tiles.primary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tiles.secondary { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
}
.tile-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.tile-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tiles.primary .tile { background: var(--accent-soft); border-color: transparent; padding: 14px 16px; }
.tiles.primary .tile-label { color: var(--accent); font-size: 1rem; }
.tiles.primary .tile-value { font-size: 3.25rem; }
.tile-change { font-size: 0.8rem; font-weight: 650; color: var(--warn); }
.tile-change.none { color: var(--muted); font-weight: 500; }

.changes { background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; margin: 16px 0 4px; }
.changes h3 { margin: 0 0 4px; font-size: 1rem; color: var(--warn); }
.changes ul { list-style: none; margin: 0; padding: 0; }
.changes li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 6px 0; }
.changes li + li { border-top: 1px solid var(--border); }
.changes .who { flex: 1 1 220px; }

.names-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 20px 0 8px;
}
.names-head h3 { margin: 0; font-size: 1.1rem; }
.find { flex: 0 1 300px; }
.find input { min-height: 44px; border-radius: 999px; padding: 8px 16px; }
.legend { margin: 0 0 4px; }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn);
  margin-right: 6px; vertical-align: 0.1em;
}

.name-list { border-top: 1px solid var(--border); }
.name-list > summary {
  display: flex; align-items: center; gap: 8px; min-height: 52px; margin: 0; padding: 6px 0; list-style: none;
}
.name-list > summary::-webkit-details-marker { display: none; }
.name-list > summary::before {
  content: "›"; display: inline-block; width: 0.8em; color: var(--muted); font-size: 1.4rem; line-height: 1;
  transition: transform 0.15s;
}
.name-list[open] > summary::before { transform: rotate(90deg); }
.list-label { font-size: 1.05rem; font-weight: 650; }
.count {
  margin-left: auto; min-width: 2.8em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px;
}
.list-lunch .count, .list-dinner .count, .list-attending .count, .list-answered .count {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
.names { list-style: none; margin: 0 0 14px; padding: 0; columns: 230px; column-gap: 28px; }
.names li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--border); }
.names .who { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.names .dept { color: var(--muted); font-size: 0.8rem; margin-left: 2px; }
.names .details { display: block; font-size: 0.85rem; font-weight: 600; color: var(--warn); }
.name-list .empty { margin: 0 0 12px; }
.name-list .table-wrap, .name-list > table { margin-bottom: 12px; }

/* Canteen closed */
.closed-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px;
}
.closed-banner strong { display: block; color: var(--warn); font-size: 1.05rem; }
.closed-banner .small { display: block; }
.closed-banner .note { font-style: italic; margin-top: 2px; }
.closed-banner .button { min-height: 40px; padding: 6px 18px; }
.closed-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--warn); color: var(--surface); border-radius: 999px; padding: 1px 7px; vertical-align: 0.15em;
}
.tiles.primary .tile.closed { background: var(--warn-soft); }
.tiles.primary .tile.closed .tile-label { color: var(--warn); }
.tile.closed .tile-value { color: var(--muted); }
.when.closed { background: var(--warn); color: var(--surface); text-transform: none; letter-spacing: 0; }
.close-day { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 12px 0 0; }
.close-day .button { min-height: 40px; padding: 6px 18px; }
.day-notice {
  background: var(--warn-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0;
  font-size: 0.95rem;
}
.day-notice strong { color: var(--warn); }

.closure-form legend { font-weight: 650; margin-bottom: 8px; }
.options { display: grid; gap: 8px; }
.option {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.option > span > span { display: block; }
.closure-form .question label { font-weight: 650; }
.closure-form textarea { margin-top: 6px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; }

.overview { margin-top: 16px; }
.days th[scope="row"] { color: var(--text); font-size: 0.95rem; font-weight: 600; white-space: nowrap; }
.days th[scope="row"] a { color: inherit; text-decoration: none; }
.days tbody tr { position: relative; }
.days th[scope="row"] a::after { content: ""; position: absolute; inset: 0; }
.days tbody tr:hover { background: var(--bg); }
.days tr.selected, .days tr.selected:hover { background: var(--accent-soft); }
.days tr.selected th[scope="row"] { box-shadow: inset 3px 0 0 var(--accent); }
.days th.primary { color: var(--text); }
.days td.primary { font-size: 1.05rem; font-weight: 700; }
.days tr.past, .days tr.past th[scope="row"] { color: var(--muted); }
.days .when { font-size: 0.62rem; padding: 1px 6px; margin: 0 0 0 4px; }
.days .label { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
@media (max-width: 560px) {
  .days .col-no { display: none; }
  .days th, .days td { padding: 6px 5px; }
  .tiles.primary .tile-value { font-size: 2.75rem; }
}

@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #000; --muted: #444; --border: #bbb;
    --accent: #000; --accent-text: #000; --accent-soft: #fff; --warn: #000; --warn-soft: #fff;
  }
  @page { margin: 12mm; }
  body { background: #fff; font-size: 10.5pt; }
  .topbar, .testbar, .messages, .no-print, .dot, .legend, .tile-change { display: none !important; }
  .print-only { display: inline; }
  main, main.wide { max-width: none; padding: 0; }
  .report-head { margin-bottom: 8px; }
  .day-sheet { border: 0; padding: 0; }
  .day-nav { margin-bottom: 8px; }
  .day-title { text-align: left; }
  .when, .count, .closed-tag { background: none !important; border: 1px solid #000 !important; color: #000 !important; }
  .closed-banner { border: 1.5px solid #000; }
  .tiles.primary .tile { border: 1.5px solid #000; }
  .tiles.primary .tile-value { font-size: 26pt; }
  .tile-value { font-size: 16pt; }
  .name-list:not([open]) { display: none; }
  .name-list { break-inside: auto; }
  .name-list > summary { min-height: 0; padding: 10px 0 4px; }
  .name-list > summary::before { content: none; }
  .names { columns: 3; column-gap: 18px; }
  .names li { padding: 3px 0; }
  .names .who::before {
    content: ""; display: inline-block; width: 0.8em; height: 0.8em; border: 1px solid #000;
    margin-right: 6px; vertical-align: -0.05em;
  }
}

.steps { padding-left: 20px; }
.steps li { margin: 6px 0; }
