/* SkinCareLens: soft clinical light. Tokens first (docs/BRAND.md lists the same
   hexes; ui_test.go checks their contrast), then base, components, app pages.
   Spacing is an 8px scale: --s1 8, --s2 16, --s3 24, --s4 32, --s6 48, --s8 64
   (and --s0 4 for the tightest gaps). One elevation (--lift) for floating things. */

:root {
  --bg: #f8f6f4;
  --surface: #ffffff;
  --sunken: #f2efec;
  --paper: #fffdf8;
  --pen-match: #f7c9d6;
  --pen-watch: #fbd8b0;
  --sage: #edf3ee;
  --blush: #f9eff1;
  --ink: #211c22;
  --muted: #5d535f;
  --faint: #6a606d;
  --line: #e8e3e3;
  --field-line: #8a7f8d;
  --accent: #6a2858;
  --accent-hover: #521e44;
  --accent-ink: #ffffff;
  --accent-soft: #f4e9f1;
  --danger: #a3234a;
  --danger-soft: #fbe9ee;
  /* verdicts: ink on tint. None is green; none is a tick. */
  --v-match: #a3234a;       --v-match-bg: #fbe9ee;
  --v-watch: #8f4a10;       --v-watch-bg: #fcefe2;
  --v-none: #33404c;        --v-none-bg: #ebeff2;
  --v-incomplete: #7a5600;  --v-incomplete-bg: #fbf1cf;
  --v-cannot: #4d4a50;      --v-cannot-bg: #eeedee;
  --lift: 0 1px 2px rgba(33, 28, 34, .06), 0 12px 32px rgba(33, 28, 34, .10);
  --s0: 4px; --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px; --s8: 64px;
  --r-card: 16px; --r-ctl: 12px; --r-pill: 999px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151116; --surface: #1e191f; --sunken: #191519; --sage: #1a231d; --blush: #2a1b21; --paper: #241e25; --pen-match: #6c2c3e; --pen-watch: #6a4318;
    --ink: #f4eef3; --muted: #bdb2bc; --faint: #a79ca7; --line: #342c35; --field-line: #8f8492;
    --accent: #e6a8d3; --accent-hover: #f0c0e1; --accent-ink: #2b0f24; --accent-soft: #302030;
    --danger: #ff9db4; --danger-soft: #3b1b26;
    --v-match: #ffa3b8;      --v-match-bg: #3b1b26;
    --v-watch: #ffbf8c;      --v-watch-bg: #3a2514;
    --v-none: #c4ced6;       --v-none-bg: #252c32;
    --v-incomplete: #f1cd6c; --v-incomplete-bg: #352c10;
    --v-cannot: #c3bec6;     --v-cannot-bg: #2b282d;
    --lift: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151116; --surface: #1e191f; --sunken: #191519; --sage: #1a231d; --blush: #2a1b21; --paper: #241e25; --pen-match: #6c2c3e; --pen-watch: #6a4318;
  --ink: #f4eef3; --muted: #bdb2bc; --faint: #a79ca7; --line: #342c35; --field-line: #8f8492;
  --accent: #e6a8d3; --accent-hover: #f0c0e1; --accent-ink: #2b0f24; --accent-soft: #302030;
  --danger: #ff9db4; --danger-soft: #3b1b26;
  --v-match: #ffa3b8;      --v-match-bg: #3b1b26;
  --v-watch: #ffbf8c;      --v-watch-bg: #3a2514;
  --v-none: #c4ced6;       --v-none-bg: #252c32;
  --v-incomplete: #f1cd6c; --v-incomplete-bg: #352c10;
  --v-cannot: #c3bec6;     --v-cannot-bg: #2b282d;
  --lift: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1.0625rem/1.55 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; overflow-x: hidden;
}
h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.375rem); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.35; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s2); top: -64px; background: var(--surface); padding: var(--s1) var(--s2); border-radius: var(--r-ctl); z-index: 100; border: 1px solid var(--line); }
.skip-link:focus { top: var(--s1); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .9375rem; }
.tiny { font-size: .8125rem; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875em; }
.serif { font-family: var(--serif); }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i.sm { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- layout primitives */
.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--s2); }
.wrap.narrow { max-width: 704px; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.stack > * { min-width: 0; }
.stack.sm { gap: var(--s1); }
.stack.md { gap: var(--s2); }
.stack.lg { gap: var(--s4); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.row.tight { gap: var(--s0) var(--s1); }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 0; min-width: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s2); }

