/* InventoryOA — equipment-room look: aluminium neutrals, ink controls, label-tape yellow for asset tags. */

:root {
  --paper: #f5f6f7;
  --surface: #ffffff;
  --sunk: #eceef1;
  --line: #dce0e5;
  --line-strong: #c3c9d1;
  --ink: #1a1e23;
  --ink-soft: #3a414a;
  --muted: #5d6672;
  --tape: #ffd43b;
  --tape-ink: #2b2405;
  --ok: #1f8a5b;      --ok-bg: #e3f4ea;
  --partial: #9a5b00; --partial-bg: #fdf0d7;
  --out: #b23a2c;     --out-bg: #fbe5e1;
  --info: #24589c;    --info-bg: #e2ecf8;
  --cons: #5b4fc4;    --cons-bg: #ecebfb;
  --focus: #2f6fdb;
  --focus-ring: rgba(47,111,219,.18);
  --on-ink: #ffffff;          /* text on ink-coloured and strong status backgrounds */
  --ink-hover: #000000;
  --subtle: #fafbfc;          /* table heads, hovered rows, panel footers */
  --row-line: #eef0f3;        /* lines between list rows */
  --tape-line: #e5bd1f;
  --warn-ink: #5c3700;  --error-ink: #6d1f16;  --ok-ink: #145c3c;
  --toast-bg: var(--ink); --toast-ink: #ffffff;
  --shadow: rgba(26,30,35,.16);
  --backdrop: rgba(26,30,35,.36);
  color-scheme: light;

  --font: "Segoe UI Variable Text", "Segoe UI", Ubuntu, "Noto Sans", Cantarell, system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "DejaVu Sans Mono", "Ubuntu Mono", ui-monospace, Consolas, monospace;

  --r-control: 6px;
  --r-card: 10px;
  --gap: 16px;
  --page-max: 1200px;
}

