/* CardVault AI — mobile-first, large-touch, high-contrast "vault" UI */
:root {
  --bg: #0d1117;
  --surface: #151a22;
  --surface-2: #1c222c;
  --surface-3: #252c38;
  --line: rgba(243, 239, 230, 0.10);
  --line-strong: rgba(243, 239, 230, 0.20);
  --text: #f3efe6;
  --muted: #a5abb6;
  --faint: #6f7682;
  --accent: #35d6b9;        /* scan teal: primary actions */
  --accent-ink: #052620;
  --gold: #e9b949;          /* value / price */
  --green: #46c37b;
  --yellow: #f0b429;
  --red: #ff6b5e;
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 56px;
  --font: 'Satoshi', 'Segoe UI', Roboto, system-ui, sans-serif;
  --display: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* splash */
.splash { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); z-index: 50; transition: opacity .4s var(--ease); }
.splash.gone { opacity: 0; pointer-events: none; }
.splash img { border-radius: 24px; }
.splash-name { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: .01em; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-top)) 14px 10px; background: rgba(13,17,23,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 20px; }
.brand b { color: var(--accent); font-weight: 800; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 0; background: transparent; color: var(--text); }
.icon-btn:active { background: var(--surface-2); }
.mode-chip { margin-left: auto; font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: rgba(240,180,41,.14); color: var(--yellow); }
.offline-bar { background: var(--yellow); color: #231a00; font-weight: 700; padding: 12px 16px; text-align: center; }

main:focus, main:focus-visible { outline: none; }
main { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(120px + var(--safe-bottom)); outline: none; }
.screen { animation: enter .35s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } * { transition: none !important; } }

