:root {
  --red: #c8102e; --red-dark: #9d0c24; --bg: #f4f4f6; --card: #fff; --text: #1b1b1f; --muted: #6b6b76;
  --line: #e2e2e8; --ok: #1a7f37; --warn: #b7791f; --warn-bg: #fff4d6; --bad-bg: #fde4e7; --ok-bg: #dff5e5;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131316; --card: #1e1e23; --text: #f2f2f5; --muted: #a0a0ab; --line: #34343c; --warn-bg: #3d3216; --bad-bg: #44181f; --ok-bg: #173a22; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
.boot { text-align: center; margin-top: 30vh; color: var(--muted); }
.shell { max-width: 760px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
header.top { position: sticky; top: 0; z-index: 20; background: var(--red); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
header.top h1 { font-size: 19px; margin: 0; flex: 1; font-weight: 650; }
header.top .back { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-size: 16px; min-height: 40px; }
.pill { font-size: 13px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.22); white-space: nowrap; }
.pill.off { background: #111; }
main { flex: 1; padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
nav.tabs .inner { display: flex; width: 100%; max-width: 760px; }
nav.tabs a { flex: 1; text-align: center; padding: 9px 2px 8px; color: var(--muted); text-decoration: none; font-size: 12px; position: relative; min-height: 56px; }
nav.tabs a .ic { display: block; font-size: 22px; line-height: 1.2; }
nav.tabs a.on { color: var(--red); font-weight: 650; }
nav.tabs .badge { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--red); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 6px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card h2, .card h3 { margin: 0 0 4px; font-size: 18px; }
.muted { color: var(--muted); font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }
button, .btn { font: inherit; border: 0; border-radius: 12px; padding: 12px 16px; min-height: 52px; background: var(--red); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:active, .btn:active { background: var(--red-dark); }
button.sec, .btn.sec { background: transparent; color: var(--red); border: 2px solid var(--red); }
button.gray, .btn.gray { background: var(--line); color: var(--text); }
button.small { min-height: 40px; padding: 8px 12px; font-size: 15px; }
button.block, .btn.block { width: 100%; }
button:disabled { opacity: .45; }
input, select, textarea { font: inherit; width: 100%; min-height: 50px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); }
input[type=checkbox] { width: 28px; min-height: 28px; height: 28px; accent-color: var(--red); flex: none; }
label.field { display: block; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
label.field > input, label.field > select { margin-top: 4px; color: var(--text); font-size: 17px; }
.chip { display: inline-block; font-size: 13px; border-radius: 99px; padding: 2px 10px; background: var(--line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--red); }
.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.banner.warn { background: var(--warn-bg); }
.banner.bad { background: var(--bad-bg); }
.banner.ok { background: var(--ok-bg); }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; background: transparent; color: var(--text); min-height: 44px; }
.seg button.on { background: var(--card); color: var(--red); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.item { flex-wrap: wrap; display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-height: 60px; }
.item:last-child { border-bottom: 0; }
.item.checked { background: var(--warn-bg); border-radius: 10px; }
.qty { display: flex; gap: 6px; width: 100%; padding-left: 40px; }
.qty button { flex: 1; max-width: 64px; min-height: 46px; min-width: 0; padding: 0; background: var(--line); color: var(--text); }
.qty button.on { background: var(--red); color: #fff; }
.sticky-bar { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 10; padding-top: 8px; }
.sticky-bar button { box-shadow: 0 4px 14px rgba(0,0,0,.25); font-size: 18px; min-height: 58px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
tr.low td { background: var(--bad-bg); }
tr.low td:first-child { box-shadow: inset 4px 0 0 var(--red); }
tr.mid td { background: var(--warn-bg); }
.devs { display: flex; flex-wrap: wrap; gap: 8px; }
.devs label { display: flex; align-items: center; gap: 8px; background: var(--line); border-radius: 12px; padding: 10px 12px; min-height: 48px; }
.devs label.on { background: var(--red); color: #fff; }
.devs input { display: none; }
#toasts { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #222; color: #fff; padding: 12px 16px; border-radius: 12px; max-width: 520px; box-shadow: 0 6px 20px rgba(0,0,0,.3); pointer-events: auto; }
.toast.err { background: var(--red-dark); }
.login { max-width: 420px; margin: 0 auto; padding: 14vh 20px 20px; }
.login h1 { color: var(--red); margin-bottom: 4px; }
.big-time { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pw-box { font-family: ui-monospace, Menlo, monospace; font-size: 20px; background: var(--card); border: 2px dashed var(--red); border-radius: 12px; padding: 12px; text-align: center; user-select: all; }
@media (min-width: 700px) { main { padding-left: 20px; padding-right: 20px; } }
.art { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.art.low { background: var(--bad-bg); box-shadow: inset 5px 0 0 var(--red); }
.art.mid { background: var(--warn-bg); box-shadow: inset 5px 0 0 var(--warn); }
.art.off { opacity: .55; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: var(--line); }
.thumb.empty { display: flex; align-items: center; justify-content: center; font-size: 24px; opacity: .6; }
.img-preview { margin-top: 6px; min-height: 120px; border: 2px dashed var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--bg); }
.img-preview img { max-width: 100%; max-height: 260px; display: block; }
.zoom { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.85); display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; padding: 16px; }
.zoom img { max-width: 100%; max-height: 80vh; border-radius: 12px; }