/* Dark theme: follows the device unless someone picked light or dark (data-theme on <html>, see theme_switch).
   The same values twice, because a media query can't be combined with the attribute selector. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121417; --surface: #1b1e22; --sunk: #272b31; --line: #30353c; --line-strong: #49505a;
    --ink: #e8eaed; --ink-soft: #c5cad1; --muted: #9ba4af;
    --tape: #f2c935; --tape-ink: #2b2405; --tape-line: #c9a21c;
    --ok: #63d49c;      --ok-bg: #16352a;
    --partial: #f2b75e; --partial-bg: #3b2b12;
    --out: #ff8f80;     --out-bg: #431e19;
    --info: #8cb6f8;    --info-bg: #1b2c46;
    --cons: #b7aeff;    --cons-bg: #2b2752;
    --focus: #6ea0ff; --focus-ring: rgba(110,160,255,.28);
    --on-ink: #121417; --ink-hover: #ffffff;
    --subtle: #20242a; --row-line: #262a30;
    --warn-ink: #f6d09a; --error-ink: #ffb9ae; --ok-ink: #a5e6c4;
    --toast-bg: #2d3239; --toast-ink: #eef0f2;
    --shadow: rgba(0,0,0,.5); --backdrop: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121417; --surface: #1b1e22; --sunk: #272b31; --line: #30353c; --line-strong: #49505a;
  --ink: #e8eaed; --ink-soft: #c5cad1; --muted: #9ba4af;
  --tape: #f2c935; --tape-ink: #2b2405; --tape-line: #c9a21c;
  --ok: #63d49c;      --ok-bg: #16352a;
  --partial: #f2b75e; --partial-bg: #3b2b12;
  --out: #ff8f80;     --out-bg: #431e19;
  --info: #8cb6f8;    --info-bg: #1b2c46;
  --cons: #b7aeff;    --cons-bg: #2b2752;
  --focus: #6ea0ff; --focus-ring: rgba(110,160,255,.28);
  --on-ink: #121417; --ink-hover: #ffffff;
  --subtle: #20242a; --row-line: #262a30;
  --warn-ink: #f6d09a; --error-ink: #ffb9ae; --ok-ink: #a5e6c4;
  --toast-bg: #2d3239; --toast-ink: #eef0f2;
  --shadow: rgba(0,0,0,.5); --backdrop: rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .75em; }
code { font-family: var(--font-mono); font-size: .85em; background: var(--sunk); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -40px; background: var(--ink); color: var(--on-ink); padding: 6px 10px; border-radius: var(--r-control); z-index: 100; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.hint.block { display: block; margin-top: 2px; }
.text-alert { color: var(--out); font-weight: 600; }

/* --- top bar ---------------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; min-height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 14px; border-radius: 2px; background: var(--tape);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  transform: rotate(-4deg);
}
.mainnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.mainnav a {
  text-decoration: none; color: var(--muted); padding: 16px 10px; white-space: nowrap;
  border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px;
}
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.badge { background: var(--out); color: var(--on-ink); border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 0 6px; line-height: 1.5; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.subtle-link { color: var(--muted); font-size: .9rem; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; font-size: .8rem; }
.lang-switch a { text-decoration: none; padding: 2px 8px; color: var(--muted); }
.lang-switch a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.theme-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; flex: none; }
.theme-switch a { display: grid; place-items: center; padding: 3px 7px; color: var(--muted); text-decoration: none; }
.theme-switch a:hover { color: var(--ink); background: var(--sunk); }
.theme-switch a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.theme-switch .icon { width: 16px; height: 16px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; font-size: .92rem; }
.menu-pop .theme-switch a { width: auto; padding: 5px 9px; border-radius: 0; }
.menu-pop .theme-switch a:hover { background: var(--sunk); }
.menu-pop .theme-switch a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.user-chip { list-style: none; cursor: pointer; font-size: .9rem; padding: 4px 10px; border-radius: 999px; background: var(--sunk); }
.user-chip::-webkit-details-marker { display: none; }

/* --- page ---------------------------------------------------------------------------------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.breadcrumb { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.narrow { max-width: 640px; }
.section { margin-bottom: 36px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.card-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; }

/* --- buttons ------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer;
  padding: 8px 14px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--sunk); border-color: transparent; }
.btn-danger { color: var(--out); }
.btn-danger-solid { background: var(--out); border-color: var(--out); color: var(--on-ink); }
.btn-warn { background: var(--partial-bg); border-color: var(--partial); color: var(--partial); }
.btn-small { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn-icon:disabled, .btn-step:disabled { opacity: .4; cursor: not-allowed; }
.btn, .btn-icon, .btn-step, .stepper button, .fab, .chip, .view-toggle label { touch-action: manipulation; }
.btn-icon {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--r-control); background: transparent; color: var(--muted); cursor: pointer; font: inherit;
}
.btn-icon:hover { background: var(--sunk); color: var(--ink); }
.icon { width: 18px; height: 18px; flex: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- forms --------------------------------------------------------------------------------- */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  padding: 8px 10px; width: 100%; min-height: 38px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--out); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .field > .label { font-weight: 600; font-size: .88rem; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .grow { flex: 1 1 200px; }
.field-error { color: var(--out); font-size: .85rem; margin: 0; }
.check { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { margin-top: 4px; }
.check .hint.block { flex-basis: 100%; padding-left: 21px; }
.checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

/* Settings-style option rows: text on the left, a switch on the right; the whole row is the target. */
.options { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); margin-bottom: 14px; }
.option {
  display: flex; align-items: center; gap: 14px; padding: 11px 14px; cursor: pointer;
  border-top: 1px solid var(--line); text-decoration: none; color: inherit;
}
.options > .option:first-child { border-top: 0; }
.option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: .92rem; }
.option-text .hint { font-weight: 400; line-height: 1.4; }
.option-go { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.option-link:hover .option-text { text-decoration: underline; }
.option-extra { display: flex; flex-direction: column; gap: 5px; padding: 0 14px 14px; }
.option-extra > label { font-weight: 600; font-size: .88rem; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; cursor: pointer;
  width: 44px !important; height: 26px; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(18px); background: var(--on-ink); }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: none; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .field { margin-bottom: 4px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 20px; }
.input-qty { width: 76px; text-align: center; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; background: var(--surface); }
.stepper button { border: 0; background: var(--sunk); width: 34px; font-size: 1.1rem; cursor: pointer; color: var(--ink-soft); }
.stepper button:hover { background: var(--line); }
.stepper input, .stepper output { border: 0; border-radius: 0; width: 56px; text-align: center; font-weight: 650; min-height: 36px; box-shadow: none; display: grid; place-items: center; }
.stepper-small button { width: 28px; font-size: 1rem; }
.stepper-small input, .stepper-small output { width: 40px; min-height: 30px; padding: 2px; }

/* --- the label-tape asset tag -------------------------------------------------------------- */
.code-tag {
  display: inline-block; font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  background: var(--tape); color: var(--tape-ink); padding: 1px 6px 0; border-radius: 2px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.12);
  white-space: nowrap; vertical-align: 1px;
}
.tag { display: inline-block; font-size: .75rem; color: var(--ink-soft); background: var(--sunk); border-radius: 4px; padding: 0 6px; margin: 0 4px 2px 0; }

