/* combineSearch: industrial dashboard, dark by default with a light theme for daylight. Tokens and components per
   DESIGN.md; the Sprint 6 type and touch scale (SPRINT_PLAN.md) is below. Every colour on the page comes from a
   token, so both themes stay readable: derived borders and washes use color-mix() of a token, never a fixed rgba. */

:root {
  /* type and touch scale: one scale everywhere, the Mac included (filters.css and cards.css use these too) */
  --fs-body: 17px;          /* body text, buttons, inputs */
  --fs-small: 15px;         /* secondary lines: hints, notes, table cells, tile rows */
  --fs-label: 14px;         /* labels, sentence case, weight 500 (no uppercase tracking) */
  --fs-title: 20px;         /* card and page titles, weight 600 */
  --fs-price: 28px;         /* asking price and the dashboard numerals, weight 500 */
  --fs-chip: 14px;          /* status chips, 28 px tall */
  --tap: 44px;              /* the smallest target */
  --tap-lg: 48px;           /* icon buttons, inputs, selects */
  --gap-tap: 12px;          /* space between neighbouring targets */
  --topbar-h: 64px;         /* the sticky topbar's height (one row: 48 px controls + 8 px above and below); the filter
                               bar and the detail panel stick right under it. 124px with a toolbar row, 0 on phones */

  /* colour, dark theme (the default; the light theme below redefines these) */
  --bg: #121212;
  --surface: #1B1B1B;
  --surface-2: #232323;     /* inputs, nested panels */
  --surface-3: #2A2A2A;     /* hover fill */
  --well: #151515;          /* the recessed well behind tile grids */
  --line: #3A3A3A;
  --line-strong: #4A4A4A;
  --line-hover: #5C5C57;
  --text: #F2F2F0;
  --muted: #B4B4AE;         /* secondary text and labels, 7:1 or better on every surface */
  --dim: #5F5F5A;           /* decoration only (ticks, dots, rules); never text or placeholders */
  --accent: #6FA8FF;        /* cool blue highlight (was mustard yellow) */
  --accent-hover: #8ABBFF;
  --on-accent: #0E1726;     /* text on --accent, and on --text where a pill is "on" */
  --on-accent-muted: #182740; /* secondary text on --accent (6.2:1) */
  --on-text-muted: #4D525C; /* a count inside an "on" pill, on the --text fill (7:1) */
  --red: #E25A45;
  --blue: #7F8A9C;          /* quiet slate for the 'stable' status, so the accent stands out */
  --good: #3FC9A6;          /* price drops */
  --new: #F2B544;           /* new listings: badge, tick bar, tint, the timeline's 'added' series */
  --violet: #A78BFA;        /* auction lots */
  --olive: #9A8A2E;
  --check: #C9B95A;         /* "needs checking": a must-have depends on a value the ad doesn't give (olive family) */
  --differ: #F5A55A;        /* amber: the same machine's ads disagree on price / hours / year (6.5:1 on its tint) */
  --star: #F2B544;          /* the shortlist star when on */
  --series-seen: #D9D9D4;   /* the timeline's 'first seen' series */
  /* text-safe variants of the status hues (>= 4.5:1 on their tints) */
  --red-text: #F28470;
  --blue-text: #B4BCC9;
  --good-text: #7EE0C8;
  --new-text: #F7CB70;
  --violet-text: #C4B5FD;
  --tint-accent: rgba(111, 168, 255, .10);
  --tint-red: rgba(226, 90, 69, .12);
  --tint-blue: rgba(127, 138, 156, .12);
  --tint-good: rgba(63, 201, 166, .16);
  --tint-new: rgba(242, 181, 68, .14);
  --tint-violet: rgba(167, 139, 250, .16);
  --tint-check: rgba(154, 138, 46, .16);
  --tint-differ: rgba(242, 140, 40, .16);
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --texture-line: rgba(255, 255, 255, .025);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23B4B4AE' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --make-bar-filter: none;  /* the By-make bars use brand colours set inline (MAKE_COLORS in app/main.py) */
  color-scheme: dark;

  --radius: 16px;
  --radius-sm: 10px;
  --pill: 999px;
  /* only on the wells behind tile grids (never behind text) */
  --grid-texture:
    repeating-linear-gradient(0deg, var(--texture-line) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, var(--texture-line) 0 1px, transparent 1px 28px);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Light theme: follows the device unless the theme switch (POST /theme, a `theme` cookie that base.html turns into
   data-theme on <html>) says otherwise. The two blocks hold the same values; keep them in step. Every text pair is
   4.5:1 or better on --bg, --surface and its own tint (muted 7:1). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) {
    --bg: #F3F2EE; --surface: #FFFFFF; --surface-2: #ECEBE6; --surface-3: #E3E2DC; --well: #E8E7E1;
    --line: #D6D4CC; --line-strong: #B9B6AC; --line-hover: #9C998F;
    --text: #141414; --muted: #4E4E48; --dim: #A3A199;
    --accent: #1A56C4; --accent-hover: #14459E; --on-accent: #FFFFFF; --on-accent-muted: #E3EAF8; --on-text-muted: #B4B4B4;
    --red: #D2442F; --blue: #6B778A; --good: #14A383; --new: #D9961A; --violet: #7C5CE0; --olive: #8A7A1E;
    --check: #6B5E10; --differ: #9A4A00; --star: #B87A0B; --series-seen: #6B6B65;
    --red-text: #B3321F; --blue-text: #4A5568; --good-text: #0A6B53; --new-text: #8A5A00; --violet-text: #5B3FC4;
    --tint-accent: rgba(26, 86, 196, .08); --tint-red: rgba(210, 68, 47, .09); --tint-blue: rgba(107, 119, 138, .12);
    --tint-good: rgba(20, 163, 131, .10); --tint-new: rgba(217, 150, 26, .14); --tint-violet: rgba(124, 92, 224, .10);
    --tint-check: rgba(154, 138, 46, .14); --tint-differ: rgba(214, 120, 20, .12);
    --shadow: 0 8px 24px rgba(20, 20, 20, .14);
    --texture-line: rgba(0, 0, 0, .035);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234E4E48' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --make-bar-filter: brightness(.8) saturate(1.1);  /* brand colours made for the dark surfaces, darkened to show on white */
    color-scheme: light;
  }
}
:root[data-theme=light] {
  --bg: #F3F2EE; --surface: #FFFFFF; --surface-2: #ECEBE6; --surface-3: #E3E2DC; --well: #E8E7E1;
  --line: #D6D4CC; --line-strong: #B9B6AC; --line-hover: #9C998F;
  --text: #141414; --muted: #4E4E48; --dim: #A3A199;
  --accent: #1A56C4; --accent-hover: #14459E; --on-accent: #FFFFFF; --on-accent-muted: #E3EAF8; --on-text-muted: #B4B4B4;
  --red: #D2442F; --blue: #6B778A; --good: #14A383; --new: #D9961A; --violet: #7C5CE0; --olive: #8A7A1E;
  --check: #6B5E10; --differ: #9A4A00; --star: #B87A0B; --series-seen: #6B6B65;
  --red-text: #B3321F; --blue-text: #4A5568; --good-text: #0A6B53; --new-text: #8A5A00; --violet-text: #5B3FC4;
  --tint-accent: rgba(26, 86, 196, .08); --tint-red: rgba(210, 68, 47, .09); --tint-blue: rgba(107, 119, 138, .12);
  --tint-good: rgba(20, 163, 131, .10); --tint-new: rgba(217, 150, 26, .14); --tint-violet: rgba(124, 92, 224, .10);
  --tint-check: rgba(154, 138, 46, .14); --tint-differ: rgba(214, 120, 20, .12);
  --shadow: 0 8px 24px rgba(20, 20, 20, .14);
  --texture-line: rgba(0, 0, 0, .035);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234E4E48' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --make-bar-filter: brightness(.8) saturate(1.1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { flex: none; display: block; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip {
  position: absolute; left: 16px; top: -64px; z-index: 10; display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 18px; border-radius: var(--pill); background: var(--accent); color: var(--on-accent); font-weight: 500;
}
.skip:focus { top: 12px; color: var(--on-accent); }
.muted { color: var(--muted); }
.lbl, .label {
  font-size: var(--fs-label); font-weight: 500; color: var(--muted);
}
form.inline { display: inline; margin: 0; }

/* ------------------------------------------------------------------ topbar */

/* One 64 px row at every width above a phone, so both iPad Pro sizes and the Mac get the same bar, sticky at the top
   so the filter bar and the detail panel stick right under it (at --topbar-h): the dashboard button and the page
   tabs on the left; search, the red bell and the gear menu on the right. The bottom rule is an inset shadow, so the
   bar is exactly --topbar-h tall. A page that fills the toolbar block gets a second row (body.tb-2rows). */
