@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600&family=IBM+Plex+Serif:wght@600&display=swap');

:root {
  --bg: #faf8f3; --surface: #ffffff; --surface-2: #f2eee5; --ink: #232c3a; --muted: #566172;
  --line: #e2dccf; --border: #808894; --navy: #1b2a4e; --navy-tint: #e6eaf2;
  --brass: #c9a227; --brass-ink: #7d6213; --brass-soft: #c9a22726;
  --ok: #2e6b45; --ok-soft: #2e6b451f; --warn: #8a5a00; --warn-soft: #8a5a001f;
  --danger: #a33a2c; --danger-soft: #a33a2c1f;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/22px 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--navy); }
h1 { margin: 0; font: 600 28px/34px 'IBM Plex Serif', Georgia, serif; color: var(--navy); }
h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }

/* shopper app shell */
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
[data-screen] { flex: 1; display: flex; flex-direction: column; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 68px; }
.brand { font: 600 18px/24px 'IBM Plex Serif', Georgia, serif; color: var(--navy); }
.step { font-size: 13px; color: var(--muted); }
.back { background: none; border: 0; font: inherit; font-weight: 600; color: var(--navy); min-height: 44px; padding: 0; cursor: pointer; }
.body { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.foot { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-top: 1px solid var(--line); background: var(--surface); position: sticky; bottom: 0; }

.btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--navy); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.brass { background: var(--brass); border-color: var(--brass); color: var(--navy); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.link { border: 0; background: none; text-decoration: underline; }
.btn.small { min-height: 44px; }
.btn:disabled { opacity: .5; cursor: default; }

.label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 8px; }
input[type=text], input[type=search], input[type=email], input[type=password], select, textarea {
  min-height: 48px; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--surface); width: 100%;
}
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--navy); }
.small { font-size: 13px; line-height: 18px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.note { background: var(--navy-tint); color: var(--navy); border-radius: 6px; padding: 12px; font-size: 13px; line-height: 18px; }
.note.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.note.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok); font-weight: 600; }
.note.err { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.chip { display: inline-block; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.navy { background: var(--navy-tint); color: var(--navy); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.brass { background: var(--brass-soft); color: var(--brass-ink); }

.steps { display: flex; flex-direction: column; gap: 8px; }
.steps > div { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.dot { width: 28px; height: 28px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }

.opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.opt:has(input:checked) { border: 3px solid var(--navy); background: var(--navy-tint); padding: 6px 10px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opts.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 600; }

/* camera */
.cam { position: relative; flex: 1; min-height: 320px; background: var(--ink); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .frame { position: relative; width: 70%; aspect-ratio: 1; border: 3px dashed #fff; border-radius: 10px; }
.cam .msg { position: absolute; left: 12px; right: 12px; bottom: 12px; color: #fff; background: rgba(27, 42, 78, .8); border-radius: 6px; padding: 8px 12px; font-size: 13px; line-height: 18px; text-align: center; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--brass); transition: width .15s; }

/* result */
.result { display: flex; gap: 16px; align-items: center; }
.swatch { width: 88px; height: 88px; border-radius: 6px; border: 1px solid var(--border); flex: none; }
.stage-num { font: 600 28px/34px 'IBM Plex Serif', Georgia, serif; color: var(--navy); }
.ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ladder > div { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; text-align: center; }
.ladder > div.on { border: 3px solid var(--navy); background: var(--navy-tint); padding: 6px 2px; font-weight: 600; color: var(--navy); }
.ladder i { display: block; width: 100%; height: 36px; border-radius: 4px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item i { width: 40px; height: 40px; border-radius: 4px; border: 1px solid var(--border); flex: none; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 448px; margin: 0 auto; z-index: 10; }

/* admin */
.admin-bar { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding: 16px 2rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs .btn { min-height: 44px; }
.tabs .btn[aria-current=page] { background: var(--navy); border-color: var(--navy); color: #fff; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 2rem; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tools select, .tools input { width: auto; min-height: 44px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.fig { font-size: 24px; line-height: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.cols > * { flex: 1 1 360px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface-2); text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }
.bars { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr) 90px; gap: 8px; align-items: center; }
.bars .track { height: 20px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bars .track > div { height: 100%; background: var(--navy); }
.bars .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.q { display: flex; flex-direction: column; gap: 12px; }
.q-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.inline { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.inline label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 600px) { .wrap { padding: 1rem; } .admin-bar { padding: 12px 1rem; } }
