/* app.css — Basement Stock
   Mobile-first, built for people new to smartphones: big touch targets
   (buttons >= 64px), large rounded text (Nunito), high contrast, clear
   green / amber / red stock colours. Light + dark themes via design tokens.
   Polished but deliberately calm and simple. */

/* ============================ Design tokens ============================ */
:root {
  /* Surfaces & text (light) */
  --bg:          #eef2f8;
  --surface:     #ffffff;
  --surface-2:   #f7f9fc;
  --ink:         #0f172a;
  --ink-2:       #334155;
  --ink-soft:    #505a6b;          /* muted text — passes 4.5:1 on --bg */
  --line:        #e3e8f0;
  --line-2:      #cdd6e4;          /* decorative dividers / chevrons */
  --field-line:  #8b95a8;          /* form & control borders — meets 3:1 on white */

  /* Brand (industrial slate) */
  --brand:       #1e293b;
  --brand-2:     #0f172a;
  --on-brand:    #ffffff;

  /* Status: healthy / low / zero (bright accents for tints/borders/icons) */
  --ok:    #16a34a;  --ok-ink:  #15803d;  --ok-bg:  #dcfce7;  --ok-line:  #bbf7d0;
  --low:   #d97706;  --low-ink: #b45309;  --low-bg: #fef3c7;  --low-line: #fde68a;
  --zero:  #dc2626;  --zero-ink:#b91c1c;  --zero-bg:#fee2e2;  --zero-line:#fecaca;
  /* Solid fills for WHITE text on colour (badges, stock card, Add/Remove) — AA in both themes. */
  --fill-ok: #15803d;  --fill-low: #b45309;  --fill-zero: #b91c1c;

  /* Category accent chips (icon colours meet 3:1 on their tint) */
  --cat-phone:  #4f46e5; --cat-phone-bg:  #e0e7ff;
  --cat-watch:  #7c3aed; --cat-watch-bg:  #ede9fe;
  --cat-tablet: #0f766e; --cat-tablet-bg: #ccfbf1;
  --cat-general:#b45309; --cat-general-bg:#fef3c7;
  --cat-audio:  #be123c; --cat-audio-bg:  #ffe4e6;

  --ring: #3b82f6;
  --link: #2563eb;                 /* link/affordance blue — passes 4.5:1 on --bg */

  --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-pill: 999px;
  --tap: 64px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 2px 10px rgba(15,23,42,.07);
  --shadow-md: 0 8px 24px rgba(15,23,42,.10);
  --dur: 160ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0b1220;
    --surface:   #131c2e;
    --surface-2: #0f1827;
    --ink:       #f1f5f9;
    --ink-2:     #cbd5e1;
    --ink-soft:  #9aa7bb;
    --line:      #33405a;            /* dividers visible on cheap dark panels */
    --line-2:    rgba(80,96,122,.65); /* was 8-digit hex; rgba works on old WebViews */
    --field-line: rgba(120,138,170,.7);

    --brand:     #0c1422;
    --brand-2:   #0c1422;
    --on-brand:  #f1f5f9;

    --ok:   #22c55e; --ok-ink:  #4ade80; --ok-bg:  rgba(34,197,94,.16);  --ok-line:  rgba(34,197,94,.40);
    --low:  #f59e0b; --low-ink: #fbbf24; --low-bg: rgba(245,158,11,.16); --low-line: rgba(245,158,11,.40);
    --zero: #ef4444; --zero-ink:#f87171; --zero-bg:rgba(239,68,68,.16);  --zero-line:rgba(239,68,68,.42);

    --cat-phone:  #818cf8; --cat-phone-bg:  rgba(99,102,241,.18);
    --cat-watch:  #a78bfa; --cat-watch-bg:  rgba(124,58,237,.20);
    --cat-tablet: #2dd4bf; --cat-tablet-bg: rgba(13,148,136,.20);
    --cat-general:#fbbf24; --cat-general-bg:rgba(217,119,6,.20);
    --cat-audio:  #fb7185; --cat-audio-bg:  rgba(225,29,72,.20);

    --ring: #60a5fa;
    --link: #93c5fd;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 2px 10px rgba(0,0,0,.45);
    --shadow-md: 0 10px 28px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;            /* fallback so the themed bg fills short screens */
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
}

