/* ==========================================================================
   UTL Scanner — California Unflavored Tobacco List
   Design: a counter instrument, not a landing page. Hairlines, one accent,
   colour reserved exclusively for verdicts.
   ========================================================================== */

:root {
  --bg:        #f2f2ef;
  --surface:   #ffffff;
  --surface-2: #fafaf8;
  --ink:       #101317;
  --ink-2:     #565f6b;
  --ink-3:     #8b939d;
  --line:      #e4e3de;
  --line-2:    #ededea;

  --ok:        #0c7346;
  --ok-bg:     #e8f4ed;
  --ok-line:   #c3e2d0;

  --warn:      #8a5200;
  --warn-bg:   #fdf3e2;
  --warn-line: #f0dbb2;

  --bad:       #b3261e;
  --bad-bg:    #fceceb;
  --bad-line:  #f4cac6;

  --accent:    #101317;
  --accent-ink:#ffffff;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --shadow-1: 0 1px 2px rgba(16,19,23,.05);
  --shadow-2: 0 12px 40px -12px rgba(16,19,23,.18), 0 2px 8px rgba(16,19,23,.05);
  --shadow-3: 0 -18px 60px -20px rgba(16,19,23,.28);

  --ease: cubic-bezier(.2,.8,.2,1);
  --gut: 18px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #08090a;
    --surface:   #131518;
    --surface-2: #171a1e;
    --ink:       #f1f2f4;
    --ink-2:     #a3aab4;
    --ink-3:     #737b85;
    --line:      #24272c;
    --line-2:    #1c1f23;

    --ok:        #5cd68f;
    --ok-bg:     #0d1f16;
    --ok-line:   #1d4632;

    --warn:      #f0b429;
    --warn-bg:   #1f1810;
    --warn-line: #47351a;

    --bad:       #ff8175;
    --bad-bg:    #200f0e;
    --bad-line:  #4d2320;

    --accent:    #f1f2f4;
    --accent-ink:#0a0b0d;

    --shadow-1: 0 1px 2px rgba(0,0,0,.5);
    --shadow-2: 0 16px 50px -16px rgba(0,0,0,.8);
    --shadow-3: 0 -18px 60px -20px rgba(0,0,0,.9);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:        #08090a;
  --surface:   #131518;
  --surface-2: #171a1e;
  --ink:       #f1f2f4;
  --ink-2:     #a3aab4;
  --ink-3:     #737b85;
  --line:      #24272c;
  --line-2:    #1c1f23;
  --ok:        #5cd68f;  --ok-bg:   #0d1f16;  --ok-line:  #1d4632;
  --warn:      #f0b429;  --warn-bg: #1f1810;  --warn-line:#47351a;
  --bad:       #ff8175;  --bad-bg:  #200f0e;  --bad-line: #4d2320;
  --accent:    #f1f2f4;  --accent-ink:#0a0b0d;
  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 16px 50px -16px rgba(0,0,0,.8);
  --shadow-3: 0 -18px 60px -20px rgba(0,0,0,.9);
  color-scheme: dark;
}