/* ---------- top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: var(--s3); height: 64px; }
.brand { display: inline-flex; align-items: center; gap: var(--s1); font-family: var(--serif); font-weight: 600; font-size: 1.1875rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.brand-mark .i { width: 20px; height: 20px; stroke-width: 1.6; }
.topnav { display: none; gap: var(--s0); margin-left: var(--s1); }
.topnav a { padding: var(--s1) 12px; border-radius: var(--r-pill); color: var(--muted); text-decoration: none; font-size: .9375rem; font-weight: 500; }
.topnav a:hover { color: var(--ink); background: var(--sunken); }
.topnav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.btn.topbar-scan { display: none; }
.account { position: relative; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .875rem; cursor: pointer; }
.avatar:hover { border-color: var(--field-line); }
.menu { position: absolute; right: 0; top: calc(100% + var(--s1)); min-width: 248px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--lift); padding: var(--s1); z-index: 40; }
.menu .who { padding: var(--s1) 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: var(--s1); display: flex; flex-direction: column; font-size: .9375rem; }
.menu .who span { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.menu a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 12px; border-radius: var(--r-ctl); color: var(--ink); text-decoration: none; font-size: .9375rem; }
.menu a:hover { background: var(--sunken); }
.menu a .muted { font-size: .875rem; }
.menu .m-only { display: flex; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: var(--s0) var(--s1) calc(var(--s0) + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--s1) 0; border-radius: var(--r-ctl); color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar .tab-scan .disc { display: grid; place-items: center; width: 48px; height: 40px; margin-top: -16px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); border: 4px solid var(--bg); box-sizing: content-box; }
.tabbar .tab-scan { color: var(--ink); }
body.has-tabbar main { padding-bottom: 96px; }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .btn.topbar-scan { display: inline-flex; }
  .tabbar { display: none; }
  .menu .m-only { display: none; }
  body.has-tabbar main { padding-bottom: 0; }
}
@media (min-width: 640px) { .wrap { padding-inline: var(--s3); } }

main { padding-block: var(--s4) var(--s8); outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s2); }
.page-head .lede { color: var(--muted); margin-top: var(--s0); }
.back { display: inline-flex; align-items: center; gap: var(--s0); font-size: .9375rem; color: var(--muted); text-decoration: none; margin-bottom: var(--s1); }
.back:hover { color: var(--ink); }
.back .i { transform: rotate(180deg); width: 16px; height: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: var(--s0) var(--s1); align-items: center; color: var(--muted); font-size: .9375rem; margin-top: var(--s1); }
.meta > * + *::before { content: "·"; margin-right: var(--s1); color: var(--faint); }

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s3); }
.card.tight { padding: var(--s2); }
.card.sage { background: var(--sage); border-color: transparent; }
.card.blush { background: var(--blush); border-color: transparent; }
.card > h2, .section-h { margin-bottom: var(--s2); }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.section-h h2 { font-size: 1.25rem; }
.divided > * + * { border-top: 1px solid var(--line); }

/* ---------- controls */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); min-height: 44px; padding: 0 20px; border: 1px solid var(--field-line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9375rem; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--sunken); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: var(--surface); }
.btn.sm { min-height: 36px; padding: 0 16px; font-size: .875rem; }
.btn.lg { min-height: 52px; padding: 0 var(--s3); font-size: 1rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn:not(.primary)[aria-busy="true"]::after { border-color: var(--accent); border-right-color: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn.sm { width: 36px; height: 36px; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: var(--s1); }
.field > label, .label { font-weight: 600; font-size: .9375rem; }
.input { width: 100%; min-height: 48px; padding: 12px var(--s2); border: 1px solid var(--field-line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); }
textarea.input { resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.field.invalid .input { border-color: var(--danger); }
.hint { color: var(--muted); font-size: .875rem; }
.err { color: var(--danger); font-size: .875rem; }
.err:empty { display: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: var(--s1); cursor: pointer; font-size: .9375rem; }
.check input:not(.switch), .acheck input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.check .switch, .switch { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--field-line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); top: 3px; left: 3px; transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

/* segmented control */
.seg { display: inline-flex; padding: var(--s0); gap: 2px; border-radius: var(--r-pill); background: var(--sunken); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg > button, .seg > label { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font-weight: 600; font-size: .9375rem; cursor: pointer; white-space: nowrap; }
.seg > button:hover, .seg > label:hover { color: var(--ink); }
.seg > button[aria-pressed="true"], .seg > label:has(input:checked) { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--line); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg > label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.seg .n { font-variant-numeric: tabular-nums; font-weight: 500; opacity: .85; }
.seg.block { display: flex; }
.seg.block > * { flex: 1; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--s0) var(--s1); }
.chip { display: inline-flex; align-items: center; gap: var(--s0); padding: 2px 12px; border-radius: var(--r-pill); background: var(--sunken); color: var(--muted); font-size: .8125rem; font-weight: 500; border: 0; line-height: 1.6; }
button.chip { cursor: pointer; min-height: 36px; padding: 0 16px; font-size: .875rem; border: 1px solid var(--line); background: var(--surface); }
button.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip .x { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: -8px; border: 0; background: transparent; color: inherit; cursor: pointer; border-radius: 50%; }
.chip .i { width: 14px; height: 14px; }

/* verdict chip and flag chip: colour and shape both carry meaning */
.vchip { display: inline-flex; align-items: center; gap: var(--s1); padding: 4px 12px 4px 8px; border-radius: var(--r-pill); font-size: .875rem; font-weight: 600; line-height: 1.4; background: var(--vbg); color: var(--vfg); border: 1.5px solid transparent; }
.vchip .i { width: 18px; height: 18px; }
.v-matches_avoid { --vfg: var(--v-match); --vbg: var(--v-match-bg); }
.v-watch { --vfg: var(--v-watch); --vbg: var(--v-watch-bg); }
.v-no_matches_found { --vfg: var(--v-none); --vbg: var(--v-none-bg); }
.v-no_matches_incomplete { --vfg: var(--v-incomplete); --vbg: var(--v-incomplete-bg); }
.v-cannot_assess { --vfg: var(--v-cannot); --vbg: var(--v-cannot-bg); }
.vchip.v-no_matches_incomplete, .vchip.v-cannot_assess { border-style: dashed; border-color: var(--vfg); }
.vchip.v-no_matches_found { border-color: var(--vfg); }
.vchip.v-watch .i { stroke-width: 2; }
.fchip { display: inline-flex; align-items: center; gap: var(--s0); padding: 2px 12px 2px 8px; border-radius: var(--r-pill); font-size: .8125rem; font-weight: 600; background: var(--vbg); color: var(--vfg); }
.fchip .i { width: 14px; height: 14px; }
.fchip.match { --vfg: var(--v-match); --vbg: var(--v-match-bg); }
.fchip.watch { --vfg: var(--v-watch); --vbg: var(--v-watch-bg); }
.fchip.unk { --vfg: var(--v-cannot); --vbg: var(--v-cannot-bg); border: 1px dashed var(--v-cannot); }

/* ---------- notices, empty, skeleton, toasts, dialog */
.banner { display: flex; align-items: center; gap: var(--s2); padding: 12px var(--s2); border-radius: var(--r-ctl); background: var(--v-incomplete-bg); color: var(--ink); border: 1px dashed var(--v-incomplete); font-size: .9375rem; margin-bottom: var(--s3); }
.banner .i { color: var(--v-incomplete); }
.banner.bad { background: var(--danger-soft); border: 1px solid var(--danger); }
.banner.info { background: var(--accent-soft); border: 1px solid transparent; }
.banner.info .i { color: var(--accent); }
.banner:empty { display: none; }
#banners:empty { display: none; }
.empty { text-align: center; padding: var(--s6) var(--s2); display: flex; flex-direction: column; align-items: center; gap: var(--s1); }
.empty .big { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s1); }
.empty .big .i { width: 28px; height: 28px; }
.empty p { color: var(--muted); max-width: 44ch; }
.empty .btn { margin-top: var(--s1); }
.skel { border-radius: var(--r-ctl); background: linear-gradient(90deg, var(--sunken), var(--line), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skel.line { height: 16px; } .skel.block { height: 120px; } .skel.row { height: 56px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toasts { position: fixed; z-index: 70; right: var(--s2); left: var(--s2); bottom: calc(88px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--s1); align-items: flex-end; pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: var(--s3); right: var(--s3); left: auto; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s2); max-width: 420px; padding: 12px var(--s2); border-radius: var(--r-ctl); background: var(--ink); color: var(--bg); box-shadow: var(--lift); font-size: .9375rem; }
.toast a { color: inherit; font-weight: 600; }
.toast .x { border: 0; background: transparent; color: inherit; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; }
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(21, 17, 22, .55); display: grid; place-items: end center; padding: 0; }
.dialog { background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: var(--r-card) var(--r-card) 0 0; padding: var(--s3); box-shadow: var(--lift); }
.dialog.wide { max-width: 640px; }
.dialog .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s1); margin-top: var(--s3); }
.secret { display: flex; gap: var(--s1); align-items: center; padding: 12px; border-radius: var(--r-ctl); background: var(--sunken); font-family: ui-monospace, Menlo, monospace; font-size: .875rem; overflow-wrap: anywhere; }
@media (min-width: 640px) { .scrim { place-items: center; padding: var(--s2); } .dialog { border-radius: var(--r-card); } }

/* ---------- list rows (reports, products) */
.rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.item { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); }
.item + .item { border-top: 1px solid var(--line); }
.item-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.item-title:hover { color: var(--accent); text-decoration: underline; }
.item-sub { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s0); text-align: right; }
.item .check input { width: 22px; height: 22px; }
.clamp1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.clamp2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 639px) {
  .item { flex-wrap: wrap; padding: var(--s2); }
  .item-side { flex-direction: row; align-items: center; flex-wrap: wrap; text-align: left; width: 100%; padding-left: 0; justify-content: flex-start; order: 3; }
}
.selbar { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: 12px var(--s2); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r-card); box-shadow: var(--lift); margin-top: var(--s2); }
@media (min-width: 900px) { .selbar { bottom: var(--s3); } }
.filters { display: grid; gap: var(--s2); grid-template-columns: 1fr; }
@media (min-width: 640px) { .filters { grid-template-columns: 1fr 1fr; } }

