/* Minimal mobile-first styles for the walking skeleton. Tailwind comes later. */
:root { --fg: #1d1d1f; --bg: #fafaf7; --accent: #c2410c; --muted: #6b6b6b; --surface: #fff; --soft: #f3f1ea; --line: #e5e5e0; --line-strong: #ccc; --on-accent: #fff; --shortcut: #1d4ed8; --on-shortcut: #fff; }
/* Dark theme (Profile): chosen, or "as the device" when the device is dark. A minimal palette;
   color-scheme makes the browser's own controls dark too. */
:root[data-theme="dark"] { --fg: #ececec; --bg: #17171a; --accent: #fb923c; --muted: #a3a3a3; --surface: #232328; --soft: #2c2c32; --line: #3a3a40; --line-strong: #55555c; --on-accent: #17171a; --shortcut: #3b82f6; --on-shortcut: #17171a; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] { --fg: #ececec; --bg: #17171a; --accent: #fb923c; --muted: #a3a3a3; --surface: #232328; --soft: #2c2c32; --line: #3a3a40; --line-strong: #55555c; --on-accent: #17171a; --shortcut: #3b82f6; --on-shortcut: #17171a; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; color: var(--fg); background: var(--bg); }
/* The app bar (UX guidelines 2.1): 56 px, sticky, hamburger + company left, avatar right. It
   sits above the page (the menus open inside it) and has its own background. */
.appbar { position: sticky; top: 0; z-index: 20; height: 56px; background: var(--bg); display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 8px; border-bottom: 1px solid var(--line); }
html { scroll-padding-top: 64px; } /* a link to #anchor is not hidden under the bar */
.appbar-left, .appbar-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.appbar .brand { font-weight: 700; color: var(--fg); text-decoration: none; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: none; border-radius: 8px; background: none; color: var(--fg); cursor: pointer; flex: none; }
.back + .drawer-toggle { display: none; } /* a sub-page: the back arrow replaces the hamburger */
.appbar-lang { margin: 0; display: flex; align-items: center; } /* anonymous pages: a compact select */
.appbar-lang select { min-height: 36px; padding: 4px 8px; font-size: 0.875rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } /* keyboard users */

/* The drawer (UX guidelines 2.2/2.4). Phone: an overlay with a scrim, closed until the
   hamburger opens it. >= 1024 px: a persistent 240 px rail, no scrim, hamburger hidden. */
.shell { min-height: calc(100dvh - 56px); }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.45); }
.drawer { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(85vw, 320px); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); transform: translateX(-105%); visibility: hidden; transition: transform 0.2s ease; }
body.drawer-open .drawer { transform: none; visibility: visible; }
body.drawer-open .scrim { display: block; }
body.drawer-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer-head { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.drawer-company { font-weight: 700; }
.drawer-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px; }
.drawer-group { margin: 12px 8px 4px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.drawer-item { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-left: 3px solid transparent; border-radius: 8px; color: var(--fg); text-decoration: none; }
.drawer-item:hover { background: var(--soft); }
.drawer-item[aria-current="page"] { background: var(--soft); background: color-mix(in srgb, var(--accent) 12%, transparent); border-left-color: var(--accent); font-weight: 600; }
.drawer-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
@media (min-width: 64rem) {
  .drawer-toggle { display: none; }
  .scrim { display: none !important; }
  body.drawer-open { overflow: auto; }
  .shell { display: flex; align-items: flex-start; }
  .drawer { position: sticky; top: 56px; bottom: auto; height: calc(100dvh - 56px); width: 240px; flex: none; transform: none; visibility: visible; }
  .content { flex: 1; min-width: 0; }
}
.content { max-width: 720px; margin: 0 auto; padding: 16px; }
.content.wide { max-width: 1100px; } /* tables: daily sheet, production, orders (UX 2.4) */
.content:has(.section-tabs) { max-width: 1100px; } /* every page of a tabbed section shares the wide column, so the tab bar never changes width */
.stack { display: flex; flex-direction: column; gap: 8px; }
input, select, button { font: inherit; padding: 12px; border-radius: 8px; border: 1px solid var(--line-strong); }
button { background: var(--accent); color: var(--on-accent); border: none; min-height: 48px; }
.error { color: #b91c1c; }

/* Catalogue and other back-office lists (mobile-first, one hand). */
a { color: var(--accent); }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
/* Page header (UX guidelines 3): H1 left, at most one primary button right, secondary buttons
   and a More menu before it, sub-page links in one row under the title. */
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pagehead.component-head { align-items: flex-start; }
.pagehead.component-head h1 { flex: 1; min-width: 0; margin: 0 0 8px; }
.pagehead-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.pagehead.component-head .button { min-width: 88px; }
.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 8px; background: var(--accent); color: var(--on-accent); text-decoration: none; }
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.button.danger { background: transparent; color: #b91c1c; border-color: #b91c1c; }
.button:disabled, .button[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.page-links { display: flex; gap: 16px; margin: -4px 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.page-links::-webkit-scrollbar { display: none; }
.page-link { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; color: var(--accent); text-decoration: none; }
.page-link:hover, .page-link:focus-visible { text-decoration: underline; }
/* Section tabs (ADR-0029 B3): the pages of one drawer item, under the H1, same place and
   style on every page of the section; the current one is marked. */
.section-tabs { display: flex; gap: 4px; margin: 4px 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; white-space: nowrap; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.section-tab:hover, .section-tab:focus-visible { color: var(--fg); }
.section-tab[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; display: flex; flex-direction: column; min-width: 12rem; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.18); }
.more-item { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 8px; color: var(--fg); text-decoration: none; white-space: nowrap; }
.more-item:hover, .more-item:focus-visible { background: var(--soft); }
.more-item.danger { color: #b91c1c; }
/* The phone's primary create action is a FAB (UX guidelines 3.1): 56 px, bottom right, above
   the safe area. The same action stays the header button on the laptop. */
.fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 15; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 1.75rem; line-height: 1; text-decoration: none; box-shadow: 0 6px 18px rgb(0 0 0 / 0.25); }
.content:has(.fab) { padding-bottom: calc(88px + env(safe-area-inset-bottom)); } /* room for the FAB: it never covers the last row */
body:has(input:focus, select:focus, textarea:focus) .fab { display: none; } /* the keyboard */
@media (min-width: 64rem) {
  .fab { display: none; }
  .content:has(.fab) { padding-bottom: 16px; }
}
@media (max-width: 63.999rem) {
  .pagehead.has-fab .pagehead-cta { display: none; }
  .pagehead.component-head .button.primary { min-height: 48px; }
}
.cards { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.card.inactive { opacity: 0.6; }
.card > a, .card > .row { display: flex; justify-content: space-between; gap: 8px; color: inherit; text-decoration: none; min-height: 32px; align-items: center; }
.card .title { font-weight: 600; }
.card .price { white-space: nowrap; }
.card p { margin: 4px 0 0; }
.allergens { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.allergen { color: #1d1d1f; font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: #fef3c7; border: 1px solid #f59e0b; }
.allergen.trace { color: var(--fg); background: var(--surface); border-style: dashed; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field textarea { font: inherit; padding: 12px; border-radius: 8px; border: 1px solid var(--line-strong); }
.choices { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; grid-template-columns: 1fr; gap: 4px; }
@media (min-width: 420px) { .choices { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.check input { width: 22px; height: 22px; }
.has-error input, .has-error select { border-color: #b91c1c; }

/* The role settings panel (ADR-0022 section 7): one card per drawer group. On the phone a row
   stacks its text above the two ticks, so nothing scrolls sideways at 360 px; from 40rem the
   text and the View and Edit columns sit on one line. */
.perm-panel { border: 0; padding: 0; margin: 0; min-width: 0; }
.perm-panel .perm-group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0 0 12px; min-width: 0; }
.perm-group-title { margin: 4px 0 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.perm-group-title + .perm-row { border-top: 0; }
.perm-text { grid-column: 1 / -1; min-width: 0; }
.perm-label { font-weight: 600; }
.perm-desc { display: block; color: var(--muted); font-size: 0.875rem; }
.perm-tick { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.perm-tick input { width: 22px; height: 22px; flex: none; }
.perm-extra { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); font-size: 0.875rem; cursor: pointer; }
.perm-extra input { width: 22px; height: 22px; flex: none; }
.perm-extra input:disabled + span { opacity: 0.5; }
.perm-single { grid-template-columns: minmax(0, 1fr) auto; }
.perm-single .perm-text { grid-column: auto; }
.perm-single > input { width: 22px; height: 22px; }
@media (min-width: 40rem) {
  .perm-row { grid-template-columns: minmax(0, 1fr) 4.5rem 4.5rem; }
  .perm-text { grid-column: auto; }
  .perm-single { grid-template-columns: minmax(0, 1fr) auto; }
  .perm-extra { grid-column: 2 / -1; }
}

/* Form rules (UX guidelines 4.5) - shared by every form that uses _form.html. Labels above the
   field, 48 px fields, 16 px text (no iOS zoom). */
.field > label, .field > .label { font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]),
.field select, .field textarea { width: 100%; min-height: 48px; font-size: 1rem; }
.field textarea { height: auto; }
/* Width follows content on the laptop; the phone is one column. */
@media (min-width: 40rem) {
  .field input.short, .field input[type=number], .field input[type=date],
  .field input[type=tel] { max-width: 50%; }
}
.req { color: var(--muted); font-size: 0.8rem; font-weight: 400; margin-left: 4px; }
.form-errors { border: 2px solid #b91c1c; border-radius: 8px; padding: 8px 12px; background: var(--surface); }
.form-errors-title { margin: 0; color: #b91c1c; font-weight: 700; }
.form-errors ul { margin: 4px 0 0; padding-left: 20px; }
.form-errors a { color: #b91c1c; }
.form-basics { gap: 12px; margin-bottom: 8px; }
/* "More details": the extra fields closed by default (native <details>). */
.more-details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 12px 12px; }
.more-details > summary { display: flex; align-items: center; min-height: 48px; font-weight: 600; }
.more-details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
/* The phone's save bar sits at the bottom, in reach; the laptop keeps the inline button. */
.save-bar { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.save-bar button[type=submit] { flex: 1; min-height: 48px; }
.save-bar .page-link { flex: none; }
.content:has(.save-bar) { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
@media (min-width: 64rem) {
  .save-bar { position: static; padding: 8px 0 0; background: none; border-top: 0; }
  .save-bar button[type=submit] { flex: 0 0 auto; min-width: 120px; }
  .content:has(.save-bar) { padding-bottom: 16px; }
}
/* Toggle rows: the whole row is the label, the switch is 44x26. */
.check.switch { justify-content: space-between; width: 100%; min-height: 48px; gap: 12px; }
.check.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); border: 0; position: relative; cursor: pointer; transition: background 0.15s ease; }
.check.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; }
.check.switch input:checked { background: var(--accent); }
.check.switch input:checked::after { transform: translateX(18px); }
/* A file input looks like a button, not like the browser's raw "Choose File" control: the
   input stays in the DOM (focusable) but invisible, and its label is the button. */
.file-field { position: relative; }
.file-field input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; overflow: hidden; }
.file-select { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; padding: 0 16px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); font-weight: 600; cursor: pointer; }
.file-field:focus-within .file-select { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Company settings: one card per section, its in-page nav wraps instead of scrolling. */
.settings-nav { flex-wrap: wrap; gap: 4px 16px; }
.settings-section { margin: 0 0 16px; }
.settings-section h2 { margin-top: 0; font-size: 1.125rem; }
.settings-section > .stack > .buttons { margin-top: 4px; }
.settings-section .buttons > button { flex: 0 0 auto; min-width: 120px; }

/* Tables: grouped rows, sideways scroll on narrow phones. */
.links { margin-top: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px 16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.9375rem; }
.table .group-head th { text-align: left; background: var(--bg); color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 8px 4px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table thead th { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr.group th { background: var(--soft); font-weight: 700; padding-top: 14px; }
.table tr.inactive td { opacity: 0.55; }
.table td a { font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.badge { color: #1d1d1f; display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 2px 2px 0; border-radius: 999px; text-align: center; font-size: 0.8rem; font-weight: 700; background: #fef3c7; border: 1px solid #f59e0b; }
.badge.trace { color: var(--fg); background: var(--surface); border-style: dashed; }
.legend { color: var(--muted); line-height: 2; }
button.link { background: none; color: var(--accent); min-height: 0; padding: 4px; }
button.link.danger { color: #b91c1c; }
button.link.tap { min-height: 44px; min-width: 44px; padding: 0 8px; } /* a finger, not a cursor */

/* Bilingual switch (ADR-0007): the other language under the name. */
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.toggle { margin: 0; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 1px solid var(--line-strong); font-size: 0.85rem; font-weight: 600; }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.alt { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.alt abbr { text-decoration: none; font-weight: 700; font-size: 0.7rem; margin-right: 2px; }
.alt .missing { color: #b45309; }
h1 .alt { font-size: 0.9rem; }
ul.plain { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }

/* Dialog (htmx loads forms into it) and recipe actions. */
dialog { border: none; border-radius: 16px; padding: 16px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
dialog h1 { font-size: 1.25rem; margin-top: 0; }
.buttons { display: flex; gap: 8px; }
.buttons > * { flex: 1; }
/* Long forms in a dialog: Save stays in reach at the bottom while the form scrolls. */
dialog .buttons { position: sticky; bottom: 0; background: var(--surface); padding: 8px 0; border-top: 1px solid var(--line); }
summary { padding: 12px 0; cursor: pointer; } /* a 44 px tap target */
button.secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.actions.start { justify-content: flex-start; margin: 8px 0 16px; }
select, input, textarea { background: var(--surface); color: var(--fg); }

/* Costs and margins (ADR-0014). */
.warn { color: #b45309; }
.overdue { color: #b91c1c; font-weight: 600; } /* a next step past its date; due today is .warn */
.stage-move { margin-top: 4px; }
.stage-move form { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0; }
.stage-move summary { padding: 8px 0; }
.negative { color: #b91c1c; font-weight: 700; }
.notice { color: #1d1d1f; background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 8px 12px; }
.problems, tr.problems td { color: #b45309; font-size: 0.85rem; }
tr.problems td { border-bottom-color: var(--line); padding-top: 0; }

/* Filter bar (UX guidelines 4.2). Phone: "Filter" and "View" open bottom sheets. Laptop
   (>= 64rem): the same five dropdowns sit in one row. Options are plain links; the bar works
   without JavaScript and the script only adds closing and focus behaviour. */
.filterbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font-size: 0.9rem; font-weight: 600; cursor: pointer; list-style: none; white-space: nowrap; }
.filter-btn::-webkit-details-marker { display: none; }
.filter-btn.is-set { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.filter-btn-value { font-weight: 700; }
.filter-caret { color: var(--muted); font-size: 0.7rem; transition: transform 0.15s ease; }
details[open] > .filter-btn .filter-caret { transform: rotate(180deg); }
.filter-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4em; height: 1.4em; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 0.75rem; }
.filter-buttons { display: none; }
.filter-item { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.filter-item .filter-btn { border: 0; background: none; border-radius: 7px; }
.filter-item.is-set { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.filter-x { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 44px; color: var(--accent); text-decoration: none; font-weight: 700; border-left: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.filter-clearall { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: 0.9rem; }
.filter-sheet-group { display: block; }
.filter-sheet { display: none; }
.filter-sheet-group[open] > .filter-sheet { display: block; position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 80dvh; overflow-y: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / 0.25); }
.filter-scrim { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / 0.45); }
.filter-section { padding: 8px 0; border-bottom: 1px solid var(--line); }
.filter-section:last-child { border-bottom: 0; }
.filter-section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.filter-section-clear { text-transform: none; font-size: 0.85rem; }
.filter-options { display: flex; flex-direction: column; }
.filter-option { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 6px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.filter-option:hover, .filter-option:focus-visible { background: var(--soft); }
.filter-option.selected { font-weight: 600; }
.filter-mark { width: 18px; height: 18px; flex: none; border: 2px solid var(--line-strong); border-radius: 50%; }
.filter-mark.checkbox { border-radius: 4px; }
.filter-option.selected .filter-mark { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.result-count { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
@media (min-width: 64rem) {
  .filter-sheet-group { display: none; }
  .filter-scrim { display: none; }  /* a phone sheet resized away leaves no scrim behind */
  .filter-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .filter-panel { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 25; min-width: 14rem; max-height: 70dvh; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.18); }
  .filter-dropdown { position: relative; }
  .filter-dropdown[open] > .filter-panel { display: block; }
  .filter-panel .filter-option { min-height: 44px; }
  .filter-x { min-width: 32px; }
}

/* CRM (US-70). */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; } /* many chips: one row to swipe */
.chips.scroll > * { flex: none; white-space: nowrap; }
.filters input[type=search] { width: 100%; }
.status { color: #1d1d1f; display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: #eee; }
.status-lead { background: #e0f2fe; }
.status-tasting { background: #fef3c7; }
.status-active { background: #dcfce7; }
.status-paused { background: #f3f4f6; color: #6b6b6b; }
.status-qualified { background: #dbeafe; }
.status-proposal { background: #e0e7ff; }
.status-won { background: #dcfce7; }
.status-lost { background: #f3f4f6; color: #6b6b6b; }
.status-site_survey, .status-installation { background: #e0f2fe; }
.status-at_risk { background: #fee2e2; }
.status-churned { background: #f3f4f6; color: #6b6b6b; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.timeline { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.timeline > li { border-left: 3px solid var(--line); padding-left: 12px; overflow-wrap: anywhere; } /* long URLs and emails */
form.inline { display: inline; margin: 0; }
.delete-form { margin-top: 16px; text-align: center; }
/* New customer: the "Fill with AI" block above the form (UX guidelines 5.2). */
.ai-fill { margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.ai-fill h2 { margin: 0; font-size: 1.125rem; }
.ai-fill form { display: flex; flex-direction: column; gap: 8px; }
.ai-fill .button { align-self: flex-start; }

/* Day switcher: previous · date · next · today on one line at 390 px, wrapping if needed. */
.dayswitch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 16px; }
.dayswitch input[type="date"] { flex: 1 1 auto; min-width: 0; }
.dayswitch .chip { flex: none; padding: 0 8px; }
.print-only { display: none; }
.stops .card.done { opacity: 0.6; } /* delivered stops stay, faded */
.stops .chip { min-height: 44px; } /* call from the van: a finger, not a cursor */
/* A stop's steps, one row each on the phone: Entregado, then method + Pagado, then the undos. */
.stop-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.stop-actions form { display: flex; gap: 8px; margin: 0; }
.stop-actions form > button, .stop-actions form > select { flex: 1; min-height: 44px; }
.stop-actions .undo { display: flex; gap: 8px; justify-content: space-between; }
.stop-actions .undo form > button { flex: none; }
.stopno { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 0.85rem; }

/* Printing a day sheet (US-16): no menu, no buttons; the content on the paper's width. */
/* The daily order sheet (US-114): A4 portrait, two columns (left: the left areas, right: the
   right areas), a line per dish of a person, no headers. The type shrinks before a 2nd page. */
.sheet-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
.sheet { --sheet-pt: 10pt; }
.sheet-line { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) 2em minmax(0, 2fr) 0.9em; gap: 4px; align-items: baseline; padding: 2px 0; border-bottom: 1px solid var(--line); font-size: var(--sheet-pt); }
.sheet-line .tick { width: 0.8em; height: 0.8em; border: 1.5px solid var(--fg); display: inline-block; }
.sheet-line .code { font-weight: 700; }
.sheet-line .qty { text-align: right; }
/* The delivery sheet (US-17, ADR-0035): a header per stop, then one line per person with the
   product, its size and the quantity; a tick box ends the line. */
.sheet-line.delivery { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.4fr) minmax(0, 0.7fr) 2.2em 1.2em 0.9em; }
.sheet-line.delivery .size { color: var(--muted); }
.sheet-stop { font-size: var(--sheet-pt); font-weight: 700; padding: 3px 0 1px; border-bottom: 2px solid var(--fg); margin-top: 4px; break-after: avoid; }
.sheet-stop .todo { font-weight: 400; display: block; }
.deleted { font-style: italic; }
/* The production sheet (US-66): a line per size, a total per product; tick, size, bottles, litres. */
.sheet-line.production { grid-template-columns: 0.9em minmax(0, 1fr) 4em 4.5em; }
.sheet-line.production .num { text-align: right; }
.sheet-line.production.total { font-weight: 700; border-bottom: 2px solid var(--fg); margin-bottom: 4px; }
.sheet-line.production.grand { font-weight: 700; border-top: 2px solid var(--fg); border-bottom: 0; }
.sheet-capacity { font-size: var(--sheet-pt); font-weight: 700; margin: 2px 0 6px; }
.sheet-legend { margin-top: 6px; }
/* ADR-0034 step 1: "What we need", three tables on screen and on A4. */
.needs { font-size: 0.95rem; }
.needs-section h2 { break-after: avoid; }
@media print {
  .needs { font-size: 10pt; }
  .needs th, .needs td { padding: 3px 4px; border-bottom-color: #999; }
  .needs tr { break-inside: avoid; }
}
/* ADR-0034 §4: the results report, three A4 tables (no navigation, no filter form). */
.results-section + .results-section { margin-top: 24px; }
.results-section h2, .results-section h3 { break-after: avoid; }
@media print {
  .results { font-size: 10pt; }
  .results th, .results td { padding: 3px 4px; border-bottom-color: #999; }
  .results tr { break-inside: avoid; }
  .results-section + .results-section { margin-top: 12mm; }
}
.sheet-line .pay { text-align: center; font-weight: 700; }
.sheet-line .new { font-weight: 700; color: var(--accent); }
@media (max-width: 40rem) { .sheet-body { grid-template-columns: 1fr; } }
@page { size: A4 portrait; margin: 10mm; }
@media print {
  .sheet-body { grid-template-columns: 1fr 1fr; gap: 0 8mm; }
  .sheet-line { padding: 1px 0; border-bottom-color: #999; break-inside: avoid; }
  .sheet-line .tick { border-color: #000; }
  .sheet-stop { border-bottom-color: #000; }
  .sheet-stop-block { break-inside: avoid; }
}
/* The type fit: the script measures the sheet as printed (A4 width less margins) off screen. */
.sheet.sheet-measure { position: absolute; visibility: hidden; width: 190mm; left: 0; top: 0; }
/* The Deliver day's paper is measured off screen and shown only on paper (ADR-0035 §2).
   The zero-height wrapper keeps the 190 mm measuring copy out of the phone's scroll width. */
.delivery-print-wrap { position: relative; height: 0; overflow: hidden; }
.delivery-print-only { position: absolute; visibility: hidden; width: 190mm; left: 0; top: 0; }
.sheet.sheet-measure .sheet-body { grid-template-columns: 1fr 1fr; gap: 0 8mm; }
.sheet.sheet-measure .sheet-line { padding: 1px 0; }
@media print {
  .print-only { display: block; }
  .delivery-print-wrap { position: static; height: auto; overflow: visible; }
  .delivery-print-only { position: static; visibility: visible; width: auto; }
  .appbar, .drawer, .scrim, .no-print, dialog { display: none !important; }
  body { background: #fff; }
  .content { max-width: none; padding: 0; }
  .card { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
  .table-wrap { overflow: visible; }
}


/* The user menu in the app bar: a <details>, no script; the items drop below on the phone. */
.usermenu { position: relative; }
/* Home (UX guidelines section 6): tiles come from the drawer tree; two columns on the phone,
   three on a tablet and four on the laptop. The whole tile is the link, at least 88 px high. */
.home-shortcuts { margin: 0 0 24px; }
.home-today { margin: 0 0 24px; }
.home-group { margin: 0 0 20px; }
.home-group-label { margin: 0 0 8px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.home-today h3 { margin: 16px 0 8px; font-size: 1rem; }
/* Owner decision 2026-11-15: the shortcuts are compact buttons in one scrolling row, in their
   own colour (distinct from the primary action). The row scrolls inside itself; the page never
   scrolls sideways. Keyboard focus stays visible, also on the buttons off-screen. */
.shortcut-grid { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; padding: 6px 5px; list-style: none; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.shortcut-grid::-webkit-scrollbar { display: none; }
.shortcut-grid > li { flex: none; }
.shortcut { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 8px; background: var(--shortcut); color: var(--on-shortcut); font-weight: 600; white-space: nowrap; text-decoration: none; }
.shortcut:hover { background: color-mix(in srgb, var(--shortcut) 88%, var(--fg)); }
.shortcut:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 88px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--fg); text-decoration: none; }
.tile:hover, .tile:focus-visible { background: var(--soft); }
.tile-title { font-weight: 600; }
.tile-hint { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
@media (min-width: 48rem) { .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.avatar { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--soft); color: var(--fg); font-weight: 700; cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.usermenu-items { position: absolute; right: 0; z-index: 10; display: flex; flex-direction: column; gap: 4px; min-width: 15em; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.usermenu-items { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; } /* taller than the screen: scroll inside the menu */
.usermenu-head { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--line); }
.usermenu-name { font-weight: 600; }
.usermenu-items a, .usermenu-items button { min-height: 44px; display: flex; align-items: center; padding: 0 8px; }
.usermenu-items form { margin: 0; }
.usermenu-items form.lang { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px; }
.usermenu-items form.lang select { min-height: 44px; }
.usermenu-logout { border-top: 1px solid var(--line); padding-top: 4px; } /* log out is last */
.usermenu-logout .link { color: var(--fg); }
.usermenu-version { margin: 0; padding: 4px 8px 0; } /* the app version and build, last in the menu */
.login-version { margin-top: 24px; }

/* The personal order link (US-117): a phone page without the staff menu. */
.orderlink { max-width: 32rem; margin: 0 auto; padding: 16px; }
.orderlink .ok { color: #166534; font-weight: 600; }
.orderlink .dish { border-top: 1px solid var(--line); padding: 8px 0; }
.orderlink .dish h3 { margin: 0; }
.orderlink .dishrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.orderlink .stepper { display: inline-flex; align-items: center; gap: 4px; }
.orderlink .stepper button { min-width: 44px; min-height: 44px; font-size: 1.25rem; }
.orderlink .stepper input { width: 3.2rem; min-height: 44px; text-align: center; font-size: 1.1rem; }
.orderlink .sides { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; }
.orderlink .sides .chip { display: inline-flex; align-items: center; gap: 6px; }
.orderlink textarea { width: 100%; }
.orderlink form > button[type=submit] { width: 100%; min-height: 48px; margin-top: 12px; }

/* The daily menu editor (US-06) */
.status-published { background: #dcfce7; }
.status-draft { background: #fef3c7; }
.menuitems { list-style: none; padding: 0; margin: 8px 0 16px; }
.menuitems li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.menuitems li.menu-product-row { flex-wrap: wrap; align-items: flex-start; }
.menu-row-main { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.menu-option-block { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
/* One row per product (ADR-0029 A12): the actions of the chosen size are the row's actions.
   CSS, not JavaScript, so a size still acts on itself when the script does not run. */
.menu-actions { display: none; flex-wrap: wrap; align-items: center; gap: 4px; }
.menu-option-block:has(input:checked) .menu-actions { display: inline-flex; }
.menuitems .dishname { flex: 1 1 100%; }
.menuitems form { margin: 0; }
.menuitems button, .menucopy button { min-height: 44px; min-width: 44px; }
.menuday { margin: 16px 0; padding-left: 8px; border-left: 3px solid transparent; }
.menuday.on { border-left-color: var(--accent, currentColor); }
.menuday.past { opacity: .6; }
.menuprice { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.menuprice input { width: 5.5em; }
.menu-drag { min-width: 44px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--muted); cursor: grab; touch-action: none; font-size: 1.15rem; }
.menu-dragging { background: var(--surface); box-shadow: 0 4px 14px rgb(0 0 0 / 18%); }
.menuitems li.menu-sort-placeholder { display: block; padding: 0; border-bottom: 1px dashed var(--line-strong); background: var(--soft); }
.menu-sorting { user-select: none; }
@media (max-width: 40rem) {
  .menuitems .menumove { min-width: 36px; min-height: 36px; padding: 2px 4px; }
}
.menutext { width: 100%; font: inherit; padding: 12px; border-radius: 8px; border: 1px solid var(--line-strong); }
.place-pick { display: flex; gap: 8px; align-items: center; }
.place-pick select { flex: 1; min-width: 0; }
.place-pick .button { flex: none; }
.fill-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fill-tools select { flex: 1; min-width: 0; }
.summary { margin: 0 0 16px; }
.summary .row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.summary dt, .summary dd { margin: 0; }
.summary dd { text-align: right; }

[x-cloak] { display: none !important; }
input.changed { background: #fef3c7; border-color: #f59e0b; }
.button.big { font-size: 1.125rem; padding: 12px 20px; }

/* Quick order: big tap targets for the phone */
.quick { max-width: 40rem; margin: 0 auto; }
.quick input[type=search], .quick input[type=text] { width: 100%; min-height: 48px; font-size: 1.1rem; }
.quick-list, .quick-saved, .quick-cart { list-style: none; padding: 0; margin: 8px 0; }
.quick-list li { margin: 4px 0; }
.quick-list button, .quick-list a.quick-option { width: 100%; min-height: 48px; text-align: left; }
.quick-dishes { display: grid; gap: 8px; margin: 12px 0; }
.quick-dish-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.quick-dish-row .dishname { flex: 1 1 100%; font-weight: 600; }
.quick-dish-row .variant-row { flex: 1 1 auto; justify-content: space-between; }
.quick-dish-row .quick-variant { flex: 1 1 auto; min-height: 44px; }
.quick-dish-add { flex: none; min-height: 44px; min-width: 44px; font-size: 1.2rem; }
.quick-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.quick-option-name { font-weight: 600; }
.quick-option-company { line-height: 1.2; }
.quick-option.active, .quick-option[aria-selected="true"] { background: var(--soft); border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.chip-late { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.quick-qty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.quick-qty button { min-width: 48px; min-height: 48px; font-size: 1.2rem; }
.quick-qty input { width: 5rem; min-height: 48px; text-align: center; font-size: 1.1rem; }
.quick-cart li { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.quick-cart .line { flex: 1; min-height: 48px; text-align: left; }
.quick-cart button { min-height: 48px; min-width: 48px; }
.quick .buttons button { width: 100%; min-height: 56px; }
/* Variant picker (ADR-0029 A12): the sizes of one product as segmented buttons in its row. */
.variant-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.variant-picker { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.variant-option { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font-size: 0.9rem; font-weight: 600; cursor: pointer; user-select: none; }
.variant-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.variant-option:has(input:checked) { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.variant-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.variant-option.single { cursor: default; }
.variant-price { font-weight: 600; white-space: nowrap; }
.line-product { margin: 0 0 4px; font-weight: 600; }
.variant-qty-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em; padding: 0 0.35em; border-radius: 999px; background: var(--surface); color: var(--accent); border: 2px solid var(--accent); font-size: 0.85rem; font-weight: 700; }
/* The menu module: the type-ahead list (a finger-sized row per dish), the price box, the print sheet. */
.menuresults form { margin: 0 0 6px; }
.menuresults .variant-row { width: 100%; min-height: 48px; justify-content: space-between; }
.menuresults .addrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 48px; text-align: left; }
.menuresults .addrow-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 auto; }
.menuresults .addrow-name { font-weight: 600; }
.menuresults .addrow-button { min-height: 44px; flex: none; }
.menuprint { max-width: 190mm; margin: 0 auto; }
.menuprint .company { font-size: 1.1rem; font-weight: 700; margin: 0; }
.menuprint h2 { margin: 2px 0 12px; }
.menuprint ul { list-style: none; padding: 0; margin: 0; }
.menuprint li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.menuprint .dish { display: flex; flex-direction: column; }
.menuprint .allergens { font-size: 0.8rem; color: var(--muted); }
.menuprint .price { font-weight: 700; white-space: nowrap; }
@media print {
  @page { size: A4 portrait; margin: 15mm; }
  .menuprint { max-width: none; color: #000; }
  .menuprint .allergens { color: #333; }
}

/* Palette (ADR-0032 §2): the product offer in force, a dense working sheet printed on A4. */
.palette { max-width: 190mm; margin: 0 auto; }
.palette h2 { margin: 18px 0 6px; font-size: 1rem; }
.palette .table { font-size: 0.95rem; }
/* A wide palette scrolls inside its table, never the page, on a narrow phone. */
.palette .table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media print {
  .palette { max-width: none; color: #000; }
  .palette .table-scroll { overflow: visible; }
  .palette .table { width: 100%; table-layout: fixed; font-size: 8pt; }
  .palette .table th:first-child, .palette .table td:first-child { width: 35%; white-space: normal; }
  .palette .table th, .palette .table td { padding: 3px 4px; }
  .palette tr { break-inside: avoid; }
}

/* Quotes (US-108): the form lines (a size, then the numbers) and the A4 print page. */
.quote-line { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.terms { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 10px; margin: 0; min-width: 0; }
[hidden] { display: none !important; }
.terms .label { font-weight: 600; }
.choice-field > div > div { display: block; }
.choice-field label { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.settlement-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.minimum-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tier-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tier-fields { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; min-width: 0; }
.tier-row input[readonly] { background: var(--line); }
.tier-remove { min-width: 44px; min-height: 44px; }
.quote-line-numbers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 40rem) { .quote-line-numbers { grid-template-columns: repeat(4, 1fr); } }
.quoteprint { max-width: 190mm; margin: 0 auto; }
.quoteprint p { margin: 2px 0; }
.quoteprint .company { font-size: 1.2rem; font-weight: 700; }
.quoteprint-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.quoteprint-no { text-align: right; }
.quoteprint-logo { display: block; max-height: 22mm; max-width: 60mm; width: auto; height: auto; margin-bottom: 6px; }
.logo-preview { max-height: 80px; max-width: 220px; display: block; }
.quoteprint-no h2 { margin: 0 0 4px; }
.quoteprint-to { margin-bottom: 16px; }
.quoteprint-terms { margin-top: 16px; }
@media print {
  @page { size: A4 portrait; margin: 15mm; }
  .quoteprint { max-width: none; color: #000; }
  .quoteprint .table { font-size: 10pt; }
  .quoteprint tr { break-inside: avoid; }
}
.quoteprint-notice { border: 2px solid currentColor; padding: 4px 10px; font-weight: 700; text-transform: uppercase; text-align: center; margin: 0 0 12px; }

/* Fridge offer assortment: numbered rows, one column (phone first). */
.fridge-line { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.fridge-line-no { min-width: 2ch; padding-top: 2rem; font-weight: 600; }
.fridge-line-fields { flex: 1; display: grid; grid-template-columns: 1fr; gap: 8px; min-width: 0; }
@media (min-width: 40rem) { .fridge-line-fields { grid-template-columns: 1fr 1fr 8rem auto; align-items: end; } }
.fridge-line-price { margin: 0; }
.fridge-filter { margin-bottom: 4px; }
.fridge-line-remove { min-width: 44px; min-height: 44px; margin-top: 1.6rem; }
.pack-load { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }

/* Company logo variants: the one for the dark theme shows only in the dark theme. */
.logo-for-dark { display: none; }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .logo-for-light { display: none; }
  :root[data-theme="system"] .logo-for-dark { display: inline; }
}
.logo-preview-box { padding: .5rem; display: inline-block; border: 1px solid var(--line); }

/* Record lists (UX guidelines 4.3): a card per row on the phone, the same rows as a table on
   the laptop. Both are in the markup; only CSS decides which one is visible. */
.record-cards { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.record-card { display: flex; flex-direction: column; gap: 4px; min-height: 64px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--fg); text-decoration: none; }
.record-card:hover, .record-card:focus-visible { background: var(--soft); }
.record-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.record-card-title { font-weight: 600; }
.record-card-head .status, .record-card-head .badge { flex: none; }
.record-card-meta { color: var(--muted); font-size: 0.875rem; }
.record-card-total { font-weight: 600; }
.record-group { margin: 16px 0 8px; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.record-group:first-child { margin-top: 0; }
.record-group a { color: inherit; }
.record-table { display: none; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--soft); }
@media (min-width: 64rem) {
  .record-cards { display: none; }
  .record-table { display: block; }
}

/* Shift rota (orders/rota.html): a week grid on the laptop, a card per day on the phone. */
.rota-table td { vertical-align: top; }
.rota-person { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 4px 0; }
.rota-shift { display: flex; flex-direction: column; gap: 2px; }

/* Planner calendar (ADR-0032): a month grid, one row per week. Phone: the week label above
   its seven days, so the grid fits 375 px. Laptop: the label in its own first column. */
.calendar { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 6px; }
.calendar-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.calendar-head > :first-child { display: none; } /* the phone has no "Week" column */
.calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.calendar-weekhead { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; color: var(--fg); text-decoration: none; font-weight: 600; }
.calendar-weekno { color: var(--muted); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; }
.calendar-day { position: relative; display: flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); text-decoration: none; font-size: 0.95rem; }
.calendar-day:hover, .calendar-day:focus-visible { background: var(--soft); }
.calendar-day.outside { color: var(--muted); background: transparent; border-style: dashed; }
.calendar-day.today { border: 2px solid var(--accent); font-weight: 700; }
.calendar-day.changed { box-shadow: inset 3px 0 0 var(--accent); }
.calendar-dot { position: absolute; top: 3px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.calendar-mark { position: absolute; right: 4px; bottom: 3px; width: 6px; height: 6px; border: 1px solid var(--muted); border-radius: 50%; background: var(--surface); }
/* ADR-0032: an extra production has its own colour in the Week tab. */
.extra-run { color: #b45309; }
.badge.extra { background: #b45309; color: #fff; }
@media (min-width: 40rem) {
  .calendar-head { grid-template-columns: 7rem repeat(7, minmax(0, 1fr)); font-size: 0.8rem; }
  .calendar-head > :first-child { display: block; }
  .calendar-week { grid-template-columns: 7rem repeat(7, minmax(0, 1fr)); align-items: center; }
  .calendar-weekhead { grid-column: auto; flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* Week tab (orders/production_plan.html): three weeks, one below the other. */
.plan-week { margin: 0 0 20px; }
.plan-week-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1rem; }
.plan-days { display: flex; flex-direction: column; gap: 8px; }

/* Empty states (UX guidelines 4.6): what the empty list means and the way out of it. */
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 24px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface); margin: 0 0 16px; }
.empty-state-title { margin: 0; font-weight: 600; }
.empty-state-text { margin: 0; color: var(--muted); }
.empty-state .button { text-decoration: none; }
.logo-preview-light { background: #fff; }
.logo-preview-dark { background: #17171a; }

/* Toasts (UX guidelines 4.7). Phone: bottom, above the FAB or the sticky save bar, where the
   thumb is. Laptop (>= 64rem): top right, below the app bar. Success goes after 4 s; an error
   stays until its close button. */
.toasts { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
body:has(.fab) .toasts,
body:has(.save-bar) .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 8px; padding: 12px; border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface); color: var(--fg); box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); }
.toast-text { flex: 1; margin: 0; font-size: 0.95rem; }
.toast-success { border-left-color: #166534; }
.toast-error { border-left-color: #b91c1c; }
.toast-warning { border-left-color: #b45309; }
.toast-info { border-left-color: var(--accent); }
.toast-undo { flex: none; margin: 0; }
.toast-undo button.link { font-weight: 600; white-space: nowrap; }
.toast-close { flex: none; min-width: 32px; min-height: 32px; padding: 0; background: none; color: var(--muted); font-size: 1.25rem; line-height: 1; }
.toast-close:hover, .toast-close:focus-visible { color: var(--fg); }
@media (min-width: 64rem) {
  .toasts { left: auto; right: 16px; top: 72px; bottom: auto; width: min(380px, calc(100vw - 32px)); }
  body:has(.fab) .toasts,
  body:has(.save-bar) .toasts { bottom: auto; }
}

/* The confirmation dialog (UX guidelines 4.8). Phone: a bottom sheet; laptop: centred, at most
   480 px. Native <dialog> traps the focus and closes on Escape. */
.confirm-dialog { width: min(480px, calc(100vw - 32px)); }
.confirm-dialog .confirm-title { font-size: 1.15rem; font-weight: 600; margin: 0 0 8px; }
.confirm-dialog p { margin: 0 0 16px; color: var(--muted); }
.confirm-dialog .confirm-warning { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px; padding: 12px; border: 1px solid #b91c1c; border-radius: 8px; background: #fef2f2; color: #7f1d1d; }
.confirm-dialog .confirm-warning[hidden] { display: none; }
.confirm-dialog .confirm-warning p { margin: 4px 0 0; color: inherit; }
.confirm-dialog .confirm-warning-icon { flex: 0 0 auto; color: #b91c1c; }
.confirm-dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-dialog .buttons > * { flex: 0 0 auto; min-width: 88px; }
.confirm-dialog button.danger { background: #b91c1c; color: #fff; border: 0; }
.confirm-dialog button.link { background: none; color: var(--accent); }
@media (max-width: 63.999rem) {
  .confirm-dialog { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media print { .toasts { display: none !important; } }

/* The shared ⋮ row menu (components/row_actions.html): at the right end of a card or table
   row, 44 px tap target, the same panel as the page header's More menu. */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-head > a { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; min-height: 44px; color: inherit; text-decoration: none; }
.card-head > a .price { margin-left: auto; }
.card-head .row-actions { flex: none; }
.card > .row-actions { margin-left: auto; }
.actions-cell .row-actions { margin-left: auto; }
.row-actions > summary { border-radius: 8px; }
.row-actions > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A form button inside the More menu (e.g. Delete on the customer page). */
.more-items form { margin: 0; }
.more-items button.more-item { width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--fg); text-align: left; }
.more-items button.more-item:hover, .more-items button.more-item:focus-visible { background: var(--soft); }
.more-items button.more-item.danger { color: #b91c1c; }

/* Send order links (US-117): the send queue, the per-contact state and the selection bar. */
.send-queue { position: sticky; top: 56px; z-index: 16; margin: 0 0 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.12); }
.send-queue-count { margin: 0; font-weight: 700; }
.send-queue-name { margin: 4px 0 0; font-size: 1.15rem; font-weight: 600; }
.send-queue-send { width: 100%; min-height: 56px; justify-content: center; font-size: 1.15rem; margin: 8px 0; }
.send-queue-actions { display: flex; gap: 8px; }
.send-queue-actions .button { flex: 1; justify-content: center; min-height: 48px; }
.queue-start { position: sticky; bottom: 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 12px; padding: 8px calc(8px + env(safe-area-inset-left)); background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.queue-start .button { min-height: 48px; flex: none; }
.send-customer { margin: 0 0 16px; }
.send-customer-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 0; }
.send-customer-name { font-weight: 700; flex: 1; }
.send-contact-main { display: flex; align-items: center; gap: 8px; }
.send-contact-check { flex: none; }
.send-contact-check input { width: 24px; height: 24px; }
.send-contact-body { flex: 1; min-width: 0; }
.send-contact-state .link-state.sent { color: #166534; font-weight: 700; }
.send-contact-state .link-state.ready { color: var(--muted); font-weight: 600; }
.send-contact-state .link-state.none { color: var(--muted); }

/* UI audit 2026-11-12, layout on the phone. */
.pagehead .button, .chip { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; } /* "+ New" never breaks onto two lines; a very long translation is cut with an ellipsis, never wider than the screen */
select, input, textarea { max-width: 100%; } /* a long option never makes the page wider than the screen */
/* A header with three or more buttons (rota, production plan): the title block takes the first
   row, the buttons the next one, instead of a narrow column beside the title. */
.pagehead { flex-wrap: wrap; }
.pagehead > :first-child { flex: 1 1 12rem; min-width: 0; }
.pagehead > .actions:has(> :nth-child(3)) { flex: 1 1 100%; justify-content: flex-start; }
@media (min-width: 64rem) {
  .pagehead > .actions:has(> :nth-child(3)) { flex: 0 1 auto; justify-content: flex-end; }
}
/* Plain Django `as_p` forms (Returns): the label above the field, the field full width. */
form.stack > p { display: flex; flex-direction: column; gap: 4px; margin: 0; }
form.stack > p > label { font-weight: 600; }
form.stack > p > select, form.stack > p > input:not([type=checkbox]), form.stack > p > textarea { width: 100%; min-height: 48px; }
/* The send bar sticks to the bottom: its long button wraps instead of leaving the screen. */
.queue-start { flex-wrap: wrap; }
.queue-start .button { flex: 1 1 14rem; justify-content: center; }
.label-preview-card { max-width: 100%; min-width: 0; box-sizing: border-box; }
.label-preview-scroll { max-width: 100%; overflow-x: auto; }
@media (max-width: 40rem) { .hide-phone { display: none; } }
/* Team list: the role pills and the two row buttons share short rows. */
.staff-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cards .card .chips { margin: 4px 0; }
.pagehead-actions { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; } /* long translated buttons wrap onto a second row, never off the screen */
