/* Ordering: the order form (store, supplier, count, review). Buttons and inputs take the app's own styles. */
.ord { display: grid; gap: var(--space-4); padding-bottom: calc(var(--space-8) + var(--space-5)); }
.ord h1 { margin: 0; }
/* the parts of Ordering as the underline tabs every page uses for its parts (UX-23, as Options and the reports); Edit order lists, a
   page of its own, is a button at the end */
.ord-nav { display: flex; gap: var(--space-1); flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border); }
.ord-nav > button { min-height: var(--control-h); padding: 0 var(--space-4); border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; box-shadow: none; color: var(--muted-foreground); font-weight: 400; }
.ord-nav > button[aria-pressed="true"] { border-bottom-color: var(--accent); background: none; color: var(--foreground); font-weight: 600; }
.ord-nav > a { margin: 0 0 var(--space-2) auto; }
.ord-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.ord-grid { margin-bottom: var(--space-4); }
.ord-grid button { min-height: 48px; font-size: var(--text-title); }
.ord-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); color: var(--foreground); font-weight: 600; }
.ord-head { display: flex; justify-content: space-between; align-items: start; gap: var(--space-4); flex-wrap: wrap; }
.ord-head h2, .ord-head p { margin: 0; }
.ord-head p { color: var(--muted-foreground); }
.ord-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.ord-notice { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--accent-tint); margin: 0; }
.ord-notice button { min-height: 32px; padding: 0 var(--space-3); }
.ord-notice p { margin: 0; }
.ord-search { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.ord-search input[type="search"] { flex: 1 1 220px; }
.ord-cat { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.ord-cat { margin-top: var(--space-3); } /* a little room between the supplier's categories (owner, 2026-10-19) */
.ord-cat-head { width: 100%; display: flex; justify-content: space-between; align-items: center; border: 0; background: transparent; text-align: left; min-height: 52px; }
.ord-cat-head small { color: var(--muted-foreground); font-weight: 400; }
.ord-cat-body { display: grid; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); }
.ord-item { display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); }
.ord-item.has-qty { border-color: var(--accent-line); background: var(--accent-tint); }
.ord-item-name { font-weight: 600; }
.ord-item-sub { font-size: var(--text-label); color: var(--muted-foreground); }
/* sized to what they hold (owner, 2026-10-29: To order stretched the whole row): a count is a few digits */
.ord-fields { display: grid; grid-template-columns: 64px 96px auto; justify-content: start; gap: var(--space-3); align-items: end; }
.ord-fields > * { display: grid; gap: var(--space-1); }
.ord-fields span { font-size: var(--text-caption); color: var(--muted-foreground); }
.ord-fields b { min-height: var(--control-h); display: flex; align-items: center; }
.ord-why { display: block; margin-top: var(--space-2); font-size: var(--text-label); color: var(--muted-foreground); }
.ord-stepper { display: grid !important; grid-template-columns: 44px 80px 44px; gap: var(--space-1) !important; }
.ord-stepper button { padding: 0; min-width: 44px; font-size: var(--text-title); }
.ord-stepper input, .ord-fields input { text-align: center; min-height: var(--control-h); height: 44px; box-sizing: border-box; } /* one height, so Par, Stock and To order labels sit on one line */
.ord-link { justify-self: start; min-height: 36px; border: 0; background: transparent; color: var(--accent-ink); text-decoration: underline; padding: 0; }
.ord-combo { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: var(--space-1); }
.ord-combo p { margin: 0; }
.ord-combo.is-warning { border-color: var(--warn); background: var(--warn-bg); } /* a warning, not an error (UX-21) */
.ord-quiet, .ord-past { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
.ord-quiet[open] > :not(summary), .ord-past[open] > :not(summary) { margin-top: var(--space-3); }
.ord-past-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
/* the fixed bar never covers the last category */
section:has(> .ord-bar) { padding-bottom: calc(7rem + env(safe-area-inset-bottom)); }
.ord-bar { position: fixed; left: var(--side-w, 0px); right: 0; bottom: 0; z-index: var(--z-menu); display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--card); border-top: 1px solid var(--border); }
/* clear of the iPhone's home bar and, on its side, the notch (viewport-fit=cover in the layout) */
.ord-bar { padding-bottom: max(var(--space-3), env(safe-area-inset-bottom)); padding-inline: max(var(--space-4), env(safe-area-inset-left)) max(var(--space-4), env(safe-area-inset-right)); }
/* the count and total, then what is still to fill in beside them, using the bar's width (it was squeezed at the left) */
.ord-bar > div { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.ord-bar p { flex: 1 1 28rem; max-width: 72ch; margin: 0 auto; text-align: center; font-size: var(--text-label); line-height: var(--leading-body); color: var(--foreground); border: 1px solid color-mix(in oklab, var(--warn) 45%, transparent); border-radius: var(--radius); padding: var(--space-1) var(--space-3); background: var(--warn-bg); } /* what is still to do is a warning in amber, not an error (UX-21, C4); the bar starts after the sidebar on wide screens, so the hint is never under it; centred in the space between the count and the button (owner, 2026-10-22) */
.ord-totals { display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-5); max-width: 360px; margin-left: auto; }
.ord-totals dt, .ord-totals dd { margin: 0; }
.ord-totals dd { text-align: right; }
.ord-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ord-filters label { display: grid; gap: var(--space-1); font-size: var(--text-caption); color: var(--muted-foreground); }
.ord-sent summary { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; cursor: pointer; padding: var(--space-3) 0; }
.ord-par-sub { display: none; }
@media (max-width: 720px) { .ord-fields { grid-template-columns: 56px 80px auto; } }
/* Phones (adapt O1, 2026-10-22): the three boxes needed 312 px and an item has 283 at 375, so the item ran out of its card and the page
   moved sideways. Par goes into the grey line under the name, Stock and To order share the row */