h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 10px; letter-spacing: .005em; }
h1 { font-size: clamp(28px, 7vw, 38px); font-weight: 800; }
h2 { font-size: 23px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 700; font-family: var(--font); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* buttons */
.btn { text-align: center; line-height: 1.2; min-height: var(--tap); padding: 0 22px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-decoration: none; transition: transform .12s var(--ease), background .2s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:active { background: #2bbfa5; }
.btn.danger { background: transparent; border-color: rgba(255,107,94,.5); color: var(--red); }
.btn.ghost { background: transparent; }
.btn.gold { background: var(--gold); color: #2a1e00; border-color: transparent; }
.btn.big { min-height: 76px; font-size: 22px; border-radius: var(--radius); }
.btn-hero { width: 100%; min-height: 168px; border-radius: 26px; border: 0; background: radial-gradient(120% 140% at 15% 0%, #4ff0d2 0%, #35d6b9 40%, #1fae95 100%); color: var(--accent-ink); font-family: var(--display); font-size: clamp(34px, 9vw, 44px); font-weight: 800; letter-spacing: .02em; display: grid; place-items: center; gap: 6px; box-shadow: 0 18px 50px -18px rgba(53,214,185,.55); cursor: pointer; }
.btn-hero small { font-family: var(--font); font-size: 16px; font-weight: 700; opacity: .8; letter-spacing: 0; }
.btn-hero:active { transform: scale(.985); }

/* cards / panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel.tight { padding: 12px; }
.list { display: grid; gap: 10px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; min-height: 72px; }
.list-item img { width: 46px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.list-item .t { font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-item .s { font-size: 14px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.chip.green { background: rgba(70,195,123,.14); color: var(--green); }
.chip.yellow { background: rgba(240,180,41,.14); color: var(--yellow); }
.chip.red { background: rgba(255,107,94,.14); color: var(--red); }
.chip.teal { background: rgba(53,214,185,.14); color: var(--accent); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.green { background: var(--green); box-shadow: 0 0 0 4px rgba(70,195,123,.18); }
.dot.yellow { background: var(--yellow); box-shadow: 0 0 0 4px rgba(240,180,41,.18); }
.dot.red { background: var(--red); box-shadow: 0 0 0 4px rgba(255,107,94,.18); }

/* health */
.health { display: grid; gap: 10px; }
.health-head { display: flex; align-items: center; gap: 12px; }
.health-head .big-dot { width: 18px; height: 18px; }
.health-items { display: grid; gap: 2px; margin-top: 8px; }
.health-item { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); }
.health-item .lbl { font-weight: 700; min-width: 128px; }
.health-item .msg { color: var(--muted); font-size: 15px; flex: 1; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; color: var(--text); text-decoration: none; }
.stat .n { font-family: var(--display); font-size: 30px; font-weight: 800; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat.alert { border-color: rgba(255,107,94,.45); }
.stat.alert .n { color: var(--red); }

/* stepper */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 2px 0 18px; }
.step { text-align: center; font-size: 12px; font-weight: 700; color: var(--faint); }
.step .bar { height: 6px; border-radius: 4px; background: var(--surface-3); margin-bottom: 6px; }
.step.done .bar { background: var(--accent); }
.step.now .bar { background: linear-gradient(90deg, var(--accent) 50%, var(--surface-3) 50%); }
.step.done, .step.now { color: var(--text); }

/* camera */
.cam { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
.cam.taken { aspect-ratio: auto; height: 46vh; }
.cam video, .cam img.still { width: 100%; height: 100%; object-fit: cover; }
.cam .guide { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cam .frame { width: 68%; aspect-ratio: 2.5 / 3.5; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border: 3px solid var(--accent); position: relative; }
.cam .frame::after { content: attr(data-label); position: absolute; top: -40px; left: 50%; transform: translateX(-50%); font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .08em; color: var(--text); background: rgba(13,17,23,.75); padding: 4px 14px; border-radius: 10px; white-space: nowrap; }
.cam .cam-msg { position: absolute; inset: auto 0 0 0; padding: 14px; text-align: center; font-weight: 700; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.cam-off { display: grid; place-items: center; text-align: center; padding: 26px; color: var(--muted); height: 100%; }
.shutter { width: 84px; height: 84px; border-radius: 50%; border: 6px solid var(--text); background: var(--accent); margin: 0 auto; display: block; cursor: pointer; box-shadow: 0 0 0 4px var(--bg), 0 10px 30px -8px rgba(53,214,185,.6); }
.shutter:active { transform: scale(.94); }
.tips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 14px; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.tips li { display: flex; gap: 8px; align-items: flex-start; }
.tips li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); margin-top: 7px; flex: none; }

/* progress */
.progress { height: 12px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease); }
.progress.indeterminate > i { width: 35%; animation: indet 1.2s infinite var(--ease); }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--surface-3); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* review */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; display: grid; gap: 8px; align-content: start; }
.side-label { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .12em; text-align: center; padding: 4px 0; border-radius: 8px; background: var(--surface-3); }
.side-label.front { color: var(--accent); }
.side-label.back { color: var(--gold); }
.side .shot { position: relative; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: 2.5/3.5; display: grid; place-items: center; }
.side .shot img { width: 100%; height: 100%; object-fit: contain; }
.side .q { font-size: 13px; font-weight: 700; }
.issues { display: grid; gap: 8px; }
.issue { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: rgba(240,180,41,.10); border: 1px solid rgba(240,180,41,.3); font-weight: 600; font-size: 15px; }
.issue.high { background: rgba(255,107,94,.10); border-color: rgba(255,107,94,.35); }
.issue .ico { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); color: #231a00; display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.issue.high .ico { background: var(--red); color: #2a0703; }
.ok-note { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: rgba(70,195,123,.10); border: 1px solid rgba(70,195,123,.3); font-weight: 600; }
.conf { display: grid; gap: 6px; }
.conf .meter { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.conf .meter i { display: block; height: 100%; border-radius: 6px; }
.price-big { font-family: var(--display); font-size: 44px; font-weight: 800; color: var(--gold); line-height: 1; }

/* forms */
label.f { display: grid; gap: 6px; font-weight: 700; font-size: 15px; }
label.f span.h { font-weight: 500; color: var(--muted); font-size: 13px; }
input.in, select.in, textarea.in { width: 100%; min-height: 54px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 17px; }
textarea.in { min-height: 96px; resize: vertical; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--accent); outline: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
details.more { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
details.more > summary { list-style: none; cursor: pointer; padding: 16px; font-weight: 700; display: flex; justify-content: space-between; min-height: var(--tap); align-items: center; }
details.more > summary::after { content: "+"; font-size: 24px; color: var(--accent); }
details.more[open] > summary::after { content: "–"; }
details.more > div { padding: 0 16px 16px; display: grid; gap: 12px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); font-weight: 700; }
.switch input { width: 54px; height: 32px; appearance: none; background: var(--surface-3); border-radius: 999px; position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ""; position: absolute; width: 24px; height: 24px; top: 4px; left: 4px; border-radius: 50%; background: var(--text); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(22px); }

/* final image order */
.order { display: grid; gap: 10px; }
.order-item { display: grid; grid-template-columns: 44px 96px 1fr; gap: 12px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.order-item .pos { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 22px; }
.order-item img { width: 96px; height: 134px; object-fit: contain; background: #000; border-radius: 8px; }
.order-item .lab { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .1em; }

/* sticky action bar */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px 16px calc(12px + var(--safe-bottom)); background: linear-gradient(transparent, var(--bg) 26%); }
.actionbar .inner { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }

/* PIN keypad */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0 26px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 340px; margin: 0 auto; }
.key { height: 74px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--display); font-size: 30px; font-weight: 800; cursor: pointer; }
.key:active { background: var(--surface-3); }
.key.fn { font-family: var(--font); font-size: 16px; font-weight: 700; color: var(--muted); }

/* batch */
.queue { display: grid; gap: 12px; }
.pair-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.slot { border-radius: 10px; background: var(--surface-2); border: 2px dashed var(--line-strong); aspect-ratio: 2.5/3.5; display: grid; place-items: center; position: relative; overflow: hidden; cursor: pointer; touch-action: none; }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot .tag { position: absolute; top: 6px; left: 6px; font-weight: 800; font-size: 12px; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: rgba(13,17,23,.85); }
.slot.selected { border: 3px solid var(--gold); }
.slot.drop { border: 3px solid var(--accent); }
.pair-row .acts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); font-weight: 700; padding: 14px 20px; border-radius: 14px; opacity: 0; pointer-events: none; transition: all .3s var(--ease); max-width: 90vw; z-index: 60; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* admin */
.admin-sec { display: grid; gap: 12px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.kv code, code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); word-break: break-all; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log td { border-top: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }
.success-mark { width: 96px; height: 96px; border-radius: 50%; background: rgba(70,195,123,.14); display: grid; place-items: center; margin: 8px auto 14px; }
.warn-mark { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,107,94,.14); display: grid; place-items: center; margin: 8px auto 14px; }

@media (min-width: 720px) {
  body { font-size: 18px; }
  .pair { gap: 16px; }
  .cam { aspect-ratio: 4 / 3; max-height: 70vh; }
}
