:root {
  --navy: #0a2a5e;
  --navy-deep: #071d42;
  --blue: #0b5cb8;
  --blue-bright: #1e7fe0;
  --ink: #17222e;
  --ink-soft: #4c5a68;
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --line: #d9dfe7;
  --ok: #177245;
  --ok-bg: #e3f3ea;
  --low: #9a6200;
  --low-bg: #fdf0d5;
  --out: #b3261e;
  --out-bg: #fbe7e5;
  --shadow: 0 1px 2px rgba(10, 42, 94, .07), 0 6px 18px rgba(10, 42, 94, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf3;
    --ink-soft: #a3b0bf;
    --bg: #0b1220;
    --surface: #131e30;
    --surface-2: #182539;
    --line: #263650;
    --ok: #5fce92;
    --ok-bg: #123626;
    --low: #f2b544;
    --low-bg: #3d2f0d;
    --out: #ff8a80;
    --out-bg: #42201d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Barlow", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ---------- Header ---------- */
header {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 16px 18px;
}
.header-inner { max-width: 880px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.logo-tile {
  background: #fff; border-radius: 12px; padding: 6px;
  width: 64px; height: 64px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.logo-tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand h1 {
  margin: 0; font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-size: 1.65rem; letter-spacing: .06em; line-height: 1.05; font-weight: 700;
  text-transform: uppercase;
}
.brand h1 span { color: #7db4f2; }
.brand p { margin: 3px 0 0; font-size: .86rem; color: #c3d5ee; letter-spacing: .02em; }
.brand .tagline { font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: #8fb2e4; margin-top: 5px; }

main { max-width: 880px; margin: 0 auto; padding: 16px 14px 48px; }

/* ---------- Notice ---------- */
.notice {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; font-size: .9rem; color: var(--ink-soft); margin-bottom: 14px;
  display: flex; gap: 10px; align-items: flex-start; box-shadow: var(--shadow);
}
.notice svg { flex: 0 0 auto; margin-top: 2px; }
.notice strong { color: var(--ink); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 10px; text-align: center; box-shadow: var(--shadow);
}
.stat .num { font-size: 1.7rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: 5px; }
.stat.alert .num { color: var(--out); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Quick actions ---------- */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.qa-btn {
  border: none; border-radius: var(--radius); padding: 16px 12px; color: #fff;
  font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: var(--shadow);
}
.qa-btn.in { background: var(--blue); }
.qa-btn.in:active { background: #0a4f9c; }
.qa-btn.out { background: var(--navy); }
.qa-btn.out:active { background: var(--navy-deep); }
.qa-btn.xfer { background: #6b3fc4; }
.qa-btn.xfer:active { background: #5a32a8; }
@media (max-width: 520px) {
  .qa-btn { flex-direction: column; gap: 5px; padding: 13px 6px; font-size: .98rem; line-height: 1.1; }
}
/* ---------- Transfer direction ---------- */
.dir-seg { display: grid; grid-template-columns: 1fr; gap: 8px; }
.dir-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 10px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink-soft);
  font-weight: 700; font-size: 1rem;
}
.dir-btn .d-arrow { font-size: 1.2rem; }
.dir-btn.active { border-color: #6b3fc4; background: #efe8fb; color: #3d2380; }
@media (prefers-color-scheme: dark) { .dir-btn.active { background: #2a1f47; color: #d9c9ff; } }
.dir-note { margin: 7px 2px 0; font-size: .88rem; color: var(--ink-soft); }
.dir-note strong { color: var(--ink); }

/* ---------- Sections ---------- */
section { margin-bottom: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
h2 {
  margin: 0; font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-size: 1.3rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 700;
}
.section-head .sub { font-size: .85rem; color: var(--ink-soft); }

/* ---------- Needs ordering ---------- */
.order-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.order-panel.has-items { border-color: #e5b04c; }
.order-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.order-row:last-child { border-bottom: none; }
.order-row .name { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.order-row .detail { font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
.order-empty { padding: 16px 14px; color: var(--ink-soft); font-size: .95rem; }
.order-actions { display: flex; gap: 8px; padding: 12px 14px; background: var(--surface-2); flex-wrap: wrap; }

/* ---------- Pills ---------- */
.pill {
  font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.low { background: var(--low-bg); color: var(--low); }
.pill.out { background: var(--out-bg); color: var(--out); }

/* ---------- Controls ---------- */
.controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.search-wrap { flex: 1 1 200px; position: relative; }
.search-wrap input {
  width: 100%; padding: 11px 12px 11px 38px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 9px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem;
}
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Item cards ---------- */
.group-label {
  font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue); margin: 16px 2px 8px; display: flex; align-items: center; gap: 10px;
}
.group-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.group-label:first-of-type { margin-top: 2px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 14px; margin-bottom: 9px;
  display: flex; gap: 12px; align-items: center;
}
.item-main { flex: 1 1 auto; min-width: 0; }
.item-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.item-meta { font-size: .85rem; color: var(--ink-soft); margin-top: 2px; }
.item-count { text-align: right; flex: 0 0 auto; }
.item-count .big { font-size: 1.9rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.item-count .unit { font-size: .78rem; color: var(--ink-soft); }
.item-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.mini-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 8px; padding: 6px 11px; font-size: .85rem; font-weight: 600;
}
.mini-btn.in { background: var(--blue); border-color: var(--blue); color: #fff; }
.mini-btn:active { filter: brightness(.94); }
.no-results { padding: 18px 14px; color: var(--ink-soft); text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 9px 15px; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn:active { filter: brightness(.94); }

/* ---------- History ---------- */
.history-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.hist-row { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.hist-row:last-child { border-bottom: none; }
.hist-badge { font-size: .7rem; font-weight: 800; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; white-space: nowrap; text-transform: uppercase; }
.hist-badge.in { background: var(--ok-bg); color: var(--ok); }
.hist-badge.out { background: var(--out-bg); color: var(--out); }
.hist-badge.fix { background: var(--low-bg); color: var(--low); }
.hist-badge.transfer { background: #efe8fb; color: #5a32a8; }
@media (prefers-color-scheme: dark) { .hist-badge.transfer { background: #2a1f47; color: #c9b3ff; } }
.mini-btn.xfer { color: #5a32a8; border-color: #cdbdf0; background: #f6f2fd; }
@media (prefers-color-scheme: dark) { .mini-btn.xfer { color: #c9b3ff; border-color: #43356a; background: #221a38; } }
.hist-text { flex: 1; font-size: .94rem; }
.hist-text .who { color: var(--ink-soft); font-size: .85rem; display: block; }
.hist-time { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.hist-empty { padding: 16px 14px; color: var(--ink-soft); font-size: .95rem; }

/* ---------- Install help ---------- */
.install {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.install h3 { margin: 0 0 6px; font-size: 1rem; }
.install ol { margin: 6px 0 10px; padding-left: 20px; color: var(--ink-soft); font-size: .94rem; }
.install ol strong { color: var(--ink); }
.install .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .install .cols { grid-template-columns: 1fr; } }

footer {
  max-width: 880px; margin: 0 auto; padding: 0 14px 34px; color: var(--ink-soft);
  font-size: .88rem; text-align: center;
}
footer a { color: var(--blue); }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5, 15, 32, .55);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
.overlay.open { display: flex; }
.sheet {
  background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
  .overlay { align-items: center; padding: 20px; }
  .sheet { border-radius: 18px; }
}
.sheet h3 { margin: 0 0 4px; font-size: 1.25rem; }
.sheet .sheet-sub { color: var(--ink-soft); font-size: .92rem; margin: 0 0 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.qty-row { display: flex; gap: 8px; align-items: stretch; }
.qty-row input { text-align: center; font-size: 1.2rem; font-weight: 700; }
.step-btn {
  width: 52px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px;
  font-size: 1.3rem; font-weight: 700; color: var(--ink);
}
.sheet-actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; justify-content: center; padding: 13px; font-size: 1rem; }
.form-error { color: var(--out); font-size: .9rem; min-height: 1.2em; margin: 4px 0 0; font-weight: 600; }
.danger-zone { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.danger-btn { background: none; border: none; color: var(--out); font-weight: 600; padding: 4px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 80px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 60; transition: transform .25s ease; max-width: 92vw; text-align: center;
}
.toast { opacity: 0; visibility: hidden; transition: transform .25s ease, opacity .25s ease, visibility 0s linear .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .25s ease, opacity .25s ease; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- Saved / sync line ---------- */
.sync { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); margin: 0 2px 12px; font-weight: 500; }
.sync .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-soft); flex: 0 0 auto; }
.sync.ok .dot { background: var(--ok); }
.sync.err { color: var(--out); font-weight: 600; }
.sync.err .dot { background: var(--out); }
.hist-time { text-align: right; }
.hist-more { text-align: center; margin-top: 10px; }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.export-row .btn { text-decoration: none; flex: 1 1 0; justify-content: center; white-space: nowrap; }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid var(--blue-bright); outline-offset: 2px; }


/* ---------- Garages ---------- */
body[data-loc="brooklyn"] { --loc: #1e7fe0; --loc-deep: #0b5cb8; }
body[data-loc="nj"] { --loc: #12976f; --loc-deep: #0b7556; }
.loc-wrap { max-width: 880px; margin: 14px auto 0; }
.loc-bar {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--loc, #1e7fe0); color: #fff; border: none; border-radius: 12px;
  padding: 11px 14px; text-align: left; box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.loc-bar:active { background: var(--loc-deep, #0b5cb8); }
.loc-pin { display: flex; line-height: 1; }
.loc-name {
  flex: 1 1 auto; font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700;
  font-size: 1.35rem; letter-spacing: .05em; text-transform: uppercase; line-height: 1.1;
}
.loc-change {
  flex: 0 0 auto; font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  background: rgba(255,255,255,.2); border-radius: 999px; padding: 5px 11px;
}
.sheet-loc {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: var(--loc, #1e7fe0); border-radius: 999px; padding: 3px 10px; margin-bottom: 6px;
}

body.picking > header, body.picking > main, body.picking > footer { display: none; }
.picker {
  display: none; min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%); color: #fff;
  padding: calc(28px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}
body.picking .picker { display: flex; align-items: center; justify-content: center; }
.picker-inner { width: 100%; max-width: 440px; }
.picker-brand { text-align: center; margin-bottom: 30px; }
.logo-tile.big { width: 96px; height: 96px; border-radius: 18px; padding: 8px; margin: 0 auto 16px; }
.picker-brand h1 {
  margin: 0; font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 2.1rem;
  letter-spacing: .07em; text-transform: uppercase; line-height: 1.05; font-weight: 700;
}
.picker-brand h1 span { color: #7db4f2; }
.picker-brand .tagline { margin: 8px 0 0; font-size: .8rem; letter-spacing: .26em; text-transform: uppercase; color: #8fb2e4; }
.picker-q {
  text-align: center; color: #fff; font-size: 1.45rem; margin: 0 0 16px;
}
.picker-btns { display: grid; gap: 14px; }
.garage-btn {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  border: none; border-radius: 18px; padding: 20px 18px; text-align: left; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.3); min-height: 96px;
  transition: transform .08s ease;
}
.garage-btn:active { transform: scale(.98); }
.garage-btn.brooklyn { background: linear-gradient(135deg, #2a8af0 0%, #0b5cb8 100%); }
.garage-btn.nj { background: linear-gradient(135deg, #19b386 0%, #0b7556 100%); }
.g-ico {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700; font-size: 1.5rem; letter-spacing: .04em;
}
.g-text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.g-name {
  font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700; font-size: 1.6rem;
  letter-spacing: .04em; text-transform: uppercase; line-height: 1.05;
}
.g-sum { font-size: .9rem; color: rgba(255,255,255,.85); margin-top: 4px; }
.g-arrow { flex: 0 0 auto; font-size: 2.2rem; line-height: 1; opacity: .85; }
.g-last {
  position: absolute; top: -9px; right: 14px; background: #fff; color: var(--navy);
  font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.picker-note { text-align: center; color: #c3d5ee; font-size: .92rem; margin: 22px 0 0; }
.picker-foot { text-align: center; color: #8fb2e4; font-size: .8rem; margin: 26px 0 0; }

/* ---------- Worker / manager ---------- */
.app-header { position: relative; }
body:not(.mgr) .mgr-only { display: none !important; }
.mgr-row { max-width: 880px; margin: 8px auto -6px; display: flex; justify-content: flex-end; }
.mgr-lock {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; color: #a9c3ea; border: none;
  border-radius: 999px; padding: 3px 4px; font-size: .78rem; font-weight: 700; letter-spacing: .04em;
}
.mgr-lock:active { color: #fff; }
body.mgr .mgr-row { display: none; }
.mgr-bar {
  max-width: 880px; margin: 10px auto 0; display: flex; align-items: center; gap: 8px;
  background: #fff3cd; color: #5c4300; border-radius: 10px; padding: 7px 8px 7px 12px; font-size: .9rem;
}
.mgr-state { flex: 1 1 auto; font-weight: 800; }
.mgr-link, .mgr-lockbtn {
  border: none; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .82rem;
}
.mgr-link { background: transparent; color: #5c4300; text-decoration: underline; padding: 6px 4px; }
.mgr-lockbtn { background: #5c4300; color: #fff; }
.code-input { text-align: center; font-size: 1.7rem !important; letter-spacing: .5em; font-weight: 800; padding-left: .5em !important; }
.code-sheet { max-width: 420px; }


/* ---------- v4: stock first, photos, categories ---------- */
/* Compact header so the stock list starts higher on a phone. */
header { padding: calc(10px + env(safe-area-inset-top)) 14px 12px; }
.logo-tile { width: 48px; height: 48px; border-radius: 10px; padding: 4px; }
.brand h1 { font-size: 1.4rem; }
.brand p { display: none; }
.brand .tagline { margin-top: 3px; }
.loc-wrap { margin-top: 10px; }
.loc-bar { padding: 9px 13px; }
main { padding-top: 12px; }
.quick-actions { margin-bottom: 12px; }
@media (max-width: 520px) {
  .qa-btn { flex-direction: row; gap: 6px; padding: 14px 4px; font-size: .95rem; }
  .qa-btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
}
.order-alert {
  width: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  background: var(--low-bg); color: var(--low); border: 1px solid #e5b04c; border-radius: 12px;
  padding: 9px 12px; font-weight: 700; font-size: .95rem; text-align: left;
}
.order-alert[hidden] { display: none; }
.order-alert #orderAlertText { flex: 1 1 auto; }
.oa-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--low); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; flex: 0 0 auto; }
.oa-go { font-size: .82rem; opacity: .85; white-space: nowrap; }
.head-btns { display: flex; gap: 6px; }
.head-btns .btn { padding: 7px 12px; font-size: .88rem; }
.chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: 1 1 100%; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; white-space: nowrap; padding: 8px 13px; }

.item { display: block; padding: 11px 12px; }
.item-top { display: flex; align-items: center; gap: 12px; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.item-meta .rp { font-size: .8rem; }
.thumb {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 12px; overflow: hidden; padding: 0;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.none { opacity: .55; }
.thumb.add { border: 1.5px dashed #9fb6d4; color: var(--blue); font-size: .66rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.thumb.has { border-color: transparent; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.item-actions { margin-top: 10px; gap: 6px; }
.mini-btn { padding: 8px 12px; font-size: .88rem; }
.mini-btn.out { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .mini-btn.out { background: #2b4a80; border-color: #2b4a80; } }

.lower { margin-top: 30px; padding-top: 18px; border-top: 2px dashed var(--line); }
.lower .stats { margin-bottom: 0; }

/* Photo field in the item sheet */
.photo-edit { display: flex; gap: 12px; align-items: center; }
.photo-prev { width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-empty { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .75rem; color: var(--ink-soft); text-align: center; }
.photo-btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.danger-text { color: var(--out) !important; }

/* Photo viewer */
.photo-sheet { max-width: 560px; }
.photo-big { background: #000; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; max-height: 62vh; }
.photo-big img { max-width: 100%; max-height: 62vh; display: block; object-fit: contain; }

/* Categories sheet */
.cat-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: none; }
.cat-info { flex: 1 1 auto; min-width: 0; }
.cat-name { font-weight: 700; }
.cat-count { font-size: .8rem; color: var(--ink-soft); }
.cat-btns { display: flex; gap: 4px; flex: 0 0 auto; }
.icon-btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 8px; min-width: 34px; height: 34px; font-weight: 700; padding: 0 8px; font-size: .85rem; }
.icon-btn.del { color: var(--out); }
.icon-btn:disabled { opacity: .35; }
.cat-add-label { display: block; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px; }
.cat-add-row { display: flex; gap: 8px; }
.cat-add-row input { flex: 1 1 auto; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
[hidden] { display: none !important; }
.item-actions .mini-btn { padding: 7px 10px; font-size: .86rem; }

/* ---------- v5: who made each change ---------- */
.mgr-row { justify-content: space-between; align-items: center; }
body.mgr .mgr-row { display: flex; margin-bottom: 0; }
body.mgr #mgrBtn { display: none; }
.me-chip {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 70%;
  background: rgba(255,255,255,.1); color: #dbe7f8; border: none; border-radius: 999px;
  padding: 4px 10px 4px 8px; font-size: .8rem; font-weight: 700;
}
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-change { color: #a9c3ea; text-decoration: underline; font-weight: 600; }
.name-overlay { z-index: 60; align-items: center; }
.name-overlay .sheet { border-radius: 18px; margin: 0 14px; }
.name-hi { font-size: 2rem; line-height: 1; margin-bottom: 6px; }
#nameInput { font-size: 1.15rem; font-weight: 700; }
.hist-by { display: block; font-size: .86rem; color: var(--ink-soft); margin-bottom: 1px; }
.hist-by .by-name { color: var(--ink); font-weight: 800; font-size: .95rem; }
.hist-by .by-none { color: var(--ink-soft); font-weight: 700; }
.hist-badge.edit { background: #e4edf9; color: #1d4f91; }
@media (prefers-color-scheme: dark) { .hist-badge.edit { background: #1d3456; color: #a9c8f2; } }
.picker-me { text-align: center; font-size: .88rem; margin-top: 10px; opacity: .85; }
.picker-me-change { background: none; border: none; color: inherit; text-decoration: underline; padding: 0; font: inherit; }

/* Take Out needs a job */
.btn.primary.is-blocked { background: #9aa6b4 !important; border-color: #9aa6b4 !important; color: #fff; box-shadow: none; }
.job-hint { margin: 5px 0 0; font-size: .84rem; font-weight: 700; color: var(--out); }
#jobField.required label { color: var(--out); }
.job-hint.shake { animation: jobShake .45s ease; }
@keyframes jobShake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