@media (max-width: 560px) {
  .ord-par-sub { display: inline; }
  .ord-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .ord-fields > :first-child { display: none; }
  .ord-stepper { grid-template-columns: 44px minmax(0, 1fr) 44px; }
}
/* With the phone's keyboard up the bar took a third of what was left: it steps aside while a box has focus (adapt O2) */
@media (pointer: coarse) {
  section:has(> .ord-bar):has(input:not([type="checkbox"]):focus) > .ord-bar { display: none; }
}

.ord { min-width: 0; }
.ord table td, .ord table th { white-space: normal; }
.ord-scroll { overflow-x: auto; max-width: 100%; }
.ord-scroll table { min-width: 560px; }
.ord-nav a { display: inline-flex; align-items: center; min-height: var(--control-h); padding: 0 var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius); color: inherit; font-size: var(--text-body); font-weight: 600; text-decoration: none; }
.ord-totals { width: 100%; }
.ord { grid-template-columns: minmax(0, 1fr); }
.ord > * { min-width: 0; }
.ord-scroll.ord-fit table { min-width: 0; }
/* a table that fits the phone needs no right-edge shadow: it showed as a white smear on Order history (owner, 2026-11-17) */
.ord-scroll.ord-fit { background-image: none; }

/* Stock take: the count table fits a phone. The count box is a fixed small width and the cells are tighter, so the four columns fit
   in 375 px; a table that is still too wide (a very long name) scrolls inside its own section, never the whole page */
[data-take] td > input[type="number"] { width: 5rem; }
/* every group's table the same width with the same columns, so Ingredient, Expected, Counted and Count in line up down the page (owner,
   2026-11-04: each table was its own width); on a phone the columns size to their words, as before */
[data-take] > section { flex: 1 1 100%; width: 100%; }
@media (min-width: 561px) {
  [data-take] > section table { table-layout: fixed; }
  [data-take] > section th:nth-child(2) { width: 22%; }
  [data-take] > section th:nth-child(3) { width: 9rem; }
  [data-take] > section th:nth-child(4) { width: 24%; }
}
@media (max-width: 560px) {
  [data-take] th, [data-take] td { padding-inline: var(--space-2); }
  [data-take] > section { overflow-x: auto; }
  /* not held at a wide table's 620px: the four columns fit, so the count box and its unit are on screen without a swipe (O-74) */
  [data-take] table, [data-take-recent] table { min-width: 0; }
}

/* Stock count's paper sheet (owner, 2026-11-04, mock-up 3): only in print, and then it is all that prints, an A4 page with its page
   numbers at the foot. Black on white whatever the screen's mode. */
