/* Theme: neutral greys, one warm accent. Dark mode follows the system unless the
   user picks Light or Dark (html[data-theme], set by theme.js). */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --accent: #c2410c;
  --on-accent: #ffffff;
  --accent-soft: #fff4ec;
  --ok: #15803d;
  --warn: #92400e;
  --warn-soft: #fffbeb;
  --err: #b91c1c;
  --err-soft: #fef2f2;
  --stripe: #ecebe9;
  --radius: 8px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315; --surface: #1a1d21; --surface-2: #16191c; --text: #e6e8eb; --muted: #9aa1ab;
    --line: #2a2f36; --line-strong: #39404a; --accent: #fb923c; --on-accent: #1a1d21;
    --accent-soft: #2e2116; --ok: #4ade80; --warn: #fbbf24; --warn-soft: #2b2412;
    --err: #f87171; --err-soft: #2c1a1a; --stripe: #23272d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315; --surface: #1a1d21; --surface-2: #16191c; --text: #e6e8eb; --muted: #9aa1ab;
  --line: #2a2f36; --line-strong: #39404a; --accent: #fb923c; --on-accent: #1a1d21;
  --accent-soft: #2e2116; --ok: #4ade80; --warn: #fbbf24; --warn-soft: #2b2412;
  --err: #f87171; --err-soft: #2c1a1a; --stripe: #23272d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

header.top {
  display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 650; text-decoration: none; color: var(--text); }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