/* Tabular figures everywhere numbers carry meaning (no width jitter). */
.stock-number, .badge, .chg, .dir-cur, .ledger-mid strong, .ledger-time, .bignum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Inline SVG icons inherit text colour and size. */
.ico { width: 1.3em; height: 1.3em; display: inline-block; vertical-align: -0.22em; flex: 0 0 auto; }

/* ============================ Top bar ============================ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  background: var(--brand); color: var(--on-brand);
  padding: 10px;
  padding-top: calc(10px + env(safe-area-inset-top));
  box-shadow: var(--shadow);
}
.toptitle {
  flex: 1; margin: 0; text-align: center;
  font-size: 1.25rem; font-weight: 800; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbtn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px; height: 48px; border-radius: 12px;
  color: var(--on-brand); text-decoration: none;
  background: rgba(255,255,255,.12);
  transition: background var(--dur) ease, transform var(--dur) ease;
}
.topbtn .ico { width: 26px; height: 26px; }
.topbtn.ghost { background: transparent; pointer-events: none; }
.topbtn:active { background: rgba(255,255,255,.26); transform: scale(.96); }

/* ============================ Layout ============================ */
.wrap {
  max-width: 560px; margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom));
  animation: rise var(--dur) ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.lead   { font-size: 1.12rem; margin: 4px 2px 14px; color: var(--ink-2); }
.hello  { font-size: 1.12rem; margin: 2px 2px 16px; display: flex; align-items: center; gap: 8px; }
.muted  { color: var(--ink-soft); }
.hint   { color: var(--ink-soft); font-size: .98rem; margin: 8px 2px; }
.empty  { color: var(--ink-soft); text-align: center; padding: 28px 12px; background: var(--surface-2);
          border: 1px dashed var(--line-2); border-radius: var(--r); }
.subhead{ font-size: 1.12rem; font-weight: 800; margin: 26px 2px 12px; }
.link   { display: inline-flex; align-items: center; gap: 4px; margin: 14px 2px; color: var(--link); font-weight: 800; text-decoration: none; }
.link .ico { width: 1.1em; height: 1.1em; }
.rolechip { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
            color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line);
            padding: 3px 10px; border-radius: var(--r-pill); }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .95em; }

/* ============================ Flash ============================ */
.flash {
  border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px;
  font-size: 1.05rem; font-weight: 700; border: 1px solid transparent;
  animation: rise var(--dur) ease both;
}
.flash-ok  { background: var(--ok-bg);   color: var(--ok-ink);   border-color: var(--ok-line); }
.flash-err { background: var(--zero-bg); color: var(--zero-ink); border-color: var(--zero-line); }
.flash-err div { font-weight: 600; }

/* ============================ Tiles (login + category) ============================ */
.tiles { display: flex; flex-direction: column; gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 14px; min-height: 84px;
  text-decoration: none; color: var(--ink);
  transition: transform var(--dur) ease, box-shadow var(--dur) ease, border-color var(--dur) ease;
}
.tile:active { transform: scale(.985); box-shadow: var(--shadow); border-color: var(--line-2); }
.tile-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 18px; flex: 0 0 auto;
  background: var(--surface-2); color: var(--ink-2);
}
.tile-chip .ico { width: 30px; height: 30px; }
.tile-user .tile-chip { background: var(--brand); color: var(--on-brand); }
.tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tile-title { font-size: 1.2rem; font-weight: 800; }
.tile-sub   { color: var(--ink-soft); font-size: 1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile-go { color: var(--line-2); display: inline-flex; }
.tile-go .ico { width: 26px; height: 26px; }

/* category accent chips */
.cat-phone   { background: var(--cat-phone-bg);   color: var(--cat-phone); }
.cat-watch   { background: var(--cat-watch-bg);   color: var(--cat-watch); }
.cat-tablet  { background: var(--cat-tablet-bg);  color: var(--cat-tablet); }
.cat-general { background: var(--cat-general-bg); color: var(--cat-general); }
.cat-audio   { background: var(--cat-audio-bg);   color: var(--cat-audio); }

/* ============================ Search bar ============================ */
.searchbar { position: relative; display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.searchbar-ico { position: absolute; left: 16px; color: var(--ink-soft); pointer-events: none; display: inline-flex; }
.searchbar-ico .ico { width: 22px; height: 22px; }
.searchbar input[type="search"] {
  flex: 1; min-height: var(--tap); width: 100%;
  font: inherit; font-size: 1.1rem; padding: 0 14px 0 48px;
  border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--surface); color: var(--ink);
}
.searchbar input::placeholder { color: var(--ink-soft); }
.searchbar input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }

/* ============================ Menu (home) ============================ */
.menu { display: flex; flex-direction: column; gap: 10px; margin: 22px 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--ink); font-size: 1.08rem; font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) ease, border-color var(--dur) ease;
}
.menu-item:active { transform: scale(.99); border-color: var(--line-2); }
.menu-ico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
            border-radius: 11px; background: var(--surface-2); color: var(--ink-2); flex: 0 0 auto; }
.menu-ico .ico { width: 22px; height: 22px; }
.menu-item > :not(.menu-ico):not(.menu-go) { flex: 1; }
.menu-go { color: var(--line-2); display: inline-flex; margin-left: auto; }
.menu-go .ico { width: 22px; height: 22px; }

/* ============================ Rows (lists) ============================ */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 10px 12px 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) ease, border-color var(--dur) ease;
}
.row:active { transform: scale(.99); border-color: var(--line-2); }
.row-name { flex: 1; font-size: 1.1rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.row-variant { display: block; font-size: .92rem; font-weight: 600; color: var(--ink-soft); margin-top: 1px; }
.row-end { display: inline-flex; align-items: center; gap: 6px; }
.row-chev { color: var(--line-2); display: inline-flex; }
.row-chev .ico { width: 22px; height: 22px; }

/* ============================ Quantity badge / pills ============================ */
.badge {
  min-width: 54px; max-width: 6.5em; padding: 7px 12px; border-radius: var(--r-pill);
  font-size: 1.2rem; font-weight: 800; text-align: center; color: #fff;
  border: 1px solid transparent; overflow: hidden; text-overflow: ellipsis;
}
.badge-ok   { background: var(--fill-ok); }
.badge-low  { background: var(--fill-low); }
.badge-zero { background: var(--fill-zero); }

.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill);
        font-size: .85rem; font-weight: 800; border: 1px solid transparent; }
.pill-low  { background: var(--low-bg);  color: var(--low-ink);  border-color: var(--low-line); }
.pill-zero { background: var(--zero-bg); color: var(--zero-ink); border-color: var(--zero-line); }