/* ---------- overview */
.hero-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); background: var(--sage); border-radius: var(--r-card); padding: var(--s4) var(--s3); }
.hero-act p { color: var(--muted); margin-top: var(--s0); }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure b { font-family: var(--serif); font-size: 2rem; line-height: 1.1; font-weight: 600; }
.figure span { color: var(--muted); font-size: .875rem; }
.cols { display: grid; gap: var(--s3); }
@media (min-width: 900px) { .cols { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.hbars li { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s1) 0; font-size: .9375rem; }
.hbars li + li { border-top: 1px solid var(--line); }
.spark { width: 100%; height: 48px; color: var(--accent); display: block; }

/* ---------- scan */
.scan-card { display: flex; flex-direction: column; gap: var(--s3); }
.drop { display: flex; flex-direction: column; align-items: center; gap: var(--s2); text-align: center; padding: var(--s4) var(--s2); border: 1.5px dashed var(--field-line); border-radius: var(--r-card); background: var(--sunken); }
.frame { position: relative; display: inline-block; padding: var(--s1); }
.frame > i { position: absolute; width: 20px; height: 20px; border: 3px solid var(--accent); }
.frame .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.frame .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.frame .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.frame .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.frame img { display: block; max-height: 260px; border-radius: 6px; }
.price { color: var(--muted); font-size: .9375rem; }
.progress { text-align: center; align-items: center; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s6) var(--s3); }
.bar { width: 100%; max-width: 360px; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar.indet > i { width: 40%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.found { padding: var(--s2); border-radius: var(--r-ctl); background: var(--sunken); }

/* camera */
.vf { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: min(64vh, calc(100dvh - 400px)); min-height: 260px; margin-inline: auto; background: #0e0b0f; border-radius: var(--r-card); overflow: hidden; }
.vf-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vf-frame { position: absolute; inset: 10% 8%; pointer-events: none; }
.vf-frame.wide { inset: 32% 8%; }
.vf-frame > i { position: absolute; width: 28px; height: 28px; border: 3px solid #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,.5)); }
.vf-frame .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.vf-frame .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.vf-frame .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.vf-frame .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.vf-hint { position: absolute; left: var(--s2); right: var(--s2); bottom: var(--s2); margin: 0; padding: 6px 12px; border-radius: var(--r-pill); background: rgba(14, 11, 15, .72); color: #fff; font-size: .875rem; text-align: center; }
.vf-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s2); }
.vf-controls > :last-child { justify-self: end; }
.vf-controls .btn { white-space: nowrap; padding: 0 12px; }
.vf-controls .short { display: none; }
@media (max-width: 479px) { .vf-controls .long { display: none; } .vf-controls .short { display: inline; } }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid var(--accent); background: transparent; padding: 4px; cursor: pointer; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--accent); transition: transform .1s; }
.shutter:active span { transform: scale(.88); }
.icon-btn.light { background: var(--sunken); color: var(--ink); }
.icon-btn.light[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.crop { position: relative; display: block; width: 100%; max-width: 560px; margin-inline: auto; overflow: hidden; border-radius: var(--r-ctl); background: #0e0b0f; touch-action: none; line-height: 0; }
.crop-img { width: 100%; height: auto; display: block; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(14, 11, 15, .5); cursor: move; touch-action: none; border-radius: 2px; }
.crop-box:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.crop-box .h { position: absolute; width: 28px; height: 28px; background: #fff; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.25); touch-action: none; }
.crop-box .h::after { content: ""; position: absolute; inset: -8px; }
.crop-box .tl { left: -14px; top: -14px; cursor: nwse-resize; } .crop-box .tr { right: -14px; top: -14px; cursor: nesw-resize; }
.crop-box .bl { left: -14px; bottom: -14px; cursor: nesw-resize; } .crop-box .br { right: -14px; bottom: -14px; cursor: nwse-resize; }
.thumbs { display: flex; gap: var(--s1); }
.thumb { position: relative; }
.thumb > button:first-child { padding: 0; border: 2px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; background: none; cursor: pointer; display: block; line-height: 0; }
.thumb.on > button:first-child { border-color: var(--accent); }
.thumb .x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.fullscreen { position: fixed; inset: 0; z-index: 55; background: var(--bg); display: grid; place-items: center; padding: var(--s3); padding-top: calc(var(--s3) + env(safe-area-inset-top)); }
.fullscreen .progress { max-width: 520px; }
body.noscroll { overflow: hidden; }
.brand-mark.big { width: 64px; height: 64px; border-radius: 20px; }
.brand-mark.big .i { width: 36px; height: 36px; }
.menu .menu-btn { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); width: 100%; padding: 12px; border: 0; background: transparent; border-radius: var(--r-ctl); font-size: .9375rem; cursor: pointer; text-align: left; }
.menu .menu-btn:hover { background: var(--sunken); }
.install-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-card); background: var(--accent-soft); }

/* native feel: no flash on tap, no accidental selection on chrome, safe areas */
html { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
.topbar, .tabbar, .btn, .seg, .icon-btn, .chip, .avatar, .menu, .shutter, .vf-controls { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.topbar { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.dialog { padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom)); }
@media (display-mode: standalone) { body { overscroll-behavior: none; } .brand { pointer-events: auto; } }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .topbar { view-transition-name: topbar; }
  .tabbar { view-transition-name: tabbar; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
}
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- report */
.rep { display: grid; gap: var(--s3); }
@media (min-width: 960px) { .rep { grid-template-columns: 344px minmax(0, 1fr); align-items: start; gap: var(--s4); } .rep-side { position: sticky; top: 88px; } }
.vcard { display: flex; flex-direction: column; gap: var(--s2); border-radius: var(--r-card); padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--vfg); }
.vcard.v-no_matches_incomplete, .vcard.v-cannot_assess { border-top-style: dashed; }
.vcard .headline { font-size: 1.5rem; }
.vcard .thumb { width: 100%; max-height: 160px; object-fit: cover; border-radius: var(--r-ctl); border: 1px solid var(--line); }
.quality .row { margin-bottom: var(--s1); font-size: .9375rem; }
.meter { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.quality ul { margin-top: var(--s1); color: var(--muted); font-size: .875rem; padding-left: var(--s2); list-style: disc; }
.vactions { display: flex; flex-wrap: wrap; gap: var(--s1); padding-top: var(--s1); border-top: 1px solid var(--line); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.ing-group { margin-top: var(--s3); }
.ing-group > header { padding: var(--s2) 0; }
.ing-group > header h3 { display: flex; align-items: center; gap: var(--s1); }
.ing-group > header p { color: var(--muted); font-size: .9375rem; margin-top: var(--s0); max-width: 60ch; }
.ing-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.ing { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--s1) var(--s2); padding: var(--s2) var(--s3); align-items: start; }
.ing + .ing { border-top: 1px solid var(--line); }
.ing .pos { color: var(--faint); font-size: .875rem; padding-top: 2px; font-variant-numeric: tabular-nums; }
.ing .name { font-weight: 600; overflow-wrap: anywhere; }
.ing .printed { color: var(--muted); font-size: .875rem; }
.ing .fn { color: var(--faint); font-size: .8125rem; }
.ing .flags { margin-top: var(--s1); display: flex; flex-direction: column; gap: var(--s1); }
.ing .flag { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s0); }
.ing .reason { font-size: .9375rem; }
.ing .how { color: var(--muted); font-size: .8125rem; }
.ing .note { margin-top: var(--s1); color: var(--muted); font-size: .9375rem; }
.ing.flagged { background: linear-gradient(90deg, var(--vbg), transparent 12%); border-left: 3px solid var(--vfg); padding-left: calc(var(--s3) - 3px); }
.ing.flagged.match { --vfg: var(--v-match); --vbg: var(--v-match-bg); }
.ing.flagged.watch { --vfg: var(--v-watch); --vbg: var(--v-watch-bg); }
.ing .ev { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); }
.ing .ev:hover { background: var(--sunken); color: var(--accent); }
.ing .ev .i { width: 16px; height: 16px; }
.unk-list li { display: flex; gap: var(--s2); padding: var(--s2) var(--s3); font-size: .9375rem; }
.unk-list li + li { border-top: 1px solid var(--line); }
.ing-group.unk .ing-list { border-style: dashed; border-color: var(--v-cannot); }
details.fold { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
details.fold > summary { display: flex; align-items: center; gap: var(--s1); padding: var(--s2) var(--s3); cursor: pointer; font-weight: 600; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > .fold-body { padding: 0 var(--s3) var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
details.fold.fail { border-color: var(--danger); }
details.fold.fail > summary { color: var(--danger); }
.checklist li { display: flex; gap: var(--s1); padding: var(--s1) 0; font-size: .9375rem; }
.checklist li + li { border-top: 1px solid var(--line); }
.checklist .bad { color: var(--danger); }
.confirm { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-card); background: var(--blush); }
.confirm textarea { background: var(--surface); }
.disclaimer { margin-top: var(--s4); padding: var(--s3); border-radius: var(--r-card); background: var(--sunken); color: var(--muted); font-size: .9375rem; display: flex; flex-direction: column; gap: var(--s1); }
.disclaimer .ver { font-size: .8125rem; color: var(--faint); }
.steps li { padding: var(--s1) 0; }
.steps li + li { border-top: 1px solid var(--line); }

/* ---------- compare */
.centries { display: grid; gap: var(--s2); grid-template-columns: 1fr; }
@media (min-width: 720px) { .centries { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.centry { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.centry .rank { font-family: var(--serif); font-size: 1.5rem; color: var(--faint); }
.centry dl { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); font-size: .9375rem; }
.centry dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.centry dt { color: var(--muted); }
.mwrap { overflow-x: auto; contain: paint; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
table.matrix { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.matrix th, .matrix td { padding: 12px var(--s2); text-align: left; border-bottom: 1px solid var(--line); }
.matrix thead th { font-size: .8125rem; color: var(--muted); font-weight: 600; vertical-align: bottom; max-width: 160px; }
.matrix tbody th { font-weight: 500; position: sticky; left: 0; background: var(--surface); min-width: 160px; }
.matrix td { text-align: center; color: var(--faint); font-variant-numeric: tabular-nums; }
.matrix td.on { color: var(--ink); }
.matrix td.match { background: var(--v-match-bg); color: var(--v-match); font-weight: 600; }
.matrix td.watch { background: var(--v-watch-bg); color: var(--v-watch); font-weight: 600; }
.matrix tr:last-child > * { border-bottom: 0; }

/* ---------- forms and settings */
.fgroup { display: flex; flex-direction: column; gap: var(--s2); padding-block: var(--s3); }
.fgroup + .fgroup { border-top: 1px solid var(--line); }
.fgroup > legend, .fgroup > h2 { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; padding: 0; margin-bottom: var(--s0); float: none; }
.agrid { display: grid; gap: var(--s1); grid-template-columns: 1fr; }
@media (min-width: 640px) { .agrid { grid-template-columns: 1fr 1fr; } }
.acheck { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; background: var(--surface); }
.acheck:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.acheck b { display: block; font-weight: 600; font-size: .9375rem; }
.acheck .small { color: var(--muted); font-size: .8125rem; line-height: 1.4; display: block; }
.savebar { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: var(--s1); padding: var(--s2); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); margin-inline: calc(-1 * var(--s2)); }
@media (min-width: 900px) { .savebar { bottom: 0; } }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s3); }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.keyrow { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) 0; }

/* ---------- routine */
.rgrid { display: grid; gap: var(--s3); }
@media (min-width: 800px) { .rgrid { grid-template-columns: 1fr 1fr; align-items: start; } }
.rentry { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) 0; }
.rentry + .rentry { border-top: 1px solid var(--line); }
.rstep { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .875rem; flex: none; }
.caution { padding: var(--s2) 0; display: flex; flex-direction: column; gap: var(--s1); }
.caution + .caution { border-top: 1px solid var(--line); }

/* ---------- usage */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.chart .bar-r { fill: var(--accent); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.tbl th { text-align: left; font-size: .8125rem; color: var(--muted); font-weight: 600; padding: var(--s1) var(--s2); border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px var(--s2); border-bottom: 1px solid var(--line); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

/* ---------- error and busy */
#app[aria-busy="true"] { opacity: .6; }
.settled { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .bar.indet > i { width: 100%; }
}
.print-only { display: none; }
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #333; --line: #bbb; }
  body { font-size: 11pt; background: #fff; }
  .topbar, .tabbar, .toasts, .vactions, .no-print, .confirm, .back, .selbar, .skip-link, #banners { display: none !important; }
  .print-only { display: block; margin-bottom: 12pt; }
  main { padding: 0; }
  .rep { display: block; }
  .rep-side { position: static; margin-bottom: 12pt; }
  .card, .vcard, .ing-list, details.fold { break-inside: avoid; border-color: #999; }
  .ing { break-inside: avoid; }
  details.fold > .fold-body { display: flex; }
  .wrap { max-width: none; padding: 0; }
}

/* ================= the idea: a specimen under a lens (docs/BRAND.md) ================= */
em, .em { font-style: italic; color: var(--accent); font-family: var(--serif); }
.lab { font: 600 .75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* lab paper: a faint dot grid under everything */
body { background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 0); background-size: 24px 24px; }

/* scan-frame corners: they snap on around whatever is being looked at */
.corners { position: absolute; inset: 8px; pointer-events: none; }
.corners > i { position: absolute; width: 18px; height: 18px; border: 2.5px solid var(--vfg, var(--accent)); opacity: .9; animation: snap .35s cubic-bezier(.2, .8, .2, 1) both; }
.corners .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.corners .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.corners .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.corners .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
@keyframes snap { from { opacity: 0; transform: translate(var(--sx, -10px), var(--sy, -10px)); } to { opacity: .9; transform: none; } }
.corners .tr { --sx: 10px; } .corners .bl { --sy: 10px; } .corners .br { --sx: 10px; --sy: 10px; }

/* the focus ring: verdict shape inside, label readability as the arc */
.vtop { display: flex; align-items: center; gap: var(--s2); }
.lens { flex: none; overflow: visible; color: var(--vfg); animation: settle .6s cubic-bezier(.2, .8, .2, 1) both; }
.lens .glass { fill: var(--vbg); }
.lens .track { fill: none; stroke: var(--vfg); stroke-opacity: .28; stroke-width: 4; stroke-linecap: round; }
.lens .arc { fill: none; stroke: var(--vfg); stroke-width: 5; stroke-linecap: round; }
.lens .glyph { fill: none; stroke: var(--vfg); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@keyframes settle { from { opacity: .2; transform: scale(1.18); filter: blur(7px); } to { opacity: 1; transform: none; filter: blur(0); } }
.vcard { position: relative; border-top-width: 1px; border-top-style: solid; border-top-color: var(--line); padding: var(--s4) var(--s3) var(--s3); }
.vcard.v-no_matches_incomplete, .vcard.v-cannot_assess { border-top-style: solid; }
.qreasons { color: var(--muted); font-size: .875rem; padding-left: var(--s2); list-style: disc; }

/* the film strip: perforated rail, numbered frames, rows advance into place */
.ing-list.strip { position: relative; overflow: hidden; padding-left: 28px; background: var(--surface); }
.ing-list.strip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 28px; background: var(--sunken); border-right: 1px solid var(--line);
  background-image: radial-gradient(ellipse 4px 6px at 14px 14px, color-mix(in srgb, var(--ink) 16%, var(--sunken)) 99%, transparent 100%); background-size: 28px 28px; background-repeat: repeat-y; }
.ing { animation: advance .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes advance { from { opacity: 0; transform: translateY(8px); filter: blur(3px); } to { opacity: 1; transform: none; filter: blur(0); } }
.ing .pos { font: 600 .8125rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--faint); }
.ing-list.strip .ing { padding-left: var(--s2); }
.ing.flagged { border-left: 0; padding-left: var(--s2); background: linear-gradient(90deg, var(--vbg), transparent 40%); position: relative; }
.ing.flagged::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--vfg); }

/* the frosted patch: what could not be established stays visibly out of focus */
.ing-group.unk .ing-list.frost { border: 1.5px dashed var(--v-cannot); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--v-cannot-bg) 80%, var(--surface)) 0 10px, color-mix(in srgb, var(--v-cannot-bg) 45%, var(--surface)) 10px 20px); box-shadow: inset 0 0 28px color-mix(in srgb, var(--surface) 70%, transparent); }
.blurdots { width: 36px; height: 20px; fill: var(--v-cannot); opacity: .55; filter: blur(1.5px); }
.ing-group.unk .ing { background: transparent; }