/* --- pills --------------------------------------------------------------------------------- */
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-partial { background: var(--partial-bg); color: var(--partial); }
.pill-out { background: var(--out-bg); color: var(--out); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-consumable { background: var(--cons-bg); color: var(--cons); }
.pill-muted { background: var(--sunk); color: var(--muted); }

/* --- filters ------------------------------------------------------------------------------- */
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.searchbox { position: relative; display: block; }
.searchbox .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox input { padding-left: 38px; min-height: 44px; font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; border: 0; margin: 0; padding: 0; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; gap: 6px; align-items: baseline;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: .88rem;
}
.chip small { color: var(--muted); font-size: .78rem; }
.chip:hover span { border-color: var(--line-strong); }
.chip input:checked + span { background: var(--tape); border-color: var(--tape-line); color: var(--tape-ink); font-weight: 600; }
.chip input:checked + span small { color: var(--tape-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: .88rem; color: var(--muted); }
.inline-select { display: inline-flex; align-items: center; gap: 6px; }
.inline-select select { width: auto; min-height: 32px; padding: 3px 8px; font-size: .88rem; }
.view-toggle { display: inline-flex; margin: 0 0 0 auto; padding: 0; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; }
.view-toggle label { padding: 5px 9px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.view-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.view-toggle label:has(input:checked) { background: var(--ink); color: var(--on-ink); }
.view-toggle label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }

/* --- items table --------------------------------------------------------------------------- */
.item-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
/* Rounded corners on the cells instead of overflow:hidden, which would clip the row menus. */
.item-table thead th:first-child { border-top-left-radius: var(--r-card); }
.item-table thead th:last-child { border-top-right-radius: var(--r-card); }
.item-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-card); }
.item-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--r-card); }
.item-table th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--subtle); }
.item-table td { padding: 8px 12px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
.item-table tbody tr:last-child td { border-bottom: 0; }
.item-table tbody tr[data-href] { cursor: pointer; }
.item-table tbody tr:hover { background: var(--subtle); }
.item-name { font-weight: 600; text-decoration: none; }
a.item-name:hover { text-decoration: underline; }
.item-sub { margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.item-sub .tag { margin: 0; }
.col-photo { width: 56px; }
.col-actions { width: 48px; text-align: right; }
.col-cat, .col-loc { color: var(--ink-soft); font-size: .92rem; }
.result-count { font-size: .85rem; margin-top: 10px; }

.photo { width: 40px; height: 40px; border-radius: var(--r-control); object-fit: cover; background: var(--sunk); }
.photo-empty { display: grid; place-items: center; color: var(--muted); font-weight: 650; font-size: .9rem; }
.photo-large { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--r-card); font-size: 3rem; }

.qty-adjust { display: inline-flex; align-items: center; gap: 4px; }
.qty-adjust form { margin: 0; display: flex; }
.btn-step {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer;
  font: inherit; font-size: 1.05rem; line-height: 1; color: var(--ink-soft);
}
.btn-step:hover { border-color: var(--ink); }
.btn-step:active:not(:disabled) { background: var(--sunk); }
.qty-adjust input {
  width: 3.4em; min-height: 0; height: 28px; padding: 0 4px; text-align: center; font-weight: 650;
  border-color: transparent; background: var(--sunk); border-radius: 999px;
}
.qty-adjust.is-consumable input { background: var(--cons-bg); color: var(--cons); }
.qty-adjust input:hover { border-color: var(--line-strong); }
.qty-adjust input:focus { background: var(--surface); color: var(--ink); }
.qty-adjust.is-pending input { box-shadow: inset 0 -2px 0 var(--focus); }
.qty-count { min-width: 3.4em; height: 28px; display: grid; place-items: center; font-weight: 650; background: var(--sunk); border-radius: 999px; padding: 0 6px; }
.btn-step-spacer { width: 28px; flex: none; }
a.btn-step { text-decoration: none; }
.touch-qty { display: none; }

/* Small popup (native <dialog>), e.g. the serial number for a new unit. */
.quick-dialog {
  width: min(420px, calc(100% - 24px)); padding: 18px; border: 0; border-radius: var(--r-card);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px var(--shadow);
}
.quick-dialog::backdrop { background: var(--backdrop); }
.quick-dialog form { margin: 0; }
.quick-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.quick-head h2 { margin: 0 0 2px; }
.quick-head p { margin: 0; font-size: .9rem; }
.quick-head .btn-icon { margin: -6px -6px 0 0; }
.quick-dialog .field { margin-bottom: 16px; }
.quick-foot { display: flex; gap: 8px; justify-content: flex-end; }
.item-loc { display: none; }
.facts-qty { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }

/* --- item grid ---------------------------------------------------------------------------- */
.item-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.item-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.item-card:hover { border-color: var(--line-strong); }
.card-link { display: flex; flex-direction: column; text-decoration: none; height: 100%; }
.card-photo { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; font-size: 2rem; }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; flex: 1; }
.card-body .muted { font-size: .85rem; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }

/* --- menus (details-based) ------------------------------------------------------------------ */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 180px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: 0 10px 30px var(--shadow); padding: 6px; display: flex; flex-direction: column;
}
.menu-right .menu-pop { left: auto; right: 0; }
.menu.menu-up .menu-pop { top: auto; bottom: calc(100% + 4px); }
.menu-wide { min-width: 240px; }
.menu-pop a, .menu-pop button {
  text-align: left; text-decoration: none; font: inherit; font-size: .92rem; color: var(--ink);
  background: none; border: 0; padding: 7px 10px; border-radius: var(--r-control); cursor: pointer; width: 100%;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--sunk); }
.menu-pop form { margin: 0; }
.menu-pop .stack { padding: 6px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.menu-pop .stack label { font-size: .85rem; font-weight: 600; }
.menu-pop .stack button.btn { width: auto; background: var(--surface); border: 1px solid var(--line-strong); }

/* --- drawer (slide-over panel) ------------------------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: var(--backdrop); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%);
  background: var(--surface); box-shadow: -12px 0 40px var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) .drawer-panel { animation: slide-in .18s ease-out; }
  @keyframes slide-in { from { transform: translateX(32px); } to { transform: none; } }
}
.panel-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.panel-head .btn-icon { margin-left: auto; }
.panel-body { padding: 18px; overflow-y: auto; flex: 1; }
.panel-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--subtle); }
.kbd-hint { margin-left: auto; font-size: .78rem; color: var(--muted); }
.label-short, .hint-touch { display: none; }
.kbd-keeper { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; pointer-events: none; }
.field-qty { flex: 0 0 auto; }
.more { margin: 6px 0 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.more > summary { cursor: pointer; font-weight: 600; font-size: .9rem; margin-bottom: 12px; color: var(--ink-soft); }
.photo-drop {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); padding: 12px; color: var(--muted); font-size: .9rem;
}
.photo-drop:hover, .photo-drop.is-dragover { border-color: var(--ink); color: var(--ink); background: var(--subtle); }
.photo-drop img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-control); }
.photo-drop-text { display: flex; align-items: center; gap: 8px; }
.tag-suggestions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-suggestions button { font: inherit; font-size: .8rem; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 1px 8px; cursor: pointer; }
.tag-suggestions button:hover { border-color: var(--ink); }

/* --- toasts --------------------------------------------------------------------------------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { background: var(--toast-bg); color: var(--toast-ink); border-radius: var(--r-card); padding: 10px 14px; font-size: .92rem; box-shadow: 0 8px 24px var(--shadow); display: flex; gap: 14px; align-items: center; }
.toast-error { background: var(--out); }
.toast button { font: inherit; font-weight: 650; color: var(--tape); background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }

/* --- callouts & empty states ---------------------------------------------------------------- */
.callout { display: flex; gap: 10px; border-radius: var(--r-card); padding: 10px 12px; margin: 12px 0; font-size: .92rem; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout ul { padding-left: 18px; margin: 4px 0; }
.callout .icon { margin-top: 2px; }
.callout-warn { background: var(--partial-bg); color: var(--warn-ink); }
.callout-error { background: var(--out-bg); color: var(--error-ink); display: block; }
.callout-ok { background: var(--ok-bg); color: var(--ok-ink); align-items: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-card); }
.empty p { margin-bottom: 14px; }

/* --- detail page --------------------------------------------------------------------------- */
.detail-head { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; margin-bottom: 28px; }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-title h1 { margin: 0; }
.detail-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.detail-actions form { margin: 0; }
.actions-main, .actions-more { display: contents; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0 0 20px; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }
.facts.compact { gap: 4px 14px; font-size: .92rem; }
.notes { white-space: pre-wrap; }
.log { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.log li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--row-line); }
.log time { color: var(--muted); flex: 0 0 64px; }
.log li span:nth-child(2) { flex: 1; }
.loan-mini { list-style: none; padding: 0; margin: 0 0 24px; }
.loan-mini li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--row-line); }

