/* Mise: a kitchen book.
   The rail is the cloth cover (pandan green), the content is the page.
   Words people read are set in a book serif; numbers and controls in the system sans.
   The stock list is set like a cookbook's ingredient list; use-by dates are masking tape. */

@font-face { font-family: "Mise Book"; src: url("/fonts/misebook-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Mise Book"; src: url("/fonts/misebook-bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Mise Book"; src: url("/fonts/misebook-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --cover: #1f3d31;
  --cover-hi: #2c5444;
  --cover-ink: #ece7da;
  --cover-muted: #a9b9ad;
  --page: #fffdf8;
  --desk: #efebe2;
  --ink: #26231e;
  --ink-2: #4a453d;
  --muted: #6f685d;
  --rule: #e4ddd0;
  --rule-strong: #cfc6b5;
  --leaf: #1f7a55;
  --leaf-wash: rgba(31, 122, 85, 0.1);
  --saffron: #c8860d;
  --chili: #a93226;
  --chili-tint: #f8e0db;
  --amber: #7f5500;
  --amber-tint: #fbebc4;
  --ok-tint: #e1efe7;
  --tape: #e9dfc4;
  --tape-soon: #f2d27a;
  --tape-bad: #eba99c;
  --serif: "Mise Book", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rail-w: 236px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--desk);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; color: var(--ink); }
h1 { font-size: 2.15rem; letter-spacing: -0.005em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--leaf); text-underline-offset: 2px; }
a:hover { color: var(--cover); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.serif { font-family: var(--serif); }
.note-i { font-family: var(--serif); font-style: italic; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell: the cover on wide screens, a tab bar on phones ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--cover);
  color: var(--cover-ink);
  display: flex;
  flex-direction: column;
  padding: 26px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-family: var(--serif); font-size: 2.2rem; line-height: 1; padding: 0 12px; letter-spacing: 0.01em; }
.brand-sub { font-family: var(--serif); font-style: italic; color: var(--cover-muted); font-size: 0.95rem; padding: 6px 12px 0; }
.rail .tag { margin: 12px 12px 0; align-self: flex-start; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; flex: 1; overflow-y: auto; }
.nav a, .nav button {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px 0 14px;
  color: var(--cover-ink); text-decoration: none; opacity: 0.86;
  border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; width: 100%;
}
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, 0.07); opacity: 1; }
/* The current page is marked with a saffron ribbon, like a cookbook's bookmark. */
.nav a[aria-current="page"] { background: var(--cover-hi); opacity: 1; font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px;
  background: var(--saffron); border-radius: 0 3px 3px 0;
}
.nav svg { width: 20px; height: 20px; flex: none; }
.rail-foot { border-top: 1px solid rgba(255, 255, 255, 0.14); padding: 14px 12px 0; font-size: 0.875rem; color: var(--cover-muted); }
.rail-foot strong, .rail-foot span { display: block; }
.rail-foot strong { color: var(--cover-ink); font-weight: 600; }
.rail-foot button { margin-top: 10px; }
.main { padding: 32px clamp(16px, 3.6vw, 48px) 64px; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { display: block; }
  .rail { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20;
    background: var(--cover); color: var(--cover-ink); padding: 0 16px; height: 56px;
    padding-top: env(safe-area-inset-top);
  }
  .topbar .brand { padding: 0; font-size: 1.75rem; }
  .main { padding: 20px 16px 104px; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--page); border-top: 1px solid var(--rule-strong);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a, .tabbar button {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 60px; padding: 6px 2px; border: 0; background: none;
    color: var(--muted); font-size: 0.75rem; text-decoration: none; cursor: pointer;
  }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"], .tabbar button.current { color: var(--cover); font-weight: 700; }
  .tabbar a[aria-current="page"]::before, .tabbar button.current::before {
    content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; background: var(--saffron); border-radius: 0 0 3px 3px;
  }
  h1 { font-size: 1.85rem; }
}

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 24px; }
.page-head > div:first-child { max-width: 560px; min-width: 0; }
.page-head p { margin-top: 6px; color: var(--muted); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* The greeting at the top of Today: the one place the serif gets to be large. */
.hello { margin-bottom: 26px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.hello .date { color: var(--muted); font-size: 0.9rem; margin-bottom: 6px; }
.hello h1 { font-size: 2.6rem; }
.hello .lede { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--ink-2); margin-top: 8px; max-width: 46ch; }
@media (max-width: 860px) { .hello h1 { font-size: 2.1rem; } .hello .lede { font-size: 1.08rem; } }

/* ---------- buttons and form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  background: var(--cover); color: #fff; border: 1px solid var(--cover);
  border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--cover-hi); border-color: var(--cover-hi); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.quiet { background: var(--page); color: var(--ink); border-color: var(--rule-strong); }
.btn.quiet:hover { background: #fff; border-color: var(--ink-2); color: var(--ink); }
.btn.danger { background: var(--page); color: var(--chili); border-color: #ddb0a8; }
.btn.danger:hover { background: var(--chili-tint); border-color: var(--chili); color: var(--chili); }
.btn.solid-danger { background: var(--chili); border-color: var(--chili); }
.btn.solid-danger:hover { background: #8a271d; border-color: #8a271d; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.875rem; }
.btn.on-dark { background: transparent; color: var(--cover-ink); border-color: rgba(255, 255, 255, 0.3); }
.btn.on-dark:hover { background: rgba(255, 255, 255, 0.1); }
.btn svg { width: 18px; height: 18px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule-strong); background: var(--page); border-radius: 10px; cursor: pointer;
  font-size: 1.35rem; line-height: 1; padding: 0; color: var(--ink);
}
.icon-btn:hover:not(:disabled) { background: #fff; border-color: var(--ink-2); }
.icon-btn:active:not(:disabled) { background: var(--desk); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field > label, .field > .label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.83rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--rule-strong); border-radius: 8px; background: #fff;
}
.textarea { min-height: 84px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--leaf); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .row2, .row3 { grid-template-columns: 1fr; } }

.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-strong); border-radius: 10px; overflow: hidden; background: var(--page); }
.segmented button { min-height: 44px; padding: 0 16px; border: 0; background: none; cursor: pointer; border-right: 1px solid var(--rule); }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--cover); color: #fff; font-weight: 600; }

/* Filter chips: one tap instead of a dropdown. */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--page); cursor: pointer; font-size: 0.92rem; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-2); }
.chip .count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.82rem; }
.chip[aria-pressed="true"] { background: var(--cover); border-color: var(--cover); color: #fff; font-weight: 600; }
.chip[aria-pressed="true"] .count { color: var(--cover-muted); }

/* ---------- surfaces ---------- */
.panel { min-width: 0; background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule-strong); }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--rule); }
.panel > header p { color: var(--muted); font-size: 0.875rem; }
.panel .body { padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid2 > * { min-width: 0; }
.grid2.top { align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.stack > * + * { margin-top: 20px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title p { color: var(--muted); font-size: 0.9rem; }

/* Headline figures: sans numbers (they are data), serif-free on purpose. */
.strip { display: flex; flex-wrap: wrap; background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule-strong); margin: 0 0 22px; }
.strip > div { flex: 1 1 160px; padding: 16px 20px; border-right: 1px solid var(--rule); min-width: 0; }
.strip > div:last-child { border-right: 0; }
.strip .figure { font-weight: 650; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.strip .name { color: var(--muted); font-size: 0.875rem; margin-top: 4px; }
.strip .figure.alert { color: var(--chili); }
.strip:has(> div:nth-child(5)) .figure { font-size: 1.55rem; }
@media (max-width: 600px) {
  .strip > div { flex-basis: 50%; border-bottom: 1px solid var(--rule); padding: 14px 16px; }
  .strip > div:nth-child(2n) { border-right: 0; }
  .strip .figure { font-size: 1.6rem; }
}

.empty { padding: 34px 22px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin-bottom: 6px; }
.empty .art { width: 76px; height: 76px; margin: 0 auto 12px; color: var(--leaf); opacity: 0.85; }
.empty .btn { margin-top: 16px; }

/* ---------- lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 20px; border-top: 1px solid var(--rule); min-height: 60px; }
.rows > li:first-child { border-top: 0; }
.rows .grow { flex: 1 1 170px; min-width: 0; }
@media (min-width: 861px) { .rows > li { flex-wrap: nowrap; } .rows .grow { flex: 1 1 auto; } }
.rows .title { font-family: var(--serif); font-size: 1.08rem; overflow-wrap: anywhere; color: var(--ink); text-decoration: none; }
a.title:hover { text-decoration: underline; }
.rows > li.done .title, .rows > li.done .num { text-decoration: line-through; color: var(--muted); }
.rows input[type="checkbox"] { accent-color: var(--cover); flex: none; width: 22px; height: 22px; }

/* An item's picture: its photo, or a drawn icon for its category. */
.thumb {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--desk); color: var(--cover); border: 1px solid var(--rule);
}
.thumb svg { width: 28px; height: 28px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.sm { width: 40px; height: 40px; }
.thumb.sm svg { width: 22px; height: 22px; }
.thumb.lg { width: 96px; height: 96px; }
.thumb.lg svg { width: 44px; height: 44px; }

/* ---------- the stock list, set like an ingredient list ---------- */
.items { background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule-strong); overflow: hidden; }
.group-head { padding: 14px 20px 8px; border-top: 1px solid var(--rule); background: linear-gradient(var(--page), var(--page)); }
.group-head:first-child { border-top: 0; }
.group-head h3 { font-weight: 400; font-style: italic; font-size: 1.05rem; color: var(--ink-2); }
.item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 200px auto;
  gap: 16px; align-items: center;
  padding: 12px 20px; border-top: 1px solid var(--rule);
}
.group-head + .item { border-top: 1px solid var(--rule); }
.item.out { background: linear-gradient(90deg, var(--chili-tint), transparent 40%); }
.item .open { all: unset; cursor: pointer; display: block; min-width: 0; border-radius: 6px; }
.item .open:focus-visible { outline: 3px solid var(--leaf); outline-offset: 4px; }
.item .thumb-btn { all: unset; cursor: pointer; border-radius: 50%; }
.item .thumb-btn:focus-visible { outline: 3px solid var(--leaf); outline-offset: 3px; }
/* Quantities sit in their own right-aligned column, so the names line up like a printed ingredient list. */
.ing { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); column-gap: 14px; align-items: baseline; min-width: 0; }
.ing .qu { text-align: right; white-space: nowrap; }
.ing .q { font-weight: 650; font-size: 1.15rem; font-variant-numeric: tabular-nums lining-nums; }
.ing .u { color: var(--muted); font-size: 0.92rem; margin-left: 4px; }
.ing .n { font-family: var(--serif); font-size: 1.2rem; overflow-wrap: anywhere; color: var(--ink); }
.ing > .note, .ing > .reorder { grid-column: 2; }
.item .open:hover .n { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.item .note { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 0.95rem; margin-top: 2px; overflow-wrap: anywhere; }
.reorder { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 0.82rem; color: var(--muted); }
.reorder > span:last-child { white-space: nowrap; }
.meter { width: 96px; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; background: var(--ink-2); border-radius: 2px; }
.meter.low i { background: var(--saffron); }
.meter.out { background: var(--chili-tint); }
.state-word { font-weight: 600; }
.state-word.low { color: var(--amber); }
.state-word.out { color: var(--chili); }
.item .useby { justify-self: start; }
.item .ctrl { display: flex; gap: 8px; }
.item .ctrl .icon-btn { width: 46px; height: 46px; }

@media (max-width: 860px) {
  .item { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "thumb main ctrl" "thumb tape ctrl"; gap: 6px 12px; padding: 14px 14px; }
  .item .thumb-btn { grid-area: thumb; align-self: start; }
  .item .open { grid-area: main; }
  .item .useby { grid-area: tape; }
  .item .useby:empty { display: none; }
  .item .ctrl { grid-area: ctrl; flex-direction: column-reverse; gap: 6px; }
  .item .ctrl .icon-btn { width: 48px; height: 48px; }
  .item .thumb { width: 48px; height: 48px; }
  .ing { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
  .ing .qu { text-align: left; }
  .reorder .lvl { display: none; }
  .ing .n { font-size: 1.1rem; }
  .meter { width: 56px; }
  .group-head { padding: 14px 14px 8px; }
  .desk-only { display: none !important; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar .search { flex: 1 1 240px; }
.toolbar .select { width: auto; min-width: 150px; flex: 0 1 auto; }
@media (max-width: 520px) { .toolbar .select { flex: 1 1 140px; } }

/* ---------- stock take ---------- */
.count-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--rule); }
.count-row .n { font-family: var(--serif); font-size: 1.1rem; overflow-wrap: anywhere; }
.count-row .was { font-size: 0.85rem; color: var(--muted); }
.count-row .qty-in { display: flex; align-items: center; gap: 8px; }
.count-row .qty-in .input { text-align: right; font-weight: 650; font-size: 1.1rem; font-variant-numeric: tabular-nums; min-height: 48px; }
.count-row .qty-in .input { min-width: 0; }
.count-row .qty-in span { color: var(--muted); font-size: 0.86rem; min-width: 2.5ch; max-width: 4.6em; overflow-wrap: anywhere; line-height: 1.15; }
.count-row.changed { background: #fff6dc; }
.count-row.changed .was { color: var(--amber); font-weight: 600; }
@media (max-width: 520px) { .count-row { grid-template-columns: 36px minmax(0, 1fr) 146px; padding: 10px 14px; } }
.savebar {
  position: sticky; bottom: 16px; z-index: 15; margin-top: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--cover); color: var(--cover-ink); padding: 12px 14px 12px 20px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(31, 61, 49, 0.3);
}
.savebar .btn { background: var(--saffron); border-color: var(--saffron); color: #1d1608; }
.savebar .btn:hover { background: #dc9a1f; border-color: #dc9a1f; color: #1d1608; }
@media (max-width: 860px) { .savebar { bottom: calc(72px + env(safe-area-inset-bottom)); } }

/* Shift count: two boxes per line, Sold and Left. */
.count-row.tally { grid-template-columns: 40px minmax(0, 1fr) 104px 104px; }
.count-row .cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.count-row .cell .input { min-width: 0; width: 100%; text-align: right; font-weight: 650; font-size: 1.1rem; font-variant-numeric: tabular-nums; min-height: 48px; padding: 0 10px; }
.count-row.changed .was { color: var(--ink-2); font-weight: 600; }
.count-row.ok { background: var(--ok-tint); }
.count-row.ok .was { color: var(--leaf); }
.count-row.off { background: var(--chili-tint); }
.count-row.off .was { color: var(--chili); }
.count-sheet .group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.count-sheet .group-head .cols { display: grid; grid-template-columns: 104px 104px; gap: 12px; color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.count-sheet .group-head .cols span { padding-left: 2px; }
.count-note { margin-top: 18px; }
.count-note .field { margin-bottom: 0; }
@media (max-width: 520px) {
  .count-row.tally { grid-template-columns: 34px minmax(0, 1fr) 72px 72px; gap: 8px; padding: 10px 12px; }
  .count-row.tally .thumb.sm { width: 34px; height: 34px; }
  .count-row .cell .input { padding: 0 8px; min-height: 46px; }
  .count-sheet .group-head .cols { grid-template-columns: 72px 72px; gap: 8px; font-size: 0.72rem; }
}

/* Storage areas as index tabs along the top of the stock book. */
.area-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule-strong); margin: 0 0 16px; }
.area-tabs::-webkit-scrollbar { display: none; }
.area-tab {
  flex: none; display: inline-flex; align-items: baseline; gap: 7px; min-height: 46px; padding: 0 14px;
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer;
  font-family: var(--serif); font-size: 1.08rem; color: var(--ink-2); white-space: nowrap;
}
.area-tab:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.area-tab[aria-pressed="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--saffron); }
.area-tab .count { font-family: var(--sans); font-size: 0.78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Count reports */
.tally-list .off-amount { text-align: right; white-space: nowrap; }
.tally-list .off-amount b { font-variant-numeric: tabular-nums; }
details.fold { margin-bottom: 18px; }
details.fold > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 10px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "+"; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule-strong); display: grid; place-items: center; font-weight: 700; color: var(--muted); flex: none; }
details.fold[open] > summary::before { content: "−"; }
details.fold[open] > summary { border-bottom: 1px solid var(--rule); }
details.fold > summary h2 { font-size: 1.15rem; }

/* Setup lists */
.setup-list .acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.add-row { display: flex; gap: 10px; border-top: 1px solid var(--rule); }
.add-row .input { flex: 1 1 auto; min-width: 0; }
.roles { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 14px; }
.roles dt { font-family: var(--serif); font-weight: 700; }
.roles dd { margin: 0; color: var(--ink-2); }
@media (max-width: 520px) { .roles { grid-template-columns: 1fr; gap: 2px; } .roles dd { margin-bottom: 10px; } }

/* ---------- tables (owner console, team, suppliers) ---------- */
.table-wrap { background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule-strong); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { text-align: left; padding: 13px 18px; border-top: 1px solid var(--rule); vertical-align: middle; }
th { background: transparent; border-top: 0; border-bottom: 1px solid var(--rule-strong); color: var(--muted); font-size: 0.83rem; font-weight: 600; white-space: nowrap; }
td strong { font-family: var(--serif); font-weight: 400; font-size: 1.06rem; }
td.right, th.right { text-align: right; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: #fff; }
td .sub { color: var(--muted); font-size: 0.85rem; }

/* ---------- labels ---------- */
/* Masking tape: how kitchens label use-by dates. Colour carries the urgency, words carry the meaning. */
.tape {
  display: inline-block; font-family: var(--sans); font-weight: 650; font-size: 0.86rem; letter-spacing: 0.01em;
  padding: 4px 14px; background: var(--tape); color: var(--ink);
  transform: rotate(-1.4deg);
  clip-path: polygon(0 0, 100% 0, 97% 25%, 100% 50%, 97% 75%, 100% 100%, 0 100%, 3% 75%, 0 50%, 3% 25%);
  white-space: nowrap;
}
.tape.soon { background: var(--tape-soon); }
.tape.bad { background: var(--tape-bad); }
.tape.ok { background: #bfe0cc; }
.tape.dark { background: var(--saffron); color: #1d1608; font-size: 0.78rem; padding: 3px 12px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--desk); color: var(--ink-2); border: 1px solid var(--rule); }
.pill.pro { background: var(--cover); color: var(--cover-ink); border-color: var(--cover); }
.state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 0.92rem; }
.state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rule-strong); }
.state.active::before { background: var(--leaf); }
.state.expired::before { background: var(--saffron); }
.state.suspended::before { background: var(--chili); }
.delta-up { color: var(--leaf); font-weight: 600; }
.delta-down { color: var(--chili); font-weight: 600; }

.banner { padding: 13px 18px; border-radius: var(--radius); background: var(--amber-tint); color: #5a3d00; margin-bottom: 20px; border: 1px solid #f0d68e; }
.banner.bad { background: var(--chili-tint); color: #6f1d14; border-color: #e9b6ad; }
.banner a { color: inherit; font-weight: 600; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart .lbl { fill: var(--muted); font-size: 11.5px; font-family: var(--sans); }
.chart .lbl.ink { fill: var(--ink); font-weight: 600; }
.chart .grid line { stroke: var(--rule); stroke-width: 1; }
.chart .base { stroke: var(--rule-strong); stroke-width: 1; }
.chart .mark { fill: var(--leaf); transition: opacity 0.12s; }
.chart .mark.dim { fill: var(--rule-strong); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .mark, .chart .hit:focus + .mark { opacity: 0.75; }
.chart .hit:focus { outline: none; }
.chart .line { fill: none; stroke: var(--leaf); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .wash { fill: var(--leaf-wash); }
.chart .dot { fill: var(--leaf); stroke: var(--page); stroke-width: 2; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink); color: #fff; padding: 7px 11px; border-radius: 7px; font-size: 0.8rem; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(38, 35, 30, 0.25);
}
.chart-tip b { display: block; font-size: 0.98rem; font-variant-numeric: tabular-nums; }
.chart-data { margin-top: 8px; font-size: 0.83rem; color: var(--muted); }
.chart-data summary { cursor: pointer; width: max-content; }
.chart-data table { min-width: 0; margin-top: 6px; font-size: 0.85rem; }
.chart-data th, .chart-data td { padding: 6px 10px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars .bar-row { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); gap: 12px; align-items: center; }
.bars .bar-name { font-family: var(--serif); font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bar-track { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.bars .bar-lane { min-width: 0; }
.bars .bar { height: 14px; background: var(--leaf); border-radius: 0 4px 4px 0; min-width: 3px; max-width: 100%; }
.bars .bar-val { font-size: 0.85rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- modal: a dialog on wide screens, a bottom sheet on phones ---------- */
.scrim { position: fixed; inset: 0; background: rgba(31, 38, 33, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 14px; overflow-y: auto; z-index: 50; }
.modal { background: var(--page); border-radius: 14px; width: min(560px, 100%); box-shadow: 0 24px 64px rgba(20, 28, 24, 0.35); }
.modal.narrow { width: min(440px, 100%); }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--rule); }
.modal > header h2 { font-size: 1.45rem; }
.modal > .content { padding: 20px 22px; }
.modal > footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--rule); background: var(--desk); border-radius: 0 0 14px 14px; }
.modal > footer .left { margin-right: auto; }
@media (max-width: 640px) {
  .scrim { align-items: flex-end; padding: 0; }
  .modal, .modal.narrow { width: 100%; border-radius: 18px 18px 0 0; max-height: 94vh; overflow-y: auto; animation: sheet-up 0.22s ease-out; }
  .modal > header { position: sticky; top: 0; background: var(--page); z-index: 1; border-radius: 18px 18px 0 0; }
  .modal > header::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--rule-strong); }
  .modal > footer { position: sticky; bottom: 0; border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal > footer .btn { flex: 1 1 auto; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.error { color: var(--chili); font-weight: 600; margin: 4px 0 12px; }
.creds { background: var(--desk); border: 1px dashed var(--rule-strong); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.creds dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.creds dt { color: var(--muted); }
.creds dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.creds code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; background: #fff; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--rule); }
.more-menu { display: flex; flex-direction: column; }
.more-menu a, .more-menu button { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 6px; border: 0; border-bottom: 1px solid var(--rule); background: none; text-decoration: none; color: var(--ink); text-align: left; cursor: pointer; font-size: 1rem; }
.more-menu svg { width: 22px; height: 22px; color: var(--leaf); }
.sheet-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.sheet-head .n { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; }
.sheet-head .q { font-size: 0.95rem; color: var(--muted); margin-top: 2px; }

/* Batches in the stock sheet: each delivery with its own use-by date, oldest first. */
.batches { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); margin: -4px 0 18px; }
.batches-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; padding: 10px 14px 8px; border-bottom: 1px solid var(--rule); }
.batch-list { list-style: none; margin: 0; padding: 0; }
.batch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px; border-top: 1px solid var(--rule); }
.batch:first-child { border-top: 0; }
.row-acts { display: flex; gap: 8px; flex-wrap: nowrap; }
.batch-main { flex: 1 1 200px; }
.batch-acts .btn { white-space: nowrap; }
/* The four ways to change stock: one row, equal widths, even on a small phone. */
.segmented.fill { display: flex; flex-wrap: nowrap; width: 100%; }
.segmented.fill button { flex: 1 1 0; min-width: 0; padding: 0 6px; white-space: nowrap; }
@media (max-width: 380px) { .segmented.fill button { font-size: 0.92rem; padding: 0 2px; } }
.batch-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.batch-qty { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 4.5em; }
.batch-from { flex-basis: 100%; }
.batch-acts { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.batch-acts .input { width: 150px; min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 420px) { .batch-acts { margin-left: 0; width: 100%; } .batch-acts .input { flex: 1 1 auto; width: auto; min-width: 0; } }
.photo-field { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.photo-field .acts { display: flex; flex-wrap: wrap; gap: 8px; }

.toasts { position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; }
/* On a desktop: bottom right, high enough to clear the save bar, away from the page buttons at the top. */
@media (min-width: 861px) { .toasts { top: auto; bottom: 100px; right: 22px; left: auto; align-items: flex-end; width: 360px; } }
.toast { max-width: 100%; background: var(--cover); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 0.92rem; box-shadow: 0 8px 22px rgba(20, 28, 24, 0.28); animation: toast-in 0.18s ease-out; }
.toast.bad { background: var(--chili); }
.toast.has-action { display: flex; align-items: center; justify-content: space-between; gap: 14px; pointer-events: auto; padding: 8px 8px 8px 16px; }
.toast.has-action button {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.toast.has-action button:hover { background: rgba(255, 255, 255, 0.12); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- sign-in: cover and page ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.cover {
  position: relative; overflow: hidden; background: var(--cover); color: var(--cover-ink);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px clamp(28px, 5vw, 72px);
}
.cover .endpaper { position: absolute; inset: 0; color: var(--saffron); opacity: 0.26; pointer-events: none; }
.cover .endpaper svg { width: 100%; height: 100%; }
.cover > * { position: relative; }
.cover .wordmark { font-family: var(--serif); font-size: clamp(3.4rem, 7vw, 5.4rem); line-height: 0.95; letter-spacing: 0.01em; }
.cover .tagline { font-family: var(--serif); font-style: italic; font-size: clamp(1.25rem, 2.2vw, 1.6rem); margin-top: 14px; max-width: 24ch; line-height: 1.3; }
.cover .what { color: var(--cover-muted); max-width: 38ch; font-size: 0.98rem; }
.auth-page { display: grid; place-items: center; padding: 40px 20px; background: var(--page); }
.sign-in { width: min(400px, 100%); }
.sign-in h1 { font-size: 2rem; margin-bottom: 6px; }
.sign-in .lead { color: var(--muted); margin-bottom: 24px; }
.sign-in .btn { width: 100%; min-height: 48px; }
.sign-in .help { margin-top: 18px; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .cover { padding: 28px 22px 30px; min-height: 0; gap: 8px; }
  .cover .wordmark { font-size: 3rem; }
  .cover .tagline { font-size: 1.15rem; margin-top: 6px; max-width: none; }
  .cover .what { display: none; }
  .auth-page { align-items: start; padding: 28px 20px 40px; }
}

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 22px 16px; }
.center-screen > * { min-width: 0; max-width: 100%; }
.notice-card { width: min(520px, 100%); background: var(--page); border: 1px solid var(--rule); border-radius: 14px; padding: 30px; box-shadow: 0 1px 0 var(--rule-strong); }
.notice-card h1 { margin: 14px 0 10px; }
.notice-card p + p { margin-top: 10px; }
.notice-card .btn { margin-top: 12px; margin-right: 8px; }
@media (max-width: 520px) {
  .btn { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
  .notice-card { padding: 24px 18px; }
  .notice-card .btn { width: 100%; margin-right: 0; }
}

/* ---------- print (order list) ---------- */
.print-sheet { display: none; }
@media print {
  body.printing-sheet > *:not(.print-sheet) { display: none !important; }
  body.printing-sheet .print-sheet { display: block; color: #000; font-family: var(--sans); }
  .print-sheet h1 { font-size: 20pt; margin: 0 0 6pt; }
  .print-sheet h2 { font-size: 13pt; margin: 14pt 0 4pt; }
  .print-sheet table { width: 100%; min-width: 0; border-collapse: collapse; page-break-inside: auto; table-layout: fixed; }
  .print-sheet th:nth-child(1) { width: 46%; }
  .print-sheet th, .print-sheet td { border: 1px solid #555; padding: 5pt 7pt; text-align: left; font-size: 10.5pt; }
  .print-sheet td:nth-child(3), .print-sheet td:nth-child(4), .print-sheet th:nth-child(3), .print-sheet th:nth-child(4) { width: 18%; }
  .print-sheet tr { page-break-inside: avoid; }
  .rail, .topbar, .tabbar, .head-actions, .toolbar, .toasts, .no-print, .savebar, .back-link, .tabs-row, .dock { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .panel, .items { border-color: #999; box-shadow: none; }
}

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

/* ---------- getting started ---------- */
.checklist .steps { list-style: none; margin: 0; padding: 4px 0; }
.checklist .steps li { display: flex; align-items: center; gap: 14px; padding: 10px 20px; }
.checklist .tick {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--rule-strong);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; color: #fff;
}
.checklist li.done .tick { background: var(--leaf); border-color: var(--leaf); }
.checklist li.done .title { color: var(--muted); text-decoration: line-through; }
.checklist .title { font-family: var(--serif); font-size: 1.06rem; }

/* ---------- forms added for buying and waste ---------- */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
fieldset.buying { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px 4px; margin: 0 0 15px; background: var(--desk); }
fieldset.buying legend { font-weight: 600; font-size: 0.9rem; padding: 0 6px; }
fieldset.buying .hint { margin: -6px 0 10px; }
@media (max-width: 520px) { fieldset.buying .row3 { grid-template-columns: 1fr 1fr; } fieldset.buying .row3 > :first-child { grid-column: 1 / -1; } }
.archived-link { margin-top: 14px; }
.qty-pair { display: flex; align-items: center; gap: 6px; min-width: 0; }
.qty-pair .input, .qty-pair .select { min-width: 0; }
.qty-pair > span { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.panel > header .acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- dishes on the count sheet ---------- */
.count-row.dish { grid-template-columns: minmax(0, 1fr) 104px; }
.dishes-sold .group-head { padding-top: 12px; }
.dish-line { margin: -8px 0 18px; color: var(--ink-2); }
@media (max-width: 520px) { .count-row.dish { grid-template-columns: minmax(0, 1fr) 88px; } }

/* ---------- purchase orders ---------- */
.po-lines table { min-width: 620px; }
.po-lines.readonly table { min-width: 0; }
@media (max-width: 520px) { .po-lines.readonly th, .po-lines.readonly td { padding: 11px 12px; } }
td .sub.delta-down { color: var(--chili); }
.po-lines .qty-pair .input { width: 86px; }
.po-lines td > .input { width: 110px; }
.po-add { margin-top: 12px; max-width: 360px; }
.receive-list li { flex-wrap: wrap; }
.receive-list .qty-pair .input { width: 90px; }
.receive-list .use-by-pair .input { width: 150px; }
@media (max-width: 520px) { .receive-list .grow { flex-basis: 100%; } }

/* ---------- menu and recipes ---------- */
.menu-list .dish-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 92px; gap: 6px 16px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--rule); color: inherit; text-decoration: none;
}
.menu-list .dish-row:hover { background: #fff; }
.menu-list .group-head + .dish-row { border-top: 0; }
.menu-list .n { display: block; font-family: var(--serif); font-size: 1.12rem; }
.menu-list .note { display: block; color: var(--muted); font-size: 0.85rem; }
.menu-list .money { display: flex; flex-direction: column; align-items: flex-end; }
.menu-list .money .num { font-weight: 650; }
.menu-list .pct-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
@media (max-width: 520px) { .menu-list .dish-row { grid-template-columns: minmax(0, 1fr) auto; } .menu-list .pct-cell { grid-column: 2; grid-row: 1 / span 2; } .menu-list .money { grid-column: 1; align-items: flex-start; flex-direction: row; gap: 6px; } }
/* Prep rows: name, cost per unit, what is on the shelf, and Make. */
.menu-list .prep-row { grid-template-columns: minmax(0, 1fr) auto 110px auto; }
.menu-list .prep-row .grow { color: inherit; text-decoration: none; min-width: 0; }
.menu-list .prep-row .grow:hover .n { text-decoration: underline; text-underline-offset: 3px; }
.menu-list .stock-cell { display: flex; flex-direction: column; align-items: flex-end; }
.menu-list .stock-cell .num { font-weight: 650; white-space: nowrap; }
@media (max-width: 520px) {
  .menu-list .prep-row { grid-template-columns: minmax(0, 1fr) auto; }
  .menu-list .prep-row .money { grid-column: 1; }
  .menu-list .prep-row .stock-cell { grid-column: 2; grid-row: 1; }
  .menu-list .prep-row .btn { grid-column: 2; grid-row: 2; justify-self: end; }
}
.sheet-head .grow { flex: 1 1 auto; min-width: 0; }
.sheet-make { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -6px 0 18px; }
/* Make a batch: what comes off stock. */
.make-uses { list-style: none; margin: 4px 0 6px; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); }
.make-uses li { display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: space-between; padding: 8px 12px; border-top: 1px solid var(--rule); }
.make-uses li:first-child { border-top: 0; }
.make-uses li .num { font-weight: 650; white-space: nowrap; }
.make-uses li .delta-down { flex-basis: 100%; text-align: right; }
.make-uses li.short { background: var(--chili-tint); }
.amount-pair .input { width: 150px; flex: none; }
/* Where an item is kept, in the stock sheet. */
.areas-box { margin: -6px 0 16px; }
.areas-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.areas-list { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); }
.areas-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--rule); }
.areas-list li:first-child { border-top: 0; }
.areas-list .num { font-weight: 650; white-space: nowrap; }
/* Receipts: the photo beside the lines on a wide screen, above them on a phone. */
.receipt-state { display: flex; align-items: center; gap: 12px; margin: -8px 0 16px; }
.receipt-layout { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.receipt-layout > :only-child { grid-column: 1 / -1; }
.receipt-photo { position: sticky; top: 16px; display: block; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: #fff; }
.receipt-photo img { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
@media (max-width: 860px) {
  .receipt-layout { grid-template-columns: minmax(0, 1fr); }
  .receipt-photo { position: static; }
  .receipt-photo img { max-height: 42vh; }
}
.receipt-line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 36px; grid-template-areas: "printed printed printed printed" "pick pick pick del" "qty price total ."; gap: 8px 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--rule); }
.receipt-lines > .receipt-line:first-child { border-top: 0; }
.receipt-line .printed { grid-area: printed; font-size: 0.85rem; color: var(--ink-2); font-family: var(--serif); font-style: italic; overflow-wrap: anywhere; }
.receipt-line .printed:empty { display: none; }
.receipt-line .pick { grid-area: pick; min-width: 0; }
.receipt-line .pick .select { width: 100%; }
.receipt-line > :nth-child(3) { grid-area: qty; }
.receipt-line > :nth-child(4) { grid-area: price; }
.receipt-line > :nth-child(5) { grid-area: total; }
.receipt-line > :nth-child(6) { grid-area: del; }
.receipt-line .qty-pair .input { flex: 1 1 auto; width: auto; min-width: 0; text-align: right; }
.receipt-line .qty-pair .unit, .receipt-line .qty-pair .per { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.receipt-line.unmatched { background: var(--amber-tint); }
@media (max-width: 700px) {
  .receipt-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; grid-template-areas: "printed printed printed" "pick pick del" "qty price price" "total total total"; }
}
.receipt-sum { margin-top: 10px; }
.receipt-list .receipt-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; min-width: 0; }
.receipt-list .receipt-link:hover .title { text-decoration: underline; }
.reading { display: flex; align-items: center; gap: 14px; padding: 6px 0 12px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--leaf); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.receipt-add { display: inline-flex; }

/* Monthly report: a ledger of where the stock value came from and went. */
.ledger { list-style: none; margin: 0; padding: 4px 0; }
.ledger li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 20px; border-top: 1px solid var(--rule); }
.ledger li:first-child { border-top: 0; }
.ledger li .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger li.total { font-weight: 650; background: var(--desk); }
.month-bar .select { width: auto; min-width: 200px; }
.month-table td.num, .month-table th.num { text-align: right; white-space: nowrap; }
.month-table td strong { font-family: var(--sans); font-weight: 650; }
@media print { .ledger li.total { background: none; } .month-table { font-size: 0.85rem; } }
.item .areas-note { font-style: normal; font-family: var(--sans); font-size: 0.82rem; }
.pct { display: inline-block; min-width: 4.2em; text-align: center; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; background: var(--desk); color: var(--ink-2); border: 1px solid var(--rule); }
.pct.good { background: var(--ok-tint); color: #145a3e; border-color: #b9dccb; }
.pct.near { background: var(--amber-tint); color: #5a3d00; border-color: #f0d68e; }
.pct.over { background: var(--chili-tint); color: #7d2016; border-color: #e9b6ad; }
.recipe-line {
  display: grid; grid-template-columns: minmax(0, 1fr) 170px 120px 84px 36px; gap: 10px; align-items: center;
  padding: 10px 20px; border-top: 1px solid var(--rule);
}
.recipe-lines > .recipe-line:first-child { border-top: 0; }
.recipe-line .n { font-family: var(--serif); font-size: 1.06rem; overflow-wrap: anywhere; }
.recipe-line .qty-pair .input { width: 90px; text-align: right; }
.recipe-line .qty-pair .select { width: 72px; padding-left: 8px; padding-right: 4px; }
.recipe-line .waste .input { width: 64px; text-align: right; }
.recipe-line .line-cost { text-align: right; font-weight: 650; }
.recipe-line .line-cost.missing { color: var(--chili); }
@media (max-width: 700px) {
  .recipe-line { grid-template-columns: minmax(0, 1fr) auto 36px; padding: 12px 14px; row-gap: 8px; }
  .recipe-line .who { grid-column: 1; grid-row: 1; }
  .recipe-line .line-cost { grid-column: 2; grid-row: 1; }
  .recipe-line .icon-btn { grid-column: 3; grid-row: 1; }
  .recipe-line .qty-pair:not(.waste) { grid-column: 1; grid-row: 2; }
  .recipe-line .waste { grid-column: 2 / span 2; grid-row: 2; justify-self: end; }
}
.dish-summary .figure.alert { color: var(--chili); }
.sales-list { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 14px; }
.sales-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--rule); font-family: var(--serif); font-size: 1.04rem; }
.sales-row:first-child { border-top: 0; }
.sales-row .input { text-align: right; }
details.paste summary { cursor: pointer; color: var(--leaf); font-weight: 600; margin-bottom: 10px; }

/* ---------- settings ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; }
.switch-row { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
input.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 52px; height: 30px; margin: 0;
  border-radius: 999px; background: var(--rule-strong); cursor: pointer; transition: background 0.15s;
}
input.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
input.switch:checked { background: var(--leaf); }
input.switch:checked::after { transform: translateX(22px); }


/* ---------- bigger text, chosen per phone ---------- */
html.large-text { font-size: 18px; }
html.large-text body { font-size: 17px; }

/* ---------- the customer's own logo, search ---------- */
.own-logo { display: block; max-height: 30px; max-width: 120px; width: auto; border-radius: 4px; background: #fff; object-fit: contain; }
.brand-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-sub .own-logo { max-height: 28px; }
.topbar .brand.own { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; min-width: 0; }
.topbar .brand.own span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .top-search { margin-left: auto; color: var(--cover-ink); background: transparent; border-color: rgba(255, 255, 255, 0.3); width: 42px; height: 42px; }
.topbar .top-search span { display: none; }
.topbar .top-search svg { width: 20px; height: 20px; }
.rail-search {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 -12px; min-height: 40px; padding: 0 12px;
  background: rgba(255, 255, 255, 0.08); color: var(--cover-muted); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; cursor: pointer; font: inherit; text-align: left;
}
.rail-search:hover { color: var(--cover-ink); background: rgba(255, 255, 255, 0.12); }
.rail-search svg { width: 18px; height: 18px; }
.rail-search::after { content: "/"; margin-left: auto; font-size: 0.78rem; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 4px; padding: 0 6px; }
.search-modal .input { font-size: 1.05rem; min-height: 50px; margin-bottom: 10px; }
.search-results { min-height: 120px; }
.search-group { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 14px 0 4px; font-family: var(--sans); font-weight: 700; }
.search-hit { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-radius: 8px; background: none; text-align: left; color: inherit; text-decoration: none; cursor: pointer; font: inherit; }
.search-hit:hover, .search-hit:focus-visible { background: var(--desk); }
.search-hit .grow { display: flex; flex-direction: column; min-width: 0; }
.search-hit .n { font-family: var(--serif); font-size: 1.05rem; }

/* ---------- page header: back link, tabs row, one main button, More ---------- */
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.back-link:hover { color: var(--ink); }
.tabs-row { margin: -10px 0 22px; }
.segmented.scroll { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.segmented.scroll::-webkit-scrollbar { display: none; }
.segmented.scroll button { flex: none; white-space: nowrap; }
.more-btn { padding: 0 12px; }
.more-btn svg { width: 20px; height: 20px; }
.menu-scrim { position: fixed; inset: 0; z-index: 60; }
.menu-pop {
  position: fixed; min-width: 230px; max-width: calc(100vw - 24px); background: var(--page); border: 1px solid var(--rule-strong);
  border-radius: 12px; box-shadow: 0 16px 40px rgba(31, 38, 33, 0.22); padding: 6px; display: flex; flex-direction: column;
}
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px; border: 0; border-radius: 8px; background: none;
  color: var(--ink); text-decoration: none; text-align: left; font: inherit; cursor: pointer; white-space: nowrap;
}
.menu-pop a:hover, .menu-pop button:hover, .menu-pop a:focus-visible, .menu-pop button:focus-visible { background: var(--desk); outline: none; }
.menu-pop .danger { color: var(--chili); }
@media (max-width: 640px) {
  .menu-scrim { background: rgba(31, 38, 33, 0.45); }
  .menu-pop { left: 0; right: 0; bottom: 0; top: auto; max-width: none; border-radius: 16px 16px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); animation: sheet-up 0.18s ease-out; }
  .menu-pop a, .menu-pop button { min-height: 52px; font-size: 1.02rem; }
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* On phones the page's main button sits at the bottom, above the tab bar, where the thumb is. */
@media (max-width: 860px) {
  .page-head .head-actions { width: 100%; }
  .dock {
    position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 15;
    min-height: 52px; font-size: 1.02rem; box-shadow: 0 10px 26px rgba(31, 61, 49, 0.32);
  }
  body.has-dock .main { padding-bottom: 170px; }
  body.has-dock .savebar { bottom: calc(132px + env(safe-area-inset-bottom)); }
}

/* ---------- tables become cards on phones ---------- */
@media (max-width: 600px) {
  .table-wrap:has(table.cardify) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.cardify, table.cardify tbody, table.cardify tr, table.cardify td { display: block; min-width: 0; width: 100%; }
  table.cardify thead { display: none; }
  table.cardify tr { background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule-strong); padding: 10px 14px; margin-bottom: 12px; }
  table.cardify td { border: 0; padding: 5px 0; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  table.cardify td.right { text-align: right; }
  table.cardify td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.82rem; font-weight: 600; flex: none; }
  table.cardify td:first-child { display: block; padding-bottom: 6px; }
  table.cardify td:first-child::before { display: none; }
  table.cardify td.no-label, table.cardify td:empty { justify-content: flex-end; }
  table.cardify td:empty { display: none; }
  table.cardify td .input { max-width: 150px; }
}

/* ---------- loading placeholder ---------- */
.skeleton { padding-top: 4px; }
.sk { background: linear-gradient(90deg, var(--rule) 0%, #f4efe6 50%, var(--rule) 100%); background-size: 200% 100%; border-radius: 8px; animation: shimmer 1.2s linear infinite; margin-bottom: 14px; }
.sk-title { height: 34px; width: 38%; }
.sk-line { height: 14px; width: 62%; margin-bottom: 26px; }
.sk-strip { height: 86px; }
.sk-card { height: 120px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Today: needs you ---------- */
.needs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 22px; }
.need {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 118px;
  padding: 14px 16px 12px 18px; background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--rule-strong); color: inherit; text-decoration: none; position: relative; overflow: hidden;
}
.need::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--leaf); }
.need.urgent::before { background: var(--chili); }
.need.soon::before { background: var(--saffron); }
.need:hover { background: #fff; border-color: var(--rule-strong); }
.need-body { display: flex; flex-direction: column; gap: 4px; }
.need strong { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; line-height: 1.25; }
.need-text { color: var(--muted); font-size: 0.88rem; }
.need-go { align-self: flex-start; font-weight: 700; font-size: 0.9rem; color: var(--leaf); }
.need.urgent .need-go { color: var(--chili); }
.need.soon .need-go { color: var(--amber); }
.calm { margin-bottom: 22px; }
.calm .body { color: var(--ink-2); }
.calm strong { font-family: var(--serif); font-weight: 400; font-size: 1.1rem; margin-right: 4px; }
@media (max-width: 600px) { .needs { grid-template-columns: minmax(0, 1fr); } .need { min-height: 0; flex-direction: row; align-items: center; } .need-go { align-self: center; white-space: nowrap; } }

/* ---------- item form: more details ---------- */
details.more-details { border-top: 1px solid var(--rule); margin: 4px 0 6px; padding-top: 6px; }
details.more-details > summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: 22px minmax(0, 1fr); row-gap: 2px; padding: 8px 0 12px; font-weight: 700; color: var(--leaf); }
details.more-details > summary::-webkit-details-marker { display: none; }
details.more-details > summary::before { content: "+"; grid-row: 1 / span 2; font-size: 1.15rem; line-height: 1.2; }
details.more-details[open] > summary::before { content: "−"; }
details.more-details > summary .muted { grid-column: 2; font-weight: 400; }

/* ---------- counting one by one ---------- */
.count-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.savebar-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.solo { padding: 18px 20px 20px; max-width: 560px; }
.solo.done { padding: 0; }
.solo .acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.solo .acts .btn { margin-top: 0; }
.solo-progress { height: 6px; background: var(--rule); border-radius: 999px; overflow: hidden; }
.solo-progress i { display: block; height: 100%; background: var(--saffron); border-radius: 999px; transition: width 0.2s; }
.solo-where { color: var(--muted); font-size: 0.88rem; margin: 8px 0 14px; font-weight: 600; }
.solo-item { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.solo-item h2 { font-size: 1.7rem; line-height: 1.15; overflow-wrap: anywhere; }
.solo-line { color: var(--muted); margin-top: 4px; font-weight: 600; }
.solo-line.off { color: var(--chili); }
.solo-line.ok { color: var(--leaf); }
.thumb.xl { width: 112px; height: 112px; }
.thumb.xl svg { width: 54px; height: 54px; }
.stepper { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 10px; align-items: center; }
.stepper .step { width: 64px; height: 64px; font-size: 1.8rem; font-weight: 700; }
.input.big { min-height: 64px; font-size: 2rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.chips.quick { margin-top: 10px; flex-wrap: wrap; overflow: visible; }
.chips.quick .chip { min-height: 44px; padding: 0 18px; font-weight: 700; }
.solo-sold .input { max-width: 180px; }
.solo-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.solo-nav .btn { min-height: 54px; min-width: 130px; font-size: 1.02rem; }
@media (max-width: 520px) {
  .solo { padding: 16px 14px; }
  .thumb.xl { width: 84px; height: 84px; }
  .solo-item h2 { font-size: 1.45rem; }
  .solo-nav .btn { flex: 1 1 0; min-width: 0; }
}

/* ---------- logo and sign-in language ---------- */
.logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-preview { width: 140px; height: 70px; border: 1px dashed var(--rule-strong); border-radius: 10px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-row .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-switch { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.lang-switch button { border: 0; background: none; padding: 6px 14px; font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--muted); min-height: 34px; }
.lang-switch button[aria-pressed="true"] { background: var(--cover); color: #fff; font-weight: 600; }


/* ---------- small-screen fixes from the full crawl ---------- */
@media (min-width: 601px) { table.narrow { min-width: 480px; } }
@media (max-width: 600px) {
  /* Numbers in the figure strips stay on one line and shrink to fit, instead of breaking mid-amount. */
  .strip .figure.num { font-size: clamp(1.05rem, 5.4vw, 1.55rem); overflow-wrap: normal; white-space: nowrap; }
  /* Panel headings keep their line; the note or buttons next to them move underneath. */
  .panel > header { flex-wrap: wrap; row-gap: 4px; }
  .panel > header > p { flex-basis: 100%; }
  .panel > header > .acts { flex-basis: 100%; justify-content: flex-start; }
  /* Page tabs wrap onto a second row rather than hiding off the edge. */
  .segmented.scroll { flex-wrap: wrap; overflow: visible; }
  .segmented.scroll button { flex: 1 1 auto; border-bottom: 1px solid var(--rule); margin-bottom: -1px; }
}
@media (max-width: 380px) {
  .count-row.tally { grid-template-columns: minmax(0, 1fr) 64px 64px; }
  .count-row.tally .thumb { display: none; }
  .count-sheet .group-head .cols { grid-template-columns: 64px 64px; }
}
.recipe-line .qty-pair .select { width: auto; min-width: 72px; max-width: 124px; }