.topbar { position: sticky; top: 0; z-index: 25; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
.tb-row {
  max-width: 1360px; height: 64px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
body.tb-2rows { --topbar-h: 124px; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-left { flex: 0 1 auto; }
.tb-right { flex: 1 0 auto; justify-content: flex-end; }
.tb-row2 {
  max-width: 1360px; height: 60px; margin: 0 auto; padding: 0 24px 12px;
  display: flex; align-items: center; gap: 10px 16px;
}
.tb-tools { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.tb-tools::-webkit-scrollbar { display: none; }

/* the page tabs: quiet until current, which is filled */
.pill {
  display: inline-flex; align-items: center; gap: 8px; flex: none; height: var(--tap-lg); padding: 0 16px;
  border-radius: var(--pill); border: 1px solid transparent; background: transparent;
  color: var(--text); font-size: var(--fs-body); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.pill:hover { color: var(--text); background: var(--surface-3); }
.pill.on, .pill.on:hover { background: var(--text); border-color: var(--text); color: var(--on-accent); }
.pill-n { color: var(--muted); font-weight: 500; }
.pill.on .pill-n { color: var(--on-text-muted); }
.pill-n.hl { color: var(--accent); }
.pill .ic { color: var(--muted); }
.pill.on .ic { color: var(--on-accent); }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); cursor: pointer; padding: 0; transition: background-color .15s, border-color .15s;
}
.topbar .icon-btn { width: var(--tap-lg); height: var(--tap-lg); }
.icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--line-strong); }
.icon-btn.on, .icon-btn.on:hover { background: var(--text); border-color: var(--text); color: var(--on-accent); }
.icon-btn.alert { background: color-mix(in srgb, var(--red) 16%, transparent); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red-text); }
.icon-btn.alert:hover { background: color-mix(in srgb, var(--red) 24%, transparent); color: var(--red-text); }
.icon-btn .ping {
  position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px var(--surface);
}
.icon-btn.sm { width: var(--tap); height: var(--tap); }

