/* SlabWatch — compact, scannable UI. Light + dark. No inline styles (CSP). */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #8a94a6;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --gold: #b45309;
  --gold-bg: #fff7e6;
  --gold-line: #f5c26b;
  --good: #067647;
  --good-bg: #ecfdf3;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --new: #d92d20;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12; --surface: #15181e; --surface-2: #1c2028; --line: #262b35; --line-strong: #343a46;
    --text: #f2f4f7; --text-2: #b4bcc8; --text-3: #7a8494;
    --accent: #818cf8; --accent-soft: #1e1b4b; --accent-text: #0c0e12;
    --gold: #f5b544; --gold-bg: #2a2010; --gold-line: #7a5a1c;
    --good: #47cd89; --good-bg: #0f2a1d; --bad: #f97066; --bad-bg: #2d1515; --new: #f97066;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 0 4px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--text-3); } .small { font-size: 12px; } .mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.good { color: var(--good); font-weight: 600; } .bad { color: var(--bad); font-weight: 600; }
.gold-text { color: var(--gold); } .new-text { color: var(--new); }

main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------- top bar ---------- */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); }
.brand:hover { text-decoration: none; }
.mark { width: 18px; height: 22px; border-radius: 4px; border: 2px solid var(--accent); position: relative; }
.mark::after { content: ""; position: absolute; left: 2px; right: 2px; top: 2px; height: 4px; border-radius: 1px; background: var(--accent); }
.nav { display: flex; gap: 2px; height: 100%; }
.nav a { display: flex; align-items: center; padding: 0 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.on { color: var(--text); border-bottom-color: var(--accent); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; color: var(--text-3); font-size: 12px; }
.scan { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.dot.live { background: var(--good); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* ---------- page heading ---------- */
.head, .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head { display: block; }
.page-head.row { display: flex; }
.sub, .page-head p { color: var(--text-2); margin: 6px 0 0; }

/* ---------- controls ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 7px 10px; height: 34px;
}
textarea { height: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button, .button {
  font: inherit; font-weight: 500; cursor: pointer; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow);
}
button:hover, .button:hover { background: var(--surface-2); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.small { height: 28px; padding: 0 10px; font-size: 12px; }
button:disabled { opacity: .55; cursor: default; }
form.inline { display: inline; }
label { display: block; font-weight: 500; margin-bottom: 14px; color: var(--text); }
label > input:not([type=checkbox]), label > select, label > textarea { display: block; width: 100%; margin-top: 6px; font-weight: 400; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0 16px 10px 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 6px; }
section.card h3 { margin-top: 18px; }
label.check.block { display: flex; align-items: flex-start; margin-right: 0; }
label.check.block input { margin-top: 3px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---------- toolbar on Finds ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg a { padding: 5px 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.seg a i { font-style: normal; color: var(--text-3); margin-left: 4px; font-size: 12px; }
.seg.small a { padding: 4px 10px; font-size: 12px; }
.toolbar .seg.small { margin-left: auto; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.filters input[type=search] { width: 200px; }
.filters select { max-width: 220px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; color: var(--text-2); cursor: pointer; }
.clear { color: var(--text-3); font-size: 12px; }

/* ---------- results ---------- */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.group-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.group-name { font-weight: 650; font-size: 14px; color: var(--text); }
.group-name span { color: var(--text-3); font-weight: 500; }
.group-set { color: var(--text-3); font-size: 12px; }
.group-stats { margin-left: auto; color: var(--text-2); font-size: 12px; }
.rows { display: flex; flex-direction: column; }
.lr {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 88px 92px 74px 76px; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--line); position: relative;
}
.lr:last-child { border-bottom: 0; }
.lr:hover { background: var(--surface-2); }
.lr.hit::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold-line); }
.lr-img { width: 40px; height: 40px; border-radius: 6px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.lr-img img { width: 40px; height: 40px; object-fit: contain; }
.lr-title { min-width: 0; }
.lr-title > a { display: block; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { display: block; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-card { color: var(--text-2); font-weight: 500; }
.new { color: var(--new); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; margin-left: 6px; }
.badge { justify-self: start; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.plain { background: var(--surface-2); color: var(--text-2); font-weight: 500; }
.badge.gold { background: var(--gold-bg); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-line); }
.lr-price { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.copies { font-weight: 600; color: var(--text-2); margin-left: 4px; }
.copy-list { font-size: 12px; margin-top: 2px; }
.copy-list summary { cursor: pointer; color: var(--accent); width: max-content; }
.copy-list ul { margin: 4px 0 2px; padding-left: 16px; columns: 2; column-gap: 24px; }
.copy-list li { break-inside: avoid; margin-bottom: 2px; }
.lr-when { color: var(--text-3); font-size: 12px; text-align: right; white-space: nowrap; }
.lr-act { display: flex; justify-content: flex-end; gap: 6px; }
.view { font-size: 12px; font-weight: 600; white-space: nowrap; }
button.icon { width: 30px; height: 28px; padding: 0; justify-content: center; font-size: 14px; }
button.icon.yes { color: var(--good); } button.icon.yes:hover { background: var(--good-bg); }
button.icon.no { color: var(--bad); } button.icon.no:hover { background: var(--bad-bg); }
@media (max-width: 760px) {
  .lr { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "img title price" "img meta act"; row-gap: 2px; }
  .lr-img { grid-area: img; } .lr-title { grid-area: title; } .lr-price { grid-area: price; }
  .badge { grid-area: meta; } .lr-when { display: none; } .lr-act { grid-area: act; }
  .toolbar .seg.small { margin-left: 0; }
  .filters input[type=search] { width: 100%; }
}
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 20px; text-align: center; color: var(--text-2); }

/* ---------- generic panels / lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.attention { border-color: var(--gold-line); background: var(--gold-bg); }
.narrow { max-width: 640px; }
.row { display: flex; gap: 12px; align-items: flex-end; } .row > label { flex: 1; } .row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; align-items: center; }
.grow { flex: 1; min-width: 0; }
.two-col { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .bar-in { gap: 14px; } .scan { display: none; } }
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.trow { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.trow:last-child { border-bottom: 0; }
.table .trow:hover { background: var(--surface-2); }
.card .trow { padding: 10px 0; }
.trow.paused { opacity: .5; }
.trow a.grow { color: var(--text); } .trow a.grow:hover { text-decoration: none; } .trow a.grow:hover b { color: var(--accent); }
.trow b { font-weight: 600; }
.trow .grades { width: 210px; }
.trow .nums { width: 120px; text-align: right; display: flex; flex-direction: column; font-size: 12px; }
.trow .nums b { font-size: 14px; }
.trow .maybe { color: var(--gold); font-size: 12px; }
.trow .status-col { width: 170px; }
.trow .actions { display: flex; gap: 8px; align-items: center; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); margin: 0 3px 3px 0; border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-check { margin: 0; font-weight: 500; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-grid; place-items: center; min-width: 40px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-variant-numeric: tabular-nums; }
.chip-check input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); }
.field { margin-bottom: 16px; } .field .label { font-weight: 500; }
details.advanced { margin: 4px 0 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details > summary { cursor: pointer; color: var(--text-2); font-weight: 500; margin-bottom: 12px; }
.hint { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; color: var(--text-2); }
.help ul { margin: 0; padding-left: 18px; color: var(--text-2); } .help li { margin-bottom: 6px; }
.danger-zone { margin-top: 20px; }
.add-store { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.add-store label { flex: 1; min-width: 260px; margin: 0; }
.add-store textarea { min-height: 36px; }
.inline-details { display: inline-block; margin-left: 8px; }
.col-when { width: 90px; } .col-who { width: 220px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 22px 0 10px; text-transform: none; }

/* ---------- messages ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: var(--good-bg); color: var(--good); border: 1px solid transparent; }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 420px; padding: 12px 16px; border-radius: 10px;
  background: var(--text); color: var(--surface); box-shadow: 0 8px 24px rgba(16,24,40,.18); transition: opacity .4s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.gone { opacity: 0; pointer-events: none; }

/* ---------- sign-in ---------- */
.auth { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.auth h1 { margin-bottom: 8px; }
.auth p { color: var(--text-2); }
button.google { width: 100%; height: 42px; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #dadce0; font-weight: 600; }
.empty.slim { border: 0; border-radius: 0; padding: 18px; }
form.me { display: flex; align-items: center; gap: 8px; }
.checks { display: flex; gap: 4px 18px; flex-wrap: wrap; margin: -4px 0 14px; }
@media (max-width: 760px) {
  .bar-in { padding: 0 12px; gap: 12px; }
  .nav { overflow-x: auto; scrollbar-width: none; flex: 1; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 0 9px; white-space: nowrap; }
  .bar-right { gap: 8px; }
  .me .avatar { display: none; }
  main { padding: 18px 12px 48px; }
}
button.linkish, button.linkish:hover { background: none; border: 0; box-shadow: none; height: auto; padding: 0; color: var(--accent); font-weight: 500; }
.trow .nums { flex-direction: row; justify-content: flex-end; gap: 4px; align-items: baseline; white-space: nowrap; }
.trow .nums .maybe { margin-left: 6px; }
form.row > label:has(select), .row > label.role { flex: 0 0 180px; }
main > h1 { margin-bottom: 18px; }
main > form.filters { margin-bottom: 14px; }
.more { display: block; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.loc { color: var(--text-3); }
.filters select { max-width: 190px; }
.group.live { border-color: var(--accent); }
.group.live .group-head { background: var(--accent-soft); }
.lr-price small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); }
