/* "Terminal" theme adapted from the FYND prototype (Prototype development
   request.zip): Space Grotesk + IBM Plex Mono, oklch surfaces, KPI cards,
   hairline section labels. Terminal (dark) is the base; daylight overrides
   under prefers-color-scheme: light. Chart series colors are the dataviz-
   validated palette, re-validated against these surfaces. */
:root {
  --accent: #4cc6e0;
  --r: 10px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --page: oklch(0.165 0.012 255);
  --page-2: oklch(0.195 0.013 255);
  --surface: oklch(0.215 0.014 255);
  --surface-2: oklch(0.255 0.015 255);
  --border: oklch(0.31 0.014 255);
  --grid: oklch(0.275 0.012 255);
  --ink: oklch(0.96 0.004 250);
  --ink-2: oklch(0.82 0.010 255);
  --muted: oklch(0.66 0.012 255);
  --axis: oklch(0.44 0.022 255);
  --good: oklch(0.76 0.15 152);
  --bad: oklch(0.68 0.17 25);
  --s1: #3987e5;
  --s2: #199e70;
  --s3: #c98500;
  --s4: #008300;
  --s5: #9085e9;
  --s6: #e66767;
  --band-core: var(--accent);
  --band-outer: color-mix(in oklch, var(--accent) 45%, transparent);
  --shadow: 0 1px 0 oklch(0.40 0.02 255 / 0.4) inset, 0 8px 24px oklch(0 0 0 / 0.3);
}
@media (prefers-color-scheme: light) {
  :root {
    --page: oklch(0.965 0.004 250);
    --page-2: oklch(0.94 0.005 250);
    --surface: oklch(0.995 0.002 250);
    --surface-2: oklch(0.965 0.004 250);
    --border: oklch(0.88 0.006 250);
    --grid: oklch(0.915 0.005 250);
    --ink: oklch(0.24 0.012 255);
    --ink-2: oklch(0.40 0.013 255);
    --muted: oklch(0.52 0.013 255);
    --axis: oklch(0.82 0.018 255);
    --good: oklch(0.56 0.14 152);
    --bad: oklch(0.57 0.18 25);
    --accent: #1e9cb8;
    --s1: #2a78d6;
    --s2: #1baf7a;
    --s3: #eda100;
    --s4: #008300;
    --s5: #4a3aa7;
    --s6: #e34948;
    --shadow: 0 1px 2px oklch(0.2 0.02 255 / 0.06), 0 6px 18px oklch(0.2 0.02 255 / 0.06);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display rules must never beat hidden */
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 4px 24px 80px; }
nav.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in oklch, var(--page) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
nav.top .top-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: baseline; gap: 22px;
}
nav.top .brand {
  display: flex; align-items: baseline; gap: 9px;
  font-weight: 700; font-size: 17px; letter-spacing: 0.12em; color: var(--ink);
}
nav.top .brand .dot {
  width: 8px; height: 8px; border-radius: 50%; align-self: center;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
nav.top .brand small {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--muted); font-weight: 500;
}
nav.top .crumb {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted);
}
/* big back button, top left of the page body */
.pageback {
  display: inline-block; margin: 20px 0 0;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2); background: var(--page-2);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 18px; cursor: pointer;
}
.pageback:hover { color: var(--accent); border-color: var(--accent);
                  text-decoration: none; }