.search {
  display: flex; align-items: center; flex: 0 1 240px; height: var(--tap-lg); min-width: 160px; padding: 0 2px 0 16px;
  border-radius: var(--pill); border: 1px solid var(--line); background: var(--surface-2);
}
.search:focus-within { border-color: var(--accent); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none;
  font-size: var(--fs-body); color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.search button {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer;
}
.search button:hover { background: var(--surface-3); }

/* the gear menu (base.html): Sources, Runs, What to scrape, the theme switch (POST /theme) and Help, 48 px rows */
.tb-menu { position: relative; flex: none; }
.tb-menu > summary { list-style: none; }
.tb-menu > summary::-webkit-details-marker { display: none; }
.tb-menu[open] > summary:not(.on) { border-color: var(--accent); background: var(--tint-accent); }
.tb-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1;
  display: flex; flex-direction: column; gap: 2px; width: max-content; min-width: 300px; max-width: calc(100vw - 32px);
  padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.tb-panel form { display: contents; }
.tb-mi {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: var(--tap-lg); margin: 0; padding: 0 16px 0 14px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; font-size: var(--fs-body); text-align: left; white-space: nowrap; cursor: pointer;
}
.tb-mi .ic { color: var(--muted); }
.tb-mi[aria-current] { background: var(--tint-accent); font-weight: 600; }
.tb-mi[aria-current] .ic { color: var(--accent); }
.tb-mv { margin-left: auto; padding-left: 24px; color: var(--muted); font-size: var(--fs-small); }
.tb-sep { margin: 6px 8px; border: 0; border-top: 1px solid var(--line); }
/* the theme switch: the icon shows the current mode */
.theme-btn .ic { pointer-events: none; }

/* Help (_help.html): a modal panel opened from the gear menu */
.help {
  width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.help::backdrop { background: color-mix(in srgb, var(--bg) 72%, transparent); }
.help-in { display: flex; flex-direction: column; gap: 12px; padding: 0 24px 24px; font-size: var(--fs-body); }
.help-bar {
  position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 -24px; padding: 8px 12px 8px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.help-title { font-size: var(--fs-title); font-weight: 600; }
.help-h { margin: 8px 0 0; font-size: var(--fs-body); font-weight: 600; }
.help-chips { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.help-chips > div { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 4px 16px; align-items: baseline; }
.help-chips dt, .help-chips dd { margin: 0; }

@media (hover: hover) {
  .tb-mi:hover { background: var(--surface-3); color: var(--text); }
}

/* ------------------------------------------------------------------ page */

.page {
  max-width: 1360px; width: 100%; margin: 0 auto; padding: 20px 24px 56px;
  display: flex; flex-direction: column; gap: 16px;
}
.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-small);
}
.notice .ic { margin-top: 3px; }
.notice.ok { background: var(--tint-blue); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.notice.ok .ic { color: var(--blue-text); }
.notice.err { background: var(--tint-red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.notice.err .ic { color: var(--red-text); }
.notice.paused { background: color-mix(in srgb, var(--olive) 12%, transparent); border-color: color-mix(in srgb, var(--olive) 40%, transparent); }
.notice.paused .ic { color: var(--accent); }

/* ------------------------------------------------------------------ buttons, chips, inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 20px;
  border-radius: var(--pill); border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  font-size: var(--fs-body); font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.danger { color: var(--red-text); }
.btn.danger:hover { background: var(--tint-red); border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red-text); }
.btn.sm { min-height: var(--tap); min-width: var(--tap); padding: 0 14px; font-size: var(--fs-small); }
.btn.icon { width: var(--tap-lg); height: var(--tap-lg); min-height: 0; padding: 0; }
.btn.icon.danger { border-color: var(--line); }
.btn.block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: var(--pill);
  font-size: var(--fs-chip); font-weight: 500; line-height: 1; letter-spacing: 0; text-transform: none; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent;
}
.chip.new { background: var(--tint-new); color: var(--new-text); }
.chip.auction { background: var(--tint-violet); color: var(--violet-text); }
.chip.drop { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good-text); }
.chip.up { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red-text); }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.chip.ghost { background: transparent; border-color: var(--line-strong); color: var(--muted); }
a.chip { height: var(--tap); padding: 0 14px; }  /* a chip that is a link is a full-size target */

.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: var(--pill);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: var(--fs-small); white-space: nowrap;
}
a.tag { height: var(--tap); }
a.tag:hover { color: var(--text); border-color: var(--line-strong); }

input[type=text], input[type=number], input[type=password], input[type=url], input[type=search].field-input, select.input {
  width: 100%; height: var(--tap-lg); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font-size: var(--fs-body); outline: none;
  transition: border-color .15s;
}
input[type=text]:focus, input[type=number]:focus, input[type=password]:focus, input[type=url]:focus, select.input:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select.input, .pill-select select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
  background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 14px center;
}
select option { background: var(--surface-2); color: var(--text); }

/* checkbox chips (criteria) and the toggle pill (listings) */
.cb {
  display: inline-flex; align-items: center; gap: 10px; height: var(--tap); padding: 0 16px 0 13px;
  border-radius: var(--pill); border: 1px solid var(--line-strong); background: transparent;
  font-size: var(--fs-small); color: var(--text); cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.cb:hover { border-color: var(--line-hover); }
.cb input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.cb:has(input:checked) { background: var(--tint-accent); border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.cb:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cb input:focus-visible { outline: none; }

/* ------------------------------------------------------------------ tile */

.tile {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 150px;
  padding: 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
a.tile { transition: border-color .15s, transform .15s; }
a.tile:hover { color: var(--text); border-color: var(--line-hover); }
.tile.stable { background: linear-gradient(var(--tint-blue), var(--tint-blue)), var(--surface); border-color: color-mix(in srgb, var(--blue) 55%, transparent); }
.tile.new { background: linear-gradient(var(--tint-new), var(--tint-new)), var(--surface); border-color: color-mix(in srgb, var(--new) 55%, transparent); }
.tile.alert { background: linear-gradient(var(--tint-red), var(--tint-red)), var(--surface); border-color: color-mix(in srgb, var(--red) 55%, transparent); }
a.tile.stable:hover { border-color: color-mix(in srgb, var(--blue) 90%, transparent); }
a.tile.new:hover { border-color: color-mix(in srgb, var(--new) 90%, transparent); }
a.tile.alert:hover { border-color: color-mix(in srgb, var(--red) 90%, transparent); }
.tile.selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tile.selected .k, .tile.selected .u, .tile.selected .tile-note { color: var(--on-accent-muted); }
.tile.selected .tick { background: var(--on-accent); }
.tile.selected .icon-btn { background: color-mix(in srgb, var(--on-accent) 8%, transparent); border-color: color-mix(in srgb, var(--on-accent) 22%, transparent); color: var(--on-accent); }
.tile.selected .icon-btn:hover { background: color-mix(in srgb, var(--on-accent) 16%, transparent); }
.tile.empty {
  align-items: center; justify-content: center; text-align: center; gap: 12px;
  background: color-mix(in srgb, var(--text) 3%, transparent); border: 1px dashed color-mix(in srgb, var(--text) 26%, transparent); color: var(--muted);
}
a.tile.empty:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 50%, transparent); background: color-mix(in srgb, var(--text) 5%, transparent); }
.plus {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border-radius: 50%;
  background: var(--text); color: var(--on-accent);
}

.tile-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tick { flex: none; width: 3px; height: 16px; border-radius: 2px; background: var(--dim); }
.stable > .tile-head .tick, .tick.stable { background: var(--blue); }
.new > .tile-head .tick, .tick.new { background: var(--new); }
.alert > .tile-head .tick, .tick.alert { background: var(--red); }
.tick.off { background: var(--dim); }
.tile-title { flex: 1; min-width: 0; font-size: var(--fs-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-value { flex: none; font-size: var(--fs-title); font-weight: 500; white-space: nowrap; }
.tile-body { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.tile-note { font-size: var(--fs-small); color: var(--muted); }
.kv { display: flex; align-items: baseline; gap: 5px; min-width: 0; font-size: var(--fs-small); }
.kv .k { flex: none; font-size: var(--fs-small); font-weight: 500; color: var(--muted); }
.kv .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.kpis .tile-body { margin-top: 0; }
.tile-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tile.selected .chip { background: color-mix(in srgb, var(--on-accent) 12%, transparent); color: var(--on-accent); }

/* numerals with a small unit: weight 500 (thin strokes wash out in glare) */
.num { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 500; line-height: 1; white-space: nowrap; }
.num .n { font-size: var(--fs-price); letter-spacing: -.01em; }
.num .u { font-size: var(--fs-small); color: var(--muted); font-weight: 500; }
.num.md .n { font-size: var(--fs-price); }
.num.sm .n { font-size: var(--fs-title); }
.tile-value .n { font-size: var(--fs-title); }
.tile-value .u { font-size: var(--fs-small); color: var(--muted); margin-left: 2px; }
.tile.selected .tile-value .u { color: var(--on-accent-muted); }

/* ------------------------------------------------------------------ panel */

.panel {
  min-width: 0; padding: 18px 20px 20px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { font-size: var(--fs-body); font-weight: 600; }
.panel-sub { font-size: var(--fs-small); color: var(--muted); }
.empty-note { color: var(--muted); font-size: var(--fs-small); }

/* ------------------------------------------------------------------ dashboard */

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpis .tile { min-height: 176px; }
.kpis .num .n { font-size: var(--fs-price); }

.hold-panel { padding-bottom: 16px; }
.hold {
  --cols: 3;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)) minmax(150px, .6fr);
  grid-template-rows: repeat(2, minmax(150px, auto)); grid-auto-flow: column; gap: 10px;
  padding: 10px; border-radius: 14px; background: var(--grid-texture), var(--well); border: 1px solid var(--line);
}
.hold .tile.empty { grid-row: span 2; }
.hold.none { display: block; }
.hold.none .tile.empty { min-height: 160px; }
.hold .tile { min-height: 150px; }
.hold .tile-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.hold .tile-head { align-items: flex-start; }
.hold .tile-head .tick { margin-top: 2px; }

/* the dashboard at the Sprint 6 scale: nothing under 15 px (labels, column heads, chips, the timeline's dates), and a
   link inside a sentence is a 44 px target (the padding reaches above and below the line without moving it) */
.dash { display: contents; }
.dash .lbl, .dash .rt-head, .dash .tl-axis, .dash .chip, .dash .fit-pill, .dash .sale-srcs .k, .dash .bars.makes .bp .u { font-size: var(--fs-small); }
.dash .panel-sub a, .dash .empty-note a, .dash .panel-foot a { padding-block: 13px; }
.dash .tile.selected .tile-sub, .dash .tile.selected .k, .dash .tile.selected .u { color: var(--on-accent); }
/* a listing tile's facts in the card's words: hours with units, place, seller (+N sites) */
.tile-facts { display: flex; flex-direction: column; gap: 4px; margin: auto 0 0; padding: 0; list-style: none; min-width: 0; font-size: var(--fs-small); }
.tile-facts li { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-facts abbr { text-decoration: none; }
.tile-chips .chip.cd-st, .tile-chips .chip.cd-vd { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.span-6 { grid-column: span 6; }
.span-3 { grid-column: span 3; }
.span-12 { grid-column: span 12; }

/* timeline */
.tl-heads { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tl-read { display: inline-flex; align-items: center; gap: 10px; }
.ring { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.ring.y { border-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.ring.w { border-color: var(--series-seen); border-right-color: color-mix(in srgb, var(--series-seen) 25%, transparent); }
.tl-read .lbl { display: block; margin-top: 4px; }
.tl { position: relative; }
.tl-plot {
  position: relative; height: 128px; display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr));
  border-bottom: 1px solid var(--line-strong);
  background:
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--text) 5.5%, transparent) 0 1px, transparent 1px 7px) bottom / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--text) 2.5%, transparent) 0 1px, transparent 1px 7px);
}
.tl-day { position: relative; border-left: 1px solid color-mix(in srgb, var(--text) 6%, transparent); }
.tl-day:first-child { border-left-color: transparent; }
.tl-day:hover, .tl-day:focus-visible { background: color-mix(in srgb, var(--text) 3%, transparent); }
.tl-day:focus-visible { outline-offset: -2px; }
.tl-fill { position: absolute; left: calc(50% + 1px); right: 3px; bottom: 0; background: linear-gradient(to top, color-mix(in srgb, var(--new) 14%, transparent), color-mix(in srgb, var(--new) 4%, transparent)); border-radius: 2px 2px 0 0; }
.tl-seg { position: absolute; left: 3px; right: 3px; height: 2px; border-radius: 2px; transform: translateY(1px); }
.tl-seg.seen { right: calc(50% + 1px); background: var(--series-seen); opacity: .75; }
.tl-seg.added { left: calc(50% + 1px); background: var(--new); height: 3px; }
.tl-day.today .tl-seg.added { background: var(--new-text); box-shadow: 0 0 10px color-mix(in srgb, var(--new) 55%, transparent); }
.tl-day.today .tl-seg.seen { opacity: 1; background: var(--text); }
.tl-scrub { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: color-mix(in srgb, var(--text) 45%, transparent); }
.tl-dot { position: absolute; left: 50%; width: 9px; height: 9px; margin: 0 0 -4px -4px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }
.tl-axis { display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr)); margin-top: 8px; font-size: var(--fs-label); color: var(--muted); }
.tl-axis span { text-align: center; white-space: nowrap; overflow: visible; }
.tl-empty { position: absolute; inset: 0 0 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: var(--fs-small); }
.legend { display: flex; align-items: center; gap: 14px; font-size: var(--fs-small); color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* gauge */
.gauge { position: relative; max-width: 270px; margin: 4px auto 0; }
.gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.gauge-read { position: absolute; left: 0; right: 0; bottom: 2%; text-align: center; }
.gauge-cap { margin-top: 8px; text-align: center; font-size: var(--fs-small); color: var(--muted); }
.gauge-cap.over { color: var(--red-text); }
.gauge-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* price range */
.range3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.range3 .lbl { display: block; margin-bottom: 6px; }
.range3 .num .n { font-size: var(--fs-price); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 36px; align-items: center; gap: 10px; font-size: var(--fs-small); }
.bar-row .bl { color: var(--muted); white-space: nowrap; }
.bar-row .bn { text-align: right; }
.bar-track { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); min-width: 0; }
.bars.makes .bar-fill { filter: var(--make-bar-filter); }
.bar-fill.none { background: var(--muted); }
.range-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-small); }

