/* ==========================================================================
   Ayvens Image Checker — stylesheet
   Token-driven, framework-free. Dark (default) + light themes via
   html[data-theme]; row density via html[data-density]. Mirrors the
   "Ayvens Image Checker" Claude Design refresh.
   ========================================================================== */

:root,
html[data-theme="dark"] {
  --bg: #0e1116;
  --card: #151a21;
  --surf2: #0f141a;
  --border: #232b35;
  --text: #e8ebef;
  --muted: #98a2ad;
  --accent: #37c871;
  --accent-fg: #062815;
  --danger: #ff7a7a;
  --grid: #232b35;

  /* Status pills (dark) */
  --pill-danger-bg: rgba(255,122,122,.14);
  --pill-danger-fg: #ff9b9b;
  --pill-danger-br: rgba(255,122,122,.32);
  --pill-error-bg: rgba(240,180,90,.15);
  --pill-error-fg: #f2c17a;
  --pill-error-br: rgba(240,180,90,.34);
  --pill-missing-bg: rgba(160,140,250,.16);
  --pill-missing-fg: #c3b5fd;
  --pill-missing-br: rgba(160,140,250,.34);
}

html[data-theme="light"] {
  --bg: #f4f6f7;
  --card: #ffffff;
  --surf2: #eef1f3;
  --border: #dde3e8;
  --text: #182029;
  --muted: #5a6672;
  --accent: #0f9d52;
  --accent-fg: #ffffff;
  --danger: #d3453b;
  --grid: #e6ebee;

  --pill-danger-bg: #fbe9e7;
  --pill-danger-fg: #c0392b;
  --pill-danger-br: #f3cfca;
  --pill-error-bg: #fbeecf;
  --pill-error-fg: #8a5a00;
  --pill-error-br: #efdca8;
  --pill-missing-bg: #eee9fd;
  --pill-missing-fg: #5b3fc4;
  --pill-missing-br: #ddd3f7;
}

:root {
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --rowpad: .62rem;
  --maxw: 1120px;
}
html[data-density="compact"] { --rowpad: .34rem; }

* { box-sizing: border-box; }

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background .3s ease, color .3s ease;
}

a { color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); font-weight: 400; }
.danger { color: var(--danger); }
.small { font-size: .8rem; }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Top navigation
   -------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .85rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1.6rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-right: .3rem;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand .muted { font-weight: 500; }
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: .3rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-spacer { flex: 1; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: .34rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--text); }

/* --------------------------------------------------------------------------
   Layout + type
   -------------------------------------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem 1.6rem 4rem;
}
h1 { margin: 0 0 .3rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
h2 { margin: 0 0 .75rem; font-size: 1.15rem; font-weight: 700; }
h3 { margin: 0; font-size: .98rem; font-weight: 600; }
.lead { color: var(--muted); margin: 0 0 .2rem; max-width: 64ch; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: 1.3rem; display: flex; flex-direction: column; gap: .4rem; }
.row { display: flex; gap: .9rem; }
.row .field { flex: 1; }

label { font-weight: 600; font-size: .9rem; }
label .muted { font-weight: 400; }

select,
input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .6rem .7rem;
  border-radius: 9px;
  font: inherit;
  font-size: 1rem;
}
input[type="text"].mono,
input[type="number"].mono { font-family: var(--mono); font-size: .9rem; }
select:focus, input:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: .75rem 1.1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 9px;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: .55; cursor: not-allowed; filter: none; }

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}
button.secondary:hover { filter: none; border-color: var(--accent); }
.btn-full { width: 100%; }

/* Login page (standalone, no app nav) */
.login-wrap { max-width: 400px; margin: 9vh auto 0; }
.login-card { display: flex; flex-direction: column; gap: 1.1rem; padding: 1.8rem; }
.login-card .field { margin: 0; }
.login-brand { display: flex; align-items: center; gap: .45rem; font-size: 1rem; }
.login-card h1 { margin: 0; font-size: 1.4rem; }
.login-card .error { margin: 0; }
.nav-logout { display: flex; margin: 0; }

