/* Perfect Order: a calm work tool. Mobile first; sidebar from 60rem.
   Colour has a job: ink blue = you can tap it; red = Out; amber = runs out today / short.
   Everything else is greys. No gradients, no decoration. */

@font-face {
  font-family: "Inter";
  src: url("../vendor/inter-4.1/InterVariable.2bf3d951bf9d.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --text: #151821;
  --text-2: #3d4250;
  --muted: #6a7080;
  --border: #e3e5ea;
  --border-strong: #cdd1d9;

  --primary: #1f3f8f;          /* ink blue */
  --primary-hover: #19337a;
  --on-primary: #ffffff;
  --primary-soft: #e9eef9;
  --primary-line: #c3cfee;
  --link: #1f3f8f;

  --danger: #b4232b;
  --danger-soft: #fcecec;
  --danger-line: #f1c4c6;
  --warn: #a35a05;
  --warn-dot: #e28a0c;
  --warn-soft: #fdf2e1;
  --warn-line: #f2d5a6;
  --ok: #1d6b45;

  --shadow-pop: 0 10px 30px -10px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --tabbar-h: 4rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --surface: #161921;
    --surface-2: #1d212b;
    --text: #e9ebf0;
    --text-2: #c3c7d1;
    --muted: #9198a8;
    --border: #262a35;
    --border-strong: #363b48;

    --primary: #3a58bb;
    --primary-hover: #4866c9;
    --primary-soft: #1c2440;
    --primary-line: #2f3d6b;
    --link: #a5b9f6;

    --danger: #f0767b;
    --danger-soft: #2e1719;
    --danger-line: #5a2a2e;
    --warn: #f0b25a;
    --warn-dot: #e8a13a;
    --warn-soft: #2b2112;
    --warn-line: #57401c;
    --ok: #6fcf9c;

    --shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, .6);
  }
}

/* --- Base ------------------------------------------------------------------------------ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* hidden always wins over button/flex styles */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  /* cv05: l with a tail, cv08: I with serifs, so barcodes and names never mix up l / I / 1 */
  font-feature-settings: "cv05", "cv08";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0 0 1.25rem; }
.page-head h1 { margin: 0; }
h2 { font-size: 1rem; line-height: 1.3; font-weight: 600; letter-spacing: -.005em; margin: 2rem 0 .75rem; }
p { margin: 0 0 1rem; }
a { color: var(--link); text-underline-offset: .2em; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon { width: 1.25em; height: 1.25em; flex: none; stroke-width: 1.75; vertical-align: -.25em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .count, .nav-count, .tab-count { font-variant-numeric: tabular-nums; }

/* --- App shell: top bar + bottom tab bar on phones, sidebar on computers ---------------- */
.mobilebar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  height: 3.25rem; padding: 0 .5rem 0 1rem;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 650; letter-spacing: -.015em; color: var(--text); text-decoration: none;
}
.brand-mark {
  display: inline-grid; place-items: center; width: 1.625rem; height: 1.625rem; border-radius: 7px;
  background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 700; letter-spacing: -.02em;
}
main { max-width: 42rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
body.signed-in main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 2rem); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar form { display: contents; }
.tabbar .navlink {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1875rem;
  padding: 0; border: 0; border-radius: 0; background: none;
  font: inherit; font-size: .6875rem; font-weight: 500; letter-spacing: .005em;
  color: var(--muted); text-decoration: none; cursor: pointer;
}
.tabbar .navlink .icon { width: 1.375rem; height: 1.375rem; }
.tabbar .navlink[aria-current="page"] { color: var(--primary); }
@media (prefers-color-scheme: dark) { .tabbar .navlink[aria-current="page"] { color: var(--link); } }
.tabbar .navlink .nav-count { position: absolute; top: .375rem; left: calc(50% + .25rem); }
.tabbar .new .bubble {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; margin-top: -.125rem;
  border-radius: 50%; background: var(--primary); color: var(--on-primary);
}
.tabbar .new .bubble .icon { width: 1.375rem; height: 1.375rem; stroke-width: 2.25; }

.sidebar { display: none; }

@media (min-width: 60rem) {
  body.signed-in { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); }
  .mobilebar, .tabbar { display: none; }
  .sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 1.25rem;
    padding: 1.25rem .875rem 1rem;
    background: var(--surface); border-right: 1px solid var(--border);
  }
  .sidebar .brand { padding: 0 .5rem; }
  .sidebar .button { display: flex; justify-content: center; }
  .sidebar nav { display: flex; flex-direction: column; gap: .125rem; }
  .sidebar .nav-label { margin: .75rem .625rem .25rem; font-size: .75rem; font-weight: 500; color: var(--muted); }
  .sidebar .navlink {
    display: flex; align-items: center; gap: .625rem;
    padding: .5rem .625rem; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: .9375rem; text-decoration: none;
  }
  .sidebar .navlink .icon { color: var(--muted); }
  .sidebar .navlink:hover { background: var(--surface-2); color: var(--text); }
  .sidebar .navlink[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .sidebar .navlink[aria-current="page"] .icon { color: inherit; }
  .sidebar .nav-count { margin-left: auto; }
  .sidebar .who {
    margin-top: auto; padding: .75rem .625rem 0; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    font-size: .875rem; color: var(--text-2);
  }
  .sidebar .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar .who form { flex: none; }
  .sidebar .who button { white-space: nowrap; padding-inline: .5rem; }
  body.signed-in main { max-width: 56rem; margin: 0; padding: 2rem 2.5rem 3rem; }
}
@media (prefers-color-scheme: dark) and (min-width: 60rem) {
  .sidebar .navlink[aria-current="page"] { color: var(--link); }
}