section[data-count-sheet] { display: none; }
@page count-sheet {
  size: A4;
  margin: 14mm 14mm 16mm;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt Inter, sans-serif; color: #555; }
}
@media print {
  main:has(> section[data-count-sheet]) > :not(section[data-count-sheet]) { display: none !important; }
  section[data-count-sheet] { display: block; page: count-sheet; color: #000; font-size: 10pt; }
  section[data-count-sheet] h2 { margin: 0 0 2mm; font-size: 18pt; font-weight: 700; }
  section[data-count-sheet] > p { margin: 0; color: #444; }
  div[data-sheet-sign] { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8mm; margin: 8mm 0 6mm; }
  div[data-sheet-sign] > span { padding-bottom: 5mm; border-bottom: 1px solid #000; color: #444; }
  main section[data-count-sheet] table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  section[data-count-sheet] th, section[data-count-sheet] td { padding: 2.2mm 2mm; border-bottom: 1px solid #ccc; text-align: left; background: none; color: #000; }
  section[data-count-sheet] thead th { border-bottom: 1.5px solid #000; font-weight: 600; }
  section[data-count-sheet] tr[data-sheet-group] th { background: #eee; font-weight: 700; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  section[data-count-sheet] th:nth-child(1) { width: 34%; }
  section[data-count-sheet] th:nth-child(2) { width: 26%; }
  section[data-count-sheet] th:nth-child(3) { width: 16%; }
  section[data-count-sheet] td[data-box] { border-left: 1px solid #999; }
  section[data-count-sheet] > p[data-sheet-foot] { margin-top: 4mm; font-size: 9pt; }
}

/* Choose what is counted (owner, 2026-11-04, mock-up 1): a group in one go, each card saying how many it adds, then one by one */
details[data-explain="counted"] > div[data-count-groups], div[data-count-groups][data-receive-ways] { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--space-3); margin: var(--space-3) 0 var(--space-4); }
div[data-count-groups] > :is(button, a) { display: grid; gap: var(--space-1); align-content: start; min-height: 0; padding: var(--space-4); text-align: left; font-weight: 400; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); }
div[data-count-groups] > :is(button:not(:disabled), a):hover { border-color: var(--accent-line); background: var(--accent-tint); }
div[data-count-groups] > :is(button, a) > strong { font-size: var(--text-title); font-weight: 600; color: var(--foreground); }
div[data-count-groups] > :is(button, a) > span { color: var(--muted-foreground); }
div[data-count-groups] > :is(button, a) > em { font-style: normal; font-weight: 600; color: var(--accent-ink); }
/* Goods received's three ways in (owner, 2026-11-14): the same cards as Choose what is counted, as links */
div[data-count-groups][data-receive-ways] > a { text-decoration: none; color: inherit; }
/* Stock count's Leave some out: one line per ingredient, its button at the end, in a box that scrolls on its own */
details[data-leave-out] { margin: var(--space-3) 0; }
details[data-leave-out] > ul { max-height: 22rem; overflow-y: auto; margin: var(--space-2) 0 0; padding: 0; list-style: none; }
details[data-leave-out] > ul > li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; border-bottom: 1px solid var(--border); }
div[data-count-groups] > button:disabled > em { color: var(--muted-foreground); }
/* the counted list's team: Kitchen in the theme's accent, Bar in its second colour (a second series, not a status); "also" in grey. <data>, not <span>: the td > span rule is the amber flag */
data[data-team] { display: inline-block; padding: 1px var(--space-2); border-radius: 999px; font-size: var(--text-caption); font-weight: 600; background: var(--accent-tint); color: var(--accent-ink); }
data[data-team="bar"] { background: var(--pop-bg); color: var(--pop-ink); }
data[data-team-also], small[data-batch] { display: inline-block; margin-left: var(--space-1); padding: 1px var(--space-2); border-radius: 999px; font-size: var(--text-caption); background: var(--muted); color: var(--muted-foreground); }
div[data-counted-head] { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-4); }
div[data-counted-head] > h3 { margin: 0; }

/* the delivery day on Review, and What to buy on the supplier choice (O-70, O-73) */
.ord-deliver { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* The branch's suppliers, one row each with what to buy there and Start order at its end (owner, 2026-10-29: each was shown twice) */
.ord-to-buy-why { max-width: 72ch; margin: 0 0 var(--space-3); font-size: var(--text-label); color: var(--muted-foreground); }
.ord-suppliers { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); max-height: none; overflow: visible; } /* every supplier in the page, not a box of its own that scrolls (owner, 2026-11-17) */
.ord-suppliers button { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name go" "buy go"; align-items: center; gap: 2px var(--space-4); width: 100%; min-height: 64px; padding: var(--space-3) var(--space-4); text-align: left; font-weight: 400; background: var(--card); }
.ord-suppliers button > strong { grid-area: name; font-size: var(--text-title); font-weight: 600; }
.ord-suppliers button > small { grid-area: buy; font-size: var(--text-label); color: var(--muted-foreground); }
.ord-suppliers button[data-to-buy] > small { color: var(--amber); font-weight: 500; }
.ord-suppliers button > span { grid-area: go; color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
@media (hover: hover) { .ord-suppliers button:hover { border-color: var(--accent-line); background: var(--accent-tint); } }
.ord > p[data-brief] { margin: var(--space-4) 0 var(--space-4); }
.ord-suppliers > li { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; } /* the button is the card; no second box round it */

/* Strike and sink (owner, 2026-11-07): a counted line gets a tick and a grey name, below the ones still to count (StockTakeForm) */
[data-take] tr > td:first-child > svg { vertical-align: -3px; margin-right: var(--space-1); color: var(--good); }
[data-take] tr[data-counted] > td:first-child { color: var(--muted-foreground); }

/* Stock hidden: the To order stepper is the only field, so it must not be hidden as "the stock box" on phones (owner, 2026-11-18). */
.ord-fields > :only-child { grid-column: 1 / -1; }
@media (max-width: 560px) { .ord-fields > :only-child { display: grid; } }