nav.top .navlink {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
nav.top .navlink:hover { color: var(--accent); text-decoration: none; }
nav.top .navlink.more { margin-left: 18px; }

/* ── forms (price watches) ── */
.wform { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.wform label { display: flex; flex-direction: column; gap: 4px;
               font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
               color: var(--muted); }
.wform select, .wform input[type="number"], .wform input[type="text"],
.wform input[type="date"], .wform input[type="url"] {
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--page-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
}
.wform input[type="number"] { width: 110px; font-weight: 600; }
.wform input[type="text"], .wform input[type="url"] { width: 230px; }

/* flip log — the mark-sold form folds out of an open position card */
.flipsell { margin-top: 10px; }
.flipsell summary {
  cursor: pointer; user-select: none; display: inline-block;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.flipsell[open] summary { color: var(--muted); }
.flipsell .wform { margin-top: 12px; }
.pricebox { display: flex; align-items: center; gap: 7px;
            font-size: 13px; color: var(--muted); text-transform: none;
            letter-spacing: normal; }
.btn {
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  padding: 8px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--accent); color: oklch(0.16 0.01 255); cursor: pointer;
}
@media (prefers-color-scheme: light) { .btn { color: #fff; } }
.btn.ghost { background: transparent; color: var(--ink-2);
             font-size: 12px; padding: 4px 11px; }
.btn.ghost:hover { color: var(--ink); border-color: var(--axis); }
.btn.ghost.danger:hover { color: var(--bad); border-color: var(--bad); }
.wactions { display: flex; gap: 8px; margin-top: 12px; }
.wactions form { margin: 0; }

h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 26px 0 4px; }
h2 { /* section label: uppercase mono with trailing hairline */
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  margin: 30px 0 12px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.sub b { color: var(--ink); }

/* ── KPI tiles ── */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr);
         gap: 12px; margin: 20px 0; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { display: flex; flex-direction: column; background: var(--surface);
        border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; }
.tile .k { order: -1; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
           color: var(--muted); margin: 0 0 3px; }
.tile .v { font-family: var(--mono); font-size: 22px; font-weight: 600;
           letter-spacing: -0.02em; }
.tile .note { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── cards / grid ── */
.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }
.col-12 { grid-column: span 12; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h3 { font-size: 13px; margin: 0; letter-spacing: 0.02em; font-weight: 600; }
.card-head .hint { font-size: 11px; color: var(--muted); }
.card-head .right { margin-left: auto; }
@media (max-width: 960px) {
  .col-8, .col-4 { grid-column: span 12; }
}

/* ── model selector — stat cards; each card is a URL (design C) ── */
.vcards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 6px 0 10px;
}
.vcards a {
  display: block; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px; color: inherit;
}
.vcards a:hover { border-color: var(--accent); text-decoration: none; }
.vcards .name { font: 600 14px var(--sans); color: var(--ink); display: block; }
.vcards .n { font: 400 12px var(--mono); color: var(--muted);
             display: block; margin-top: 6px; }
.vcards .p50 { font: 500 15px var(--mono); color: var(--ink-2);
               display: block; margin-top: 3px; min-height: 19px; }
.vcards a.on {
  border: 2px solid var(--accent); padding: 13px 15px;
  background: color-mix(in oklch, var(--accent) 13%, var(--surface-2));
}
.vcards a.on .p50 { color: var(--accent); }
.vcards a.dim:not(.on) .name { color: var(--muted); }
/* the model page's filter rows: chips on one line, not cards */
.vcards.compact { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.vcards.compact a { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; }
.vcards.compact a.on { padding: 4px 9px; }
.vcards.compact .name { font-size: 13px; font-weight: 500; }
.vcards.compact .n { font-size: 11px; margin-top: 0; }

/* ── tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
     color: var(--muted); font-weight: 600; padding: 0 10px 9px;
     border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--page-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sortable[data-dir="asc"]::after { content: " ▲"; font-size: 8px; }
th.sortable[data-dir="desc"]::after { content: " ▼"; font-size: 8px; }
.product-list th.sortable:not([data-dir])::after {
  content: " ↕";
  font-size: 9px;
  opacity: .45;
}
.bundle-list .bundle-contents { min-width: 290px; line-height: 1.55; }
.bundle-list td { vertical-align: top; }
td.num { font-family: var(--mono); font-size: 12.5px; }
.scroll { max-height: 460px; overflow-y: auto; }
.rowlink { color: var(--ink); font-weight: 500; }
/* the whole row is the click target (delegated handler in base.html); the
   .rowlink <a> stays the focusable element so tab order and middle-click
   still work exactly like a normal link */
tbody tr:has(a.rowlink) { cursor: pointer; }
tr.deal td { background: color-mix(in oklch, var(--good) 7%, transparent); }
tr.deal td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--muted); }

/* ── listing thumbnails / photo carousel ── */
td.thumbcell { width: 52px; padding: 4px 0 4px 10px; }
.thumb { display: block; width: 48px; height: 48px; object-fit: cover;
         border-radius: 6px; border: 1px solid var(--border); background: var(--page-2); }
/* No picture at all. On an AD row that is an empty square (the ad carries no
   photo); on a MODEL row it is the third and last source for a product shot
   (issue #39: catalog file, then prisjakt, then this) and it carries the
   model's initials, so a row still reads as a product and not as a gap.
   CSS only — no image file, no request, and the cell keeps its width because
   the column sorter in base.html indexes cells by position. */
.thumb.none { opacity: 0.4; display: flex; align-items: center; justify-content: center;
              font: 600 10px/1 var(--mono, ui-monospace, monospace); letter-spacing: 0.06em;
              color: var(--muted); user-select: none; overflow: hidden; }
.card-head .thumb, .card-head a:has(.thumb) { align-self: center; flex-shrink: 0; }
/* a MODEL row's thumb is smaller than an ad row's: there it is a recognition
   aid, not evidence. Hovering it opens the shared hover card (base.html)
   with the big rendition, so the small file is all the row ever loads. */
.thumb.sm { width: 32px; height: 32px; }
td.thumbcell:has(.thumb.sm) { width: 40px; }

/* the model page's photo strip: what the ads for this model actually look
   like, taken from the ads themselves — there is no stock photography
   anywhere in this UI. Each square links to the ad it came from. */
.photostrip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.photostrip a.photo { display: block; line-height: 0; }
.photostrip a.photo img { display: block; width: 72px; height: 72px;
                          object-fit: cover; border-radius: 6px;
                          border: 1px solid var(--border); background: var(--page-2); }
.photostrip a.photo:hover img { border-color: var(--accent); }

/* ── flip buy form: the intake slot is the whole idle state ── */
.buyform .urlrow { display: flex; align-items: center; gap: 10px; }
.buyform .urlrow .prompt { font-family: var(--mono); color: var(--accent);
                           font-size: 15px; }
.buyform #f-url { flex: 1; font-family: var(--mono); font-size: 13px;
                  color: var(--ink); background: var(--page-2);
                  border: 1px solid var(--border); border-radius: 9px;
                  padding: 10px 13px; min-width: 0; }
.buyform #f-url:focus { border-color: var(--accent); outline: none; }
.linklike { background: none; border: none; cursor: pointer; padding: 0;
            font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
            text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.linklike:hover { color: var(--accent); }
.buyform > .footnote { margin: 8px 0 0 24px; }

/* the fetched-ad receipt: thumb + renamable title + provenance line */
.receipt { display: flex; align-items: center; gap: 12px; margin-top: 14px;
           background: var(--page-2); border: 1px solid var(--border);
           border-radius: 10px; padding: 10px 14px; }
.receipt .thumb { width: 56px; height: 56px; }
.receipt .rmain { flex: 1; min-width: 0; }
.receipt .rtitle { width: 100%; font-family: var(--sans); font-weight: 600;
                   font-size: 15px; color: var(--ink); background: transparent;
                   border: none; border-bottom: 1px dashed transparent;
                   padding: 2px 0; }
.receipt .rtitle:hover, .receipt .rtitle:focus {
  border-bottom-color: var(--axis); outline: none; }
.receipt .rmeta { font-family: var(--mono); font-size: 11.5px;
                  color: var(--muted); margin-top: 3px; }
.buyform .fields { margin-top: 16px; }
.wform label.grow { flex: 1; min-width: 180px; }
.wform label.grow input { width: 100%; }

/* chart sold-outcome filter (alla · bud · köp nu) */
.chartfilter { display: inline-flex; gap: 12px; font-family: var(--mono);
               font-size: 11px; letter-spacing: 0.04em; white-space: nowrap; }
.chartfilter a { color: var(--muted); }
.chartfilter a:hover { color: var(--ink); text-decoration: none; }
.chartfilter a.on { color: var(--accent); font-weight: 600; }
.chartfilter .n { opacity: 0.7; margin-left: 3px; }

.carousel .stage { position: relative; background: var(--page-2);
                   border: 1px solid var(--border); border-radius: var(--r);
                   overflow: hidden; }
.carousel .stage img { display: block; width: 100%; height: 480px;
                       object-fit: contain; }
.carousel .nav { position: absolute; top: 50%; transform: translateY(-50%);
                 width: 40px; height: 40px; border-radius: 50%; border: none;
                 background: var(--surface); color: var(--ink);
                 font-size: 24px; line-height: 1; cursor: pointer;
                 box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25); opacity: 0.9; }
.carousel .nav:hover { opacity: 1; }
.carousel .nav.prev { left: 12px; }
.carousel .nav.next { right: 12px; }
.carousel .count { position: absolute; right: 12px; bottom: 12px;
                   background: rgba(0, 0, 0, 0.6); color: #fff;
                   padding: 2px 10px; border-radius: 999px; font-size: 12px;
                   font-family: var(--mono); }
.carousel .strip { display: flex; gap: 8px; margin-top: 8px;
                   overflow-x: auto; padding-bottom: 4px; }
.carousel .strip img { width: 72px; height: 54px; object-fit: cover; flex: none;
                       border-radius: 6px; border: 2px solid transparent;
                       background: var(--page-2); cursor: pointer; opacity: 0.75; }
.carousel .strip img:hover { opacity: 1; }
.carousel .strip img.sel { border-color: var(--accent); opacity: 1; }

/* ── tags & pills ── */
.pill { display: inline-flex; align-items: center; gap: 5px;
        font-family: var(--mono); font-size: 11px; padding: 2px 8px;
        border-radius: 999px; background: var(--page-2);
        border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }
.pill.warn { color: var(--bad); border-color: transparent;
             background: color-mix(in oklch, var(--bad) 16%, transparent); }
.pill.good { color: var(--good); border-color: transparent; font-weight: 600;
             background: color-mix(in oklch, var(--good) 18%, transparent); }
/* desperate-seller tiers: warm = amber nudge, hot = red urgency */
.pill.desp-warm { color: var(--s3); border-color: transparent;
                  background: color-mix(in oklch, var(--s3) 15%, transparent); }
.pill.desp-hot { color: var(--bad); border-color: transparent; font-weight: 600;
                 background: color-mix(in oklch, var(--bad) 18%, transparent); }

/* köp-nu ads read differently from auctions — tint the whole row */
tr.bin td { background: color-mix(in oklch, var(--good) 6%, transparent); }
/* time-on-market speed: sold fast = signal, sat 10+ days = ask likely high */
.tom-fast { color: var(--good); font-weight: 600; }
.tom-slow { color: var(--bad); font-weight: 600; }

/* ── chart ── */
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis { stroke: var(--axis); stroke-width: 1; }
svg .tick { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
svg .label { fill: var(--ink-2); font-family: var(--mono); font-size: 11px; }
.s1-fill { fill: var(--s1); } .s1-line { stroke: var(--s1); }
.s2-fill { fill: var(--s2); } .s2-line { stroke: var(--s2); }
.s3-fill { fill: var(--s3); } .s3-line { stroke: var(--s3); }
.s4-fill { fill: var(--s4); } .s4-line { stroke: var(--s4); }
.s5-fill { fill: var(--s5); } .s5-line { stroke: var(--s5); }
.s6-fill { fill: var(--s6); } .s6-line { stroke: var(--s6); }
/* the transparent stroke is hit area, not ink: a 3.5px dot is a miserable
   hover target for the card */
svg .dot { fill-opacity: 0.5; stroke: transparent; stroke-width: 9; }
svg .dot:hover { fill-opacity: 1; }
svg .dot[data-card-href]:hover { cursor: pointer; }   /* opens the sale page */
/* a sale no verdict has read yet: a hollow ring, never mistaken for a band dot */
svg .udot { fill: transparent; stroke: var(--muted); stroke-width: 1.4; opacity: 0.7; }
svg .udot:hover { opacity: 1; stroke-width: 2.2; }
svg .udot[data-card-href]:hover { cursor: pointer; }
svg .xdot { fill: var(--bad); fill-opacity: 0.35; stroke: var(--bad); stroke-width: 1.2; }
svg .xdot:hover { fill-opacity: 0.9; }
svg .xdot[data-card-href]:hover { cursor: pointer; }
/* sold, but refused by the band (kit, bundle, defect …): a hollow amber ring */
/* dashed so it never reads as a 3rd variant's dot, which shares --s3 */
svg .edot { fill: transparent; stroke: var(--s3); stroke-width: 1.8; opacity: 0.85;
            stroke-dasharray: 2.5 1.5; }
svg .edot:hover { opacity: 1; stroke-width: 2.6; }
svg .edot[data-card-href]:hover { cursor: pointer; }

.legend { display: flex; gap: 18px; margin: 4px 0 10px; font-size: 12.5px;
          color: var(--ink-2); flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 10px; height: 10px;
              border-radius: 3px; margin-right: 6px; vertical-align: baseline; }

/* ── band rows (compact, fits a col-4 card):
       name          p25
       n = 32        p50 · p75
       [========bar========]     */
.bandrow { display: grid; grid-template-columns: 1fr auto; gap: 0 14px;
           padding: 10px 0; border-bottom: 1px solid var(--grid); }
.bandrow:last-child { border-bottom: none; }
.bandrow .name { font-size: 13px; font-weight: 500; grid-column: 1; grid-row: 1; }
.bandrow .name a { color: var(--ink); }
.bandrow .n { color: var(--muted); font-size: 11px; font-family: var(--mono);
              grid-column: 1; grid-row: 2; align-self: end; }
.bandrow > div:nth-child(2) { grid-column: 1 / -1; grid-row: 3; margin-top: 4px; }
.bandnums { font-family: var(--mono); text-align: right; white-space: nowrap;
            grid-column: 2; grid-row: 1 / 3; }
.bandnums b { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.bandnums .pp { display: block; font-size: 11px; color: var(--muted); }
svg.bandbar { width: 100%; height: 26px; display: block; }
.band-outer { fill: var(--band-outer); }
.band-core { fill: var(--band-core); }
/* p25 is the KEYED mark (I-74) and is the HEAVY tick — it cannot be
   accent-coloured, because it stands on the accent core's left edge and
   half of it would disappear into the fill. The median is the thin, quiet
   tick beside it, and is never removed. */
.band-key { stroke: var(--ink); stroke-width: 3; }
.band-median { stroke: var(--ink); stroke-width: 1.25; opacity: .55; }

/* ── timeline (listing page) ── */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 150px 110px 1fr; gap: 12px;
               padding: 8px 0; border-bottom: 1px solid var(--grid); }
.timeline li:last-child { border-bottom: none; }
.timeline .when { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.timeline .ev { font-weight: 600; }
/* a DERIVED row (posted / discovered / detail) is not an `ad_events` row:
   it is a fact about the ad the timeline shows in place, so it is drawn
   quieter than something that actually happened on a cycle */
.timeline li.derived { color: var(--ink-2); }
.timeline li.derived .ev { font-weight: 500; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 10px 20px; }
.kv .k { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
         color: var(--muted); }
.kv .v { font-weight: 550; }

/* ── tooltip ── */
#tip { position: fixed; z-index: 40; max-width: 340px; pointer-events: none;
       background: var(--surface-2); color: var(--ink); padding: 6px 10px;
       border: 1px solid var(--border); border-radius: 7px;
       box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.35; }

/* hover card — the ad behind a chart dot, after a 1 s dwell */
#hovercard { position: fixed; z-index: 41; width: 250px; pointer-events: none;
             background: var(--surface-2); border: 1px solid var(--border);
             border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
#hovercard img { display: block; width: 100%; height: 150px;
                 object-fit: cover; background: var(--page-2);
                 opacity: 0; transition: opacity .09s ease-out; }
#hovercard img.ready { opacity: 1; }
#hovercard .hc-body { padding: 8px 10px 9px; }
#hovercard .hc-title { font-size: 12.5px; line-height: 1.3; color: var(--ink);
                       display: -webkit-box; -webkit-line-clamp: 2;
                       -webkit-box-orient: vertical; overflow: hidden; }