/* slide-style empty states */
.slide-art { width: 132px; height: auto; margin-bottom: var(--s1); }
.slide-art .glass { fill: var(--surface); stroke: var(--field-line); stroke-width: 1.5; }
.slide-art .brk { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.slide-art .drop { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 4; stroke-linecap: round; }
.slide-art .glyph { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.empty .big { display: none; }

/* viewfinder: the frame snaps in when the camera starts; the hint breathes once */
.vf-frame > i { animation: snap .45s cubic-bezier(.2, .8, .2, 1) both; --sx: -14px; --sy: -14px; }
.vf-frame .tr { --sx: 14px; } .vf-frame .bl { --sy: 14px; } .vf-frame .br { --sx: 14px; --sy: 14px; }
.hero-act, .install-card { position: relative; }
.page-head h1 { text-wrap: balance; }

@media (prefers-reduced-motion: reduce) {
  .ing, .lens, .corners > i, .vf-frame > i { animation: none !important; }
}

/* ================= round 2: the pharmacist's desk ================= */
:root { --hand: "Bradley Hand", "Segoe Print", "Chalkboard SE", "Marker Felt", "Noteworthy", "Comic Sans MS", cursive; --print: ui-monospace, SFMono-Regular, Menlo, monospace; }
h1, h2 { letter-spacing: -.02em; }
.display { font-family: var(--serif); font-weight: 600; letter-spacing: -.025em; line-height: 1.02; font-size: clamp(2.5rem, 1.2rem + 6vw, 5rem); text-wrap: balance; }
.display em { font-style: italic; color: var(--accent); }
.note { font-family: var(--hand); color: var(--accent); font-size: 1.3125rem; line-height: 1.3; transform: rotate(-1.2deg); }
p.note { margin: 0; }
.note-arrow { width: 56px; height: 36px; color: var(--accent); flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dash { border: 0; border-top: 1.5px dashed var(--line); margin: 0; }
.eyebrow-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }

/* the label strip (specimen) */
.strip-paper { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: var(--s4) var(--s4) var(--s3); box-shadow: var(--lift); transform: rotate(-.6deg);
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--ink) 5%, transparent) 31px 32px); }
.strip-paper .pin { position: absolute; top: -9px; left: 28px; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, #fff), var(--accent) 60%); box-shadow: 0 3px 5px rgba(0, 0, 0, .25); }
.strip-paper .lab { margin-bottom: var(--s1); }
.print { font-family: var(--print); font-size: clamp(.9375rem, .8rem + .6vw, 1.1875rem); line-height: 2.1; letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
.print .w { padding: 1px 2px; }
.print .pen { color: var(--ink); background: linear-gradient(100deg, transparent 0 1%, var(--pen) 1% 99%, transparent 99%) 0 62% / 0 78% no-repeat; padding: 2px 6px; margin: 0 -2px; border-radius: 3px; animation: penline .5s ease-out forwards; animation-delay: calc(var(--k, 0) * 120ms + .3s); transform: skewX(-4deg); display: inline-block; line-height: 1.5; }
.print .pen.match { --pen: var(--pen-match); } .print .pen.watch { --pen: var(--pen-watch); }
@keyframes penline { to { background-size: 100% 78%; } }
.print .frost { display: inline-block; filter: blur(3.2px); opacity: .75; color: var(--ink); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--v-cannot) 18%, transparent) 0 4px, transparent 4px 8px); border-radius: 3px; outline: 1.5px dashed var(--v-cannot); outline-offset: 1px; }
.pend { color: var(--faint); }

