/* Dark, poster-first design. */
:root {
  --bg: #14181c;
  --surface: #1c2228;
  --surface-2: #2a323b;
  --line: #2f3843;
  --text: #e9eef2;
  --text-2: #b8c4cf;
  --muted: #8494a3;
  --accent: #2bb3a3;
  --accent-text: #06201d;
  --accent-soft: rgb(43 179 163 / .16);
  --star: #f5b42a;
  --wish: #40bcf4;
  --lent: #ff8a4c;
  --warn-soft: #3a2f14;
  --warn-text: #f3c56b;
  --ok-soft: #143329;
  --ok-text: #8fd9b6;
  --danger: #ff6b5e;
  --radius: 12px;
  --poster-radius: 6px;
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Top bar and sections ---------- */

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 0;
  border-bottom: 1px solid var(--line);
}
.topbar-row { display: flex; align-items: baseline; gap: 10px; }
.brand { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.count { color: var(--muted); font-size: 13px; flex: 1; }

.sections {
  display: flex; gap: 22px; overflow-x: auto; margin: 6px -16px 0; padding: 0 16px;
  scrollbar-width: none;
}
.sections::-webkit-scrollbar { display: none; }
.sections button {
  flex: none; background: none; border: 0; padding: 10px 0 11px; color: var(--muted);
  font-size: 14px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.sections button.on { color: var(--text); border-bottom-color: var(--accent); }
.sections .n { font-weight: 400; color: var(--muted); margin-left: 4px; font-size: 12px; }

/* ---------- Library ---------- */

.page { display: none; padding: 12px 16px 0; }
.page.active { display: block; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 10px; padding: 0 12px; color: var(--muted);
}
.search input { flex: 1; border: 0; background: none; padding: 10px 0; outline: none; min-width: 0; color: var(--text); }

.subchips { display: flex; gap: 6px; margin-top: 10px; }
.subchip {
  border: 1px solid var(--line); background: none; border-radius: 999px; padding: 5px 12px;
  font-size: 13px; color: var(--text-2);
}
.subchip.on { background: var(--surface-2); color: var(--text); border-color: var(--surface-2); }

.toolbar { display: flex; align-items: center; gap: 6px; margin: 10px 0 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  font-size: 13px; color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.pill.icon { width: 34px; padding: 0; justify-content: center; font-size: 15px; }
.pill.ghost { background: none; }
.pill svg { width: 16px; height: 16px; flex: none; }
.pill.select { padding-right: 4px; }
.pill.select span { color: var(--muted); }
.pill.select select { border: 0; background: none; color: var(--text); outline: none; max-width: 10em; padding: 0 2px; font-size: 13px; }
.pill.select select option { background: var(--surface); }
.badge {
  background: var(--accent); color: var(--accent-text); border-radius: 999px; font-weight: 700;
  font-size: 11px; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px;
}

.group-head {
  margin: 20px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.group-head span { font-weight: 400; margin-left: 4px; }

/* Poster (shared by grid, list, picker, detail) */
.poster {
  position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--poster-radius);
  aspect-ratio: 2 / 3; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08);
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .ph { font-size: 28px; opacity: .45; }
.poster.square { aspect-ratio: 1; }
/* Release cover art keeps its own shape (cases, slipcovers and packshots aren't 2:3). */
.poster.natural { aspect-ratio: auto; min-height: 60px; background: none; box-shadow: none; }
.poster.natural img { position: static; display: block; height: auto; border-radius: var(--poster-radius); }
.poster.natural .ph { position: absolute; }

.grid .group-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px 10px; }
.tile { background: none; border: 0; padding: 0; text-align: left; min-width: 0; display: flex; flex-direction: column; color: inherit; }
.tile:active .poster { outline: 2px solid var(--accent); }
.tile-title { font-size: 12.5px; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.tile-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Badges over posters */
.marks { position: absolute; left: 5px; right: 5px; bottom: 5px; display: flex; gap: 4px; justify-content: flex-end; z-index: 1; }
.mark {
  height: 20px; min-width: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  background: rgb(10 12 14 / .78); font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
}
.mark svg { width: 13px; height: 13px; }
.mark.done { color: var(--accent); }
.mark.wishlist { color: var(--wish); }
.mark.preorder { color: var(--star); }
.mark.loaned { color: var(--lent); }

.list .group-items { display: flex; flex-direction: column; }
.row {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 0; color: inherit;
}
.row .poster { width: 52px; flex: none; }
.row .marks { display: none; } /* list rows already show status as text */
.meta { min-width: 0; flex: 1; }
.row-title { font-weight: 650; overflow-wrap: anywhere; }
.row-title .yr { color: var(--muted); font-weight: 400; margin-left: 4px; }
.row-sub { color: var(--muted); font-size: 13.5px; margin-top: 1px; }
.row-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip-s { font-size: 11.5px; background: var(--surface-2); color: var(--text-2); border-radius: 5px; padding: 2px 7px; }
.chip-s.wishlist { color: var(--wish); }
.chip-s.preorder { color: var(--star); }
.chip-s.loaned { color: var(--lent); }
.chip-s.done { color: var(--accent); }
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; font-size: 13px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); margin: 8px 0 6px; font-size: 19px; }
.empty p { margin: 0 auto 18px; max-width: 32ch; }
.empty-icon { font-size: 44px; }

/* ---------- Panels, stats ---------- */

.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.panel h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.panel p { margin: 0 0 12px; }
.btn-row { display: flex; flex-direction: column; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 12px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 14px; }
.kpi b { display: block; font-size: 26px; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.bar { display: grid; grid-template-columns: minmax(0, 9em) 1fr 2.5em; gap: 10px; align-items: center; padding: 4px 0; font-size: 13.5px; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */

.btn {
  border: 0; background: var(--accent); color: var(--accent-text); border-radius: 10px;
  padding: 12px 18px; font-weight: 700; font-size: 15px;
}
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #1a0705; }
.btn.danger.ghost { background: none; color: var(--danger); border: 1px solid currentColor; }
.link { background: none; border: 0; color: var(--accent); padding: 8px 4px; font-size: 15px; text-decoration: none; }
.link.strong { font-weight: 700; }
.link.center { display: block; margin: 0 auto; }

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  background: none; border: 0; color: var(--muted); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--text); }
.tabbar .fab {
  width: 56px; height: 56px; border-radius: 50%; justify-self: center; margin-top: -24px;
  background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 20px rgb(0 0 0 / .45);
  justify-content: center;
}
.tabbar .fab svg { width: 27px; height: 27px; }

/* ---------- Sheets ---------- */

dialog.sheet {
  border: 0; padding: 0; margin: 0; background: var(--bg); color: var(--text);
  max-width: none; max-height: none;
}
dialog.sheet::backdrop { background: rgb(0 0 0 / .6); }
dialog.sheet.full { width: 100vw; height: 100dvh; }
dialog.sheet.full[open] { display: flex; flex-direction: column; }
#item-form { display: flex; flex-direction: column; height: 100%; }
dialog.sheet.bottom {
  position: fixed; top: auto; bottom: 0; width: 100vw; max-height: 80dvh; border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface);
}
dialog.sheet.bottom[open] { display: flex; flex-direction: column; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30%); opacity: 0; } }