/* Multi-market picker (checkbox grid reusing .mode-option styling) */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.field-actions { display: inline-flex; align-items: baseline; gap: .35rem; font-size: .8rem; }
.field-actions .sep { color: var(--muted); }
.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: .8rem;
}
.linklike:hover { text-decoration: underline; }
.market-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); margin-top: .4rem; }

/* Segmented "Images to check" control */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; }
.mode-option {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: .6rem .65rem;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.mode-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.mode-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.mode-option input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.mode-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode-title { font-weight: 600; font-size: .9rem; }
.mode-sub { color: var(--muted); font-size: .76rem; }

/* Checkbox option (e.g. auto-validate vendor IMGs on the run form) */
.check-option {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: .7rem .75rem;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.check-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.check-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.check-option input[type="checkbox"] {
  width: 1.1rem; height: 1.1rem;
  margin-top: .1rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
}
.check-text { display: flex; flex-direction: column; gap: .15rem; }
.check-title { font-weight: 600; font-size: .9rem; }
.check-sub { color: var(--muted); font-size: .76rem; font-weight: 400; }

/* Advanced options disclosure */
details.advanced {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-bottom: 1.3rem;
}
details.advanced > summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: .88rem;
  list-style: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸ "; }
details.advanced[open] > summary::before { content: "▾ "; }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: .9rem; }
.adv-grid .field { margin: 0; gap: .35rem; }
.adv-grid .field.span2 { grid-column: 1 / -1; }
.adv-grid label { font-size: .82rem; color: var(--muted); }

/* --------------------------------------------------------------------------
   Run page: form + progress two-up
   -------------------------------------------------------------------------- */
.run-top {
  display: grid;
  grid-template-columns: minmax(0, 620px);
  gap: 1.25rem;
  margin-top: 1.5rem;
  align-items: start;
}
.run-top.two-col { grid-template-columns: 1.15fr .85fr; }

/* Progress card */
.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.progress-head h2 { margin: 0; font-size: 1.1rem; }
.progress-head-right { display: inline-flex; align-items: center; gap: .55rem; }
.elapsed-timer {
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surf2);
  border: 1px solid var(--border);
  padding: .2rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: .2rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-live .pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
.badge-live.done { color: var(--muted); background: var(--surf2); border-color: var(--border); }
.badge-live.done .pulse { animation: none; opacity: .5; }
.phase-steps { display: flex; gap: .5rem; margin-bottom: 1rem; font-size: .78rem; }
.phase-step { flex: 1; display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.phase-step.active { color: var(--text); font-weight: 600; }
.phase-step.done::before { content: "✓"; color: var(--accent); }

.bar-outer {
  height: 10px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.bar-inner {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7fe0ff));
  background-size: 32px 100%;
  animation: barstripe 1s linear infinite;
  transition: width .3s ease;
}
.bar-inner.indeterminate {
  width: 100% !important;
  background: repeating-linear-gradient(45deg,
    var(--accent) 0 12px,
    color-mix(in srgb, var(--accent) 50%, var(--surf2)) 12px 24px);
  background-size: 48px 48px;
  animation: slide 1s linear infinite;
}
#progress-text { margin: .6rem 0 1.1rem; color: var(--muted); font-family: var(--mono); font-size: .82rem; }

.prog-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.mini-stat { background: var(--surf2); border: 1px solid var(--border); border-radius: 9px; padding: .6rem .75rem; }
.mini-num { font-family: var(--mono); font-size: 1.25rem; font-weight: 600; }
.mini-label { color: var(--muted); font-size: .74rem; }
#cancel-btn { margin-top: 1rem; }

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */
.section { margin-top: 1.5rem; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.section-head .title { display: flex; align-items: baseline; gap: .7rem; }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.results-meta { color: var(--muted); font-family: var(--mono); font-size: .8rem; }

/* imaca ID-validation panel (under the results header) */
.validation-panel {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin: -.4rem 0 1.1rem;
}
.validation-panel button { padding: .4rem .8rem; font-size: .82rem; }
.validation-panel .bar-outer { flex: 1 0 100%; margin-top: .1rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1.6rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .95rem 1.05rem;
}
.stat-label { color: var(--muted); font-size: .76rem; margin-bottom: .35rem; }
.stat-value { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; }
.stat-sub { color: var(--muted); font-size: .74rem; margin-top: .15rem; }

.results-grid {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  gap: 1.25rem;
  align-items: start;
}

/* Data cards + tables */
.data-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.data-card .card-head {
  padding: 1rem 1.1rem .7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.data-card .card-head p { margin: .2rem 0 0; }
.table-scroll { max-height: 440px; overflow: auto; }

table.data-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surf2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: .6rem .9rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.data-table td {
  padding: var(--rowpad) .9rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}
.data-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.data-table th.num, .data-table td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.data-table td.strong { font-weight: 600; }
.data-table td.mono { font-family: var(--mono); font-size: .8rem; }

.url-cell a {
  display: block;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .78rem;
  text-decoration: none;
}
.url-cell a:hover { text-decoration: underline; }

/* Breakdown mini-bar */
.bd-cell { }
.bd-bar { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.bar-track { width: 56px; height: 6px; background: var(--surf2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bd-count { font-family: var(--mono); font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: right; }

/* Status pills */
.pill {
  display: inline-block;
  padding: .14rem .5rem;
  border-radius: 999px;
  font: 600 .72rem/1.4 var(--mono);
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-danger  { background: var(--pill-danger-bg);  color: var(--pill-danger-fg);  border-color: var(--pill-danger-br); }
.pill-error   { background: var(--pill-error-bg);   color: var(--pill-error-fg);   border-color: var(--pill-error-br); }
.pill-missing { background: var(--pill-missing-bg); color: var(--pill-missing-fg); border-color: var(--pill-missing-br); }

/* Affected images — brand+model group rows, expandable to their image rows.
   Rows come in pairs (group row + hidden detail row), so the generic zebra
   striping is switched off here and the open state carries the highlight. */
.data-table.group-table tbody tr:nth-child(even) td { background: transparent; }
.group-table tbody tr.group-row { cursor: pointer; }
.group-table td.group-name { min-width: 10rem; }
.group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-right: .55rem;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .3rem;
  background: var(--surf2);
  color: var(--muted);
  font: 600 .9rem/1 var(--mono);
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease;
}
.group-row:hover .group-toggle,
.group-row.open .group-toggle { border-color: var(--accent); color: var(--accent); }
.group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.group-label { vertical-align: middle; }
.group-brand { font-weight: 600; }
.group-model { color: var(--muted); }
.data-table.group-table tbody tr.group-row.open td { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Second line of a group row: angle/lifestyle split + status-mix pills. */
.group-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem .5rem;
  margin: .3rem 0 0 1.8rem;
}
.group-types { white-space: nowrap; }
/* Slightly tighter pills here so the whole mix usually fits on one line. */
.group-meta .pill { font-size: .66rem; padding: .1rem .4rem; }

/* Expanded child rows live in a full-width detail row holding a sub-table. */
.data-table tbody tr.group-detail > td { padding: 0; background: var(--surf2); }
.data-table tbody tr.group-detail:hover > td { background: var(--surf2); }
/* Fixed layout so the long image URLs ellipsize inside the card instead of
   forcing the whole grouped table wider than it. */
table.sub-table { font-size: .84rem; table-layout: fixed; width: 100%; }
.sub-table th:nth-child(1), .sub-table td:nth-child(1) { width: 16%; }
.sub-table th:nth-child(2), .sub-table td:nth-child(2) { width: 26%; }
.sub-table th:nth-child(3), .sub-table td:nth-child(3) { width: 14%; }
.sub-table th {
  position: static;      /* only the outer table's header sticks */
  background: transparent;
  padding: .45rem .9rem .4rem;
  font-size: .68rem;
}
.sub-table th:first-child,
.sub-table td:first-child { padding-left: 2.6rem; }
.sub-table tbody tr:last-child td { border-bottom: none; }
.sub-table .url-cell a { max-width: 100%; }   /* full URL stays in the title/href */
.sub-table td.mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Market tag (history) */
.tag {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
  background: var(--surf2);
  border: 1px solid var(--border);
  padding: .1rem .45rem;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   History / dashboard shared filter row
   -------------------------------------------------------------------------- */
.filter-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 1.5rem 0 1rem;
}
.filter-row label { font-size: .9rem; }
.filter-row select { width: auto; min-width: 200px; }
.filter-row .count { color: var(--muted); font-size: .85rem; }

/* Filter toggle (e.g. include/exclude lifestyle images). Pill button whose
   pressed/on state is accent-tinted so the current mode reads at a glance. */
.toggle-btn {
  padding: .5rem .85rem;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.toggle-btn:hover { filter: none; border-color: var(--accent); }
.toggle-btn[aria-pressed="true"] {
  background: var(--pill-missing-bg);
  border-color: var(--pill-missing-br);
  color: var(--pill-missing-fg);
}
.toggle-btn #lifestyle-toggle-state { font-weight: 700; }

/* History actions */
td.actions { white-space: nowrap; }
td.actions .act { display: inline-flex; gap: .8rem; align-items: center; }
td.actions a, td.actions button {
  font: inherit;
  font-weight: 600;
  font-size: .84rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
td.actions a.view { color: var(--accent); text-decoration: none; }
td.actions a.csv { color: var(--muted); text-decoration: none; }
td.actions a:hover { text-decoration: underline; }
.link-danger { color: var(--danger); }
.link-danger:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Run detail
   -------------------------------------------------------------------------- */
.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--text); }
.detail-meta {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .84rem;
  margin: .1rem 0 .4rem;
}
.detail-meta .strong { color: var(--text); font-weight: 600; }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.dash-grid .card.wide { grid-column: 1 / -1; }
.dash-grid .card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.dash-grid .card h2 .muted { font-weight: 400; font-size: .85rem; }
.chart-box { position: relative; height: 280px; }
.card.wide .chart-box { height: 300px; }

/* "Numbers": stat cards for the latest run. auto-fit so the row stays balanced
   whether the (conditionally hidden) lifestyle card brings the count to 4 or 5. */
.impacted-card { margin-bottom: 1.25rem; }
.impacted-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 0; }

/* Image funnel: total -> broken -> not-with-vendor, narrowing top to bottom */
.funnel-card { margin-bottom: 1.25rem; }
.funnel { display: flex; flex-direction: column; gap: 1.1rem; }
.funnel-stage { display: flex; flex-direction: column; gap: .4rem; }
.funnel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.funnel-name { font-weight: 600; font-size: .95rem; }
.funnel-value { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; }
.funnel-value--pending { color: var(--muted); }
.funnel-track { display: flex; justify-content: center; }
.funnel-bar {
  height: 30px;
  border-radius: 8px;
  transition: width .5s cubic-bezier(.22,.61,.36,1);
  min-width: 12px;
}
.funnel-bar--total { background: var(--accent); }
.funnel-bar--broken { background: var(--danger); }
.funnel-bar--vendor { background: var(--pill-missing-fg); }
.funnel-bar--pending {
  background: repeating-linear-gradient(
    45deg, var(--surf2), var(--surf2) 8px, var(--border) 8px, var(--border) 16px
  );
  border: 1px dashed var(--border);
}
.funnel-note { color: var(--muted); font-size: .8rem; text-align: center; }

/* --------------------------------------------------------------------------
   Error banner
   -------------------------------------------------------------------------- */
.error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  padding: .8rem 1rem;
  border-radius: 9px;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes barstripe { from { background-position: 0 0; } to { background-position: 32px 0; } }
@keyframes slide { from { background-position: 0 0; } to { background-position: 48px 0; } }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .run-top.two-col { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; gap: 1rem; padding: .75rem 1rem; }
  .wrap { padding: 1.6rem 1rem 3rem; }
  .adv-grid { grid-template-columns: 1fr; }
  .url-cell a { max-width: 200px; }
  .sub-table th:first-child, .sub-table td:first-child { padding-left: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bar-inner, .badge-live .pulse { animation: none; }
}
