:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --text: #15201d;
  --muted: #5b6b66;
  --line: #e2e8e5;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #d9f2ee;
  --safe: #15803d;
  --safe-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --radius: 14px;
  --tab-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --surface: #182220; --text: #eef3f1; --muted: #9fb0aa; --line: #283531;
    --brand: #2dd4bf; --brand-ink: #062b27; --brand-soft: #123c38;
    --safe: #4ade80; --safe-soft: #14321f; --danger: #f87171; --danger-soft: #3b1515; --warn: #fbbf24; --warn-soft: #3a2c0b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; display: block; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--muted); }

#app { min-height: 100vh; min-height: 100dvh; }
.page { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.topbar h1 { font-size: 1.35rem; margin: 0; flex: 1; }
.topbar .back { background: none; border: 0; color: var(--brand); font-size: 1rem; padding: 6px 8px 6px 0; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.sub { color: var(--muted); margin: 0 0 12px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
h3 { font-size: 1rem; margin: 0 0 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.link { display: block; color: inherit; cursor: pointer; }
.card.link:active { transform: scale(.995); }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); flex: none; }
.meta { color: var(--muted); font-size: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: .85rem; background: var(--surface); color: var(--text); cursor: pointer; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.static { cursor: default; }
.chip.safe { background: var(--safe-soft); color: var(--safe); border-color: transparent; }
.chip.contains { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.unverified { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.hit { background: var(--danger-soft); color: var(--danger); border-color: transparent; font-weight: 600; }

.badge { font-size: .8rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.badge.safe { background: var(--safe-soft); color: var(--safe); }
.badge.contains { background: var(--danger-soft); color: var(--danger); }
.badge.unverified { background: var(--warn-soft); color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); border-radius: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer; width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { width: auto; padding: 8px 12px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.input { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 12px; font: inherit; }
.search { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 0 10px; }

.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; }
.stat b { display: block; font-size: 1.3rem; }
.stat span { font-size: .8rem; color: var(--muted); }

.item { padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .price { font-weight: 600; white-space: nowrap; }
.item .desc { color: var(--muted); font-size: .9rem; margin: 2px 0 6px; }

.notice { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: .9rem; margin-bottom: 12px; }
.notice.ok { background: var(--safe-soft); color: var(--safe); }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 32px 8px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); display: flex; z-index: 10; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; }
.tabs a.on { color: var(--brand); font-weight: 600; }
.tabs svg { width: 24px; height: 24px; }

.qr { display: block; margin: 12px auto; width: 220px; height: 220px; border-radius: 12px; background: #fff; padding: 8px; }
.cardface { background: linear-gradient(135deg, var(--brand), #115e59); color: #fff; border-radius: 18px; padding: 18px; }
.cardface h2 { color: #fff; margin: 0 0 4px; }
.cardface .chip { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }
.sev { font-size: .75rem; opacity: .85; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 10px; font-size: .8rem; cursor: pointer; }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.skeleton { height: 88px; border-radius: var(--radius); background: linear-gradient(90deg, var(--line), var(--surface), var(--line)); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