/* sources + runs lists */
.rows-table { display: flex; flex-direction: column; }
.rt-head, .rt-row { display: grid; align-items: center; gap: 12px; padding: 12px 0; }
.rt-head { padding-top: 0; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.rt-row { border-top: 1px solid var(--line); font-size: var(--fs-small); }
.src-grid { grid-template-columns: minmax(90px, 1.4fr) repeat(3, minmax(44px, .8fr)) minmax(70px, 1fr); }
.src-grid > :nth-child(n+2):nth-child(-n+4) { text-align: right; }
.src-err { grid-column: 1 / -1; margin-top: -4px; font-size: var(--fs-small); color: var(--red-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-grid { grid-template-columns: minmax(120px, 1.6fr) minmax(60px, .8fr) minmax(64px, .8fr) minmax(48px, .6fr) minmax(48px, .6fr); }
.run-grid > :nth-child(n+4) { text-align: right; }
.st { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-small); }
.st .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.st.done .dot, .st.ok .dot { background: var(--good); }
.st.done, .st.ok { color: var(--good-text); }
.st.running .dot { background: var(--new); }
.st.running { color: var(--new-text); }
.st.failed .dot, .st.error .dot { background: var(--red); }
.st.failed, .st.error { color: var(--red-text); }
.st.running .dot { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.st.running { color: var(--accent); }
.st.none { color: var(--muted); }
.next-run { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 12px; border-radius: 12px; background: var(--surface-2); }
.next-run .lbl { display: block; margin-bottom: 3px; }
.next-run-time { font-size: var(--fs-title); font-weight: 500; }
.run-live { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: var(--fs-small); }

/* ------------------------------------------------------------------ running list */

.pill-select { position: relative; display: inline-flex; align-items: center; }
.pill-select select {
  height: var(--tap-lg); padding: 0 40px 0 16px; border-radius: var(--pill); border: 1px solid var(--line-strong); background-color: var(--surface-2);
  color: var(--text); font-size: var(--fs-body); outline: none;
}
.pill-select select:hover { border-color: var(--line-hover); }
.pill-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cb.toggle { height: var(--tap); border-color: var(--line-strong); background: var(--surface-2); }
.cb.toggle:has(input:checked) { background: var(--tint-accent); border-color: color-mix(in srgb, var(--accent) 70%, transparent); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.list-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--fs-small); color: var(--muted); }
.find-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--fs-small); color: var(--muted); }

.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: start;
  padding: 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); transition: opacity .2s, border-color .15s;
}
.row:hover { border-color: var(--line-strong); }
.row.new { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: linear-gradient(color-mix(in srgb, var(--accent) 5%, transparent), color-mix(in srgb, var(--accent) 5%, transparent)), var(--surface); }
.row.alert { border-color: color-mix(in srgb, var(--red) 38%, transparent); }
.row.htmx-swapping { opacity: 0; }
.row.dismissed { border-style: dashed; border-color: var(--line-strong); background: transparent; }
.row.dismissed > .thumb, .row.dismissed > .body { opacity: .55; }
.row.removed {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px;
  border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--muted); font-size: var(--fs-small);
}
.row.removed > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb {
  width: 96px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--dim);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.title-line { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-width: 0; }
.title-line .tick { height: 16px; }
.title { font-size: var(--fs-title); font-weight: 600; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.title a { color: var(--text); }
.title a:hover { color: var(--accent); }
.matched { font-size: var(--fs-small); color: var(--muted); }
.facts { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.3fr; gap: 10px 20px; }
.fact .k { font-size: var(--fs-label); font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.fact .v { font-size: var(--fs-body); overflow-wrap: anywhere; }
.fact .num .n { font-size: var(--fs-price); font-weight: 500; }
.fact .was { display: block; margin-top: 4px; font-size: var(--fs-small); color: var(--muted); text-decoration: line-through; }
.foot { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.actions { display: flex; align-items: center; gap: 8px; }
.empty-state {
  padding: 36px 20px; text-align: center; border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--text) 22%, transparent);
  color: var(--muted); font-size: var(--fs-body);
}
.note { font-size: var(--fs-small); color: var(--muted); }

/* ------------------------------------------------------------------ criteria */

.split { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.search-list { display: flex; flex-direction: column; gap: 8px; }
.search-tile {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
}
.search-tile:hover { color: var(--text); border-color: var(--line-strong); }
.search-tile.on { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: linear-gradient(var(--tint-accent), var(--tint-accent)), var(--surface-2); }
.search-tile .tile-head { gap: 8px; }
.search-tile .hint { padding-left: 11px; }
.howto ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: var(--fs-small); }
.howto li::marker { color: var(--muted); }
.editor { display: flex; flex-direction: column; gap: 20px; padding: 20px 22px 22px; }
.editor .panel-head { margin-bottom: 0; }
.editor-title { font-size: var(--fs-title); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > .lbl { display: block; }
.hint { font-size: var(--fs-small); color: var(--muted); }
.cbs { display: flex; flex-wrap: wrap; gap: 8px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.editor-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px 16px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line); }
/* Save is first in the DOM so Enter submits it; shown last. */
.btns { display: flex; flex-direction: row-reverse; gap: var(--gap-tap); flex-wrap: wrap; flex: 1 1 auto; }
/* What to scrape (criteria.html): the filter bar's controls (filters.css .fb-chip, .fb-switch, .fb-select) on a form */
.crit-intro { font-size: var(--fs-body); }
.crit-intro a { padding-block: 12px; }  /* a 44 px target inside the sentence, the line unmoved */
.crit-new { margin-top: 12px; }
.crit-set { margin: 0; padding: 0; border: 0; }
.crit-set > legend { float: left; width: 100%; margin: 0; padding: 0; }  /* laid out as a flex item, like .fb-field's */
.crit-chips { display: flex; flex-wrap: wrap; gap: 10px var(--gap-tap); }
.three > .crit-span { grid-column: 1 / -1; margin-top: -8px; }
.crit-on { flex: none; }
.btns .danger { margin-right: auto; }

/* ------------------------------------------------------------------ runs */

.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(var(--tint-accent), var(--tint-accent)), var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font-size: var(--fs-body);
}
.pulse { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.pulse::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--accent); animation: ring 1.6s ease-out infinite; }
@keyframes ring { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.4); opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; } }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
th {
  text-align: left; padding: 0 14px 10px; font-size: var(--fs-label); font-weight: 500;
  color: var(--muted); white-space: nowrap;
}
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td.rt, th.rt { text-align: right; }
td.big { font-size: var(--fs-body); font-weight: 500; }
.srcstat { white-space: nowrap; color: var(--muted); }
.srcstat b { color: var(--text); font-weight: 500; }
/* plain disclosures (the runs table's error lists): a 44 px row */
details summary { cursor: pointer; min-height: var(--tap); padding: 10px 0; color: var(--red-text); font-size: var(--fs-small); }
.errs { margin: 6px 0 0; padding-left: 16px; color: var(--red-text); font-size: var(--fs-small); max-width: 520px; }

/* ------------------------------------------------------------------ login */

body.bare .page { min-height: 100vh; justify-content: center; align-items: center; padding-top: 24px; }
body.bare .notice { width: 100%; max-width: 400px; }
.login { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; padding: 28px 24px 24px; background: var(--surface); }
.login-mark { display: flex; align-items: center; gap: 10px; }
.login-mark .tick { height: 22px; }
.login h1 { font-size: var(--fs-title); font-weight: 600; }
.login .btn { width: 100%; min-height: var(--tap-lg); }

/* ------------------------------------------------------------------ responsive
   Four tiers. Wide: over 1366 (a Mac window). Tablet landscape: 1025 to 1366, so the 11-inch (1194) and 13-inch
   (1366) iPad Pro get exactly the same layout. Narrow: 721 to 1024 (portrait, small windows). Phone: 720 and under. */

@media (max-width: 1366px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis > * { grid-column: span 2; }
  .kpis > :nth-child(n+4) { grid-column: span 3; }
  .span-6 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
}