/* the lens seal: the verdict tag, pinned beside the strip */
.seal { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s1); text-align: center; }
.seal-disc { position: relative; display: grid; place-items: center; width: 148px; height: 148px; border-radius: 50%; background: var(--paper); border: 1.5px dashed var(--vfg); box-shadow: var(--lift); animation: stamp .6s cubic-bezier(.2, .8, .2, 1) both; }
.seal-disc .pin { position: absolute; top: -8px; left: 50%; margin-left: -9px; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, #fff), var(--accent) 60%); box-shadow: 0 3px 5px rgba(0, 0, 0, .25); }
@keyframes stamp { from { opacity: 0; transform: scale(1.25) rotate(-8deg); filter: blur(6px); } to { opacity: 1; transform: rotate(3deg); filter: blur(0); } }
.seal .lens { animation: none; }

/* specimen layout: strip + seal + the margin note, no overlaps */
.specimen { display: grid; gap: var(--s3); align-items: start; }
@media (min-width: 900px) { .specimen { grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); gap: var(--s6); } }
.specimen .seal { align-self: center; }
.specimen-note { display: flex; align-items: flex-start; gap: var(--s1); max-width: 34ch; margin-top: var(--s2); }
.specimen-note .note { font-size: 1.5rem; }
.specimen .corners { inset: 10px; --vfg: var(--faint); }
.specimen .vactions { border-top: 0; padding-top: var(--s2); }
.spec-photo { width: 120px; border-radius: 4px; border: 5px solid #fff; box-shadow: var(--lift); transform: rotate(2.5deg); margin-top: var(--s2); }
.qreasons { text-align: left; }
.rep { display: block; }
.ing-wrap { margin-top: var(--s6); }

/* the shelf of label cards */
.shelf { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.lcard { position: relative; display: flex; flex-direction: column; gap: var(--s1); padding: var(--s2); background: var(--paper); border: 1px solid var(--line); border-radius: 6px 6px 14px 14px; color: var(--ink); text-decoration: none; transition: transform .15s; }
.lcard:hover { transform: translateY(-3px) rotate(-.4deg); color: var(--ink); }
.lcard .tube { width: 28px; height: 40px; color: var(--vfg, var(--accent)); }
.lcard b { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.25; overflow-wrap: anywhere; }
.lcard .lab { font-size: .6875rem; }
.tube { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.desk-grid { display: grid; gap: var(--s4); }
@media (min-width: 900px) { .desk-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s6); } }
.notes { display: flex; flex-direction: column; gap: var(--s3); }
.notes .n { display: flex; gap: var(--s1); align-items: baseline; }
.notes .num { font-family: var(--serif); font-size: 3rem; line-height: 1; font-weight: 600; color: var(--ink); }
.notes .note { font-size: 1.25rem; }
.big-link { font-family: var(--serif); font-size: 1.5rem; color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* empty: a blank strip waiting for its label */
.slide-art { display: none; }
.empty .strip-art { width: min(260px, 70%); height: auto; margin-bottom: var(--s1); }
.strip-art .paper { fill: var(--paper); stroke: var(--field-line); stroke-width: 1.5; stroke-dasharray: 5 5; }
.strip-art .ln { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.strip-art .pinh { fill: var(--accent); }
.strip-art .brk { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.empty h3 { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.empty p { font-family: var(--hand); color: var(--accent); font-size: 1.1875rem; transform: rotate(-1deg); }

@media (prefers-reduced-motion: reduce) { .print .pen { animation: none; background-size: 100% 78%; } .seal-disc { animation: none; } }
@media print { .strip-paper, .seal-disc { box-shadow: none; transform: none; } }

.ing .name { overflow-wrap: break-word; word-break: normal; }
@media (max-width: 520px) { .ing-group.unk .ing { grid-template-columns: 32px minmax(0, 1fr); } .ing-group.unk .fchip { grid-column: 2; justify-self: start; } .btn.lg { padding: 0 20px; } }

/* ---- API page */
.doc .doc-sec { padding-top: var(--s4); border-top: 1.5px dashed var(--line); scroll-margin-top: 80px; }
.doc .doc-sec:first-of-type { border-top: 0; }
.doc h3 { font-family: var(--serif); font-size: 1.25rem; margin-top: var(--s2); }
.doc p code, .doc li code, .doc td code, .doc summary code { font-family: var(--print); font-size: .875em; background: var(--sunken); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
.codebox { position: relative; }
pre.code { margin: 0; padding: var(--s2) var(--s2); padding-right: 88px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ctl); overflow-x: auto; font-family: var(--print); font-size: .8125rem; line-height: 1.65; tab-size: 2; max-width: 100%; }
pre.code code { background: none; padding: 0; white-space: pre; font-size: inherit; }
.codebox .copy { position: absolute; top: 8px; right: 8px; }
.keyform { display: grid; gap: var(--s2); align-items: end; grid-template-columns: 1fr; }
@media (min-width: 640px) { .keyform { grid-template-columns: 1fr auto; } }
.keybox { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) var(--s3); border: 1.5px dashed var(--accent); border-radius: var(--r-card); background: var(--blush); }
.steps3 { display: grid; gap: var(--s3); counter-reset: s; }
@media (min-width: 720px) { .steps3 { grid-template-columns: repeat(3, 1fr); gap: var(--s4); } }
.steps3 li { display: flex; flex-direction: column; gap: var(--s1); }
.steps3 h2 { font-size: 1.375rem; }
.steps3 p { color: var(--muted); }
.numeral { font-family: var(--serif); font-size: 4.5rem; line-height: .9; font-weight: 600; color: transparent; -webkit-text-stroke: 2px var(--accent); }
.verb { font: 700 .75rem/1 var(--print); letter-spacing: .06em; padding: 5px 8px; border-radius: 4px; background: var(--sunken); color: var(--ink); flex: none; }
.verb.post { background: var(--accent); color: var(--accent-ink); }
details.ep > summary { flex-wrap: wrap; gap: var(--s1) var(--s2); }
details.ep .path { background: none; padding: 0; font-family: var(--print); font-size: .9375rem; overflow-wrap: anywhere; }
details.ep .ep-title { font-weight: 400; }
details.ep > summary::after { margin-left: auto; }
.plainlist { display: flex; flex-direction: column; gap: var(--s1); padding-left: var(--s2); list-style: disc; }

.doc .tbl td:first-child code, .doc .tbl td:nth-child(2) code { white-space: nowrap; overflow-wrap: normal; }
.doc .tbl td { vertical-align: top; }