/* The "More" menu in the phone top bar (a <details>, so it works without JavaScript). */
.menu { position: relative; }
.menu > summary {
  list-style: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--surface-2); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + .25rem); min-width: 14rem; padding: .375rem;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.menu-panel .navlink, .menu-panel button.navlink {
  display: flex; align-items: center; justify-content: flex-start; gap: .625rem; width: 100%; min-height: 2.75rem;
  padding: .625rem .625rem; border: 0; border-radius: var(--radius-sm); background: none;
  font: inherit; font-weight: 500; color: var(--text); text-decoration: none; text-align: left; cursor: pointer;
}
.menu-panel .navlink .icon { color: var(--muted); }
.menu-panel .navlink:hover { background: var(--surface-2); }
.menu-panel .navlink[aria-current="page"] { color: var(--primary); }
.menu-panel hr { border: 0; border-top: 1px solid var(--border); margin: .375rem 0; }
.nav-count {
  display: inline-grid; place-items: center; min-width: 1.125rem; height: 1.125rem; padding: 0 .3125rem;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .6875rem; font-weight: 600; line-height: 1;
}
@media (prefers-color-scheme: dark) { .nav-count { background: #d8434a; } }

/* --- Page header ----------------------------------------------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head .sub { margin: .25rem 0 0; color: var(--muted); font-size: .9375rem; }

/* --- Buttons --------------------------------------------------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4375rem;
  min-height: 2.75rem; padding: .5rem 1rem;
  font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary);
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .12s, border-color .12s;
}
button:hover, .button:hover { background: var(--primary-hover); }
.secondary, .button.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.secondary:hover, .button.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.quiet, button.quiet {
  background: none; border-color: transparent; color: var(--muted); font-weight: 500; padding-inline: .625rem;
}
.quiet:hover, button.quiet:hover { background: var(--surface-2); color: var(--text); }
button.danger, .button.danger { color: var(--danger); }
button.secondary.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
button.quiet.danger:hover { background: var(--danger-soft); color: var(--danger); }
button.link {
  min-height: 0; padding: 0; border: 0; background: none; color: var(--link);
  font-weight: 500; text-decoration: underline; text-underline-offset: .2em;
}
.small, button.small, .button.small { min-height: 2.25rem; padding: .375rem .75rem; font-size: .875rem; }
.block { display: flex; width: 100%; }
button:disabled, button:disabled:hover { opacity: .5; cursor: not-allowed; background: var(--surface-2); color: var(--muted); border-color: var(--border); }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.actions .push { margin-left: auto; }

/* --- Forms ----------------------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .375rem; font-size: .875rem; font-weight: 550; color: var(--text-2); }
input, select, textarea {
  width: 100%; min-height: 2.875rem; padding: .625rem .8125rem;
  font: inherit; font-size: 1rem; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
select {
  appearance: none; padding-right: 2.25rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 1rem;
}
input[type=checkbox], input[type=radio] {
  width: 1.125rem; height: 1.125rem; min-height: 0; padding: 0; margin: 0; accent-color: var(--primary); flex: none;
}
input[type=file] { padding: .375rem; min-height: 0; font-size: .875rem; color: var(--muted); }
input[type=file]::file-selector-button {
  margin-right: .75rem; padding: .5rem .875rem; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
input[type=number] { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: .5rem; }
.row input { flex: 1; min-width: 0; }
label.check {
  flex-direction: row; align-items: center; gap: .625rem; font-size: .9375rem; font-weight: 500; color: var(--text); cursor: pointer;
}
.choices { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.choices legend { padding: 0; margin-bottom: .5rem; font-size: .875rem; font-weight: 550; color: var(--text-2); }
.choice {
  flex-direction: row; align-items: center; gap: .625rem; padding: .75rem .875rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font-size: .9375rem; font-weight: 500; color: var(--text); cursor: pointer;
}
.errorlist { list-style: none; margin: -.5rem 0 0; padding: 0; color: var(--danger); font-size: .875rem; font-weight: 500; }
.errorlist.nonfield { margin: 0; padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--danger-soft); }
.form-section {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.form-section > h2 { margin: 0; font-size: .9375rem; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.row-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.row-form label { flex: 1 1 8rem; }
.row-form input[type=number] { width: 5.5rem; }
.row-form input.price { width: 7rem; }

/* --- Cards and lists ------------------------------------------------------------------- */
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .625rem; }
.card {
  display: flex; flex-direction: column; gap: .3125rem; padding: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.card.removed { opacity: .55; }
.card.unread { border-color: var(--primary-line); background: var(--primary-soft); }
.card-link { color: inherit; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.hint { color: var(--muted); font-size: .875rem; }
/* Details joined by "·". Every item gets a leading dot and the left 1rem is clipped away,
   so a line that wraps never starts with a stray dot. */
.meta {
  display: flex; flex-wrap: wrap; align-items: center; row-gap: .25rem;
  margin-left: -1rem; clip-path: inset(-.5rem -.5rem -.5rem 1rem);
  color: var(--muted); font-size: .875rem;
}
.meta > *::before { content: "·"; display: inline-block; width: 1rem; text-align: center; color: var(--border-strong); }
.meta > .badge { margin-left: 1rem; }
.meta > .badge::before { content: none; }
.placeholder {
  margin: 0; padding: 2.5rem 1.25rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.message {
  display: flex; gap: .625rem; align-items: flex-start; margin: 0 0 1rem; padding: .75rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: .9375rem;
}
.message.message-success { border-color: var(--primary-line); background: var(--primary-soft); }
.message.message-error, .message.message-danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.message.warn, .message.message-warning { border-color: var(--warn-line); background: var(--warn-soft); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; font-size: .875rem; color: var(--muted); }
.pager a {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: .375rem .875rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-weight: 600; text-decoration: none;
}
.pager a:hover { background: var(--surface-2); }
.lines { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-direction: column; gap: .75rem; }
.lines > li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: .75rem; }
.count { font-size: 1.125rem; font-weight: 650; }
.count.short { color: var(--warn); }
.prices { line-height: 1.8; }
details summary { cursor: pointer; color: var(--link); font-weight: 500; }

/* --- Badges and urgency ---------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .3125rem; align-self: flex-start;
  padding: .125rem .5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: .75rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge.level-out, .badge.overdue { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.badge.level-runs_out_today { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge.accent { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
@media (prefers-color-scheme: dark) { .badge.accent { color: var(--link); } }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--border-strong); flex: none; }
.level-out .dot, .dot.level-out { background: var(--danger); }
.level-runs_out_today .dot, .dot.level-runs_out_today { background: var(--warn-dot); }

/* --- Dashboard tabs -------------------------------------------------------------------- */
.tabs {
  display: flex; gap: .25rem; margin: 0 -1rem 1.25rem; padding: 0 1rem;
  overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: .4375rem; flex: none;
  padding: .625rem .5rem .6875rem; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: .9375rem; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.tab-count {
  display: inline-grid; place-items: center; min-width: 1.375rem; height: 1.25rem; padding: 0 .375rem;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: .75rem; font-weight: 600;
}
.tab.active .tab-count { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
@media (min-width: 60rem) { .tabs { margin: 0 0 1.5rem; padding: 0; } }

/* --- Dashboard cards ------------------------------------------------------------------- */
.item-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; padding: .875rem 1rem; }
.item-card .body { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.item-card .title { display: flex; align-items: baseline; gap: .5rem; font-weight: 600; line-height: 1.35; }
.item-card .title .dot { align-self: center; }
.item-card .title a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.item-card .title a:hover { text-decoration: underline; }
.item-card .thumb-sm { grid-column: 2; grid-row: 1; }
.item-card .actions { grid-column: 1 / -1; margin-top: .125rem; }
.thumb-sm {
  width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
@media (min-width: 60rem) {
  .item-card { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; padding: .875rem 1.125rem; }
  .item-card .thumb-sm { grid-column: 1; }
  .item-card .actions { grid-column: 3; grid-row: 1; margin: 0; justify-content: flex-end; }
}
.decision { border-color: var(--primary-line); }
.decision .compare { display: grid; gap: .5rem; margin: .25rem 0; padding: .75rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9375rem; }
.decision .compare .hint { display: block; font-size: .75rem; }
.section-head { display: flex; align-items: center; gap: .5rem; margin: 2rem 0 .75rem; }
.section-head h2 { margin: 0; }
.section-head:first-child { margin-top: 0; }

/* Phone-alerts notice (dashboard and notifications). */
.push-toggle {
  flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem;
  margin-bottom: 1.25rem; padding: .625rem .75rem .625rem 1rem; background: var(--surface-2);
}
.push-toggle .actions { margin: 0; }

/* --- New request ----------------------------------------------------------------------- */
.scan-hero { display: flex; flex-direction: column; gap: .625rem; }
.scan-hero > button { min-height: 3.25rem; font-size: 1rem; }
.scan-hero > button .icon { color: var(--primary); }
@media (prefers-color-scheme: dark) { .scan-hero > button .icon { color: var(--link); } }
.scanner { display: flex; flex-direction: column; gap: .5rem; }
.scanner video { width: 100%; max-height: 50vh; background: #000; border-radius: var(--radius); }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.levels legend { grid-column: 1 / -1; }
.levels .choice {
  position: relative; flex-direction: column; justify-content: center; gap: .375rem;
  min-height: 4.25rem; padding: .625rem .375rem; text-align: center; line-height: 1.2; font-weight: 600;
}
.levels .choice input { position: absolute; opacity: 0; pointer-events: none; }
.levels .choice:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.levels .choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.levels .choice.level-out:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.levels .choice.level-runs_out_today:has(input:checked) { border-color: var(--warn-dot); background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-dot); }
.levels .choice.level-out { order: 1; }
.levels .choice.level-runs_out_today { order: 2; }
.levels .choice.level-low { order: 3; }
#name-suggestions:not(:has(*)) { display: none; }
.narrow { max-width: 36rem; }
.stepper { display: flex; align-items: stretch; width: 10rem; }
.stepper input { text-align: center; border-radius: 0; border-left: 0; border-right: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: 2.875rem; padding: 0; flex: none; background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.stepper button:hover { background: var(--border); }
.stepper button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stepper button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.submit-bar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  margin: 0 -1rem; padding: .75rem 1rem; background: var(--bg);
}
.submit-bar button { width: 100%; min-height: 3.25rem; font-size: 1rem; }
@media (min-width: 60rem) { .submit-bar { bottom: 0; margin: 0; padding-inline: 0; } }
.result {
  display: flex; gap: .875rem; align-items: center; padding: 1rem 1.125rem; margin-bottom: 1.25rem;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.result-icon {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
}
.result-icon .icon { width: 1.25rem; height: 1.25rem; }
.result strong { font-size: 1.0625rem; display: block; }
.result-needs_ordering { border-color: var(--primary-line); background: var(--primary-soft); }
.result-needs_ordering .result-icon { background: var(--primary); color: var(--on-primary); }

/* --- Item page ------------------------------------------------------------------------ */
.back {
  display: inline-flex; align-items: center; gap: .125rem; margin: 0 0 1rem -.25rem; padding: .25rem;
  color: var(--muted); font-size: .9375rem; font-weight: 500; text-decoration: none;
}
.back:hover { color: var(--text); }
.item-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.item-head img { width: 4.5rem; height: 4.5rem; flex: none; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.item-head h1 { margin: 0 0 .375rem; overflow-wrap: anywhere; }
.status-banner {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; padding: .75rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.status-banner.status-needs_ordering { border-color: var(--primary-line); background: var(--primary-soft); }
.status-banner.status-needs_ordering .result-icon { background: var(--primary); color: var(--on-primary); }
.facts { display: flex; flex-direction: column; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.fact { display: flex; flex-direction: column; gap: .375rem; margin: 0; padding: .75rem 1rem; font-size: .9375rem; }
.fact + .fact { border-top: 1px solid var(--border); }
.fact-label .hint { font-size: .8125rem; }
.fact-value { display: flex; flex-wrap: wrap; gap: .375rem; }
.chip {
  display: inline-flex; align-items: baseline; gap: .25rem; padding: .1875rem .625rem;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.chip .hint { font-size: .8125rem; font-weight: 400; }
.vendor-card { gap: .5rem; }
.vendor-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.vendor-head > strong { font-size: 1.0625rem; }
.deadline { display: inline-flex; align-items: center; gap: .4375rem; color: var(--text-2); font-size: .9375rem; }
.deadline .icon { color: var(--muted); }
.add-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; align-items: start; margin-top: .375rem; }
.add-form .stepper { width: 100%; }
.add-form button[type=submit] { grid-column: 1 / -1; }
.add-form label > .hint { font-weight: 400; font-size: .8125rem; }
@media (min-width: 60rem) {
  .add-form { display: flex; flex-wrap: wrap; align-items: flex-end; }
  .add-form > label { width: 11rem; }
  .add-form button[type=submit] { margin-top: 1.6875rem; }
}
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.rows > li { display: flex; align-items: center; gap: .5rem .75rem; padding: .75rem 1rem; }
.rows > li + li { border-top: 1px solid var(--border); }
.rows > li.removed { opacity: .55; }
.rows .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.meta > .text { color: var(--text); font-size: .9375rem; }
.badge.state-in_cart, .badge.state-ordered { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.badge.state-missing { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge.state-cancelled { color: var(--muted); text-decoration: line-through; }
@media (prefers-color-scheme: dark) { .badge.state-in_cart, .badge.state-ordered { color: var(--link); } }

/* --- Carts and Booker list --------------------------------------------------------------- */
.cart { gap: .625rem; padding: 1rem 1rem .875rem; }
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.cart-head h2 { margin: 0; font-size: 1.0625rem; }
.cart-ordered .cart-state { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
@media (prefers-color-scheme: dark) { .cart-ordered .cart-state { color: var(--link); } }
.cart-progress { display: flex; flex-direction: column; gap: .5rem; }
.cart-progress .count { font-size: 1rem; }
progress.fill {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: .375rem;
  border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; color: var(--primary);
}
progress.fill::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress.fill::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
progress.fill::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
progress.fill.short::-webkit-progress-value { background: var(--warn-dot); }
progress.fill.short::-moz-progress-bar { background: var(--warn-dot); }
.cart .lines { margin: .125rem 0 0; gap: 0; }
.cart .lines > li { padding: .625rem 0; gap: .375rem .75rem; }
.line-name { flex: 1 1 12rem; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.line-edit { display: flex; align-items: center; gap: .25rem; }
.compact { display: flex; align-items: center; gap: .375rem; }
.compact input { min-height: 2.25rem; padding: .25rem .5rem; }
.compact input.cases { width: 4.25rem; text-align: center; }
.compact input.price { width: 7.25rem; }
.line-date { flex-basis: 100%; font-size: .875rem; }
.cart-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .5rem; padding-top: .875rem; border-top: 1px solid var(--border); }
.date-change { flex-basis: 100%; }
.cart-foot form + .date-change, .cart-foot form ~ .date-change { margin-top: .25rem; }
.date-change summary { display: inline-block; padding: .25rem 0; font-size: .875rem; }
.date-change[open] summary { margin-bottom: .5rem; }
.date-change .hint { margin: .5rem 0 0; }

/* --- Notifications, Users, Item list, My requests --------------------------------------- */
.rows > li.wrap, .people > li, .notes > li { flex-wrap: wrap; }
.rows.compact-rows > li { display: block; padding: .5rem 1rem; font-size: .9375rem; }
.note { align-items: flex-start; }
.note-icon {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
}
.note-icon .icon { width: 1.125rem; height: 1.125rem; }
.note.unread { background: var(--primary-soft); }
.note.unread .note-icon { background: var(--primary); color: var(--on-primary); }
.rows > li.note.unread:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.rows > li.note.unread:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.rows > li.note.unread:only-child { border-radius: var(--radius); }
.note-head { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.note-head .badge { margin-left: .25rem; vertical-align: 1px; }
.note-text { font-size: .9375rem; }
.note .grow { flex-basis: 12rem; }
.note form { align-self: center; }
.avatar {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 650;
}
@media (prefers-color-scheme: dark) { .avatar { color: var(--link); } }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.people .grow { flex-basis: 10rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .375rem; }
@media (max-width: 59.99rem) { .row-actions { flex-basis: 100%; padding-left: 3.25rem; } }
.file-name { overflow-wrap: anywhere; }
.form-section > h2 { display: flex; align-items: center; gap: .5rem; }
.form-section > h2 .icon { color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .75rem 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .375rem; }
.stack-sm .errorlist { margin: 0; }
.summary { display: flex; flex-direction: column; gap: .5rem; padding: .875rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.summary p { margin: 0; }
ul.plain { margin: .25rem 0 0; padding-left: 1.125rem; font-size: .9375rem; }
.badge.status { align-self: center; }
.badge.kind-in_cart, .badge.kind-already_ordered { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
@media (prefers-color-scheme: dark) { .badge.kind-in_cart, .badge.kind-already_ordered { color: var(--link); } }

/* Name suggestions under the product name. */
.suggestions {
  list-style: none; margin: -.5rem 0 0; padding: .25rem; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.suggestion {
  display: block; width: 100%; min-height: 2.75rem; padding: .5rem .625rem; border: 0; border-radius: 6px;
  background: none; color: var(--text); font-weight: 400; text-align: left;
}
.suggestion:hover, .suggestion:focus { background: var(--surface-2); outline: none; }

/* --- Photos ---------------------------------------------------------------------------- */
.photo { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.photo.thumb { max-width: 9rem; }
.photos { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- Signed-out pages (sign in) -------------------------------------------------------- */
body:not(.signed-in) main { max-width: 24rem; padding-top: 12vh; }
.signin-brand { margin-bottom: 2.5rem; font-size: 1.0625rem; }
.signin-brand .brand-mark { width: 2rem; height: 2rem; border-radius: 8px; font-size: .875rem; }

/* --- Categories page ------------------------------------------------------------------- */
.add-category { margin-bottom: 1.25rem; }
.categories .row-actions { flex-basis: auto; padding-left: 0; }
.categories details.rename summary { display: inline-flex; align-items: center; gap: .25rem; font-size: .875rem; }
.categories details.rename summary .icon { width: 1rem; height: 1rem; }
.categories details.rename form { margin-top: .5rem; }

/* --- Request photo (Take photo / Choose from gallery) ------------------------------------ */
.photo-field { display: flex; flex-direction: column; gap: .5rem; }
.photo-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.photo-preview { display: flex; align-items: flex-end; gap: .75rem; }
.photo-preview img { max-width: 10rem; max-height: 10rem; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* --- Deliveries (Delivered, Missing, invoices) ---------------------------------------- */
details.deliver { width: 100%; }
details.deliver > summary.button { list-style: none; display: inline-flex; color: var(--on-primary); }
details.deliver > summary.button::-webkit-details-marker { display: none; }
details.deliver[open] > summary.button { margin-bottom: .75rem; }
.deliver-form { padding: .875rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.deliver-form fieldset.arrived { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.deliver-form fieldset.arrived legend { font-size: .875rem; font-weight: 550; color: var(--text-2); margin-bottom: .5rem; padding: 0; }
.collect-form { align-items: flex-end; }
.invoice-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.result .send-anyway { grid-column: 1 / -1; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .25rem; }
.result:has(.send-anyway) { flex-wrap: wrap; }
.photo-camera { display: flex; flex-direction: column; gap: .5rem; }
.photo-camera video { width: 100%; max-width: 32rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }

/* --- Suppliers ------------------------------------------------------------------------- */
.suppliers .row-actions { flex-basis: auto; padding-left: 0; }
.supplier-form .schedule > li { flex-wrap: wrap; }
.supplier-form .schedule label:not(.check) { flex-direction: row; align-items: center; gap: .5rem; }
.supplier-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.other-supplier { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.vendor-card.picked { border-color: var(--primary-line); }
.other-supplier { margin-top: .75rem; }
.other-supplier label { flex: 1 1 16rem; }

/* --- Orders: one section per supplier --------------------------------------------------- */
.supplier-section { margin-bottom: 2rem; }
.supplier-section + .supplier-section { padding-top: 1.25rem; border-top: 1px solid var(--border); }
.supplier-section .cart-head h3 { margin: 0; font-size: 1rem; }
.supplier-section .nothing { margin: 0; }
.open-cart { display: flex; align-items: center; gap: .5rem; margin: .75rem 0 0; color: var(--muted); font-size: .9375rem; }
.subhead { margin: 1.25rem 0 .5rem; font-size: .9375rem; color: var(--text-2); }
.usual-days { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }

/* --- Error pages and the privacy notice ------------------------------------------------- */
.error-page { padding-block: 2rem; }
.privacy ul { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: .375rem; }
.privacy p { margin: 0; }

/* --- Platform screen ------------------------------------------------------------------- */
.shops .row-actions { flex-basis: auto; padding-left: 0; }
.twostep ol { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: .375rem; }
.twostep .qr { align-self: flex-start; padding: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.twostep .qr svg { display: block; }
.credentials p { margin: 0; }
.credentials .password { font-size: 1.125rem; letter-spacing: .02em; user-select: all; }
.platform-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.platform-bar .who { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
body.platform main { max-width: 64rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
body.platform .narrow { margin-inline: auto; }
.shop-code { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.owners .row-actions { flex-basis: auto; padding-left: 0; }