/* --------------------------------------------------------------- reset --- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 100%; height: 100%; display: block; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --------------------------------------------------------------- shell --- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 580px;
  margin: 0 auto;
  background: var(--bg);
  isolation: isolate;
}

@media (min-width: 640px) {
  body { background: var(--surface-2); }
  .app {
    height: calc(100dvh - 48px);
    margin: 24px auto;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--shadow-2);
    background: var(--bg);
  }
}

/* -------------------------------------------------------------- topbar --- */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gut) 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
  z-index: 5;
}
.app.scrolled .topbar { border-bottom-color: var(--line); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.mark {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 7px;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b {
  font-size: 15px; font-weight: 640; letter-spacing: -.015em; line-height: 1.2;
}
.brand-text small {
  font-size: 11px; color: var(--ink-3); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  flex: none;
  width: 36px; height: 36px; padding: 8px;
  border-radius: 10px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: color .15s, border-color .15s, transform .12s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* --------------------------------------------------------------- views --- */
.view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  animation: view-in .22s var(--ease);
}
.view.is-active { display: flex; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ scan stage --- */
.stage {
  position: relative;
  flex: none;
  margin: 4px var(--gut) 0;
  height: min(42dvh, 340px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #0c0d0f;
  border: 1px solid var(--line);
}

.stage video, .stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.stage video { opacity: 0; transition: opacity .4s var(--ease); }
.stage.ready video { opacity: 1; }

/* no camera: stop pretending — shrink the dead viewport and give the space
   to the result card and the manual entry path */
.stage.no-camera {
  flex: 1 1 auto;
  height: auto;
  min-height: 152px;
  max-height: none;
  background: var(--surface-2);
  border-style: dashed;
  border-color: var(--line);
}
.stage.no-camera .reticle,
.stage.no-camera .stage-hint,
.stage.no-camera .live-pill { display: none; }
.stage.no-camera .stage-state {
  background: transparent;
  color: var(--ink-2);
}
.stage.no-camera .cam-icon { color: var(--ink-3); opacity: .55; }
.stage.no-camera #camera-msg { color: var(--ink-2); }
.stage.no-camera .btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

/* let the placeholder absorb the slack instead of the result column */
#view-scan.no-cam .scan-body { flex: 0 1 auto; }

.stage-grid {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
}
.stage.ready .stage-grid { opacity: 1; }

.reticle {
  position: relative;
  width: min(74%, 300px);
  aspect-ratio: 1.9 / 1;
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.30);
}
.reticle .c {
  position: absolute;
  width: 26px; height: 26px;
  border: 2.5px solid rgba(255,255,255,.95);
}
.reticle .tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.reticle .tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.reticle .bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.reticle .br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }

.laser {
  position: absolute;
  left: 12px; right: 12px; top: 20%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent);
  box-shadow: 0 0 12px rgba(255,255,255,.55);
  animation: sweep 2.6s var(--ease) infinite;
}
@keyframes sweep {
  0%, 100% { top: 18%; opacity: .35; }
  50%      { top: 80%; opacity: 1; }
}

.stage-hint {
  position: absolute;
  bottom: 14px;
  font-size: 12px;
  font-weight: 520;
  letter-spacing: .01em;
  color: rgba(255,255,255,.72);
}

.stage-top {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  display: flex; align-items: flex-start; justify-content: space-between;
}

.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: rgba(255,255,255,.92);
  background: rgba(0,0,0,.44);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.14);
}
.live-pill i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74,222,128,.22);
  animation: pulse 2s ease-in-out infinite;
}
.live-pill.off i { background: var(--ink-3); box-shadow: none; animation: none; }
@keyframes pulse { 50% { opacity: .35; } }