header.top nav a { text-decoration: none; color: var(--muted); padding: 2px 0; border-bottom: 2px solid transparent; }
header.top nav a:hover { color: var(--text); }
header.top nav a.active { color: var(--text); border-bottom-color: var(--accent); }
header.top .who { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
header.top .who select { font-size: 13px; padding: 3px 6px; }

main { padding: 20px 16px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 21px; font-weight: 600; margin: 4px 0 12px; }
h2 { font-size: 15px; font-weight: 600; margin: 28px 0 10px; color: var(--text); }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { font-size: 12px; font-weight: 500; color: var(--muted); border-bottom-color: var(--line-strong); }
tbody th, tr > th[scope=row] { font-weight: 500; color: var(--text); white-space: nowrap; }
tr:last-child > td, tr:last-child > th { border-bottom: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.card-head .meta { color: var(--muted); font-size: 14px; }
.card-head .order { margin-left: auto; display: flex; gap: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.grid2 > table { align-self: start; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

.btn, button {
  display: inline-block; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 11px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover, button:hover { background: var(--surface-2); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover, button.primary:hover { filter: brightness(1.05); }
.btn.small, button.small { padding: 1px 8px; font-size: 13px; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); }
.issue { padding: 8px 12px; border-radius: var(--radius); margin-bottom: 6px; border: 1px solid transparent; }
.issue.error { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.issue.warning { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li { padding: 8px 12px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); margin-bottom: 6px; }
.messages li.error { background: var(--err-soft); color: var(--err); }
.spike { background: var(--warn-soft); }

input, select, textarea {
  font: inherit; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--text);
}
input[type=number] { width: 72px; }
.demand td.closed, .timeline .closed {
  background: repeating-linear-gradient(45deg, transparent, transparent 5px, var(--stripe) 5px, var(--stripe) 6px);
}
form.stack p { margin: 0 0 10px; }
form.stack label { display: block; font-size: 13px; color: var(--muted); }
.errorlist { color: var(--err); margin: 2px 0; padding-left: 18px; }
.helptext { display: block; font-size: 12px; color: var(--muted); }

.timeline-wrap { overflow-x: auto; }
.timeline td { min-width: 120px; font-size: 13px; line-height: 1.65; padding-top: 10px; padding-bottom: 10px; }
.timeline tbody th { padding-top: 10px; padding-bottom: 10px; }
.timeline tr.starter th { color: var(--ok); }
.timeline tr.dough th { color: var(--accent); }
.timeline tr.product th { font-weight: 400; padding-left: 20px; }
.timeline .cell div { white-space: nowrap; }

details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h3::before { content: "▸ "; color: var(--muted); }
details.card[open] > summary h3::before { content: "▾ "; }

.empty { padding: 24px; text-align: center; color: var(--muted); }
.login { max-width: 360px; margin: 60px auto; }

@media print {
  :root { color-scheme: light; }
  header.top, .no-print, .order { display: none !important; }
  body, table, .card { background: #fff !important; color: #000 !important; }
  main { padding: 0; max-width: none; }
  .card { break-inside: avoid; border-color: #999; }
  h2 { break-after: avoid; }
  @page { size: A4; margin: 12mm; }
}

/* Timeline: one block per production batch (same bake day) */
.timeline .batch + .batch { margin-top: 12px; }
.timeline .batch-day { margin-bottom: 2px; }
.timeline .batch.for-bake { border-left: 2px solid var(--line-strong); padding-left: 7px; }
.timeline .batch.same-day { border-left-color: var(--accent); }
.timeline .batch-day { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.timeline .batch.same-day .batch-day { color: var(--accent); }
.timeline .batch[data-batch], .timeline .batch.mix { cursor: pointer; border-radius: 0 4px 4px 0; transition: background-color .12s; }
.timeline .batch.mix { border-left: 2px solid transparent; padding-left: 7px; margin-left: -9px; }
/* Link colours, always in this order for a mix's bake days. */
.timeline { --c0: var(--accent); --c1: #2563eb; --c2: #059669; --c3: #9333ea; --c4: #db2777; }
:root[data-theme="dark"] .timeline { --c1: #60a5fa; --c2: #34d399; --c3: #c084fc; --c4: #f472b6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline { --c1: #60a5fa; --c2: #34d399; --c3: #c084fc; --c4: #f472b6; }
}
.timeline .linked { --link: var(--accent); }
.timeline .linked.c0 { --link: var(--c0); } .timeline .linked.c1 { --link: var(--c1); }
.timeline .linked.c2 { --link: var(--c2); } .timeline .linked.c3 { --link: var(--c3); }
.timeline .linked.c4 { --link: var(--c4); }
.timeline .batch.linked {
  background: color-mix(in srgb, var(--link) 14%, transparent); border-left-color: var(--link);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 35%, transparent);
}
.timeline .batch.mix.linked { background: transparent; box-shadow: none; border-left-color: var(--line-strong); }
.timeline .batch.linked .batch-day { color: var(--link); }
.timeline .mix-use.linked { color: var(--link) !important; font-weight: 600; }
.timeline tr.dough .cell .batch div:first-child { font-weight: 600; }
.timeline tr.dough .cell .batch div + div { color: var(--muted); }

/* Data tables: one row rhythm whether a cell holds text, a number or an input. */
table:not(.timeline) th, table:not(.timeline) td { height: 38px; padding: 4px 10px; vertical-align: middle; }
table:not(.timeline) thead th { height: 32px; vertical-align: bottom; }
td input[type=number] { width: 100%; max-width: 76px; padding: 3px 6px; text-align: right; }
.grid2 { align-items: start; }

/* Demand: every section shares the same column grid so days line up down the page. */
.demand { table-layout: fixed; }
.demand col.product-col { width: 220px; }
.demand th[scope=row] { white-space: normal; line-height: 1.3; }
.pill.muted-pill { background: var(--line); color: var(--text); opacity: .75; }

/* Timeline: full width; product column and date row stay visible while scrolling. */
main.wide { max-width: none; }
.timeline-scroll {
  max-height: calc(100vh - 190px); overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.timeline { border-collapse: separate; border-spacing: 0; }
.timeline thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  box-shadow: inset 0 -1px var(--line-strong);
}
.timeline tbody th, .timeline thead th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  min-width: 190px; box-shadow: inset -1px 0 var(--line-strong);
}
.timeline thead th:first-child { z-index: 3; box-shadow: inset -1px -1px var(--line-strong); }
@media print {
  .timeline-scroll { max-height: none; overflow: visible; border: none; }
  .timeline thead th, .timeline tbody th { position: static; box-shadow: none; }
}

/* Availability */
label.choice { display: block; padding: 4px 0; }
.period-row { display: grid; grid-template-columns: 150px 150px 150px 1fr auto; gap: 8px; align-items: center; }
.period-row input[type=date], .period-row select, .period-row input[type=text] { width: 100%; }
table.periods td[colspan] { padding: 6px 10px; }
.strip { display: grid; grid-template-columns: 80px 1fr; gap: 3px 10px; align-items: center; }
.strip-month { font-size: 12px; color: var(--muted); }
.strip-days { display: grid; grid-template-columns: repeat(31, 1fr); gap: 2px; }
.strip-days span, .swatch { display: inline-block; height: 12px; border-radius: 2px; }
.swatch { width: 12px; vertical-align: -1px; margin-left: 8px; }
.strip-days .available, .swatch.available { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.strip-days .unavailable, .swatch.unavailable { background: var(--stripe); }
.strip-days .past { background: transparent; }
.strip-days .today { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 760px) { .period-row { grid-template-columns: 1fr 1fr; } }
.avail-link { color: inherit; text-decoration: none; display: block; }
table.periods tr.now-row > td { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 3px 0 var(--accent); }
.issue.notice { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.choice-inline { display: inline-flex; gap: 4px; align-items: center; margin-right: 10px; }

/* Prep card: ingredients, then the split as collapsible blocks per product */
.split-divider {
  display: flex; align-items: center; gap: 12px; margin: 22px 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.split-divider::before, .split-divider::after { content: ""; flex: 1; border-top: 2px solid var(--line-strong); }
.split-divider::before { flex: 0 0 12px; }
.split {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 0 6px;
}
.split-product:last-child { border-bottom: none; }
.split-head, .split-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 90px 60px 90px 110px;
  gap: 0 10px; align-items: center; padding: 0 10px;
}
.split-head { font-size: 12px; font-weight: 500; color: var(--muted); height: 32px; border-bottom: 1px solid var(--line-strong); }
.split-product { border-bottom: 1px solid var(--line); }
.split-product > summary { list-style: none; cursor: pointer; height: 40px; font-weight: 600; }
.split-product > summary::-webkit-details-marker { display: none; }
.fold > summary {
  list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: baseline;
  padding: 6px 10px; border-radius: 6px; font-weight: 600;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--surface-2); }
.fold > summary .meta { font-weight: 400; color: var(--muted); font-size: 14px; }
.fold > summary .name::before, .split-product > summary .name::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 10px 2px 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .12s;
}
.split-product[open] > summary .name::before, .fold[open] > summary .name::before {
  transform: rotate(45deg); margin-bottom: 4px;
}
.split-product > summary:hover { background: var(--surface-2); }
.split-parts { margin: 0 0 10px 20px; padding-left: 12px; }
/* Guide rail: the vertical line beside a block's contents; clicking it folds the block. */
details { position: relative; }
.rail {
  position: absolute; width: 24px; min-height: 24px; cursor: pointer; border-radius: 4px; z-index: 1; /* ≥ 24 px target */
}
.rail::after {
  content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px;
  background: var(--line-strong); border-radius: 1px; transition: background-color .12s;
}
.rail:hover::after, .rail:focus-visible::after { background: var(--accent); }
.rail:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
details:not([open]) > .rail { display: none; }
.split-product > .rail { left: 9px; top: 40px; bottom: 10px; }
.day-nav details > .rail { left: 7px; top: 24px; bottom: 6px; }
@media print { .rail { display: none; } }
.split-parts .split-row { height: 30px; color: var(--muted); padding-left: 4px; }
.split-parts .split-row .name { color: var(--text); }
@media print {
  .fold > summary {
  list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: baseline;
  padding: 6px 10px; border-radius: 6px; font-weight: 600;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--surface-2); }
.fold > summary .meta { font-weight: 400; color: var(--muted); font-size: 14px; }
.fold > summary .name::before, .split-product > summary .name::before { display: none; }
  .split-product:not([open]) .split-parts { display: block; }
}
table.step-groups tr.group-head > th { font-weight: 600; padding-top: 14px; border-bottom: 1px solid var(--line-strong); }
table.step-groups td.indent { padding-left: 26px; }

/* Day sheet: sidebar navigation + content */
.day-section { margin: 8px 0 24px; scroll-margin-top: 12px; }
.day-section > h2 { margin-top: 0; }
[id] { scroll-margin-top: 12px; }
.day-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.day-nav {
  position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
  font-size: 13px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 6px;
}
.day-nav summary { list-style: none; cursor: pointer; }
.day-nav summary::-webkit-details-marker { display: none; }
.day-nav summary::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 10px 2px 11px; /* ≥ 24 px target */
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .12s; flex: none;
}
.day-nav[open] > summary::before,
.day-nav details[open] > summary::before { transform: rotate(45deg); margin-bottom: 4px; }
.day-nav summary { display: flex; align-items: center; min-height: 24px; }
.day-nav summary > a { flex: 1; min-width: 0; }
.nav-toggle { font-weight: 600; padding: 2px 4px 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.day-nav ul { list-style: none; margin: 0; padding: 0; }
.day-nav li ul { margin: 2px 0 6px 18px; padding-left: 8px; }
.day-nav a {
  display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 5px;
  color: var(--text); text-decoration: none;
}
.day-nav a .q { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-nav a:hover { background: var(--surface-2); }
.day-nav a.current { background: var(--accent-soft); color: var(--accent); }
.day-nav a.current .q { color: var(--accent); }
.day-nav .nav-section > details > summary > a { font-weight: 600; }
.day-nav .nav-section { margin-top: 4px; }
.day-nav li ul a { color: var(--muted); }
/* Collapsed sidebar: just the tab, content gets the width. */
.day-layout:has(> .day-nav:not([open])) { grid-template-columns: max-content minmax(0, 1fr); }
.day-nav:not([open]) { padding: 6px 10px; }
.day-nav:not([open]) > .nav-toggle { padding: 0; }
/* Flash the item jumped to from the sidebar. */
@keyframes jump-flash {
  /* two blinks (≈1.2 s), hold 3 s, then a slow fade (≈1.6 s) */
  0%, 10%, 21%, 72% { outline-color: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); }
  5%, 16% { outline-color: transparent; box-shadow: 0 0 0 0 transparent; }
  100% { outline-color: transparent; box-shadow: 0 0 0 0 transparent; }
}
.flash { outline: 2px solid transparent; outline-offset: 2px; border-radius: 6px; animation: jump-flash 5.8s linear; }
@media (max-width: 900px) {
  .day-layout, .day-layout:has(> .day-nav:not([open])) { grid-template-columns: 1fr; }
  .day-nav { position: static; max-height: none; }
}
@media print { .day-nav { display: none !important; } .day-layout { display: block; } }
td > .order, .order { display: inline-flex; gap: 4px; }
.order form { display: inline; margin: 0; }
@keyframes row-flash {
  0%, 10%, 21%, 72% { background: color-mix(in srgb, var(--accent) 28%, transparent); }
  5%, 16% { background: transparent; }
  100% { background: transparent; }
}
tr.flash, tbody.flash { animation: none; outline: none; }
tr.flash > td, tr.flash > th, tbody.flash > tr > td, tbody.flash > tr > th { animation: row-flash 5.8s linear; }

/* Search */
.search { display: inline-flex; align-items: center; gap: 8px; }
.search input { width: 240px; padding: 5px 10px; border-radius: 999px; }
.search.active input { border-color: var(--accent); }
.search-count, .search-empty { font-size: 12px; white-space: nowrap; }
[data-search][hidden], [data-search-group][hidden] { display: none !important; }
/* Timeline with sidebar: the scroll box fills the remaining width */
.day-layout > .timeline-scroll { min-width: 0; }
.day-nav a[data-search] { display: flex; }
/* Timeline: gap before each dough block (moves with the row when search hides it) */
.timeline tbody tr.dough > th, .timeline tbody tr.dough > td {
  border-top: 18px solid var(--bg); background-clip: padding-box;
}
.timeline tbody tr.dough > th, .timeline tbody tr.dough > td { box-shadow: inset 0 1px var(--line-strong); }
.timeline tbody tr.dough > th { box-shadow: inset -1px 0 var(--line-strong), inset 0 1px var(--line-strong); }
@media print { .timeline tbody tr.dough > th, .timeline tbody tr.dough > td { border-top-width: 10px; border-top-color: #fff; } }
.pill.moved { background: var(--warn-soft); color: var(--warn); font-weight: 500; }
form.inline-toggle { display: inline-block; margin-left: 10px; }
/* Closure review */
.handling-option { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); margin: 6px 0; cursor: pointer; }
.handling-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.handling-option .muted { display: block; margin-left: 24px; font-size: 13px; }
.ok-line { color: var(--ok); }
.fold > table td.indent { padding-left: 34px; }
/* One-off changes */
.move-link { margin-left: 6px; text-decoration: none; color: var(--muted); font-weight: 400; padding: 0 4px; border-radius: 4px; }
.move-link:hover { color: var(--accent); background: var(--accent-soft); }
table.tasks tr.done td { color: var(--muted); text-decoration: line-through; }
table.tasks tr.done td:first-child, table.tasks tr.done td:last-child { text-decoration: none; }
.task-add input[type=text] { width: 100%; }
h2 .btn.small { font-size: 12px; font-weight: 400; margin-left: 10px; vertical-align: 2px; }
.card-head .btn.small { margin-left: auto; }
.card-head .btn.small + .order { margin-left: 4px; }
table.bulk tr.group-head > th { padding-top: 12px; border-bottom: 1px solid var(--line-strong); }
.warn-text { color: var(--warn); }
.small-note { font-size: 12px; }
/* Timeline: batches whose prep was moved (closure or one-off) */
.timeline .batch.adjusted { border-left: 2px dashed var(--warn); }
.timeline .batch.adjusted .batch-day { color: var(--warn); }
.adjusted-mark { font-weight: 700; color: var(--warn); }
.timeline .adjusted-note { display: none; font-size: 12px; color: var(--warn); white-space: normal; max-width: 220px; margin-top: 2px; }

/* Floating info card (popover.js): never changes the layout */
.popover {
  position: fixed; z-index: 50; max-width: 340px; min-width: 220px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 10px 12px;
  font-size: 13px; line-height: 1.45; white-space: normal;
}
.pop-title { font-weight: 600; margin-bottom: 6px; }
.pop-adjusted { color: var(--warn); background: var(--warn-soft); border-radius: 5px; padding: 4px 6px; margin-bottom: 6px; }
.pop-journey { margin: 0 0 8px; padding-left: 18px; }
.pop-journey li { margin: 1px 0; }
.pop-journey li.here { font-weight: 600; }
.pop-day { display: inline-block; min-width: 48px; color: var(--muted); }
.pop-links { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 6px; }
.pop-links a { text-decoration: none; padding: 3px 4px; border-radius: 4px; }
.pop-links a:hover { background: var(--accent-soft); }
[data-pop] { cursor: pointer; }
[data-pop]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.timeline .batch.pop-open { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-pop { border-bottom: 1px dotted var(--muted); }
.timeline .row-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.timeline .row-link:hover { color: var(--accent); }
@media print { .popover { display: none !important; } }
.title-link { color: inherit; text-decoration: none; }
.title-link:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Printed day sheet: compact, two-column, tick boxes ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 9mm 10mm; }
  :root { font-size: 9pt; }
  body { background: #fff !important; }
  main, main.wide { padding: 0 !important; max-width: none !important; }
  .print-only { display: inline; }
  .print-meta { display: block; font-size: 8pt; color: #555; margin: -4pt 0 6pt; }
  h1 { font-size: 13pt; margin: 0 0 2pt; }
  h2 { font-size: 10.5pt; margin: 8pt 0 3pt !important; padding: 0; border: none; }
  h3 { font-size: 9.5pt; }
  .day-layout { display: block !important; }
  .day-nav, .search, .toolbar, .move-link, .rail, .order, .task-add, .issue.notice,
  .fold > summary, .split-divider, .split-head, details > summary::before,
  .pill:not(.moved) { display: none !important; }
  .day-section { margin: 0 0 6pt; }
  table:not(.timeline) th, table:not(.timeline) td { height: auto !important; padding: 1pt 4pt !important; }
  table { font-size: 8.5pt; }
  thead th { font-size: 7.5pt; }
  .card { padding: 4pt 6pt !important; margin: 0 0 5pt !important; border: 0.6pt solid #999 !important;
          border-radius: 3pt; box-shadow: none !important; break-inside: avoid; }
  .card-head { margin: 0 0 2pt !important; gap: 6pt; }
  .card-head .meta, .muted { color: #444 !important; }

  /* Starters: three across */
  #sec-feeds .grid2 { grid-template-columns: repeat(3, 1fr) !important; gap: 5pt; }
  #sec-feeds .card p { margin: 2pt 0 0; font-size: 7.5pt; }

  /* Mix: ingredients left, split right */
  .mix-card { display: grid !important; grid-template-columns: 0.9fr 1.3fr; column-gap: 8pt; }
  .mix-card > .card-head { grid-column: 1 / -1; }
  .mix-card > .base-fold { grid-column: 1; }
  .mix-card > .split { grid-column: 2; margin: 0 !important; background: none !important; border: none !important; padding: 0 !important; }
  .split-row, .split-head { padding: 0 2pt !important; grid-template-columns: minmax(0, 1fr) 34pt 26pt 36pt 44pt !important; }
  .split-product { border-bottom: 0.5pt solid #ccc !important; }
  .split-product > summary { display: grid !important; height: auto !important; padding: 1.5pt 2pt !important; font-weight: 600; }
  .split-parts { margin: 0 0 2pt 10pt !important; padding-left: 4pt !important; border-left: 0.6pt solid #aaa; }
  .split-parts .split-row { height: auto !important; font-size: 7.5pt; }

  /* Tick boxes */
  .mix-card > .card-head h3::before, .split-product > summary .name::before,
  table.step-groups td.indent::before, table.bake-list td:first-child::before,
  table.tasks td:nth-child(2)::before {
    content: "☐ " !important; display: inline !important; border: none !important;
    transform: none !important; width: auto !important; height: auto !important; margin: 0 !important;
    font-weight: 400; color: #000;
  }
  table.tasks td:first-child { display: none; }

  /* Folds & shaping: groups flow into two columns */
  table.step-groups { display: block; columns: 2; column-gap: 10pt; border-spacing: 0 !important; }
  table.step-groups thead { display: none; }
  table.step-groups tbody { display: block; break-inside: avoid; margin-bottom: 4pt; }
  table.step-groups tr { display: flex; gap: 4pt; border-bottom: 0.5pt solid #ddd; }
  table.step-groups tr.group-head > th { display: block; width: 100%; padding-top: 2pt !important; border-bottom: 0.6pt solid #999 !important; }
  table.step-groups td.indent { flex: 1; padding-left: 4pt !important; }
  table.step-groups td:nth-child(3) { flex: 0 0 auto; color: #444; }
  table.step-groups td:last-child:empty { display: none; }

  /* Bake list: three columns, product + pieces (retail+B2B) */
  table.bake-list { display: block; columns: 3; column-gap: 10pt; }
  table.bake-list thead { display: none; }
  table.bake-list tbody { display: block; }
  table.bake-list tr { display: flex; break-inside: avoid; border-bottom: 0.5pt solid #ddd; }
  table.bake-list td:first-child { flex: 1; }
  table.bake-list td:nth-child(2) { font-weight: 700; }
  table.bake-list td:nth-child(3), table.bake-list td:nth-child(4), table.bake-list td.no-print { display: none !important; }
  .print-split { font-size: 7pt; color: #555; }
}

/* Recipe editor */
table.edit-rows td { vertical-align: middle; }
table.edit-rows select, table.edit-rows input[type=text] { width: 100%; }
table.edit-rows input[type=number] { max-width: 110px; }
/* Process picture */
table.process { table-layout: fixed; min-width: 560px; width: 100%; }
table.process th, table.process td { height: auto !important; padding: 6px 8px; vertical-align: top; }
table.process thead th { text-align: center; }
table.process thead th:first-child, table.process tbody th { width: 110px; font-weight: 500; text-align: left; }
table.process tbody th { vertical-align: middle; }
table.process td { vertical-align: top; }
table.process td { text-align: center; border-left: 1px solid var(--line); }
table.process td.closed { background: repeating-linear-gradient(45deg, transparent, transparent 5px, var(--stripe) 5px, var(--stripe) 6px); }
table.process .wd { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.chip { display: inline-block; margin: 2px; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 1.3; background: var(--surface-2); border: 1px solid var(--line-strong); max-width: 100%; overflow-wrap: anywhere; }
.chip-feed { border-style: dashed; color: var(--ok); }
.chip-mix { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }
.chip-bake { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip.clash { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.process-card { margin-top: 8px; }
.handling-option .prep-days { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.handling-option .prep-days input { width: 70px; margin-left: 6px; }
table.demand td.copied input { background: var(--accent-soft); border-color: var(--accent); }

/* Show the working */
.why[data-why] { cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.why.open { background: var(--accent-soft); border-radius: 4px; }
.why-card { position: absolute; z-index: 60; max-width: min(460px, calc(100vw - 32px)); padding: 8px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); font-size: 13px; line-height: 1.45; }
@media print { .why[data-why] { text-decoration: none; } .why-card { display: none; } }

/* QC log */
table.qc input { width: 100%; min-width: 70px; }
table.qc td, table.qc th { vertical-align: middle; }
@media print { table.qc input { border: none; border-bottom: 1px solid #999; border-radius: 0; background: none; } }
.err-text { color: var(--err); }

/* Method notes */
.method { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.method-label { display: block; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.method-toggles { display: inline-flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.method-toggles label { display: inline-flex; gap: 4px; align-items: center; color: var(--text); }
.method-text p { margin: 0 0 6px; }
@media screen { .hide-method-screen .method { display: none; } }
@media print { .hide-method-print .method { display: none; } .method { background: none; } }

/* Inventory */
.subnav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 12px; font-size: 14px; }
.subnav a { color: var(--muted); text-decoration: none; padding: 2px 0; border-bottom: 2px solid transparent; }
.subnav a.active { color: var(--text); border-bottom-color: var(--accent); }
.filters { display: inline-flex; gap: 6px; }

/* Reduced motion: no blinking or smooth scrolling; highlights become a steady outline. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .flash { outline: 3px solid var(--accent); outline-offset: 2px; }
}
.export-list li { margin: 6px 0; }
.export-list a { display: inline-block; min-height: 24px; padding: 3px 0; }

/* Allergens */
.allergen-choices { columns: 3 180px; list-style: none; padding: 0; margin: 4px 0; }
.allergen-choices li, .allergen-choices div { break-inside: avoid; }
table.allergen-matrix th.rot { vertical-align: bottom; height: 120px; white-space: nowrap; padding: 4px 2px; }
table.allergen-matrix th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; }
table.allergen-matrix { table-layout: fixed; min-width: 720px; }
table.allergen-matrix thead th:first-child { width: 180px; }
table.allergen-matrix td { text-align: center; font-size: 16px; overflow-wrap: anywhere; }
table.allergen-matrix td .specific { display: block; font-size: 10px; color: var(--muted); line-height: 1.1; }
table.allergen-matrix td.has { background: var(--err-soft); color: var(--err); }
table.allergen-matrix td.may { color: var(--muted); }
ul.changes { padding-left: 18px; }
.print-title { margin-top: 0; }

/* Fulfilment */
.stop { margin: 10px 0 16px; break-inside: avoid; }
.stop h4 { margin: 0 0 4px; }
.delivery-note { max-width: 820px; }
.note-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.signatures { display: flex; justify-content: space-between; margin-top: 48px; }
@media print { .delivery-note input { border: none; } }

/* Demo site: tour bar and start page */
.demo-bar { background: var(--accent-soft); border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); padding: 10px 16px; }
.demo-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; }
.demo-roles { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.demo-roles form, .demo-nav form { display: inline; }
.demo-roles button[aria-pressed="true"] { opacity: 1; border-color: var(--accent); color: var(--accent); }
.demo-step { max-width: 760px; margin-top: 8px; }
.demo-step h2 { margin: 0 0 4px; font-size: 18px; }
.demo-step p { margin: 0 0 8px; }
.demo-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-start { max-width: 760px; }
.demo-start .lead { font-size: 17px; }
.demo-choices, .demo-language { border: 0; padding: 0; margin: 0 0 12px; }
.demo-choices legend, .demo-language legend { font-weight: 600; margin-bottom: 6px; }
.demo-choice { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.demo-choice:has(input:checked) { border-color: var(--accent); }
.demo-language label { margin-right: 16px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.demo-bar .muted { color: var(--text); opacity: 1; font-size: 13px; }