/* --- loans --------------------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { text-decoration: none; padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.count { background: var(--sunk); color: var(--ink-soft); border-radius: 999px; padding: 0 7px; font-size: .78rem; font-weight: 650; }
.count-alert { background: var(--out-bg); color: var(--out); }
.loan-search { max-width: 420px; margin-bottom: 14px; }
.loan-search .searchbox input { min-height: 38px; font-size: .95rem; }
.loan-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.loan-row { display: flex; align-items: center; border-bottom: 1px solid var(--row-line); }
.loan-row:last-child { border-bottom: 0; }
.loan-row:hover, .loan-row.is-open { background: var(--subtle); }
.loan-row.is-open { box-shadow: inset 3px 0 0 var(--ink); }
.loan-row.is-overdue { box-shadow: inset 3px 0 0 var(--out); }
.loan-link { flex: 1; display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 1.7fr) minmax(120px, .9fr) auto; gap: 14px; align-items: center; padding: 11px 14px; text-decoration: none; min-width: 0; }
.loan-who { display: flex; flex-direction: column; min-width: 0; }
.loan-who .muted { font-size: .82rem; }
.loan-items { color: var(--ink-soft); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.loan-dates { font-size: .9rem; color: var(--ink-soft); }
.loan-next { padding-right: 14px; }
.loan-next form { margin: 0; }
.lines { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 10px 0; }
.lines th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: 4px 0; border-bottom: 1px solid var(--line); }
.lines td { padding: 7px 0; border-bottom: 1px solid var(--row-line); }
.lines .num { text-align: right; width: 64px; }
.lines a { text-decoration: none; font-weight: 600; }
.note { background: var(--sunk); border-radius: var(--r-control); padding: 8px 10px; margin: 8px 0; font-size: .92rem; white-space: pre-wrap; }
blockquote.note { border-left: 3px solid var(--line-strong); }
.note-muted { color: var(--muted); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 16px 0 20px; }
.panel-actions > form { margin: 0; }
.inline-confirm > summary { list-style: none; }
.inline-confirm > summary::-webkit-details-marker { display: none; }
.inline-confirm[open] { flex-basis: 100%; }
.inline-confirm[open] > form, .inline-confirm[open] > .lost-line, .inline-confirm[open] > .hint { margin-top: 10px; }
.return-form { flex-basis: 100%; display: flex; flex-direction: column; gap: 10px; background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; }
.return-form h3 { margin: 0; }
.return-form .btn { align-self: flex-start; }
.return-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lost-line { display: flex; align-items: center; gap: 8px; }
.lost-line label { flex: 1; font-size: .92rem; }
.staff-note { margin: 8px 0 18px; }
.staff-note label { font-weight: 600; font-size: .88rem; }
.staff-note .btn { align-self: flex-start; }

/* --- units -------------------------------------------------------------------------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.section-head form { margin: 0; }
.units-table .num { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.units-table .col-notes { color: var(--ink-soft); font-size: .9rem; }
.units-table .col-actions { width: 48px; text-align: right; }
.units-table code { background: transparent; padding: 0; font-size: .88rem; }
.text-ok { color: var(--ok); font-weight: 600; font-size: .9rem; }
.add-units { margin-top: 12px; }
.add-units > summary { list-style: none; display: inline-flex; }
.add-units > summary::-webkit-details-marker { display: none; }
.add-units[open] > form { margin-top: 10px; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; }
.units-count { margin: 0; font-weight: 650; min-height: 38px; min-width: 56px; padding: 0 14px; display: grid; place-items: center; background: var(--sunk); border-radius: var(--r-control); }
.unit-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.unit-chip { font-family: var(--font-mono); font-size: .72rem; background: var(--sunk); border-radius: 4px; padding: 1px 6px; }
.unit-chip.is-back { color: var(--muted); text-decoration: line-through; }
.unit-pick { border: 1px solid var(--line); border-radius: var(--r-control); padding: 8px 12px 10px; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.unit-pick legend { font-weight: 600; font-size: .88rem; padding: 0 4px; }
.unit-pick .check { font-family: var(--font-mono); font-size: .82rem; }
.pick-form { flex-basis: 100%; }
.unit-select { width: auto; min-height: 32px; padding: 3px 8px; }
.menu-pop .btn-danger { color: var(--out); }

/* --- categories & users ---------------------------------------------------------------------- */
.category-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.category-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--row-line); }
.category-list li:last-child { border-bottom: 0; }
.category-list .rename { display: flex; gap: 6px; flex: 1 1 260px; margin: 0; }
.category-list .rename input { min-height: 34px; padding: 5px 8px; }
.count-link { font-size: .88rem; min-width: 70px; }
.order { display: inline-flex; }
.order form { margin: 0; }
.category-list .inline-confirm[open] { flex-basis: 100%; }
.simple-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.simple-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.simple-table td { padding: 9px 12px; border-bottom: 1px solid var(--row-line); }
.simple-table tr.is-inactive td { color: var(--muted); }
.summary-stats { list-style: none; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.summary-stats li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 10px 16px; }
.summary-stats strong { font-size: 1.3rem; margin-right: 4px; }
.summary-stats .is-alert strong { color: var(--out); }
.columns { display: block; padding: 8px 10px; }
.hint-list { color: var(--ink-soft); font-size: .92rem; padding-left: 18px; }