@media (max-width: 1024px) {
  /* still one row: the tabs scroll sideways rather than push the search off it */
  .tb-row { gap: 12px; }
  .tb-left { overflow-x: auto; padding-block: 2px; scrollbar-width: none; }
  .tb-left::-webkit-scrollbar { display: none; }
  .tb-left > * { flex: none; }
  .tb-right { flex: 0 1 auto; }
  .search { flex-basis: 200px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { display: contents; }
  .howto { order: 3; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hold {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 18px; -webkit-overflow-scrolling: touch;
    margin: 0 -18px; padding: 10px 18px; border-radius: 0; border-left: 0; border-right: 0; scrollbar-width: none;
  }
  .hold::-webkit-scrollbar { display: none; }
  .hold .tile { flex: 0 0 236px; scroll-snap-align: start; }
  .hold .tile.empty { flex-basis: 160px; }
  .hold.none { display: block; margin: 0; border: 1px solid var(--line); border-radius: 14px; }
}

@media (max-width: 720px) {
  /* phones: two rows (the tabs, then search + bell + gear) that scroll away with the page, so nothing sticks
     under them (--topbar-h 0); the detail panel covers the whole screen */
  :root, body.tb-2rows { --topbar-h: 0px; }
  .page { padding: 14px 16px 40px; gap: 12px; }
  .topbar { position: relative; }
  .tb-row { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .tb-left { flex: 1 1 100%; margin: 0 -16px; padding: 0 16px; }
  .tb-right { flex: 1 1 100%; }
  .search { flex: 1 1 auto; min-width: 0; }
  .tb-left .pill { padding: 0 14px; }
  .tb-row2 { height: auto; padding: 0 16px 12px; }
  .help-chips > div { grid-template-columns: minmax(0, 1fr); }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > * { grid-column: span 1; }
  .kpis > :nth-child(n+4) { grid-column: span 1; }
  .kpis > :last-child { grid-column: span 2; }
  .kpis .tile { min-height: 160px; padding: 14px; }

  .hold { margin: 0 -14px; padding: 10px 14px; scroll-padding: 0 14px; }

  .span-3, .span-6, .span-12 { grid-column: span 12; }
  .hide-sm { display: none !important; }
  .run-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, .5fr) minmax(0, .7fr); gap: 8px; }
  .src-grid { grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, .7fr)) minmax(0, .9fr); gap: 8px; }
  .tl-heads .tag { display: none; }
  .panel { padding: 14px 14px 16px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .tl-plot { height: 112px; }

  .tb-tools { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
  .tb-tools::-webkit-scrollbar { display: none; }

  .row { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .thumb { width: 72px; height: 56px; }
  .row .actions { grid-column: 1 / -1; justify-content: flex-end; }
  .row.removed .actions { grid-column: auto; }
  .row.noimg { grid-template-columns: minmax(0, 1fr); }
  .row.noimg > .thumb { display: none; }
  .facts { gap: 10px 14px; }

  .editor { padding: 16px 14px; }
  .two, .three { grid-template-columns: minmax(0, 1fr); }
  .btns { width: 100%; }
  .btns .btn { flex: 1 1 auto; }
  .btns .danger { margin-right: 0; }
}

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

/* By make panel: label · bar · count · median price */
.bars.makes .bar-row { grid-template-columns: minmax(88px, 136px) 1fr 36px 64px; }
.bars.makes .bp { justify-content: flex-end; color: var(--text); white-space: nowrap; }
.bars.makes .bp .n { font-size: var(--fs-small); font-weight: 500; }
.bars.makes .bp .u { font-size: var(--fs-label); }

/* ------------------------------------------------------------------ sources page */

.btn:disabled { opacity: .55; cursor: progress; }
.notice[hidden] { display: none; }
.chip .ic { margin: 0 5px 0 -2px; }
.panel-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* dashboard Sources panel: title links to /sources, off sources get a muted tag */
.title-link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--text); }
.title-link .ic { color: var(--muted); }
.title-link:hover, .title-link:hover .ic { color: var(--accent); }
.src-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.src-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-name .chip { flex: none; }
.rt-row.is-off .src-nm { color: var(--muted); }

/* On/Off switch: knob on the right and accent-coloured when on, on the left and grey when off */
.switch {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; width: 88px; height: var(--tap); padding: 0 14px 0 6px;
  border-radius: var(--pill); border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
  font-size: var(--fs-small); font-weight: 500; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.switch .knob { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-hover); flex: none; }
.switch:hover { color: var(--text); border-color: var(--line-hover); }
.switch.on { flex-direction: row-reverse; padding: 0 6px 0 14px; background: var(--tint-accent); border-color: color-mix(in srgb, var(--accent) 70%, transparent); color: var(--accent); }
.switch.on .knob { background: var(--accent); border-color: var(--accent); }
.switch.on:hover { border-color: var(--accent); color: var(--accent-hover); }

/* source rows (built-in and custom) */
.sl-grid { grid-template-columns: minmax(0, 1.7fr) minmax(44px, .5fr) minmax(44px, .5fr) minmax(0, 1.25fr) auto; }
.sl-grid > :nth-child(2), .sl-grid > :nth-child(3) { text-align: right; }
.sl-grid > :nth-child(4) { padding-left: 14px; }
.sl-name { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.sl-name .tick { margin-top: 3px; }
.sl-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sl-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sl-link { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-height: var(--tap); color: var(--text); font-weight: 500; }
.sl-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-link .ic { color: var(--muted); }
.sl-link:hover, .sl-link:hover .ic { color: var(--accent); }
.sl-sub { font-size: var(--fs-small); color: var(--muted); }
.sl-k { display: none; }
.sl-act { display: flex; align-items: center; justify-content: flex-end; gap: var(--gap-tap); }
.is-off .sl-title, .is-off .sl-link { color: var(--muted); }
.src-err.sl-err { margin-top: -2px; padding-left: 12px; white-space: normal; overflow-wrap: anywhere; }
.empty-state.sl-empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px 16px; font-size: var(--fs-body); }
.empty-state.sl-empty .ic { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--text); color: var(--on-accent); }
a.sl-empty:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 45%, transparent); }

/* add-a-source form, fetch indicator, test-fetch preview */
.add-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr) minmax(0, .9fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.add-btns { display: flex; gap: var(--gap-tap); flex-wrap: wrap; }
/* a link inside a sentence on the Sources page: a 44 px target, the line unmoved */
.src-page .panel-sub a, .src-page .panel-foot a { padding-block: 13px; }
.fetching {
  display: none; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: var(--fs-small);
  background: linear-gradient(var(--tint-accent), var(--tint-accent)), var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.fetching.htmx-request { display: flex; }
.preview-slot:empty { display: none; }
.preview { padding: 14px 16px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--well); }
.preview.err { padding-bottom: 14px; background: linear-gradient(var(--tint-red), var(--tint-red)), var(--surface); border-color: color-mix(in srgb, var(--red) 38%, transparent); }
.preview.err .preview-head .ic { color: var(--red-text); }
.preview-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-head strong { font-weight: 500; }
.preview-msg { margin-bottom: 8px; color: var(--red-text); font-size: var(--fs-small); overflow-wrap: anywhere; }
.preview .table-wrap { margin: 0 -16px; padding: 0 16px; }
.pv-table td { white-space: nowrap; }
.pv-table td.pv-title { white-space: normal; min-width: 220px; max-width: 380px; overflow-wrap: anywhere; }
.pv-table a { color: var(--text); }
.pv-table a:hover { color: var(--accent); }

@media (max-width: 1366px) {
  .add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  /* dashboard Sources panel: long names wrap (two lines at most) and the Off tag drops under them */
  .src-name { flex-wrap: wrap; gap: 3px 6px; }
  .src-nm { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }

  /* source rows stack: name + switch, then the three numbers with their own labels */
  .rt-head.sl-grid { display: none; }
  .sl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 8px 12px; align-items: start; }
  .sl-grid > .sl-name { grid-column: 1 / 4; align-self: center; }
  .sl-grid > .sl-act { grid-column: 4; grid-row: 1; }
  .sl-grid > .sl-run { grid-column: 3 / -1; padding-left: 0; }
  .sl-grid > :nth-child(2), .sl-grid > :nth-child(3) { text-align: left; }
  .sl-grid > .sl-n:nth-child(2) { padding-left: 12px; }
  .sl-k { display: block; margin-bottom: 2px; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
  .src-err.sl-err { padding-left: 12px; }

  .add-grid { grid-template-columns: minmax(0, 1fr); }
  .add-btns { width: 100%; }
  .add-btns .btn { flex: 1 1 auto; }
  .preview { padding: 12px 14px 4px; }
  .preview .table-wrap { margin: 0 -14px; padding: 0 14px; }
}

/* min–max range inputs on the criteria form */
.range2 { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.range2 .to { color: var(--muted); font-size: var(--fs-small); }

/* ------------------------------------------------------------------ market value (app/value.py) */

.chip.good { background: var(--tint-good); color: var(--good-text); }
.chip.high { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red-text); }
.value > .tile-head .tick, .tick.value { background: var(--good); }
a.tile.value:hover { border-color: color-mix(in srgb, var(--good) 60%, transparent); }

/* dashboard "Best value on the list": 3 columns of listing tiles in the same dark well as the latest tiles */
.value-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  padding: 10px; border-radius: 14px; background: var(--grid-texture), var(--well); border: 1px solid var(--line);
}
.value-grid .tile { min-height: 150px; }
.value-grid .tile-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.value-grid .tile-head { align-items: flex-start; }
.value-grid .tile-head .tick { margin-top: 2px; }