#hovercard .hc-price { font-family: var(--mono); font-size: 16px;
                       font-weight: 600; margin-top: 5px; color: var(--ink); }
#hovercard .hc-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.footnote { color: var(--muted); font-size: 12px; margin-top: 24px; }
.card .footnote { margin-top: 12px; }
.empty { color: var(--muted); padding: 18px 0; font-size: 13px; }

/* ── collapsed non-product listings (model page) ── */
/* the evidence expander on an ad: the menu that was offered, the answer,
   the guards, the call id. Collapsed by default because it is the proof,
   not the claim — but it has to look openable. */
details.evidence { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
details.evidence summary { cursor: pointer; color: var(--muted); font-size: 12px;
                           font-family: var(--mono); letter-spacing: 0.04em; }
details.evidence summary:hover { color: var(--ink-2); }
details.evidence[open] summary { color: var(--ink-2); margin-bottom: 8px; }
/* raw payloads, verbatim: they scroll inside their own box rather than
   widening the page */
pre.raw { margin: 6px 0; padding: 10px 12px; background: var(--page-2);
          border: 1px solid var(--border); border-radius: 8px;
          font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
          color: var(--ink-2); max-height: 320px; overflow: auto;
          white-space: pre-wrap; word-break: break-word; }

details.noise { margin-top: 12px; border-top: 1px solid var(--border); }
details.noise summary { cursor: pointer; color: var(--muted); font-size: 12.5px;
                        padding: 10px 0 4px; user-select: none; }
details.noise summary:hover { color: var(--ink-2); }
details.noise table { opacity: 0.8; }

/* ── hiding a deal: the ✕ sits with the ↗ in the last cell, quiet until
   the row is hovered so the table still reads as data, not as controls ── */
.rowacts { white-space: nowrap; }
.rowacts form { display: inline; margin: 0; }
.hidebtn { padding: 2px 7px; line-height: 1.2; color: var(--muted);
           border-color: transparent; opacity: 0.4; transition: opacity 0.12s; }
tr:hover .hidebtn, .hidebtn:focus { opacity: 1; }
.hidebtn:hover { color: var(--bad); border-color: var(--bad); }

/* the just-hidden strip: accented so it reads as a consequence of the click */
.hidjust { border-color: color-mix(in oklch, var(--accent) 35%, var(--border)); }
.hidjust .wform { margin-top: 4px; }
.hidjust .wform select { min-width: 240px; }
.hidjust .wform input[type="text"] { width: 320px; }
.hidundo { margin-top: 12px; }

/* ── field notes: the hand-written layer on a product ── */
.notes textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
  color: var(--ink); background: var(--page-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
}
.notes textarea:focus { outline: none; border-color: var(--accent); }
.notes textarea::placeholder { color: var(--muted); }
.nactions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.nactions select {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
  background: var(--page-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 9px;
}
/* the model page renders these as divs, not a list: the selectors match
   both shapes so a note keeps its separators either way */
.notelist { list-style: none; margin: 0 0 4px; padding: 0; }
.notelist li, .notelist .nbody { padding: 12px 0; border-top: 1px solid var(--border); }
.notelist li:first-child, .notelist .nbody:first-child { border-top: none; padding-top: 4px; }
.nmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.nmeta .when { font-family: var(--mono); font-size: 10.5px;
               letter-spacing: 0.06em; color: var(--muted); }
/* the note itself is prose, not data — sans, roomy, and it keeps the line
   breaks the writer typed */
.nbody { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink);
         white-space: pre-wrap; }
.nedit, .naddfold { margin-top: 8px; }
.nedit summary, .naddfold summary {
  cursor: pointer; user-select: none; display: inline-block;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.nedit[open] summary, .naddfold[open] summary { color: var(--muted); }
.nedit form, .naddfold form { margin-top: 10px; }
.nedit form + form { margin-top: 12px; }

/* ── review queue + manual-classification panel ── */

/* the classifier's own doubt, colour-coded: ambiguous = it picked a variant
   it isn't sure of (may be skewing a band NOW), novel = nothing to pick */
.pill.match-ambiguous { color: var(--s3); border-color: transparent;
                        background: color-mix(in oklch, var(--s3) 15%, transparent); }
.pill.match-novel { color: var(--s5); border-color: transparent;
                    background: color-mix(in oklch, var(--s5) 18%, transparent); }
.pill.match-not_product { color: var(--muted); }
.pill.match-confident { color: var(--good); border-color: transparent;
                        background: color-mix(in oklch, var(--good) 15%, transparent); }

.review-panel { border-color: color-mix(in oklch, var(--accent) 35%, var(--border)); }
.review-panel.resolved { border-color: var(--border); opacity: 0.85; }
.review-panel .rp-state { display: flex; align-items: center; gap: 10px;
                          flex-wrap: wrap; }
.review-panel .rp-state .n { color: var(--muted); font-size: 12.5px; }
.review-panel .rp-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px;
                         background: var(--page-2); font-size: 13px;
                         line-height: 1.45; color: var(--ink-2); }
.review-panel .rp-note .k { display: block; font-family: var(--mono);
                            font-size: 10.5px; letter-spacing: 0.06em;
                            text-transform: uppercase; color: var(--muted);
                            margin-bottom: 4px; }
.review-panel .rp-form { display: flex; align-items: center; gap: 8px;
                         flex-wrap: wrap; margin-top: 14px; }
.review-panel .rp-form select { min-width: 220px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ─────────────────────────────────────────────────────────────────────────
   v2 additions. Everything above is the v1 file, ported verbatim; these are
   the four things the v2 pages need and v1 had no place for:
   the nav search box, the source (confirmed / inferred) labelling, the
   unlabelled series slot for a `confident_model` row, and the two-column
   band card that puts the two sources side by side without merging them.
   ───────────────────────────────────────────────────────────────────────── */
nav.top .navsearch { margin-left: auto; }
nav.top .navsearch + .navlink { margin-left: 18px; }
nav.top .navsearch input {
  width: 260px; padding: 6px 10px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--page-2); color: var(--ink);
  font-family: var(--mono); font-size: 12px;
}
nav.top .navsearch input:focus { outline: 1px solid var(--accent); }

/* a link whose variant is unknown (a `confident_model` row): in the band,
   drawn, and deliberately colourless — it belongs to no variant series */
.s0-fill { fill: var(--muted); } .s0-line { stroke: var(--muted); }

/* source = provenance. `confirmed` is a transaction, `inferred` is an ask
   nobody is known to have paid; they never share a number or a colour. */
.pill.src-confirmed { border-color: var(--good); color: var(--good); }
.pill.src-inferred  { border-color: var(--axis); color: var(--muted); }
/* a staged sale nobody has confirmed either way: neither of the two above,
   and visibly not the green one — an unconfirmed candidate styled like
   neutral chrome beside a confirmed pill reads as "fine" */
.pill.src-candidate { border-style: dashed; border-color: var(--s3); color: var(--s3); }
.srcgrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.srcgrid .srccard { border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.srcgrid .srccard.empty-band { opacity: 0.72; }
.srcgrid h3 { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.04em; }
.srcgrid .why { color: var(--muted); font-size: 11px; margin: 6px 0 10px; }
.hitlist { margin: 0 0 18px; }
.hitlist .linehead { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
                     text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.searchbig { display: flex; gap: 10px; margin: 18px 0 6px; }
.searchbig input { flex: 1; padding: 12px 14px; font-size: 15px; border-radius: var(--r);
                   border: 1px solid var(--border); background: var(--page-2); color: var(--ink); }

/* the deals page (#58). The dismissal menu is a <details>, so the REASON is
   taken at the moment of judgment without a line of JavaScript: the ✕ is
   the summary, the panel under it is the form. `list-style: none` (and the
   webkit marker rule) removes the disclosure triangle, which would
   otherwise sit inside the button. */
.hidemenu { display: inline-block; position: relative; }
.hidemenu > summary { list-style: none; cursor: pointer; display: inline-flex; }
.hidemenu > summary::-webkit-details-marker { display: none; }
.hidemenu[open] > summary { color: var(--bad); border-color: var(--bad); opacity: 1; }
.hidemenu > form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 260px;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
}
.hidemenu label { display: flex; flex-direction: column; gap: 4px;
                  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
                  color: var(--muted); }
.hidemenu select, .hidemenu input[type="text"] {
  font: 400 13px var(--sans); text-transform: none; letter-spacing: 0;
  padding: 6px 8px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--page-2); color: var(--ink);
}
/* the margin is the column this page exists for: it carries the weight */
.deal-list td.num b { font-size: 14px; }

/* search type-ahead (inline in base.html): the header box AND the big
   search-page box share one dropdown */
:is(nav.top .navsearch, .searchbig) { position: relative; }
:is(nav.top .navsearch, .searchbig) .suggest {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  width: max(100%, 360px); max-width: calc(100vw - 32px);
  margin: 0; padding: 4px; list-style: none;
  background: var(--page-2); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
}
:is(nav.top .navsearch, .searchbig) .suggest a {
  display: flex; flex-direction: column; gap: 2px; padding: 7px 10px;
  border-radius: calc(var(--r) - 4px); color: var(--ink); text-decoration: none;
}
:is(nav.top .navsearch, .searchbig) .suggest li.on a,
:is(nav.top .navsearch, .searchbig) .suggest a:hover { background: color-mix(in oklch, var(--accent) 16%, transparent); }
:is(nav.top .navsearch, .searchbig) .suggest .nm { font-size: 13px; }
:is(nav.top .navsearch, .searchbig) .suggest .meta { font-family: var(--mono); font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* the price trend: dashed, coloured by direction (falling is good for a buyer) */
svg .trend { stroke-width: 2.2; stroke-dasharray: 7 5; fill: none; }
svg .trend-falling { stroke: var(--good); }
svg .trend-rising { stroke: var(--bad); }
svg .trend-stable { stroke: var(--muted); }
.trendline { margin: 0 0 6px; }
.trendline .rising { color: var(--bad); font-weight: 600; }

.versions ins { background: color-mix(in srgb, var(--good) 22%, transparent); text-decoration: none; }
.versions del { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.versions details + details { margin-top: .5rem; }

/* ── language switch (SV | EN), top right of the nav ── */
nav.top .langsw {
  margin-left: 18px; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted);
}
nav.top .langsw b { color: var(--ink); font-weight: 600; }
nav.top .langsw a { color: var(--muted); }
nav.top .langsw a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 700px) {
  nav.top .top-inner { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; }
  nav.top .navsearch { order: 10; flex: 1 1 100%; margin-left: 0; }
  nav.top .navsearch input { width: 100%; box-sizing: border-box; }
  nav.top .langsw { margin-left: auto; }
}