/* --- public: borrow page --------------------------------------------------------------------- */
.intro { max-width: 640px; margin-bottom: 20px; }
.intro h1 { font-size: 2rem; }
.intro p { color: var(--ink-soft); font-size: 1.02rem; }
.date-bar {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--tape);
  border-radius: var(--r-card); padding: 14px 16px; margin-bottom: 22px;
}
.date-bar .field { margin: 0; }
.date-bar input { min-width: 160px; }
.date-note { font-size: .9rem; margin: 0 0 6px; }
.picker-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.picker-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pick-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pick-card { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 10px; }
.pick-card.in-basket { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pick-card.is-unavailable { background: transparent; }
.pick-card.is-unavailable .pick-photo, .pick-card.is-unavailable .item-name { opacity: .55; }
.pick-photo { width: 64px; height: 64px; flex: none; }
.pick-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pick-body .muted { font-size: .82rem; }
.pick-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.avail { font-size: .82rem; font-weight: 650; color: var(--ok); }
.avail-none { color: var(--muted); font-weight: 500; }
.basket {
  position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px; max-height: calc(100vh - 96px); overflow-y: auto;
}
.basket h2 { margin-bottom: 2px; }
.basket-dates { font-size: .88rem; margin-bottom: 10px; }
.basket-list { list-style: none; padding: 0; margin: 0 0 12px; }
.basket-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--row-line); font-size: .92rem; }
.basket-list li span:first-child { flex: 1; min-width: 0; }
.basket-list .qty { font-weight: 650; }
.basket-list button { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; text-decoration: underline; padding: 0; }
.basket-empty { font-size: .9rem; }
.details { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.details h3 { margin-bottom: 10px; }
.basket-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none;
  justify-content: space-between; align-items: center; gap: 12px;
  background: var(--toast-bg); color: var(--toast-ink); padding: 10px 16px;
}
.basket-bar .btn-primary { background: var(--tape); color: var(--tape-ink); border-color: var(--tape); }

