/* One reading column, cards for hits and searches; same palette as docs/pipeline.html. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1a1e24;
  --muted: #5b6573;
  --line: #dde1e7;
  --accent: #0e6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ee;
  --warn: #9a5b00;
  --warn-soft: #fbf0dc;
  --danger: #b3261e;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b; --surface: #1a2027; --ink: #e6e9ee; --muted: #9aa5b3; --line: #2c343e;
    --accent: #4fc2ab; --accent-ink: #0b1f1b; --accent-soft: #15302b; --warn: #e2a64a; --warn-soft: #33270f;
    --danger: #f2867e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}
main {
  max-width: 760px; margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
  display: grid; gap: 16px;
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0; text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
p { margin: 0; }
a { color: var(--accent); }
code { font-size: 0.9em; }
.muted { color: var(--muted); }
.small, small { font-size: 0.85rem; }
.empty { color: var(--muted); padding: 24px 0; }
.error { color: var(--danger); }

/* header */
.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a, .tabs a {
  padding: 6px 10px; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.top nav a[aria-current], .tabs a[aria-current] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

main > * { min-width: 0; }  /* grid items would otherwise grow to their widest content */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; max-width: 100%; scrollbar-width: none; }

/* controls */
button, .button, select, input, textarea {
  font: inherit; color: inherit;
}
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink);
}
button:hover, .button:hover { border-color: var(--muted); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.danger { color: var(--danger); background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
}
.toolbar select { width: auto; max-width: 100%; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
ul.hits, ul.searches { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hit { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.hit.alerted { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--line); }
.hit:not(:has(.thumb)) { grid-template-columns: 1fr auto; }
.hit-body, .search-body { min-width: 0; display: grid; gap: 4px; }
.hit-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.hit-title:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 0.85rem; }
.prices { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.prices strong { font-size: 1.1rem; }
.hit-side { display: grid; justify-items: end; gap: 8px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.score.good { color: var(--accent); }
.score.faint { color: var(--muted); font-weight: 500; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem;
  background: var(--accent-soft); color: var(--ink);
}
.badge.muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.feedback { display: inline-flex; gap: 6px; }
.vote { min-height: 36px; min-width: 40px; padding: 0 8px; filter: grayscale(1); opacity: 0.7; }
.vote.on { filter: none; opacity: 1; background: var(--accent-soft); border-color: var(--accent); }

.search { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.toggle { min-width: 56px; color: var(--muted); }
.toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }

/* detail */
.detail { display: grid; gap: 20px; }
.detail-head { display: grid; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.figures > div { display: grid; gap: 2px; }
.figures strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.note { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; }
.flags { margin: 8px 0 0; padding-left: 20px; color: var(--warn); }
.facts { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.comps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comps li {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.comps li.picked { border-color: var(--accent); }
.comp-n { font-variant-numeric: tabular-nums; color: var(--muted); }
.comp-side { display: grid; justify-items: end; text-align: right; }
.comps a { overflow-wrap: anywhere; }
.description { white-space: pre-line; overflow-wrap: anywhere; }

/* forms */
.form, .login { display: grid; gap: 14px; }
.form label, .login label { display: grid; gap: 4px; font-weight: 500; }
.form small { color: var(--muted); font-weight: 400; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; align-items: end; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { width: auto; min-height: 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; margin: 0; }
legend { font-weight: 600; padding: 0 4px; }
.login { max-width: 360px; width: 100%; margin: 15vh auto 0; }

/* settings */
section.card { display: grid; gap: 10px; }
.meter { height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td:nth-child(2) { overflow-wrap: anywhere; }

@media (max-width: 480px) {
  .top nav { margin-left: 0; width: 100%; }
  .thumb { width: 56px; height: 56px; }
  .hit { gap: 10px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
}