/* ============================ Item detail ============================ */
.itemhead { margin-bottom: 14px; }
.item-title   { font-size: 1.55rem; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; word-break: break-word; }
.item-variant { font-size: 1.15rem; color: var(--ink-soft); font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.item-meta    { color: var(--ink-soft); margin-top: 6px; font-size: .98rem; overflow-wrap: anywhere; }

.stockbox {
  text-align: center; border-radius: var(--r-lg);
  padding: 20px; margin: 6px 0 18px; color: #fff; box-shadow: var(--shadow);
}
.stockbox-ok   { background: var(--fill-ok);   background: linear-gradient(160deg, var(--fill-ok)  0%, color-mix(in srgb, var(--fill-ok)  78%, #000) 100%); }
.stockbox-low  { background: var(--fill-low);  background: linear-gradient(160deg, var(--fill-low) 0%, color-mix(in srgb, var(--fill-low) 78%, #000) 100%); }
.stockbox-zero { background: var(--fill-zero); background: linear-gradient(160deg, var(--fill-zero) 0%, color-mix(in srgb, var(--fill-zero) 78%, #000) 100%); }
.stock-label  { font-size: 1rem; opacity: .95; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.stock-number { font-size: clamp(2.6rem, 18vw, 4.2rem); font-weight: 900; line-height: 1; margin: 6px 0; overflow-wrap: anywhere; }
.stock-note   { font-size: 1.05rem; opacity: .98; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.stock-note .ico { width: 1.15em; height: 1.15em; }

/* ============================ Buttons ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--tap); padding: 0 20px;
  border: 1px solid transparent; border-radius: 14px; cursor: pointer;
  font: inherit; font-size: 1.18rem; font-weight: 800; text-decoration: none;
  color: #fff; background: var(--brand); box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur) ease, filter var(--dur) ease, box-shadow var(--dur) ease;
}
.btn .ico { width: 1.3em; height: 1.3em; }
.btn:active { transform: translateY(1px) scale(.99); filter: brightness(.96); }
.btn[disabled] { opacity: .45; pointer-events: none; box-shadow: none; }
.btn.block { display: flex; width: 100%; margin-top: 14px; }

.btn-primary { background: var(--brand); }
.btn-search  { background: var(--brand); padding: 0 18px; flex: 0 0 auto; }
.btn-add,    .btn-confirm.btn-add    { background: var(--fill-ok); }
.btn-remove, .btn-confirm.btn-remove { background: var(--fill-zero); }
.btn-set,    .btn-confirm.btn-set    { background: var(--brand); }
.btn-soft  { background: var(--surface); color: var(--ink); border-color: var(--field-line); }
.btn-soft .ico { color: var(--ink-2); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--field-line); box-shadow: none; }
.btn-confirm { width: 100%; margin-top: 16px; font-size: 1.3rem; }

.twobtn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.twobtn .btn { width: 100%; font-size: 1.3rem; }

/* ============================ Direction header (add / remove / set) ============================ */
.dirhead { border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 14px; color: #fff; box-shadow: var(--shadow); }
.dirhead-add    { background: var(--fill-ok);   background: linear-gradient(160deg, var(--fill-ok)  0%, color-mix(in srgb, var(--fill-ok)  78%, #000) 100%); }
.dirhead-remove { background: var(--fill-zero); background: linear-gradient(160deg, var(--fill-zero) 0%, color-mix(in srgb, var(--fill-zero) 78%, #000) 100%); }
.dirhead-set    { background: var(--brand); background: linear-gradient(160deg, var(--brand) 0%, var(--brand-2) 100%); }
.dir-word { font-size: 1.5rem; font-weight: 900; }
.dir-item { font-size: 1.12rem; margin-top: 2px; opacity: .96; }
.dir-cur  { margin-top: 8px; opacity: .95; font-weight: 700; }

/* ============================ Number pad ============================ */
.padform { display: flex; flex-direction: column; align-items: stretch; }
.pad { margin: 8px 0 6px; }
.pad-cap { font-size: 1.05rem; font-weight: 800; margin: 10px 2px 6px; }
.bignum {
  background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r);
  text-align: center; font-size: 2.9rem; font-weight: 900; letter-spacing: .04em;
  padding: 14px; min-height: 80px; margin-bottom: 12px; color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.bignum.mask { letter-spacing: .22em; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  min-height: 72px; border: 1px solid var(--field-line); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1.85rem; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur) ease, background var(--dur) ease;
}
.key:active { background: var(--surface-2); transform: translateY(1px) scale(.97); }
.key-soft { background: var(--surface-2); color: var(--ink-soft); }
.key-soft .ico { width: 28px; height: 28px; }

/* ============================ Forms ============================ */
.bigform { display: flex; flex-direction: column; gap: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.field > span { font-weight: 800; font-size: 1.02rem; }
.field input, .field select, textarea {
  min-height: var(--tap); font: inherit; font-size: 1.1rem; padding: 10px 12px;
  border: 1px solid var(--field-line); border-radius: 12px; background: var(--surface); color: var(--ink);
  width: 100%;
}
textarea { min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1rem; }
.field input:focus, .field select:focus, textarea:focus, .searchbar input:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(59,130,246,.35);                      /* fallback */
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent);
}
.more { margin: 12px 0; border: 1px solid var(--line-2); border-radius: 12px; padding: 4px 12px; background: var(--surface); }
.more > summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; color: var(--ink-2); cursor: pointer; }

/* ============================ Activity filters ============================ */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.filters-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ============================ Ledger ============================ */
.ledger { display: flex; flex-direction: column; gap: 8px; }
.ledger-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.chg { font-size: 1.25rem; font-weight: 900; min-width: 58px; text-align: center; border-radius: 10px; padding: 5px 6px; }
.chg.pos { color: var(--ok-ink);   background: var(--ok-bg); }
.chg.neg { color: var(--zero-ink); background: var(--zero-bg); }
.ledger-mid { display: flex; flex-direction: column; gap: 1px; font-size: .98rem; min-width: 0; overflow-wrap: anywhere; }
.ledger-mid .muted { font-size: .9rem; }
.ledger-time { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }

/* ============================ People (admin) ============================ */
.people { display: flex; flex-direction: column; gap: 12px; }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-sm); }
.person.is-off { opacity: .6; }
.person-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.person-name { font-size: 1.15rem; font-weight: 800; }
.person-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { margin: 0; }
.btn-tiny {
  min-height: 52px; padding: 0 16px; font: inherit; font-size: 1rem; font-weight: 800;
  border-radius: 10px; border: 1px solid var(--field-line); background: var(--surface-2); color: var(--ink-2); cursor: pointer;
}
.btn-tiny:active { transform: translateY(1px); }
.person-actions select { min-height: 52px; font: inherit; padding: 0 8px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--surface); color: var(--ink); }
.reset { display: inline-block; }
.reset > summary { list-style: none; cursor: pointer; }
.reset > summary::-webkit-details-marker { display: none; }
.reset-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; width: 100%; }
.reset-form input[type="tel"] {
  min-height: 52px; font: inherit; font-size: 1.05rem; padding: 0 12px; width: 100%; max-width: 220px;
  border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); color: var(--ink);
}

.logout { margin-top: 28px; text-align: center; }
.logout .btn { width: 100%; }

/* ============================ Accessibility ============================ */
/* Baseline :focus ring for ALL browsers (older ones lack :focus-visible)... */
a:focus, button:focus, input:focus, select:focus, textarea:focus,
[tabindex]:focus { outline: 3px solid var(--ring); outline-offset: 2px; }
/* ...then hide it for mouse/touch where :focus-visible IS supported. */
a:focus:not(:focus-visible), button:focus:not(:focus-visible),
input:focus:not(:focus-visible), select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible), [tabindex]:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

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

/* ============================ No-JavaScript fallback ============================ */
/* The inline <script> in <head> adds `.js` to <html>. If JS is off/blocked the
   on-screen pad can't function, so hide it and show a plain number field
   (from the <noscript> block) that uses the device keyboard. */
html:not(.js) .pad > .keypad,
html:not(.js) .pad > .bignum { display: none; }
.nojs-input {
  width: 100%; min-height: var(--tap); font: inherit; font-size: 1.5rem;
  text-align: center; padding: 10px 14px; border: 1px solid var(--field-line);
  border-radius: var(--r); background: var(--surface); color: var(--ink); margin: 4px 0 12px;
}

/* ============================ Dashboard stats ============================ */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0 0 16px; }
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink);
}
.stat-num { font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-lbl { font-size: .72rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.stat-low  .stat-num { color: var(--low-ink); }
.stat-zero .stat-num { color: var(--zero-ink); }
.stat-link:active { transform: scale(.97); border-color: var(--line-2); }

/* ============================ Bulk stock count ============================ */
.bulkform { display: flex; flex-direction: column; gap: 10px; }
.bulk-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-sm);
}
.bulk-name { font-size: 1.05rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.bulk-now  { font-size: .88rem; color: var(--ink-soft); white-space: nowrap; }
.bulk-input {
  width: 86px; min-height: 56px; text-align: center; font: inherit; font-size: 1.3rem; font-weight: 800;
  border: 1px solid var(--field-line); border-radius: 12px; background: var(--surface); color: var(--ink);
}

/* Item form: category-specific field groups (shown/hidden by app.js). */
.catgroup { display: contents; }

/* ============================ Grouped product list (by model) ============================ */
.model-group > summary { list-style: none; cursor: pointer; }
.model-group > summary::-webkit-details-marker { display: none; }
.model-summary { background: var(--surface); }
.model-summary .row-chev { transition: transform var(--dur) ease; }
.model-group[open] > .model-summary .row-chev { transform: rotate(90deg); }
.model-variants {
  display: flex; flex-direction: column; gap: 8px;
  margin: 8px 0 2px 10px; padding-left: 12px; border-left: 3px solid var(--line-2);
}
.row.sub { background: var(--surface-2); min-height: 56px; }