@media (max-width: 1024px) {
  .value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .value-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ sold prices (app/sales) */

/* running-list row: up to three nearest auction sales under the facts */
.sales-line { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; min-width: 0; font-size: var(--fs-small); color: var(--muted); }
.sales-line .k { flex: none; font-size: var(--fs-label); font-weight: 500; }
.sales-line ul { display: flex; flex-wrap: wrap; gap: 3px 12px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.sales-line li { min-width: 0; overflow-wrap: anywhere; }
.sales-line li + li { padding-left: 12px; border-left: 1px solid var(--line-strong); }
.sales-line a { color: var(--text); }
.sales-line a:hover { color: var(--accent); }

/* dashboard "Recent sales" */
.sale-grid { grid-template-columns: minmax(0, 1fr) auto minmax(52px, auto); }
.sale-grid > :nth-child(2), .sale-grid > :nth-child(3) { text-align: right; }
.sale-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sale-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
/* the title link's tap area reaches into the row's padding: 44 px tall without moving anything */
a.sale-title { display: block; padding-block: 11px; margin-block: -11px; }
a.sale-title:hover { color: var(--accent); }
.sale-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); color: var(--muted); }
.sale-price { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.sale-date { color: var(--muted); white-space: nowrap; }
.chip.fx { background: transparent; border-color: var(--line-strong); color: var(--muted); }

/* Sources page "Sales sources": the source-row grid with a fifth data column instead of the switch */
.ss-grid { grid-template-columns: minmax(0, 1.7fr) minmax(44px, .5fr) minmax(44px, .5fr) minmax(0, 1.25fr) minmax(0, .8fr); }

@media (max-width: 720px) {
  .ss-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ss-grid > .sl-name { grid-column: 1 / -1; }
  .ss-grid > .sl-run { grid-column: auto; }
  .ss-grid > :nth-child(4) { padding-left: 0; }
}

/* ------------------------------------------------------------------ buying requirements (app/requirements.py) */

/* --check and --tint-check ("needs checking") are with the other tokens at the top */
.check-group > summary > .ic { color: var(--muted); transition: transform .15s; }
.check-group[open] > summary > .ic { transform: rotate(180deg); }

/* the "Needs checking" group under the matches, collapsed by default */
.check-group { border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--check) 45%, transparent); background: color-mix(in srgb, var(--olive) 5%, transparent); }
.check-group > summary {
  display: flex; align-items: center; gap: 12px; min-height: 56px; margin: 0; padding: 12px 16px; list-style: none;
  color: var(--text); font-size: var(--fs-body);
}
.check-group > summary::-webkit-details-marker { display: none; }
.check-group > summary:hover .cg-title { color: var(--check); }
.cg-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cg-title { font-weight: 500; }
.cg-sub { font-size: var(--fs-small); color: var(--muted); }
.check-group > .rows { padding: 0 10px 10px; }
.tick.check { height: 16px; background: var(--check); }
.chip.check { background: var(--tint-check); color: var(--check); }
.pref { font-size: var(--fs-small); color: var(--muted); }
.pref.all { color: var(--good-text); }

@media (max-width: 720px) {
  .check-group > .rows { padding: 0 6px 6px; }
}

/* ------------------------------------------------------------------ one card per machine (app/machines.py) */

/* --differ and --tint-differ are with the other tokens at the top */
.chip.differ { background: var(--tint-differ); color: var(--differ); border-color: color-mix(in srgb, var(--differ) 40%, transparent); cursor: help; }
/* "Also on": the machine's other ads, laid out like the recent-sales line */
.also-line { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; min-width: 0; font-size: var(--fs-small); color: var(--muted); }
.also-line .k { flex: none; font-size: var(--fs-label); font-weight: 500; }
.also-line ul { display: flex; flex-wrap: wrap; gap: 3px 12px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.also-line li { min-width: 0; overflow-wrap: anywhere; }
.also-line li + li { padding-left: 12px; border-left: 1px solid var(--line-strong); }
.also-line a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.also-line a:hover { color: var(--accent); text-decoration-color: currentColor; }
.also-line .dv { color: var(--differ); }
.tile-sub { font-size: var(--fs-small); color: var(--muted); }
.tile.selected .tile-sub { color: var(--on-accent-muted); }

/* ------------------------------------------------------------------ coverage (db.coverage_pct, rotating crawl) */

/* a thin bar like the price-range bars: the share of a site's combines seen in the last 30 days */
.cov-track { display: block; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.cov-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); min-width: 0; }
.cov-fill.none { width: 0 !important; }
/* Sources page: one line under each built-in source, indented to its name */
.sl-cov { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px 10px; min-width: 0; margin-top: -4px; padding-left: 12px; font-size: var(--fs-small); color: var(--muted); }
.sl-cov-k { flex: none; font-size: var(--fs-small); font-weight: 500; }
.sl-cov .cov-track { flex: 0 0 88px; }
.sl-cov-t { min-width: 0; overflow-wrap: anywhere; }
.sl-foot p + p { margin-top: 4px; }
/* dashboard Sources panel: bar + percentage in the Coverage column */
.src-grid { grid-template-columns: minmax(90px, 1.4fr) repeat(2, minmax(40px, .7fr)) minmax(84px, 1fr) minmax(70px, 1fr); }
.src-cov { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.src-cov .cov-track { flex: 0 1 44px; min-width: 16px; }

@media (max-width: 720px) {
  .sl-cov { flex-wrap: wrap; margin-top: 0; }
  .sl-cov .cov-track { flex: 1 1 60px; }
  .sl-cov-t { flex-basis: 100%; }
  .src-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .55fr) minmax(0, .65fr) minmax(0, .75fr) minmax(0, .8fr); gap: 8px; }
  .src-cov .cov-track { display: none; }
}