/* Floating "add item" button, phones only (see the responsive section). */
.fab {
  display: none; position: fixed; z-index: 40;
  right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom));
  align-items: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px; border-radius: 999px;
  background: var(--ink); color: var(--on-ink); text-decoration: none; font-weight: 650; font-size: 1rem;
  box-shadow: 0 6px 20px var(--shadow);
}
.fab span { font-size: 1.6rem; font-weight: 400; line-height: 1; margin-top: -2px; }
.fab:active { background: var(--ink-hover); }

/* --- public: status & auth ---------------------------------------------------------------- */
.status-card, .auth-card { max-width: 520px; margin: 24px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 28px; }
.auth-card h1 { font-size: 1.4rem; }
.status-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-state { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 14px 0; margin: 10px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.status-state p { margin: 0; font-size: 1.02rem; }
.status-items { padding-left: 18px; margin: 0 0 20px; }
.error-code { font-family: var(--font-mono); font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

/* --- responsive ---------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .picker-layout, .two-col { grid-template-columns: minmax(0, 1fr); }
  .basket { position: static; max-height: none; }
  .basket-bar:not([hidden]) { display: flex; }
  body.public .page { padding-bottom: 96px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .loan-link { grid-template-columns: minmax(0, 1fr) auto; }
  .loan-items { grid-column: 1 / -1; grid-row: 2; }
  .loan-dates { grid-column: 1; grid-row: 3; }
  .loan-status { grid-column: 2; grid-row: 1; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 0 12px; padding: 0 16px; }
  .topbar .brand { min-height: 48px; }
  .staff .mainnav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 8px; border-top: 1px solid var(--line); }
  .staff .mainnav a { padding: 10px 10px; }
  .staff .subtle-link { display: none; }
  .page { padding: 20px 16px 56px; }
  h1 { font-size: 1.35rem; }
  .intro h1 { font-size: 1.6rem; }
  .view-toggle { margin-left: 0; }
  .loan-row { flex-wrap: wrap; }
  .loan-next { padding: 0 14px 10px; }
  .date-bar input { min-width: 0; }
  .date-bar .field { flex: 1 1 140px; }
  .kbd-hint { display: none; }
  .status-card, .auth-card { padding: 20px; margin: 8px auto; }
}

/* Touch screens (phones and tablets) and narrow windows: bigger targets, +/− for lendable items in the list. */
@media (pointer: coarse), (max-width: 720px) {
  .touch-qty { display: inline-flex; }
  .btn-step { width: 38px; height: 38px; font-size: 1.3rem; }
  .qty-adjust input { height: 38px; width: 3.2em; font-size: 1rem; }
  .qty-count { height: 38px; min-width: 3.2em; }
  .btn-step-spacer { width: 38px; }
  .qty-adjust { gap: 6px; }
  .item-table .col-avail { white-space: nowrap; }
  .item-table .col-avail .avail-status + .touch-qty { margin-left: 8px; }
  .stepper button { width: 44px; font-size: 1.3rem; background: var(--surface); }
  .stepper button:first-child { border-right: 1px solid var(--line); }
  .stepper button:last-child { border-left: 1px solid var(--line); }
  .stepper input { width: 56px; min-height: 42px; }
  .units-count { min-height: 40px; }
  .btn-icon { width: 44px; height: 44px; }
  .btn { min-height: 42px; }
  .btn-small { min-height: 34px; }
  .check { padding: 4px 0; }
  .check input { width: 18px; height: 18px; margin-top: 2px; }
  .check .hint.block { padding-left: 26px; }
  .option { padding: 13px 14px; }
  .menu-pop a, .menu-pop button { padding: 11px 12px; font-size: 1rem; }
  .menu-pop .theme-switch a { padding: 8px 12px; }
  .theme-switch a { padding: 6px 9px; }
  .tag-suggestions { gap: 6px; }
  .tag-suggestions button { font-size: .95rem; padding: 6px 12px; border-radius: 999px; }
  .hint-pointer { display: none; }
  .hint-touch { display: inline; }
  .photo-drop { padding: 16px; font-size: 1rem; }
  .more > summary { padding: 6px 0; }
}

@media (max-width: 720px) {
  /* 16px keeps iOS from zooming in when a field gets focus. */
  input, select, textarea { font-size: 16px; }
  .topbar { position: static; }

  /* Items: a thumb-friendly list. Rows become cards: photo, name, status, and +/− on the right. */
  .page-add { display: none; }
  .fab { display: inline-flex; }
  body.staff .page:has(.fab) { padding-bottom: 104px; }
  .filters { gap: 10px; margin-bottom: 14px; }
  .chip span { padding: 5px 12px; }
  /* Show / Location / Sort as a two-column grid, label above each dropdown. */
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
  .inline-select { flex-direction: column; align-items: stretch; gap: 2px; font-size: .8rem; min-width: 0; }
  .inline-select select { width: 100%; min-height: 40px; font-size: 16px; }
  .view-toggle { justify-self: end; align-self: end; height: 40px; }
  .view-toggle label { padding: 0 14px; }

  .item-table, .item-table tbody { display: block; }
  .item-table thead { display: none; }
  .item-table tr {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center;
    grid-template-areas: "photo item qty" "photo status qty"; gap: 2px 12px;
    padding: 10px 12px; border-bottom: 1px solid var(--row-line);
  }
  .item-table tr.is-consumable { grid-template-areas: "photo item qty"; }
  .item-table tbody tr:last-child { border-bottom: 0; }
  .item-table td { display: block; padding: 0; border: 0; }
  .item-table td.col-photo { grid-area: photo; display: block; width: auto; }
  .item-table .photo { width: 44px; height: 44px; }
  .item-table .col-item { grid-area: item; min-width: 0; }
  .item-table .item-name { display: block; line-height: 1.3; overflow-wrap: anywhere; }
  .item-table .item-sub .tag { display: none; }
  .item-table .item-sub { gap: 2px 8px; }
  .item-table .item-loc { display: inline; color: var(--muted); font-size: .82rem; }
  .item-table .col-cat, .item-table .col-loc, .item-table .col-actions { display: none; }
  .item-table .col-avail { display: contents; }
  .item-table .avail-status { grid-area: status; justify-self: start; }
  .item-table .col-avail > .qty-adjust, .item-table .touch-qty { grid-area: qty; margin: 0 !important; }
  .item-table .touch-qty { display: inline-flex; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

  /* Add/edit panel: full screen, big buttons that stay above the keyboard. */
  .drawer-panel { width: 100%; }
  .panel-head { padding: 8px 8px 8px 16px; }
  .panel-body { padding: 16px; }
  .field-row .grow { flex-basis: 140px; }
  .panel-foot { flex-wrap: nowrap; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .panel-foot .btn { flex: 1 1 0; min-height: 48px; font-size: 1rem; padding: 8px 10px; }
  .panel-foot .panel-cancel { display: none; }
  .label-long { display: none; }
  .label-short { display: inline; }

  /* The popup sits near the top, so the phone keyboard never covers it. */
  .quick-dialog { margin: calc(12px + env(safe-area-inset-top)) auto auto; }
  .quick-foot .btn { flex: 1 1 0; min-height: 46px; }

  /* Toasts on top, so they never cover the save buttons or the add button. */
  .toasts { top: calc(10px + env(safe-area-inset-top)); bottom: auto; }

  /* Item page: small photo beside the title, so the actions and quantity are visible right away. */
  .detail-head { grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 8px 14px; margin-bottom: 22px; align-items: start; }
  .detail-main { display: contents; }
  .detail-photo { max-width: none; grid-row: 1 / span 2; }
  .detail-head .photo-large { aspect-ratio: 1; font-size: 2rem; }
  .detail-title { margin: 0; gap: 6px 10px; }
  .detail-title h1 { font-size: 1.25rem; }
  .detail-status { margin: 0; }
  .detail-actions { grid-column: 1 / -1; flex-direction: column; gap: 10px; margin-top: 8px; }
  .actions-main { display: flex; gap: 8px; }
  .actions-main .btn { flex: 1 1 0; }
  .actions-more { display: flex; flex-wrap: wrap; gap: 8px; }
  .actions-more .btn { border-color: var(--line); background: var(--surface); font-size: .88rem; min-height: 38px; }
}

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