@media (min-width: 700px) {
  dialog.sheet.full { width: min(640px, 100vw); height: min(920px, 100dvh); margin: auto; border-radius: 18px; overflow: hidden; }
  dialog.sheet.bottom { width: min(640px, 100vw); left: 0; right: 0; margin: 0 auto; }
}

.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 6px) 10px 6px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.sheet-head h2 { margin: 0; font-size: 16px; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
dialog.bottom .sheet-head { background: none; padding-top: 8px; }

/* ---------- Item detail ---------- */

.detail-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; position: relative; }
.detail-hero-wrap { position: relative; overflow: hidden; }
.detail-hero {
  position: relative; height: 230px; background: var(--surface) center / cover no-repeat;
}
.detail-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgb(20 24 28 / .1) 0%, rgb(20 24 28 / .55) 55%, var(--bg) 100%);
}
.detail-hero.blur { filter: blur(18px) saturate(1.2); transform: scale(1.15); opacity: .7; }
.detail-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 14px;
}
.round-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgb(10 12 14 / .6); color: #fff;
  display: grid; place-items: center; font-size: 16px; backdrop-filter: blur(6px);
}
.detail-top-right { display: flex; gap: 8px; }
.round-btn.wide { width: auto; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.detail-body { position: relative; z-index: 1; padding: 0 16px 32px; margin-top: -120px; }
.detail-head { display: flex; gap: 14px; align-items: flex-end; }
.detail-head .poster { width: 116px; flex: none; box-shadow: 0 8px 24px rgb(0 0 0 / .5), inset 0 0 0 1px rgb(255 255 255 / .1); border: 0; padding: 0; }
.detail-head .poster .change {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px; font-size: 10.5px; text-align: center;
  background: rgb(10 12 14 / .7); color: var(--text-2); z-index: 1;
}
.detail-title { min-width: 0; padding-bottom: 4px; }
.detail-title h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
.detail-title .yr { color: var(--text-2); font-weight: 400; font-size: 17px; }
.detail-title .by { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.detail-title .kind { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0 6px; }
.action {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; color: var(--text-2);
}
.action svg { width: 20px; height: 20px; }
.action.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.action select { background: none; border: 0; color: inherit; font-weight: 600; outline: none; text-align: center; }
.action select option { background: var(--surface); }

.dsec { margin-top: 22px; }
.dsec h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.cover-label { margin: 14px 0 6px; }
.cover-variants { display: flex; gap: 10px; overflow-x: auto; }
.cover-variants button { flex: 0 0 78px; background: none; border: 0; padding: 0; color: var(--muted); font-size: 11.5px; text-align: center; }
.cover-variants button.on { color: var(--accent); }
.cover-variants button.on .poster img { outline: 2px solid var(--accent); outline-offset: 2px; }
.copies { display: flex; flex-direction: column; gap: 6px; }
.copy {
  display: flex; gap: 10px; align-items: center; text-align: left; width: 100%; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px;
}
.copy .poster { width: 34px; flex: none; }
.copy .meta { display: flex; flex-direction: column; }
.copy .row-title { font-size: 13.5px; font-weight: 600; }
.link.inline { padding: 0; font-size: inherit; text-decoration: underline; }
.share-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.share-head .poster { width: 110px; flex: none; }
.share-head h3 { margin: 0 0 4px; font-size: 19px; }
.share-head .row-sub { margin-top: 3px; }
.extras { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.extras li { margin: 3px 0; }
.notes { white-space: pre-wrap; color: var(--text-2); font-size: 14px; margin: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.links-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Poster picker ---------- */

.chip-wrap.picker-langs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.picker-langs .chip { flex: none; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.picker-grid button { background: none; border: 0; padding: 0; position: relative; }
.picker-grid button.current .poster { outline: 3px solid var(--accent); outline-offset: 2px; }
.picker-sort { margin-bottom: 10px; }
.picker-grid.stills { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.poster.wide { aspect-ratio: 16 / 9; }
.picker-grid .default { position: absolute; top: 4px; right: 4px; z-index: 1; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: var(--accent); color: var(--accent-text); padding: 1px 5px; border-radius: 4px; }
.picker-grid .votes { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; text-align: left; }
.picker-grid .lang { position: absolute; top: 4px; left: 4px; z-index: 1; font-size: 10px; font-weight: 700; text-transform: uppercase; background: rgb(10 12 14 / .75); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }

/* ---------- Item form ---------- */

.form-group { margin-top: 18px; }
.form-group h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; flex: 1; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field small { font-weight: 400; opacity: .8; }
.field input:not([type=checkbox]), .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 10px 12px; outline: none; min-height: 44px; color: var(--text);
}
.field select option { background: var(--surface); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.row2 { display: flex; gap: 10px; }
.row2.align-end { align-items: flex-end; }
.row2 .narrow { flex: 0 0 7.5em; }
.check { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; flex: 0 0 auto; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.check span { font-size: 14px !important; color: var(--text) !important; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 8px 4px; border-radius: 8px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line); white-space: nowrap; color: var(--text-2);
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.cover-row { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.cover-preview { width: 86px; flex: none; }
.cover-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.notice { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--surface); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); }
.notice.ok { background: var(--ok-soft); color: var(--ok-text); }
.notice .link { padding: 0 4px; font-size: 14px; color: inherit; text-decoration: underline; }
.alt-results { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 12px; }
.title-search { margin: -4px 0 14px; }
.title-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 340px; overflow-y: auto; }
.title-results p { margin: 4px 2px; }
.title-hit {
  display: flex; gap: 10px; align-items: center; text-align: left; width: 100%; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px;
}
.title-hit .poster { width: 36px; flex: none; }
.title-hit .ph { font-size: 15px; }
.title-hit .meta { display: flex; flex-direction: column; }
.release-box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0 0 14px; }
.release-box > span { display: block; margin-bottom: 8px; }
.release-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.inline-field { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.inline-field input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 8px;
  padding: 9px 10px; color: var(--text); outline: none; min-height: 40px;
}
.inline-field input:focus { border-color: var(--accent); }
.release-status { margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.release-status .notice { margin: 8px 0 0; }
.form-actions { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 24px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--text-2);
}
.chip .n { color: var(--muted); font-size: 11.5px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.on .n { color: inherit; opacity: .75; }

.spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Add sheet ---------- */

.add-options { display: flex; flex-direction: column; gap: 8px; padding-bottom: 20px; }
.add-option {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0;
}
button.add-option:active { border-color: var(--accent); }
.add-option > svg { width: 24px; height: 24px; flex: none; color: var(--accent); margin-top: 1px; }
.add-option > span { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.add-option b { font-size: 15px; }
.add-option small { color: var(--muted); font-size: 12.5px; }
.add-option .inline-field input { background: var(--surface); }

/* ---------- Filters ---------- */

.facet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 4px 0 8px; }
.facet { margin-bottom: 16px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Scanner ---------- */

dialog.scanner { background: #000; color: #fff; }
.scanner-view { position: relative; flex: 1; overflow: hidden; }
.scanner-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 45%; width: min(78vw, 360px); aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%); border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgb(0 0 0 / .5); border: 2px solid rgb(255 255 255 / .9);
}
.scan-line { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: #ff4d4d; box-shadow: 0 0 8px #ff4d4d; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.scanner-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 14px;
}
.scanner-hint {
  position: absolute; left: 16px; right: 16px; top: calc(45% + min(39vw, 180px) / 2 + 22px);
  text-align: center; margin: 0; text-shadow: 0 1px 4px #000;
}
.scanner-manual { display: flex; gap: 8px; padding: 14px 16px 6px; background: #111; }
.scanner-manual input {
  flex: 1; min-width: 0; border: 1px solid #333; background: #1d1d1d; color: #fff; border-radius: 10px; padding: 12px; font-size: 16px;
}
dialog.scanner .link.center { color: #9ee6dc; background: #111; width: 100%; padding: 10px 0 calc(env(safe-area-inset-bottom) + 14px); }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgb(0 0 0 / .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.danger-zone h2 { color: var(--danger); }