.round-btn {
  width: 34px; height: 34px; padding: 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0,0,0,.44);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
  transition: transform .12s var(--ease), background .15s;
}
.round-btn:active { transform: scale(.94); }
.round-btn[aria-pressed="true"] { background: rgba(255,255,255,.92); color: #0c0d0f; }

/* camera unavailable state */
.stage-state {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(120% 100% at 50% 0%, #1b1e22 0%, #0c0d0f 70%);
  color: rgba(255,255,255,.86);
  z-index: 2;
  transition: opacity .3s var(--ease), visibility .3s;
}
.stage.ready .stage-state { opacity: 0; visibility: hidden; }

.stage-state-inner { display: grid; justify-items: center; gap: 12px; max-width: 260px; }
.cam-icon { width: 30px; height: 30px; opacity: .45; }
#camera-msg { font-size: 13px; line-height: 1.5; color: rgba(255,255,255,.72); }

/* -------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-size: 14.5px; font-weight: 590; letter-spacing: -.005em;
  border: 1px solid transparent;
  transition: transform .12s var(--ease), background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn-solid  { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-1); }
.btn-solid:hover { opacity: .9; }

.btn-outline {
  background: var(--surface); color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover { border-color: var(--ink-3); }
.btn-outline[aria-pressed="true"] {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}

.btn-ghost {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-color: rgba(255,255,255,.2);
}
.btn.small { height: 34px; font-size: 12.5px; padding: 0 12px; border-radius: 9px; }
.btn.wide { width: 100%; }

.link-btn {
  font-size: 12.5px; font-weight: 560; color: var(--ink-2);
  padding: 4px 2px; border-radius: 4px;
}
.link-btn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--bad); }

/* ------------------------------------------------------------ scan body --- */
.scan-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px var(--gut) calc(env(safe-area-inset-bottom) + 84px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-slot { display: flex; flex-direction: column; }

.empty-card {
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  background: var(--surface-2);
}
.empty-card.pad { margin-top: 8px; }
.empty-title { font-size: 13.5px; font-weight: 600; }
.empty-body { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }

/* verdict card */
.verdict {
  position: relative;
  border-radius: var(--r-md);
  padding: 16px 16px 15px 19px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  animation: verdict-in .28s var(--ease);
}
@keyframes verdict-in {
  from { opacity: 0; transform: translateY(6px) scale(.995); }
  to   { opacity: 1; transform: none; }
}
.verdict::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ink-3);
}
.verdict.ok   { background: var(--ok-bg);   border-color: var(--ok-line);   --v: var(--ok); }
.verdict.ok::before   { background: var(--ok); }
.verdict.warn { background: var(--warn-bg); border-color: var(--warn-line); --v: var(--warn); }
.verdict.warn::before { background: var(--warn); }
.verdict.bad  { background: var(--bad-bg);  border-color: var(--bad-line);  --v: var(--bad); }
.verdict.bad::before  { background: var(--bad); }

.verdict.gone {
  background: var(--bad-bg);
  border-color: var(--bad-line);
  border-width: 1px;
  --v: var(--bad);
}
.verdict.gone::before { background: var(--bad); width: 4px; }
.verdict.gone .verdict-label { color: var(--bad); }

/* tinted surfaces need tinted type or the grey body copy goes muddy */
.verdict.ok .verdict-sub,
.verdict.ok .verdict-note,
.verdict.warn .verdict-sub,
.verdict.warn .verdict-note,
.verdict.bad .verdict-sub,
.verdict.bad .verdict-note,
.verdict.gone .verdict-sub,
.verdict.gone .verdict-note {
  color: color-mix(in srgb, var(--v) 26%, var(--ink));
}
.verdict.ok details.exempt li,
.verdict.warn details.exempt li,
.verdict.bad details.exempt li,
.verdict.gone details.exempt li,
.verdict.ok details.exempt summary,
.verdict.warn details.exempt summary,
.verdict.bad details.exempt summary,
.verdict.gone details.exempt summary { color: color-mix(in srgb, var(--v) 22%, var(--ink)); }

.verdict-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .085em; text-transform: uppercase;
  color: var(--ink-2);
}
.verdict.ok   .verdict-label { color: var(--ok); }
.verdict.warn .verdict-label { color: var(--warn); }
.verdict.bad  .verdict-label { color: var(--bad); }

.verdict-label .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.verdict-name {
  margin-top: 9px;
  font-size: 19px; font-weight: 640; letter-spacing: -.02em; line-height: 1.25;
  text-wrap: balance;
}
.verdict-sub {
  margin-top: 5px;
  font-size: 13px; color: var(--ink-2); line-height: 1.45;
}

.verdict-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
}
.code-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
  padding: 5px 9px; border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}
.tag {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 5px;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.verdict-actions { margin-top: 13px; display: flex; gap: 8px; }
.verdict-actions .btn { height: 38px; font-size: 13px; padding: 0 13px; border-radius: 10px; }

.verdict-note {
  margin-top: 12px;
  font-size: 12.5px; line-height: 1.5;
  color: var(--ink-2);
}
.verdict-note b { color: var(--ink); font-weight: 620; }

details.exempt {
  margin-top: 11px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  padding-top: 10px;
}
details.exempt summary {
  font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink-2);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
details.exempt summary::-webkit-details-marker { display: none; }
details.exempt summary::before {
  content: ""; width: 5px; height: 5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .18s var(--ease);
  margin-right: 2px;
}
details.exempt[open] summary::before { transform: rotate(45deg); }
details.exempt ul { margin-top: 9px; display: grid; gap: 7px; }
details.exempt li {
  font-size: 12.25px; line-height: 1.5; color: var(--ink-2);
  padding-left: 13px; position: relative;
}
details.exempt li::before {
  content: ""; position: absolute; left: 0; top: 6.5px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3);
}

/* ----------------------------------------------------------- scan action --- */
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

/* --------------------------------------------------------------- audit --- */
.audit-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 15px;
}

.recent {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 15px;
}
.recent .section-head { margin-bottom: 6px; }

.scan-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 2px 2px;
  font-size: 11px; color: var(--ink-3);
  border-top: 1px solid var(--line-2);
}
.scan-foot .link-btn { font-size: 11px; color: var(--ink-2); }
.section-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 11px;
}
.section-head h2 {
  font-size: 13px; font-weight: 680; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink);
}
.section-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.4; }
.section-actions { display: flex; gap: 10px; }

