/* Tokens. Blue means in range, amber means watch, red means act. Steel is the kitchen. */
:root {
  --steel: #E7ECEE;
  --panel: #FFFFFF;
  --ink: #13232B;
  --quiet: #586A73;
  --line: #C9D3D7;
  --cold: #0A6C8C;
  --frost: #DCEFF5;
  --amber: #8A5A00;
  --amber-bg: #FCEBC4;
  --hot: #A8231B;
  --hot-bg: #FBDCD7;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--cold); outline-offset: 2px; }
[hidden] { display: none !important; }

.btn {
  min-height: 56px;
  padding: 0 24px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 20px;
}
.btn.plain { background: transparent; color: var(--ink); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 16px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.error { color: var(--hot); font-weight: 600; min-height: 1.4em; margin: 8px 0 0; }

/* ---------- terminal ---------- */

.term { display: flex; flex-direction: column; min-height: 100%; padding: 24px 28px 28px; gap: 20px; user-select: none; }
.term-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; color: var(--quiet); }
.term-top .place { font-weight: 600; color: var(--quiet); }
/* The product's name: the same wordmark wherever it appears. The business's own name sits beside or under it. */
.brand { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.1; letter-spacing: 0.02em; color: var(--ink); }
.term-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.card p.brand { margin: 0 0 14px; color: var(--ink); }
.term-right { display: flex; align-items: center; gap: 16px; }
.term-right .btn { min-height: 48px; padding: 0 18px; font-size: 18px; }
.clock { font-family: var(--display); font-size: 28px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.headline {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  margin: 0;
  max-width: 24ch;
}
.headline.hot { color: var(--hot); }

.banner { padding: 12px 16px; border-radius: 6px; background: var(--hot-bg); color: var(--hot); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); grid-auto-rows: minmax(230px, 320px); gap: 16px; align-content: start; flex: 1; }

/* A unit tile. The left band carries the state, so it reads from across the kitchen. */
.tile {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 230px;
  padding: 16px 18px 16px 30px;
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  container-type: inline-size;
}
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: var(--line); }
.tile .name { font-weight: 600; font-size: 22px; line-height: 1.15; }
.tile .limit { color: var(--quiet); font-size: 16px; }
.tile .temp {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(52px, 34cqw, 104px);  /* shrinks with the tile, so 175.5 fits as well as 3.4 */
  line-height: 1;
  align-self: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tile .temp small { font-size: 0.45em; font-weight: 600; vertical-align: 0.75em; margin-left: 2px; }
.tile .temp.empty { color: var(--line); }
.tile .state { font-weight: 600; font-size: 18px; }

.tile.ok::before { background: var(--cold); }
.tile.ok .temp { color: var(--cold); }
.tile.warn::before { background: #D99A00; }
.tile.warn .temp { color: var(--amber); }
.tile.out::before { background: var(--hot); }
.tile.out .temp { color: var(--hot); }

.tile.due { border-color: var(--ink); border-width: 4px; padding: 14px 16px 14px 28px; }
.tile.due::before { background: var(--ink); }
.tile.due .state { background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 4px; justify-self: start; }
.tile.overdue { border-color: var(--hot); border-width: 4px; padding: 14px 16px 14px 28px; background: var(--hot-bg); }
.tile.overdue::before { background: var(--hot); }
.tile.overdue .state { background: var(--hot); color: #fff; padding: 6px 12px; border-radius: 4px; justify-self: start; }
.tile.recheck .state { color: var(--hot); }

/* Full-screen sheet for taking one reading. */
.sheet { position: fixed; inset: 0; background: var(--steel); display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 28px; padding: 24px 28px; user-select: none; }
.sheet-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sheet-info h2 { font-family: var(--display); font-size: 40px; line-height: 1.05; margin: 0; }
.sheet-info .limit { color: var(--quiet); }
.readout {
  font-family: var(--display); font-weight: 700; font-size: clamp(96px, 16vw, 180px); line-height: 1;
  font-variant-numeric: tabular-nums; margin-top: 8px; min-height: 1em;
}
.readout small { font-size: 0.4em; vertical-align: 0.9em; }
.readout.ok { color: var(--cold); }
.readout.warn { color: var(--amber); }
.readout.out { color: var(--hot); }
.verdict { font-weight: 600; font-size: 22px; min-height: 1.4em; }
.verdict.warn { color: var(--amber); }
.verdict.out { color: var(--hot); }
.sheet-actions { margin-top: auto; display: flex; gap: 12px; }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-content: center; }
.pad button {
  min-height: 76px; border: 2px solid var(--line); border-radius: 6px; background: var(--panel);
  font-family: var(--display); font-size: 40px; font-weight: 600;
}
.pad button:active { background: var(--frost); border-color: var(--cold); }
.pad .go { grid-column: 1 / -1; background: var(--ink); color: #fff; border-color: var(--ink); font-family: var(--body); font-size: 22px; }
.pad .go:disabled { opacity: 0.35; }

.choices { display: grid; gap: 10px; }
.choices button { min-height: 60px; text-align: left; padding: 0 18px; border: 2px solid var(--line); border-radius: 6px; background: var(--panel); font-weight: 600; }
.choices button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.sheet textarea { font-weight: 400; margin-top: 6px; width: 100%; min-height: 96px; padding: 12px; border: 2px solid var(--line); border-radius: 6px; background: var(--panel); resize: none; user-select: text; }
.field-label { font-weight: 600; margin: 14px 0 6px; display: block; }

.dots { display: flex; gap: 18px; margin: 20px 0 6px; }
.dots span { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--ink); }
.dots span.on { background: var(--ink); }
.dots.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

.center { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 28px; width: min(100%, 460px); }
.card h1 { font-family: var(--display); font-size: 40px; line-height: 1.05; margin: 0 0 10px; }
.card p { margin: 0 0 16px; color: var(--quiet); }
.card input[type="text"], .card input[type="email"], .card input[type="password"] {
  width: 100%; min-height: 56px; padding: 0 14px; border: 2px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: 12px;
}
.code-input { font-family: var(--display); font-size: 40px !important; letter-spacing: 0.2em; text-transform: uppercase; text-align: center; }

.saved { position: fixed; inset: 0; display: grid; place-items: center; background: var(--cold); color: #fff; text-align: center; padding: 24px; }
.saved.warn { background: #8A5A00; }
.saved.out { background: var(--hot); }
.saved h2 { font-family: var(--display); font-size: clamp(48px, 9vw, 96px); line-height: 1; margin: 0 0 12px; }
.saved p { font-size: 24px; margin: 0; }

@media (max-width: 760px) {
  .sheet { grid-template-columns: 1fr; overflow-y: auto; }
  .term { padding: 16px; }
}

/* ---------- manager ---------- */

.admin { max-width: 1120px; margin: 0 auto; padding: 20px 20px 60px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-top .brand { font-size: 30px; }
.admin-top h1 { font-family: var(--body); font-size: 18px; font-weight: 600; margin: 2px 0 0; line-height: 1.2; }
.sub { font-size: 16px; color: var(--quiet); }
.sub.bad { color: var(--hot); font-weight: 600; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); margin-bottom: 20px; }
.tabs button { border: 0; background: transparent; padding: 12px 14px; font-weight: 600; border-radius: 6px 6px 0 0; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.admin h2 { font-family: var(--display); font-size: 28px; margin: 0 0 4px; }
.admin .lead { color: var(--quiet); margin: 0 0 16px; max-width: 62ch; }
.rows { display: grid; gap: 10px; margin-bottom: 22px; }
.row { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.off { opacity: 0.55; }
.row .grow { flex: 1; min-width: 160px; }
.row .grow input[type="text"] { width: 100%; }
.row .title { font-weight: 600; }
.row .meta { color: var(--quiet); font-size: 16px; }
.form { background: var(--panel); border: 2px dashed var(--line); border-radius: 6px; padding: 14px; display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; }
.form input, .form select, .row input, .row select { min-height: 44px; padding: 0 10px; border: 2px solid var(--line); border-radius: 6px; background: #fff; font-weight: 400; }
.form input[type="number"], .row input[type="number"] { width: 96px; }
.days { display: flex; gap: 4px; }
.days label { display: grid; place-items: center; width: 44px; height: 44px; border: 2px solid var(--line); border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; background: #fff; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.days label:has(input:focus-visible) { outline: 3px solid var(--cold); outline-offset: 2px; }
.paircode { font-family: var(--display); font-size: 56px; font-weight: 700; letter-spacing: 0.15em; }
table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 16px; }
.scroll { overflow-x: auto; border: 2px solid var(--line); border-radius: 6px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.wrap { white-space: normal; min-width: 180px; }
th { font-weight: 600; background: var(--steel); }
td.num { font-family: var(--display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 4px; font-weight: 600; font-size: 14px; }
.pill.ok { background: var(--frost); color: var(--cold); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.out { background: var(--hot-bg); color: var(--hot); }
.pill.late { background: var(--ink); color: #fff; }
.mini-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 22px; }
.mini-tiles .tile { min-height: 170px; cursor: default; }
.mini-tiles .tile .temp { font-size: clamp(40px, 30cqw, 68px); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Schedules: a group is a panel holding its reading times. */
.group { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; margin-bottom: 18px; }
.group-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 2px solid var(--line); }
.group-head .grow { flex: 1; min-width: 200px; }
.group-head input[type="text"] { width: 100%; min-height: 44px; padding: 0 10px; border: 2px solid var(--line); border-radius: 6px; font-weight: 600; font-size: 20px; }
.group-body { padding: 12px 14px; display: grid; gap: 10px; }
.group-body .row, .group-body .form { border-width: 1px; }
.group .used { color: var(--quiet); font-size: 16px; }
.item-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; flex: 1; }
.item-fields label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; }
.item-fields input[type="text"] { width: 170px; }
.row.item { align-items: flex-end; }
.row.item .limit-now { flex-basis: 100%; color: var(--quiet); font-size: 16px; }

/* ---------- history: a row per round of readings, a column per item ---------- */

/* The day and time stay put while the items scroll sideways. Sticky cells lose their borders
   in a collapsed table, so their edges are drawn as inset shadows. */
.grid th, .grid td { vertical-align: top; }
.grid thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -2px var(--line); }
.grid th small { display: block; font-weight: 400; font-size: 14px; color: var(--quiet); }
.grid th.retired { color: var(--quiet); }
.grid .when { position: sticky; left: 0; z-index: 1; box-shadow: inset -2px 0 var(--line); }
.grid thead .when { z-index: 3; box-shadow: inset -2px -2px var(--line); }
.grid .when .slot { display: grid; grid-template-columns: 7em auto; column-gap: 12px; align-items: baseline; }
.grid .when .at { font-family: var(--display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grid .when .check { grid-column: 2; font-weight: 400; font-size: 14px; color: var(--quiet); }
.grid tbody tr.day-start:not(:first-child) td { border-top: 2px solid var(--ink); }
.grid tbody tr.day-start:not(:first-child) .when { box-shadow: inset -2px 0 var(--line), inset 0 2px var(--ink); }
.grid td.none { color: var(--line); }
.reading { display: grid; gap: 1px; }
.reading + .reading { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.reading .t { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.reading .t small { font-size: 0.55em; vertical-align: 0.6em; margin-left: 1px; }
.reading.ok .t { color: var(--cold); }
.reading.warn .t { color: var(--amber); }
.reading.out .t { color: var(--hot); }
.reading .by { font-size: 14px; color: var(--quiet); }
.reading .by .pill { margin-left: 6px; padding: 0 6px; font-size: 12px; }
.reading .did, .reading .note { font-size: 14px; white-space: normal; min-width: 150px; max-width: 220px; }
.reading .did { font-weight: 600; color: var(--hot); }
.reading .note { color: var(--quiet); }

/* On the terminal the grid fills the screen and scrolls inside it, so the item names stay in view. */
#history { height: 100%; }
.history-title { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 4vw, 44px); line-height: 1.05; margin: 0; color: var(--ink); }
#history .term-top { align-items: center; }
.history-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-range { font-weight: 600; text-align: center; }
.history-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.history-grid .scroll { flex: 0 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.history-grid .grid { font-size: 18px; }
.history-grid .reading .t { font-size: 30px; }
.history-grid .reading .by, .history-grid .grid th small, .history-grid .grid .when .check { font-size: 16px; }
.history-grid .grid .when .at { font-size: 26px; }

/* Narrow screens: the day sits above the time, leaving more room for the items. */
@media (max-width: 760px) {
  .grid .when .slot { grid-template-columns: auto; }
  .grid .when .check { grid-column: 1; }
  .grid th, .grid td { padding: 8px 10px; }
}

/* ---------- a drop-down of tick boxes, for the schedules an item follows ---------- */

.field { display: grid; gap: 4px; font-size: 15px; font-weight: 600; }
.multi { position: relative; font-size: 18px; font-weight: 400; }
.multi summary {
  display: block; position: relative; width: 330px; max-width: 78vw; min-height: 44px; padding: 8px 34px 8px 10px;
  border: 2px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.multi summary::-webkit-details-marker { display: none; }
.multi summary::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px; margin-top: -7px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg);
}
.multi[open] summary { border-color: var(--ink); }
.multi[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.multi-list {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(340px, 90vw);
  display: grid; gap: 2px; padding: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(19, 35, 43, 0.18);
}
.multi-list label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; border-radius: 4px; cursor: pointer; font-size: 17px; font-weight: 400; }
.multi-list label:hover { background: var(--steel); }
.multi-list input[type="checkbox"] { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--ink); }
.multi-hint { padding: 6px 8px 4px; font-size: 14px; color: var(--quiet); white-space: normal; }
.multi-list label + .multi-hint { border-top: 1px solid var(--line); margin-top: 4px; }

/* A heading inside the drop-down ticks its whole group; the group's own boxes sit indented under it. */
.multi-list label.multi-head { font-weight: 600; }
.multi-list label.multi-sub { padding-left: 40px; }
.multi-list label span { display: grid; padding: 6px 0; }
.multi-list label small { font-size: 14px; color: var(--quiet); white-space: normal; }
.multi-list label + label.multi-head { border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; }
.row .field input[type="text"], .form .field input[type="text"] { font-size: 18px; }
.row.policy, .row.person { align-items: flex-end; }
.row.policy .limit-now { flex-basis: 100%; color: var(--quiet); font-size: 16px; }
.row.person .grow { align-self: center; min-width: 200px; }
.row.person .multi summary { width: 260px; }  /* narrower here, so the whole row fits on one line */
.row .meta.warn { color: var(--hot); font-weight: 600; }

/* ---------- terminal: the two tabs, Temperatures and Cleaning ---------- */

.term-tabs { display: flex; gap: 10px; }
.term-tabs button {
  flex: 1; min-height: 60px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 2px solid var(--ink); border-radius: 6px; background: transparent; font-weight: 600; font-size: 22px;
}
.term-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
/* How many things on that tab want doing now. Red once any of them is overdue. */
.badge { min-width: 36px; padding: 0 10px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--display); font-size: 24px; line-height: 1.4; text-align: center; }
.term-tabs button[aria-selected="true"] .badge { background: #fff; color: var(--ink); }
.term-tabs .badge.hot { background: var(--hot); color: #fff; }
.badge:empty { display: none; }

/* ---------- terminal: the task list (cleaning and checks) ---------- */

/* A row per task. The left band carries the state, as on a temperature tile. Tap a row to tick it. */
.task-list { display: grid; gap: 10px; align-content: start; flex: 1; padding-bottom: 96px; }
.task-list h2 { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1.1; margin: 10px 0 0; color: var(--quiet); }
.task-list h2:first-child { margin-top: 0; }
.task-row { display: flex; align-items: stretch; position: relative; overflow: hidden; background: var(--panel); border: 2px solid var(--line); border-radius: 6px; }
.task-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: var(--line); }
.task-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 18px; min-height: 84px; padding: 12px 16px 12px 30px; border: 0; background: transparent; text-align: left; }
.task-main:disabled { opacity: 0.5; }
.tick { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 6px; background: #fff; font-size: 38px; font-weight: 700; line-height: 1; }
.task-text { display: grid; gap: 2px; min-width: 0; }
.task-text .name { font-weight: 600; font-size: 24px; line-height: 1.15; }
.task-text .state { font-size: 18px; color: var(--quiet); }
.task-text .detail { font-size: 19px; font-style: italic; white-space: pre-wrap; }  /* a check's further details */
.task-row .how { align-self: center; margin-right: 12px; min-height: 52px; padding: 0 18px; font-size: 18px; }
.task-row.due { border-color: var(--ink); border-width: 4px; }
.task-row.due::before { background: var(--ink); }
.task-row.due .state { color: var(--ink); font-weight: 600; }
.task-row.overdue { border-color: var(--hot); border-width: 4px; background: var(--hot-bg); }
.task-row.overdue::before { background: var(--hot); }
.task-row.overdue .state { color: var(--hot); font-weight: 600; }
.task-row.done::before { background: var(--cold); }
.task-row.picked { border-color: var(--ink); }
.task-row.picked .tick { background: var(--ink); color: #fff; }
/* A check last signed as a problem: red until it is signed as done. */
.task-row.flagged { border-color: var(--hot); }
.task-row.flagged::before { background: var(--hot); }
.task-row.flagged .state { color: var(--hot); font-weight: 600; }
/* A check being marked as a problem, waiting for a PIN like any other tick. */
.task-row.wrong { border-color: var(--hot); background: var(--hot-bg); }
.task-row.wrong::before { background: var(--hot); }
.task-row.wrong .tick { background: var(--hot); border-color: var(--hot); color: #fff; }
.task-row.wrong .state { color: var(--hot); font-weight: 600; }

/* A section's title with "Tick all" beside it: one tap for the whole list. */
.task-head { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.task-head:first-child { margin-top: 0; }
.task-head h2 { flex: 1; margin: 0; }
.tick-all { flex: none; min-height: 52px; padding: 0 18px; font-size: 18px; white-space: nowrap; }
/* All, Cleaning or Checks. Shown only when a business has both kinds. */
.task-filter { justify-self: start; margin-bottom: 0; }
.task-filter button { min-height: 52px; padding: 0 20px; font-size: 18px; }

/* Appears once anything is ticked: one PIN signs the lot. */
.sign-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--ink); color: #fff; }
.sign-bar .grow { flex: 1; font-weight: 600; font-size: 22px; }
.sign-bar .btn { background: #fff; color: var(--ink); border-color: #fff; }
.sign-bar .btn.plain { background: transparent; color: #fff; }

/* The sheet and the "saved" flash cover everything, the sign-off bar included. */
.sheet { z-index: 10; }
.saved { z-index: 11; }
.sheet.one { grid-template-columns: minmax(0, 1fr); }
.sheet .use { font-size: 22px; }
.sheet .method { font-size: 22px; white-space: pre-wrap; overflow-y: auto; min-height: 0; padding: 12px 14px; background: var(--panel); border: 2px solid var(--line); border-radius: 6px; user-select: text; }
.sign-list { margin: 0; padding-left: 1.2em; font-size: 20px; overflow-y: auto; min-height: 0; }
.sign-list li.wrong { color: var(--hot); font-weight: 600; }
/* Side by side, the sheet is exactly as tall as the screen, so a long list of ticked tasks
   scrolls inside itself and the PIN dots and Cancel never slide off the bottom. */
@media (min-width: 761px) {
  .sheet { grid-template-rows: minmax(0, 1fr); }
  .sheet-info { min-height: 0; }
  .sheet-info > :not(.sign-list):not(.method) { flex: none; }
}
.sheet textarea[hidden] + .sheet-actions { margin-top: auto; }

@media (max-width: 760px) {
  .term-tabs button { font-size: 18px; min-height: 52px; }
  .sign-bar { padding: 12px 16px; }
  .sign-bar .grow { font-size: 18px; }
  .task-main { gap: 12px; padding: 10px 8px 10px 24px; }
  .tick { width: 44px; height: 44px; font-size: 32px; }
  .task-text .name { font-size: 18px; }
  .task-text .state, .task-text .detail { font-size: 15px; }
  .task-row .how { margin-right: 8px; min-height: 44px; padding: 0 10px; font-size: 15px; }
  .tick-all { min-height: 44px; padding: 0 12px; font-size: 16px; }
  .term .todo-group { font-size: 18px; flex-wrap: wrap; }
}

/* ---------- manager: a schedule's times, each a sentence with its fields tucked behind Change ---------- */

.row.rule { display: block; }
.rule-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rule-line .grow { flex: 1; min-width: 220px; }
.rule-edit { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.rule-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.rule-fields label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; }
.pair { display: flex; gap: 6px; }
.pair input[type="number"] { width: 76px; }
.form .field input, .form .field select, .row .field input, .row .field select { font-size: 18px; }

/* ---------- manager: tasks (cleaning and checks) ---------- */

.row.task { align-items: flex-end; }
.row.task .limit-now { flex-basis: 100%; color: var(--quiet); font-size: 16px; }
.item-fields label.wide { flex-basis: 100%; }
.item-fields textarea, .form textarea {
  width: 100%; min-height: 0; padding: 8px 10px; border: 2px solid var(--line); border-radius: 6px;
  background: #fff; font-weight: 400; font-size: 18px; resize: vertical;
}
.item-fields input.long { width: 250px; max-width: 78vw; }
.task-fields .multi summary { width: 250px; }  /* so the four short boxes share a line */
.task-fields input[aria-label="Name"] { width: 300px; max-width: 78vw; }  /* a check's name is a sentence */
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: 6px; background: var(--amber-bg); color: var(--amber); font-weight: 600; max-width: 62ch; }
.admin h3 { font-family: var(--display); font-size: 22px; margin: 18px 0 8px; }

/* Temperatures, Cleaning or Checks, on History and Records. All, Cleaning or Checks, on Tasks. */
.switch { display: inline-flex; margin-bottom: 14px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.switch button { min-height: 44px; padding: 0 18px; border: 0; background: transparent; font-weight: 600; }
.switch button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* A tick on the task sheet, or a cross for a check signed as a problem. */
.reading.clean .t { color: var(--cold); }
.reading.clean.problem .t, .reading.clean.problem .note { color: var(--hot); font-weight: 600; }
.grid .when .day { font-weight: 600; }

/* ---------- home: to-dos for today, the next 7 days and the next 30 days ---------- */

/* A row per to-do, with the same left band as a temperature tile or a cleaning row. On the
   manager screen it is a plain row; on the terminal it is a big button that opens the right tab. */
.todo-list { display: grid; gap: 10px; align-content: start; }
.todo-list h2 { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1.1; margin: 10px 0 0; color: var(--quiet); }
.todo-list h2:first-child, .todo-list h3:first-child { margin-top: 0; }
.todo-none { margin: 0; color: var(--quiet); }
.todo-row {
  display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden; width: 100%;
  padding: 12px 14px 12px 30px; background: var(--panel); border: 2px solid var(--line); border-radius: 6px; text-align: left;
}
.todo-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: var(--line); }
.todo-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.todo-text .name { font-weight: 600; }
.todo-text .state { font-size: 16px; color: var(--quiet); }
.todo-row .pill { flex: none; }
.todo-row.due { border-color: var(--ink); }
.todo-row.due::before { background: var(--ink); }
.todo-row.due .state { color: var(--ink); font-weight: 600; }
.todo-row.overdue, .todo-row.missed { border-color: var(--hot); background: var(--hot-bg); }
.todo-row.overdue::before, .todo-row.missed::before { background: var(--hot); }
.todo-row.overdue .state, .todo-row.missed .state { color: var(--hot); font-weight: 600; }
/* A check that was missed says which day and time it was, beside its schedule's name. */
.todo-row.missed .name .at { margin-left: 8px; font-weight: 400; color: var(--quiet); }
.todo-list .todo-section.missed h2, .todo-list .todo-section.missed h3 { color: var(--hot); }
.todo-row.done::before { background: var(--cold); }
.todo-row.flagged { border-color: var(--hot); }
.todo-row.flagged::before { background: var(--hot); }
.todo-row.flagged .state { color: var(--hot); font-weight: 600; }
/* A heading that folds what is under it away. The triangle points down when open, right when shut. */
.fold { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.fold .chev { flex: none; width: 1em; text-align: center; }
.fold .words { min-width: 0; }
/* One of the three sections: its title, and when folded, what is waiting under it. */
.todo-section { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.todo-section:first-child { margin-top: 0; }
.todo-list .todo-section h2, .todo-list .todo-section h3 { flex: 1; min-width: 0; margin: 0; }
.todo-section .left { flex: none; color: var(--quiet); }
.todo-section .pill, .todo-group .pill { flex: none; }
.todo-group.folded, .todo-section.folded { padding-bottom: 6px; border-bottom: 2px solid var(--line); }
/* A schedule's heading inside a section: its name and time, what is left, and on the terminal "Tick all". */
.todo-group { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.todo-group .title { flex: 1; min-width: 0; font-weight: 600; }
.todo-group .title .at { margin-left: 10px; font-weight: 400; color: var(--quiet); }
.todo-group .left { flex: none; color: var(--quiet); }
.pill.early { background: var(--frost); color: var(--cold); }
.todo-row .pill.out { background: var(--hot); color: #fff; }  /* on a red row, the label has to stand out from it */

.term #home { flex: 1; padding-bottom: 96px; }  /* room for the sign-off bar */
.term .todo-group { margin-top: 14px; font-size: 22px; }
.term .fold { min-height: 52px; }
.term .todo-section .left { font-size: 18px; }
.term .todo-section .pill, .term .todo-group .pill { font-size: 18px; padding: 4px 14px; }
.term .todo-group .left { font-size: 18px; }
.term .todo-list .task-row { width: 100%; }
.term .todo-row { min-height: 84px; padding: 12px 18px 12px 32px; }
.term .todo-row.due, .term .todo-row.overdue { border-width: 4px; }
.term .todo-text .name { font-size: 24px; line-height: 1.15; }
.term .todo-text .state { font-size: 18px; }
.term .todo-row .pill { font-size: 18px; padding: 4px 14px; }
.term .todo-none { font-size: 20px; }
.term-tabs button { min-width: 0; }

@media (max-width: 760px) {
  .term-tabs { gap: 6px; }
  .term-tabs button { flex: 1 1 auto; font-size: 16px; gap: 6px; padding: 0 8px; }  /* each as wide as its word needs */
  .term-tabs .badge { min-width: 28px; padding: 0 7px; font-size: 20px; }
  .term .todo-text .name { font-size: 20px; }
  .term .todo-row .pill { font-size: 15px; padding: 2px 10px; }
}
.todo-section .fold { width: 100%; }
/* The line a view's errors appear on takes no room until there is one to show. */
#view-error:empty { display: none; }
.admin h2 + #view-error:empty + h3 { margin-top: 6px; }

/* ---------- who is signed in on the terminal ---------- */
/* The name is always in sight while a sign-off would be made in it, with the way out beside it. */
.who { display: inline-flex; align-items: center; gap: 10px; padding: 4px 4px 4px 14px; border: 2px solid var(--ink); border-radius: 6px; background: var(--panel); color: var(--ink); }
.who-name { font-weight: 600; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .btn { min-height: 40px; padding: 0 14px; font-size: 16px; border-width: 0 0 0 2px; border-radius: 0; }
.who.short { border-color: var(--amber); background: var(--amber-bg); }  /* a short stay on a shared device: it is somebody's only for now */
.who.short .btn { border-color: var(--amber); }
.card.signin { user-select: none; }
.card.signin .dots { justify-content: center; }
.card.signin .pad button { min-height: 64px; }
.card.signin .error { text-align: center; }
@media (max-width: 760px) {
  .term-right { flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
}
/* A terminal's settings on the manager screen: what it is, then the choice that goes with it. */
.row.terminal { align-items: flex-end; }
.row.terminal .signing { flex-basis: 100%; color: var(--quiet); font-size: 16px; }
.row.terminal .signing.warn { color: var(--hot); font-weight: 600; }

/* ---------- manager: suppliers ---------- */
/* The All, Suppliers or Contractors switch with the download beside it. */
.form-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.form-bar .switch { margin-bottom: 0; }
.form-bar .switch button { white-space: nowrap; }
@media (max-width: 480px) { .form-bar .switch button { padding: 0 12px; } }
.row.supplier { align-items: flex-end; }
.row.supplier .limit-now { flex-basis: 100%; color: var(--quiet); font-size: 16px; }
.supplier-fields input[aria-label="Name"] { width: 240px; max-width: 78vw; }

/* ---------- terminal: the supplier list, read only ---------- */
/* A card per supplier, with the phone number big enough to read across the kitchen. */
.supplier-list { display: grid; gap: 12px; align-content: start; flex: 1; }
.supplier-card { display: grid; gap: 6px; position: relative; overflow: hidden; padding: 14px 18px 16px 32px; background: var(--panel); border: 2px solid var(--line); border-radius: 6px; }
.supplier-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: var(--cold); }
.supplier-card.contractor::before { background: var(--ink); }
.supplier-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.supplier-head .name { font-weight: 600; font-size: 26px; line-height: 1.15; }
.supplier-card .supplies { font-size: 20px; color: var(--quiet); }
.supplier-card .line { font-size: 20px; color: var(--ink); overflow-wrap: anywhere; }
.supplier-card .label { color: var(--quiet); }
.supplier-card .address { white-space: pre-wrap; color: var(--quiet); }
.supplier-card .notes { font-size: 19px; font-style: italic; white-space: pre-wrap; color: var(--quiet); }
.supplier-card .call {
  justify-self: start; display: inline-flex; align-items: center; min-height: 56px; padding: 0 20px; margin: 4px 0;
  border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); text-decoration: none;
  font-family: var(--display); font-weight: 700; font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.supplier-card a.call:active { background: var(--frost); border-color: var(--cold); }
.supplier-foot { margin: 4px 0 0; color: var(--quiet); }
@media (max-width: 760px) {
  .supplier-card { padding: 12px 12px 14px 26px; }
  .supplier-head .name { font-size: 21px; }
  .supplier-card .supplies, .supplier-card .line { font-size: 17px; }
  .supplier-card .notes { font-size: 16px; }
  .supplier-card .call { font-size: 28px; min-height: 52px; }
}
/* On a phone the terminal's tabs go two to a row, so each keeps a full-size word and a big target,
   and the All / Suppliers / Contractors switch keeps each label on one line. */
@media (max-width: 480px) {
  .term-tabs { flex-wrap: wrap; }
  .term-tabs button { flex: 1 1 calc(50% - 6px); }
  .task-filter button { padding: 0 12px; font-size: 16px; white-space: nowrap; }
}

/* ---------- what was missed, put right afterwards ---------- */
/* A missed line with everything on it filled in from paper or explained: no longer red, still listed. */
.todo-row.resolved { border-color: var(--line); }
.todo-row.resolved::before { background: var(--amber); }
.todo-row.resolved .name .at { margin-left: 8px; font-weight: 400; color: var(--quiet); }
button.todo-row.missed { cursor: pointer; }
.reading .entered { font-size: 14px; color: var(--amber); white-space: normal; min-width: 150px; max-width: 240px; }
.reading .by .pill.warn { margin-left: 6px; padding: 0 6px; font-size: 12px; }
/* On the terminal: the time on the paper, and the things to fill in, one button each. */
.late-when { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.late-when input, .late-when select { min-height: 60px; padding: 0 14px; border: 2px solid var(--line); border-radius: 6px; background: #fff; font-size: 26px; font-family: var(--display); font-weight: 600; }
.late-list { display: grid; gap: 10px; overflow-y: auto; min-height: 0; }
.late-list button { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px; padding: 0 18px; text-align: left; border: 2px solid var(--line); border-radius: 6px; background: var(--panel); font-weight: 600; font-size: 20px; }
.late-list button.set { border-color: var(--ink); }
.late-list button .val { font-family: var(--display); font-size: 30px; }
.late-list button .val.ok { color: var(--cold); }
.late-list button .val.warn { color: var(--amber); }
.late-list button .val.out { color: var(--hot); }
.late-list button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.td-entered { white-space: normal; min-width: 180px; color: var(--amber); }
.late-list button .val.empty { font-family: var(--body); font-size: 17px; font-weight: 600; color: var(--quiet); white-space: nowrap; }