/* ---------------------------------------------------------------- sold comparables (Sprint 5) */
/* the sold context beside the asking-price badge (ui.sold_line): a muted line under the facts / in a value tile */
.sold-ctx { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.tile-sold { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: var(--fs-small); color: var(--muted); }
.sales-line .rg { color: var(--text); font-weight: 500; }
.sales-line .hist { color: var(--muted); font-style: italic; }
details.comps { min-width: 0; font-size: var(--fs-small); color: var(--muted); }
details.comps > summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0; cursor: pointer; list-style: none;
  font-size: var(--fs-label); font-weight: 500; color: var(--muted);
}
details.comps > summary::-webkit-details-marker { display: none; }
details.comps > summary:hover { color: var(--text); }
details.comps > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
details.comps > summary .ic { transform: rotate(-90deg); transition: transform .15s; }
details.comps[open] > summary .ic { transform: none; }
.comps-n { font-weight: 400; color: var(--muted); }
.comps-body { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.comps-body.htmx-request { opacity: .6; }
.comps-inner, .comps-page { display: flex; flex-direction: column; gap: 8px; }
.comps-summary { color: var(--text); font-size: var(--fs-small); }
.comps-h { margin-top: 6px; font-size: var(--fs-small); font-weight: 500; color: var(--text); }
.comps-group { margin: 4px 0 0; font-size: var(--fs-label); font-weight: 500; color: var(--accent); }
.comp-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.comp { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.comp:first-child { border-top: 0; padding-top: 4px; }
.comp-head { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.comp-title { color: var(--text); font-weight: 500; font-size: var(--fs-small); }
.comp-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--text); font-size: var(--fs-small); }
.comp-facts .k, .comp-line .k { margin-right: 6px; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.comp-line { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.excerpts { margin-top: 2px; }
.excerpts > summary { cursor: pointer; color: var(--accent); }
.excerpts dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 8px 0 0; }
.excerpts dt { font-size: var(--fs-label); font-weight: 500; color: var(--muted); padding-top: 2px; }
.excerpts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.excerpt-note { margin-top: 6px; font-style: italic; }
.comps-foot { margin-top: 4px; }

/* dashboard: where the stored sales came from */
.sale-srcs { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: var(--fs-small); color: var(--muted); }
.sale-srcs .k { margin-right: 8px; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
/* sources page: daily vs one-time sales sources */
.ss-h { margin: 14px 0 4px; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.ss-h:first-of-type { margin-top: 0; }
.ss-grid .sl-run .sl-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sources page: import a sales export (POST /sources/sales-import) */
.si-form { display: flex; align-items: flex-end; gap: 14px 16px; flex-wrap: wrap; }
.si-form .field { flex: 1 1 360px; }
.si-file {
  width: 100%; min-width: 0; min-height: var(--tap-lg); padding: 5px 8px; border-radius: var(--radius-sm); border: 1px dashed var(--line-strong);
  background: var(--surface-2); color: var(--muted); font-size: var(--fs-small);
}
.si-file::file-selector-button {
  margin-right: 12px; height: 36px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
}
.si-file:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.si-note { margin-top: 10px; }
.si-working { margin-top: 12px; align-items: center; }
.si-result { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.si-result .notice strong { font-weight: 500; }
.si-files { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-small); color: var(--muted); }
.si-fname { color: var(--text); overflow-wrap: anywhere; }
.si-src { padding-top: 10px; border-top: 1px solid var(--line); }
.si-src .ss-h { margin-top: 0; }
.si-counts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0; }
.si-why { margin-top: 4px; font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.si-why .k { margin-right: 8px; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }

/* /sales: sold results */
.sf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: end; }
.sf-grid > .sf-dates { grid-column: span 2; }
.sf-grid > .sf-hint { grid-column: span 3; align-self: center; }
.sales-filters .panel-sub a { padding-block: 13px; }  /* a link in a sentence: a 44 px target without moving the line */
.sf-grid input[type=date] {
  width: 100%; height: var(--tap-lg); padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font-size: var(--fs-body); outline: none; min-width: 0;
}
.sf-grid input[type=date]:focus { border-color: var(--accent); }
.sf-go .btn { width: 100%; min-height: var(--tap-lg); }
.rg-grid { grid-template-columns: minmax(0, 1.6fr) minmax(56px, .5fr) minmax(90px, .7fr); }
.rg-grid > :nth-child(2), .rg-grid > :nth-child(3) { text-align: right; }
.sr-grid { grid-template-columns: minmax(0, 2fr) minmax(84px, .8fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.sr-name, .sr-price { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sr-name .sale-title, .sr-name .sale-sub { white-space: normal; overflow-wrap: anywhere; }
.sr-price .sale-sub { white-space: normal; }
.sr-sold .chip { margin-top: 4px; }
.sr-el { font-size: var(--fs-small); overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 14px; }
/* both tables at the Sprint 6 scale: 56 px rows, 17 px figures (titles and figures; the lines under them 15 px) */
.rt-row.sr-grid, .rt-row.rg-grid { min-height: 56px; font-size: var(--fs-body); }
.rt-row.sr-grid { padding-block: 14px; }
.sr-fig { font-weight: 500; white-space: nowrap; }
/* a converted price: "US$19,350 converted" on one 44 px line, the conversion sentence one tap away */
details.sr-fx { min-width: 0; }
details.sr-fx > summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0; list-style: none;
  color: var(--muted); font-size: var(--fs-small); white-space: nowrap;
}
details.sr-fx > summary::-webkit-details-marker { display: none; }
details.sr-fx > summary .ic { transform: rotate(-90deg); transition: transform .15s; }
details.sr-fx[open] > summary .ic { transform: none; }
details.sr-fx > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
details.sr-fx > p { padding-bottom: 4px; font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.sr-pager { gap: var(--gap-tap); }
@media (hover: hover) { details.sr-fx > summary:hover { color: var(--text); } }

@media (max-width: 1024px) {
  .sf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sf-grid > .sf-hint { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .sf-grid { grid-template-columns: minmax(0, 1fr); }
  .sf-grid > .sf-dates, .sf-grid > .sf-hint { grid-column: auto; }
  .rt-head.sr-grid { display: none; }
  .sr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .sr-grid > .sr-name, .sr-grid > .sr-el { grid-column: 1 / -1; }
  .comp-facts { gap: 4px 12px; }
  .excerpts dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .excerpts dd { margin-bottom: 6px; }
}

/* the experimental fuzzy estimate (app/templates/_fuzzy.html): kept visibly apart from actual sales */
details.fuzzy-estimate > summary { flex-wrap: wrap; row-gap: 4px; }
.fz-label { white-space: nowrap; }
.fz-range { color: var(--text); text-transform: none; letter-spacing: 0; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.fz-conf { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.fz-conf.moderate { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.fz-body p { overflow-wrap: anywhere; }
.fz-body strong { color: var(--text); font-weight: 500; }
.fz-rules, .fz-adj { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.fz-rules li { display: flex; gap: 8px; align-items: baseline; }
.fz-tag { flex: none; width: 72px; font-size: var(--fs-label); font-weight: 500; }
.fz-rules .met .fz-tag { color: var(--good-text); }
.fz-rules .unmet .fz-tag { color: var(--muted); }
.fz-rules .unmet { color: var(--text); }
.fz-adj li { color: var(--text); }
.fz-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.fz-table caption { caption-side: top; text-align: left; padding-bottom: 6px; color: var(--muted); }
.fz-table th, .fz-table td { padding: 5px 8px 5px 0; border-top: 1px solid var(--line); text-align: right; font-weight: 400;
  font-size: var(--fs-small); white-space: normal; text-transform: none; letter-spacing: 0; vertical-align: baseline; }
.fz-table th:first-child { text-align: left; color: var(--text); }
.fz-table thead th { border-top: 0; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.fz-table td { color: var(--text); white-space: nowrap; }
.fz-table tbody tr:first-child th, .fz-table tbody tr:first-child td { font-weight: 500; }
.fz-sold { color: var(--text); }

/* ------------------------------------------------------------------ best matches (app/ranking.py, _fit.html) */

/* fit pill: fit only (price is a separate signal); reasons muted, concerns amber. At most 3 + 3 short chips keep it to
   one line on a desktop row; narrower rows (tablets, phones) wrap rather than clip a concern. */
.fit-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.fit-line > * { flex: none; max-width: 100%; }
.fit-pill {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: var(--pill);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--tint-accent); color: var(--accent);
  font-size: var(--fs-chip); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: help;
}
.chip.reason { background: var(--surface-2); color: var(--muted); }
.chip.concern { background: var(--tint-differ); color: var(--differ); }

/* dashboard: Best matches panel (the saved requirements' top 6) */
.bm-grid { grid-template-columns: 72px minmax(0, 1fr) auto; }
.bm-grid > :nth-child(3) { text-align: right; }
.bm-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bm-why { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); color: var(--muted); }
.bm-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bm-reqs { color: var(--text); }
/* ------------------------------------------------------------------ changes since the last visit (/changes) */

.tick.good { background: var(--good); }
.tick.accent { background: var(--accent); }
.chg-jump { display: flex; flex-wrap: wrap; gap: var(--gap-tap); }
.chg-jump .tag b { color: var(--text); font-weight: 500; }
.chg-jump .tag.off { border-style: dashed; background: transparent; }
.chg-jump .tag.off b { color: var(--muted); }
.chg-empty .empty-note a { padding-block: 13px; }
.chg-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chg-empty .panel-title { color: var(--text); }
.chg-sec { scroll-margin-top: 12px; }
.chg-title-row { display: flex; align-items: center; gap: 8px; }
.chg-list { list-style: none; margin: 0; padding: 0; }
.chg {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0;
}
.chg:first-child { border-top: 0; padding-top: 0; }
.chg-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chg-line { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; }
.chg-name { min-width: 0; font-size: var(--fs-body); font-weight: 500; overflow-wrap: anywhere; }
.chg-name a { display: inline-block; padding-block: 10px; margin-block: -10px; color: var(--text); }
.chg-name a:hover { color: var(--accent-hover); }
.chg-price { flex: none; white-space: nowrap; font-size: var(--fs-body); }
.chg-price b { font-weight: 500; }
.chg-price s { color: var(--muted); }
.chg-price .arrow { margin: 0 6px; color: var(--muted); }
#price_drops .chg-price b { color: var(--good-text); }
.chg-meta { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.chg-notes { font-size: var(--fs-small); color: var(--text); overflow-wrap: anywhere; }
.chg-view { flex: none; }

/* Runs page: the daily digest panel and its preview page */
.digest-panel .panel-head { margin-bottom: 8px; }
.digest-panel .panel-title { display: flex; align-items: center; gap: 8px; }
.digest-next { font-size: var(--fs-small); color: var(--muted); }
.digest-next b { color: var(--text); font-weight: 500; }
.digest-text {
  margin: 0; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.digest-frame { display: block; width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

@media (max-width: 720px) {
  .chg { align-items: flex-start; }
  .chg-line { flex-direction: column; gap: 2px; }
  .btn.chg-view { width: var(--tap-lg); height: var(--tap-lg); padding: 0; gap: 0; }
  .chg-view-t { display: none; }
  .digest-frame { height: 420px; }
}

/* ------------------------------------------------------------------ shortlist, comparison, details (app/shortlist.py) */

/* follow-up status: interested = accent, contacted = violet, inspect = yellow, passed = muted, bought = green */
.chip.sh-st.interested { background: var(--tint-accent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chip.sh-st.contacted { background: var(--tint-violet); color: var(--violet-text); }
.chip.sh-st.inspect { background: var(--tint-new); color: var(--new-text); }
.chip.sh-st.passed { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); }
.chip.sh-st.bought { background: var(--tint-good); color: var(--good-text); }
a.chip.sh-st:hover { border-color: currentColor; }
.tick.sh-tick { height: 16px; }
.tick.sh-tick.interested { background: var(--accent); }
.tick.sh-tick.contacted { background: var(--violet); }
.tick.sh-tick.inspect { background: var(--new); }
.tick.sh-tick.passed { background: var(--dim); }
.tick.sh-tick.bought { background: var(--good); }

/* the running list's star (and the status pill beside it once starred) */
.star-wrap { display: inline-flex; align-items: center; gap: 8px; }
.btn.star { color: var(--muted); border-color: var(--line); }
.btn.star:hover { color: var(--new-text); border-color: color-mix(in srgb, var(--new) 55%, transparent); background: var(--tint-new); }
.btn.star.on { color: var(--star); border-color: color-mix(in srgb, var(--new) 55%, transparent); background: var(--tint-new); }
#nav-sl-n:empty { display: none; }

/* Details: what the ads say (Codex finding 10), inside a details.comps disclosure */
.dt-inner { display: flex; flex-direction: column; gap: 12px; }
.dt-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dt-photos a { display: flex; flex-direction: column; gap: 4px; width: 132px; color: var(--muted); font-size: var(--fs-label); }
.dt-photos img {
  display: block; width: 132px; height: 99px; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
}
.dt-photos a:hover { color: var(--text); }
.dt-photos a:hover img { border-color: var(--accent); }
.dt-ad { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.dt-ad-head { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: var(--fs-small); color: var(--muted); }
.dt-tag { font-size: var(--fs-label); font-weight: 500; color: var(--accent); }
.dt-facts { color: var(--text); }
.dt-open { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.dt-attrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 16px; margin: 0; }
.dt-attrs div { min-width: 0; }
.dt-attrs dt { font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.dt-attrs dd { margin: 2px 0 0; font-size: var(--fs-small); color: var(--text); overflow-wrap: anywhere; }
.dt-desc {
  max-height: 320px; overflow-y: auto; font-size: var(--fs-small); line-height: 1.5; color: var(--text);
  white-space: pre-line; overflow-wrap: anywhere;
}
.dt-none { font-style: italic; }

/* /shortlist: groups by status, one card per machine */
.sh-live { font-size: var(--fs-small); color: var(--good-text); }
.sh-live:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sh-groups { display: flex; flex-direction: column; gap: 20px; }
.sh-group.is-empty { display: none; }
.sh-g-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: var(--fs-body); font-weight: 500; }
.sh-g-hint { min-width: 0; font-size: var(--fs-small); font-weight: 400; color: var(--muted); }
.sh-cards { display: flex; flex-direction: column; gap: 10px; }
details.sh-group { border-radius: var(--radius); border: 1px dashed var(--line-strong); }
details.sh-group > summary.sh-g-head { margin: 0; padding: 14px 16px; list-style: none; cursor: pointer; color: var(--text); font-size: var(--fs-body); }
details.sh-group > summary::-webkit-details-marker { display: none; }
details.sh-group > summary > .ic { margin-left: auto; color: var(--muted); transition: transform .15s; }
details.sh-group[open] > summary > .ic { transform: rotate(180deg); }
details.sh-group > .sh-cards { padding: 0 10px 10px; }

.sh-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); scroll-margin-top: 16px;
}
.sh-card:target { border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.sh-top { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.sh-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sh-ctl { display: flex; align-items: center; justify-content: flex-end; gap: var(--gap-tap); flex-wrap: wrap; }
.sh-status { margin: 0; }
.sh-select select { border-color: var(--line-strong); }
.fb-chip.sh-pick { flex: none; }  /* the filter bar's toggle chip (filters.css): the whole chip is the checkbox */
.sh-card .title a { padding-block: 11px; }  /* 44 px tall without moving the line */
.sh-line a { padding-block: 13px; }
.sh-facts abbr { text-decoration: none; }
.dt-fallback { display: inline-flex; align-items: center; min-height: var(--tap); }
.sh-line .sh-unk { color: var(--differ); }
.sh-src-v { color: var(--muted); }
.sh-gone { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-small); color: var(--red-text); }
.sh-gone .ic { margin-top: 2px; }
.sh-notes {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: 12px 14px; align-items: start;
  margin: 0; padding-top: 12px; border-top: 1px solid var(--line);
}
.sh-notes textarea {
  width: 100%; min-height: 96px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font-size: var(--fs-body); line-height: 1.5; resize: vertical; outline: none;
  transition: border-color .15s;
}
.sh-notes textarea:focus { border-color: var(--accent); }
.sh-notes textarea::placeholder { color: var(--muted); }
.sh-from { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: var(--fs-small); color: var(--text); }
.sh-from-k { flex-basis: 100%; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.sh-save { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sh-saved { font-size: var(--fs-small); color: var(--muted); }
.sh-saved.ok { color: var(--good-text); }
.sh-events { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.sh-events li { display: grid; grid-template-columns: 128px 76px minmax(0, 1fr); gap: 10px; font-size: var(--fs-small); }
.sh-ev-k { padding-top: 1px; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.sh-ev-t {
  color: var(--text); white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
li.sh-ev-none { display: block; }
.sh-card.sh-removed {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px;
  border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--muted); font-size: var(--fs-small);
}
.sh-compare {
  position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px 14px;
  flex-wrap: wrap; margin: 0; padding: 8px 8px 8px 18px; border-radius: var(--pill); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(var(--tint-accent), var(--tint-accent)), var(--surface); box-shadow: var(--shadow);
  font-size: var(--fs-small);
}
.sh-compare .btn:disabled { opacity: .45; cursor: not-allowed; }
.sh-compare.idle { position: static; box-shadow: none; }
.empty-state.sh-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state.sh-empty p { max-width: 640px; }
.empty-state.sh-empty strong { color: var(--text); font-weight: 500; }
.sh-empty-star {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border-radius: 50%;
  background: var(--tint-new); color: var(--star); border: 1px solid color-mix(in srgb, var(--new) 55%, transparent);
}

/* /compare: rows of details, one column per machine; scrolls inside its box on phones, first column pinned */
.cmp-key { display: inline-block; padding: 0 6px; border-radius: 6px; }
.cmp-key.best { background: var(--tint-good); color: var(--good-text); }
.cmp-key.unknown { background: var(--tint-differ); color: var(--differ); }
.cmp-key.foreign { background: var(--tint-blue); color: var(--text); }
table.cmp { table-layout: fixed; min-width: 720px; }
table.cmp th.cmp-k { width: 150px; }
table.cmp th, table.cmp td { padding: 12px; }
table.cmp tbody tr { height: 56px; }
table.cmp thead th { vertical-align: bottom; white-space: normal; text-transform: none; letter-spacing: 0; font-size: var(--fs-small); color: var(--text); }
table.cmp tbody th {
  padding-left: 0; border-top: 1px solid var(--line); vertical-align: top; white-space: normal;
  font-size: var(--fs-label); font-weight: 500; color: var(--muted);
}
table.cmp td { overflow-wrap: anywhere; font-size: var(--fs-body); }
/* pinned while the columns scroll; ::before covers the scroll box's gutter to its left */
table.cmp th.cmp-k, table.cmp tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.cmp th.cmp-k::before, table.cmp tbody th::before {
  content: ""; position: absolute; top: -1px; bottom: 0; right: 100%; width: 18px; background: var(--surface);
}
table.cmp td.best { background: var(--tint-good); color: var(--good-text); }
table.cmp td.unknown { background: var(--tint-differ); color: var(--differ); }
table.cmp td.foreign { background: var(--tint-blue); }
.cmp-tag { margin-left: 6px; font-size: var(--fs-label); font-weight: 500; white-space: nowrap; }
.cmp-big { font-size: var(--fs-title); font-weight: 500; }
.cmp-small { font-size: var(--fs-small); color: var(--muted); }
.cmp-note { display: block; margin-top: 4px; }
td.best .cmp-small, td.unknown .cmp-small { color: inherit; opacity: .85; }
.cmp-sub { font-weight: 400; color: var(--muted); }
.cmp-head { display: flex; flex-direction: column; gap: 6px; font-weight: 400; }
.cmp-thumb {
  display: flex; align-items: center; justify-content: center; width: 100%; max-width: 220px; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--dim);
}
.cmp-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cmp-title { font-size: var(--fs-body); font-weight: 500; line-height: 1.3; }
.cmp-title a { padding-block: 12px; color: var(--text); }
.cmp-title a:hover { color: var(--accent); }
.cmp-links { display: flex; flex-wrap: wrap; gap: 0 var(--gap-tap); font-size: var(--fs-small); color: var(--muted); }
.cmp-links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.cmp-src a { padding-block: 12px; }
.cmp-q, .cmp-src { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cmp-q li { font-size: var(--fs-small); color: var(--text); }
table.cmp td .chip { margin: 2px 4px 2px 0; }

@media (max-width: 1024px) {
  .sh-notes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sh-notes .sh-contact { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .sh-top { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .sh-thumb { width: 72px; height: 56px; }
  .sh-ctl { grid-column: 1 / -1; justify-content: flex-start; }
  .sh-ctl > form.inline { margin-left: auto; }
  .sh-card { padding: 14px; }
  .sh-notes { grid-template-columns: minmax(0, 1fr); }
  .sh-g-head { flex-wrap: wrap; }
  .sh-g-hint { flex-basis: 100%; order: 3; }
  .sh-events li { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
  .sh-ev-t { grid-column: 1 / -1; }
  .sh-compare { border-radius: var(--radius); padding: 10px 10px 10px 14px; }
  .sh-compare .btn { flex: 1 1 auto; height: 44px; }
  .sh-card.sh-removed { flex-wrap: wrap; }
  .dt-photos { gap: 6px; }
  .dt-photos a, .dt-photos img { width: 88px; }
  .dt-photos img { height: 66px; }
  .dt-attrs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .dt-open { margin-left: 0; }
  table.cmp { min-width: 640px; }
  table.cmp th.cmp-k { width: 112px; }
}