.audit-stats { display: flex; gap: 18px; padding: 2px 0 12px; }
.audit-stat { display: flex; flex-direction: column; gap: 2px; }
.audit-stat b {
  font-size: 20px; font-weight: 650; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.audit-stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.audit-stat.bad b { color: var(--bad); }

.audit-list { display: grid; gap: 1px; border-top: 1px solid var(--line-2); }
.audit-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 12.5px;
}
.audit-item:last-child { border-bottom: 0; }
.audit-item .bullet { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink-3); }
.audit-item.ok .bullet { background: var(--ok); }
.audit-item.bad .bullet { background: var(--bad); }
.audit-item.warn .bullet { background: var(--warn); }
.audit-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-item .cd { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* --------------------------------------------------------------- search --- */
.search-head {
  flex: none;
  padding: 4px var(--gut) 10px;
  display: grid; gap: 11px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 3;
}

.field {
  position: relative;
  display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 6%, transparent);
}
.field-icon { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.field input {
  flex: 1; height: 100%;
  padding: 0 40px 0 38px;
  border: 0; background: none;
  font-size: 15px; letter-spacing: -.01em;
  outline: none;
  appearance: none;
}
.field input::-webkit-search-cancel-button { display: none; }
.field input::placeholder { color: var(--ink-3); }
.field-clear {
  position: absolute; right: 8px;
  width: 26px; height: 26px; padding: 6px;
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--line);
}

.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 560;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all .15s var(--ease);
}
.chip[aria-pressed="true"] {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}

.search-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px var(--gut) calc(env(safe-area-inset-bottom) + 88px);
}

.result-meta {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 6px 2px 10px;
}

.rows { display: grid; }
.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line-2);
  text-align: left;
  transition: background .12s;
}
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-name {
  font-size: 14px; font-weight: 560; letter-spacing: -.011em; line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row-sub {
  margin-top: 3px;
  font-size: 12px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-pack {
  font-size: 11px; color: var(--ink-2);
  padding: 2px 7px; border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.mini-flag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ok);
}
.mini-flag.warn { color: var(--warn); }

/* --------------------------------------------------------------- alerts --- */
.scroll-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px var(--gut) calc(env(safe-area-inset-bottom) + 88px);
  display: flex; flex-direction: column; gap: 26px;
}

.block { display: flex; flex-direction: column; }

.notice-list {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.notice-list li + li { border-top: 1px solid var(--line-2); }

.notice-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  transition: background .12s;
}
.notice-row:hover { background: var(--surface-2); }
.notice-row .n-date {
  flex: none; width: 58px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.notice-row .n-type {
  flex: 1;
  font-size: 12.5px; font-weight: 560;
  color: var(--ink-2);
}
.notice-row.rem .n-type { color: var(--bad); font-weight: 640; }
.notice-row.resc .n-type { color: var(--warn); font-weight: 640; }
.notice-row .n-ic { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.notice-row:hover .n-ic { color: var(--ink); }
.notice-row.rem .n-ic { color: var(--bad); }

.note-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.note-row + .note-row { margin-top: 8px; }
.note-row svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--ink-3); }
.note-row p { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.note-row p b { color: var(--ink); font-weight: 620; }
.note-row.danger { border-color: var(--bad-line); background: var(--bad-bg); }
.note-row.danger svg { color: var(--bad); }
.note-row.danger p b { color: var(--bad); }

.diff-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 15px;
  margin-bottom: 10px;
}
.diff-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.diff-head b { font-size: 13px; font-weight: 620; letter-spacing: -.01em; }
.diff-head span { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.diff-counts { display: flex; gap: 16px; }
.diff-count { display: flex; align-items: baseline; gap: 6px; }
.diff-count b { font-size: 17px; font-weight: 660; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.diff-count span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; }
.diff-count.bad b { color: var(--bad); }
.diff-count.ok b { color: var(--ok); }

.diff-list { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 4px; }
.diff-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; font-size: 12.5px;
  border-bottom: 1px solid var(--line-2);
}
.diff-item:last-child { border-bottom: 0; }
.diff-item .bullet { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.diff-item.add .bullet { background: var(--ok); }
.diff-item.rem .bullet { background: var(--bad); }
.diff-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- about --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stat-cell {
  background: var(--surface);
  padding: 13px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-cell b {
  font-size: 19px; font-weight: 660; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-cell span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; }

.fineprint {
  font-size: 11px; line-height: 1.55; color: var(--ink-3);
  margin-top: 10px;
}

.legend { display: grid; gap: 1px; background: var(--line-2); border-radius: var(--r-md); overflow: hidden; }
.legend-row {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface); padding: 13px 14px;
}
.legend-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.legend-row b { font-size: 13px; font-weight: 620; letter-spacing: -.01em; }
.legend-row p { font-size: 12.25px; line-height: 1.5; color: var(--ink-2); margin-top: 2px; }

.checks { display: grid; gap: 10px; }
.checks li {
  position: relative;
  padding-left: 14px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
}
.checks li::before {
  content: "";
  position: absolute; left: 0; top: 6.5px;
  width: 5px; height: 5px;
  border-radius: 50%; background: var(--ink-3);
}
.checks li b { color: var(--ink); font-weight: 610; }

.link-stack {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.row-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px; font-weight: 540;
  transition: background .12s;
}
.row-link:last-child { border-bottom: 0; }
.row-link:hover { background: var(--surface-2); }
.row-link small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 450; margin-top: 2px; }
.row-link svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); }

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 13px 14px;
}
.callout b { font-size: 12.5px; font-weight: 650; }
.callout p { font-size: 12px; line-height: 1.55; color: var(--ink-2); margin-top: 5px; }

/* --------------------------------------------------------------- tabbar --- */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 8px calc(env(safe-area-inset-bottom) + 7px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  z-index: 6;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px;
  color: var(--ink-3);
  border-radius: 10px;
  transition: color .15s var(--ease), transform .12s var(--ease);
}
.tab svg { width: 21px; height: 21px; }
.tab span { font-size: 10px; font-weight: 580; letter-spacing: .005em; }
.tab.is-active { color: var(--ink); }
.tab.is-active span { font-weight: 650; }
.tab:active { transform: scale(.95); }

/* ---------------------------------------------------------------- sheet --- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none; }

.sheet-scrim {
  position: absolute; inset: 0;
  background: rgba(8,9,10,.42);
  backdrop-filter: blur(2px);
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }

.sheet {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 20px calc(env(safe-area-inset-bottom) + 22px);
  box-shadow: var(--shadow-3);
  animation: sheet-up .3s var(--ease);
}
@media (min-width: 640px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: var(--r-xl); max-width: 440px; animation: pop-in .24s var(--ease); }
  @keyframes pop-in { from { opacity: 0; transform: scale(.97); } }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

.sheet-grip {
  width: 36px; height: 4px; border-radius: 99px;
  background: var(--line);
  margin: 6px auto 16px;
}
@media (min-width: 640px) { .sheet-grip { display: none; } }

.sheet h2 { font-size: 18px; font-weight: 660; letter-spacing: -.02em; }
.sheet-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

.code-input {
  width: 100%; height: 58px;
  margin-top: 16px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 21px; letter-spacing: .06em; text-align: center;
  outline: none;
}
.code-input:focus { border-color: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 6%, transparent); }

.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }

/* detail sheet contents */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title { font-size: 18px; font-weight: 650; letter-spacing: -.02em; line-height: 1.28; text-wrap: balance; }
.detail-mfr { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.detail-table { margin-top: 16px; border-top: 1px solid var(--line); }
.detail-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.detail-row dt { color: var(--ink-3); font-size: 12px; }
.detail-row dd { margin: 0; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; }
.detail-row dd.empty { color: var(--ink-3); font-family: var(--font); font-size: 12px; }

/* ---------------------------------------------------------------- misc --- */
.hidden { display: none !important; }

.scrollable::-webkit-scrollbar { width: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (min-width: 640px) {
  .tabbar { border-radius: 0 0 var(--r-xl) var(--r-xl); }
}


/* -------------------------------------------------------------------- pwa --- */

/* the tool must not look current when it is running on stored data */
.offline-bar {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 8px var(--gut);
  font-size: 11.5px; font-weight: 560; letter-spacing: -.005em;
  color: var(--warn);
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
}
.offline-bar[hidden] { display: none; }
.offline-bar svg { width: 14px; height: 14px; flex: none; }

#install-block[hidden] { display: none; }

.install-card {
  display: grid; gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.install-card p { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.install-card b { color: var(--ink); font-weight: 620; }
.install-card .btn { width: 100%; height: 44px; }
.install-card .btn[hidden] { display: none; }
