/* =========================================================================
   Matcher — internal back-office tool design system
   Single hand-written stylesheet. Server-render friendly (plain classes).
   Light + dark themes via [data-theme] on <html>.
   ========================================================================= */

/* ----------------------------------------------------------------- Tokens */
:root {
  /* cool-neutral light theme · Colorway 5: Slate Graphite */
  --bg:            oklch(0.982 0.003 255);
  --surface:       oklch(1 0 0);
  --surface-2:     oklch(0.962 0.004 255);
  --surface-3:     oklch(0.94 0.005 255);
  --border:        oklch(0.9 0.006 255);
  --border-strong: oklch(0.84 0.008 255);

  --text:          oklch(0.26 0.01 260);
  --text-muted:    oklch(0.5 0.01 260);
  --text-faint:    oklch(0.64 0.009 260);

  --accent:        oklch(0.42 0.03 258);
  --accent-hover:  oklch(0.34 0.032 258);
  --accent-fg:     oklch(0.99 0 0);
  --accent-soft:   oklch(0.94 0.012 258);
  --accent-soft-bd:oklch(0.86 0.02 258);
  --accent-ink:    oklch(0.38 0.03 258);

  /* status hues — shared light/dark base, tints recomputed per theme */
  --ok:      oklch(0.52 0.1 156);
  --ok-soft: oklch(0.95 0.035 156);
  --ok-bd:   oklch(0.86 0.05 156);

  --run:      oklch(0.53 0.12 248);
  --run-soft: oklch(0.95 0.03 248);
  --run-bd:   oklch(0.86 0.05 248);

  --warn:      oklch(0.58 0.11 70);
  --warn-soft: oklch(0.95 0.04 75);
  --warn-bd:   oklch(0.86 0.06 75);

  --err:      oklch(0.55 0.16 26);
  --err-soft: oklch(0.95 0.035 26);
  --err-bd:   oklch(0.87 0.055 26);

  --neutral:      oklch(0.55 0.006 80);
  --neutral-soft: oklch(0.945 0.003 80);
  --neutral-bd:   oklch(0.88 0.004 80);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 260 / 0.05), 0 1px 1px oklch(0.2 0.02 260 / 0.04);
  --shadow-md: 0 2px 4px oklch(0.2 0.02 260 / 0.05), 0 4px 12px oklch(0.2 0.02 260 / 0.06);
  --shadow-pop: 0 8px 28px oklch(0.2 0.02 260 / 0.12);

  /* spacing */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  --r1: 5px; --r2: 8px; --r3: 12px; --r-pill: 999px;

  --maxw: 1360px;
  --nav-h: 56px;

  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Menlo", monospace;
}

[data-theme="dark"] {
  --bg:            oklch(0.205 0.004 260);
  --surface:       oklch(0.245 0.004 260);
  --surface-2:     oklch(0.285 0.005 260);
  --surface-3:     oklch(0.315 0.005 260);
  --border:        oklch(0.34 0.006 260);
  --border-strong: oklch(0.43 0.008 260);

  --text:          oklch(0.93 0.004 260);
  --text-muted:    oklch(0.71 0.006 260);
  --text-faint:    oklch(0.56 0.006 260);

  --accent:        oklch(0.74 0.035 258);
  --accent-hover:  oklch(0.8 0.035 258);
  --accent-fg:     oklch(0.2 0.01 258);
  --accent-soft:   oklch(0.34 0.025 258);
  --accent-soft-bd:oklch(0.43 0.03 258);
  --accent-ink:    oklch(0.84 0.03 258);

  --ok:      oklch(0.72 0.12 156);
  --ok-soft: oklch(0.33 0.05 156);
  --ok-bd:   oklch(0.42 0.06 156);

  --run:      oklch(0.72 0.11 248);
  --run-soft: oklch(0.33 0.05 248);
  --run-bd:   oklch(0.43 0.06 248);

  --warn:      oklch(0.78 0.11 78);
  --warn-soft: oklch(0.35 0.05 75);
  --warn-bd:   oklch(0.45 0.06 75);

  --err:      oklch(0.7 0.14 26);
  --err-soft: oklch(0.34 0.07 26);
  --err-bd:   oklch(0.45 0.08 26);

  --neutral:      oklch(0.7 0.006 260);
  --neutral-soft: oklch(0.31 0.004 260);
  --neutral-bd:   oklch(0.4 0.005 260);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
  --shadow-md: 0 2px 6px oklch(0 0 0 / 0.3);
  --shadow-pop: 0 10px 30px oklch(0 0 0 / 0.45);
}

/* ----------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.danger { color: var(--err); }
.warn { color: var(--warn); }

/* ------------------------------------------------------------- Top nav */
.topnav {
  position: sticky; top: 0; z-index: 30;
  height: var(--nav-h);
  display: flex; align-items: center; gap: var(--s5);
  padding: 0 var(--s6);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--s3); font-weight: 600; letter-spacing: -0.02em; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.brand .name { font-size: 15px; }
.brand .sub { color: var(--text-faint); font-weight: 500; font-size: 12px; letter-spacing: 0; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: var(--s5); }
.nav-links a {
  padding: 6px 12px; border-radius: var(--r1);
  color: var(--text-muted); font-weight: 500; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-spacer { flex: 1; }
.nav-right { display: flex; align-items: center; gap: var(--s3); }

/* scrape status dot in nav */
.nav-status { display: flex; align-items: center; gap: var(--s2); font-size: 12.5px; color: var(--text-muted); }
.nav-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.nav-status.is-running .dot { background: var(--run); box-shadow: 0 0 0 3px var(--run-soft); animation: pulse 1.6s ease-in-out infinite; }
.nav-status.is-ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.nav-status.is-warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.theme-toggle {
  width: 32px; height: 32px; border-radius: var(--r1);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center;
  transition: background .12s, color .12s, border-color .12s;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ------------------------------------------------------------- Page shell */
.page { padding: var(--s7) var(--s6) var(--s9); }
.page-inner { max-width: var(--maxw); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: var(--s4); margin-bottom: var(--s6); }
.page-head .titles { display: flex; flex-direction: column; gap: 3px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head .crumb { font-size: 12.5px; color: var(--text-faint); display: flex; gap: 6px; align-items: center; }
.page-head .crumb a:hover { color: var(--text-muted); }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }

.section-title {
  display: flex; align-items: baseline; gap: var(--s3);
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin: 0 0 var(--s3);
}
.section-title .count { color: var(--text-faint); font-weight: 500; letter-spacing: 0; text-transform: none; }
.section-title .line { flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 34px; padding: 0 14px; border-radius: var(--r1);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--err); border-color: var(--err-bd); background: var(--err-soft); }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 34px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 28px; }

/* ------------------------------------------------------------- Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r3); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { color: var(--text-faint); font-size: 12.5px; }
.card-head .head-actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }
.card-body { padding: var(--s5); }
.card-body.flush { padding: 0; }
.card-foot {
  padding: var(--s3) var(--s5); border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: var(--s3);
}

/* generic layout helpers */
.grid { display: grid; gap: var(--s5); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.main-side { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(280px, 1fr); gap: var(--s5); }
.stack { display: flex; flex-direction: column; gap: var(--s5); }
.row { display: flex; gap: var(--s3); align-items: center; }
.wrap { flex-wrap: wrap; }

/* ------------------------------------------------------------- Stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r3); padding: var(--s4) var(--s5); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: var(--s2); min-width: 0;
}
.stat .label { font-size: 12px; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-family: var(--font-mono); }
.stat .sub { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }
.stat .sub .delta { color: var(--ok); font-weight: 600; }
.stat .ic { width: 15px; height: 15px; color: var(--text-faint); }

/* ------------------------------------------------------------- Banners */
.banner {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s5); border-radius: var(--r3);
  border: 1px solid var(--border); background: var(--surface);
}
.banner .b-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.banner .b-ic svg { width: 19px; height: 19px; }
.banner .b-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.banner .b-title { font-weight: 600; font-size: 14.5px; }
.banner .b-desc { color: var(--text-muted); font-size: 13px; }
.banner .b-actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }
.banner-ok   { background: var(--accent-soft);  border-color: var(--accent-soft-bd); }
.banner-ok   .b-ic { background: var(--accent);   color: var(--accent-fg); }
.banner-ok   strong { color: var(--accent-ink); }
.banner-run  { background: var(--run-soft); border-color: var(--run-bd); }
.banner-run  .b-ic { background: var(--run);  color: #fff; }
.banner-warn { background: var(--warn-soft);border-color: var(--warn-bd); }
.banner-warn .b-ic { background: var(--warn); color: #fff; }
.banner-err  { background: var(--err-soft); border-color: var(--err-bd); }
.banner-err  .b-ic { background: var(--err);  color: #fff; }
.banner-idle .b-ic { background: var(--neutral); color: #fff; }

/* running banner progress bar */
.b-progress { height: 5px; border-radius: var(--r-pill); background: color-mix(in oklab, var(--run) 22%, transparent); overflow: hidden; margin-top: 8px; }
.b-progress > i { display: block; height: 100%; width: 62%; border-radius: inherit; background: var(--run);
  background-image: linear-gradient(100deg, transparent 30%, color-mix(in oklab, #fff 35%, transparent) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------- Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent; white-space: nowrap;
}
.pill .pd { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-done    { color: var(--ok-ink, var(--ok));   background: var(--ok-soft);   border-color: var(--ok-bd); }
.pill-running { color: var(--run);  background: var(--run-soft);  border-color: var(--run-bd); }
.pill-running .pd { animation: pulse 1.4s ease-in-out infinite; }
.pill-blocked { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-bd); }
.pill-error   { color: var(--err);  background: var(--err-soft);  border-color: var(--err-bd); }
.pill-empty   { color: var(--neutral); background: var(--neutral-soft); border-color: var(--neutral-bd); }
.pill-idle    { color: var(--neutral); background: var(--neutral-soft); border-color: var(--neutral-bd); }
[data-theme="dark"] .pill-done { color: var(--ok); }

/* tiny state badge for active/inactive */
.badge-active, .badge-off {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
}
.badge-active::before { content:""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.badge-off { color: var(--text-faint); }
.badge-off::before { content:""; width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); }

/* ------------------------------------------------------------- Chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: var(--r1);
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); white-space: nowrap;
}
.chip .ico { width: 12px; height: 12px; opacity: .7; }
.chip-strong { background: var(--accent-soft); border-color: var(--accent-soft-bd); color: var(--accent-ink); font-weight: 600; }
.chip-stale  { background: var(--warn-soft); border-color: var(--warn-bd); color: var(--warn); }
.chip-key    { font-family: var(--font-mono); font-size: 11.5px; }
.chip.removable { padding-right: 5px; }
.chip .x { width: 15px; height: 15px; display: grid; place-items: center; border-radius: 3px; cursor: pointer; color: var(--text-faint); }
.chip .x:hover { background: var(--surface-3); color: var(--text); }

/* "fresh" / new badge */
.fresh { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; background: var(--accent); color: var(--accent-fg); letter-spacing: .01em; white-space: nowrap; vertical-align: middle; }
.fresh-soft { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-soft-bd); }

/* ------------------------------------------------------------- Score badge */
.score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 28px; padding: 0 9px; border-radius: var(--r1);
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; font-variant-numeric: tabular-nums;
}
.score-hi  { color: var(--accent-fg); background: var(--accent); }
.score-mid { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-bd); }
.score-lo  { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .score-mid { color: var(--warn); }

/* score with bar (used in client detail) */
.score-cell { display: flex; align-items: center; gap: 10px; }
.score-bar { width: 64px; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.score-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.score-bar.mid > i { background: var(--warn); }

/* match-count mini bar (clients list / dashboard) */
.countbar { display: flex; align-items: center; gap: 8px; }
.countbar .v { font-family: var(--font-mono); font-weight: 600; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.countbar .track { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; min-width: 60px; }
.countbar .track > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* ------------------------------------------------------------- Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2);
  padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl.dense tbody td { padding: 6px 14px; }
table.tbl.dense thead th { padding: 7px 14px; }
.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.col-link { color: var(--text); font-weight: 500; }
.tbl a.listing-link { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 500; }
.tbl a.listing-link:hover { color: var(--accent); }
.tbl a.listing-link .ext { width: 13px; height: 13px; opacity: 0; color: var(--accent); transition: opacity .1s; flex: none; }
.tbl a.listing-link:hover .ext { opacity: 1; }
.cell-sub { color: var(--text-faint); font-size: 12px; }
.rowact { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .1s; }
tr:hover .rowact { opacity: 1; }
.dash { color: var(--text-faint); }

/* compact list rows (top clients, events) */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s5); border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }
.list-row .lr-main { min-width: 0; flex: 1; }
.list-row .lr-title { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.list-row .lr-sub { color: var(--text-faint); font-size: 12px; }

/* event log rows (dashboard recent events / run detail) */
.events { display: flex; flex-direction: column; }
.event { display: flex; gap: var(--s3); padding: 9px var(--s5); border-bottom: 1px solid var(--border); align-items: baseline; }
.event:last-child { border-bottom: none; }
.event .lvl { flex: none; width: 52px; }
.event .etxt { flex: 1; min-width: 0; font-size: 13px; }
.event .etime { flex: none; color: var(--text-faint); font-size: 11.5px; font-family: var(--font-mono); }
.lvl-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lvl-info { color: var(--run); background: var(--run-soft); }
.lvl-warn { color: var(--warn); background: var(--warn-soft); }
.lvl-error{ color: var(--err); background: var(--err-soft); }

/* ------------------------------------------------------------- Log tail (mono) */
.logtail {
  background: var(--surface-2); border-radius: var(--r2); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  padding: var(--s3) var(--s4); max-height: 340px; overflow: auto;
}
.logtail .ln { display: flex; gap: 10px; white-space: pre; }
.logtail .lt { color: var(--text-faint); flex: none; }
.logtail .lv { flex: none; width: 44px; font-weight: 700; }
.logtail .lv.info { color: var(--run); }
.logtail .lv.warn { color: var(--warn); }
.logtail .lv.error{ color: var(--err); }
.logtail .lm { color: var(--text-muted); white-space: pre-wrap; }
.logtail .cur { animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------- Suggested scrape cards */
.suggest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.suggest-card {
  position: relative; display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s5); border-radius: var(--r3);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .08s;
}
.suggest-card:hover { border-color: var(--accent-soft-bd); box-shadow: var(--shadow-md); }
.suggest-card:hover .sc-go { color: var(--accent); }
.suggest-card .sc-top { display: flex; align-items: center; gap: var(--s3); }
.suggest-card .sc-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center; flex: none; }
.suggest-card .sc-ic svg { width: 17px; height: 17px; }
.suggest-card .sc-title { font-weight: 600; font-size: 14px; }
.suggest-card .sc-desc { color: var(--text-muted); font-size: 12.5px; line-height: 1.45; }
.suggest-card .sc-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.suggest-card .sc-go { margin-left: auto; color: var(--text-faint); display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.suggest-card.is-rec { border-color: var(--accent-soft-bd); background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 60%); }
.suggest-tag { position: absolute; top: -9px; left: var(--s5); height: 18px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-fg); font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  display: inline-flex; align-items: center; }

/* ------------------------------------------------------------- Forms */
.form { display: flex; flex-direction: column; gap: var(--s6); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-faint); }
.field .hint .mono { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.input, .select, textarea.input {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--r1);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.input::placeholder { color: var(--text-faint); }
.input.mono { font-family: var(--font-mono); }
.input-money { position: relative; }
.input-money .cur { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-family: var(--font-mono); font-size: 13px; pointer-events: none; }
.input-money .input { padding-left: 24px; font-family: var(--font-mono); }

/* range pair (min — max) */
.range-pair { display: grid; grid-template-columns: 1fr 18px 1fr; align-items: center; gap: var(--s2); }
.range-pair .tilde { text-align: center; color: var(--text-faint); }
.range-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s5); }

/* states multi-select grid */
.states-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.states-head .sel-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.states-grid { display: grid; grid-template-columns: repeat(11, 1fr); gap: 5px; }
.state-cell {
  display: flex; align-items: center; justify-content: center;
  height: 30px; border-radius: var(--r1); font-size: 12px; font-weight: 600;
  font-family: var(--font-mono); cursor: pointer; user-select: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  transition: background .1s, color .1s, border-color .1s;
}
.state-cell:hover { border-color: var(--border-strong); color: var(--text); }
.state-cell.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.state-cell.region { background: var(--surface-3); color: var(--text-faint); cursor: default; font-size: 10px; }

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: var(--s3); cursor: pointer; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content:""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch .sw-label { font-size: 13px; font-weight: 500; }

/* checkbox */
.check { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* filter bar */
.filterbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.filterbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.filterbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.filterbar .search .input { padding-left: 32px; }
.filterbar .select { width: auto; min-width: 130px; padding-right: 28px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r1); overflow: hidden; }
.seg button { height: 34px; padding: 0 12px; border: none; background: var(--surface); color: var(--text-muted); font-size: 12.5px; font-weight: 500; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); }
.seg button:hover:not(.on) { background: var(--surface-2); color: var(--text); }

/* level filter pills (run detail) */
.lvl-filters { display: flex; gap: var(--s2); flex-wrap: wrap; }
.lvl-filter { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.lvl-filter .c { font-family: var(--font-mono); font-weight: 600; color: var(--text); }
.lvl-filter.on { background: var(--surface-2); border-color: var(--text-faint); color: var(--text); }
.lvl-filter .pd { width: 7px; height: 7px; border-radius: 50%; }
.lvl-filter.f-info .pd { background: var(--run); }
.lvl-filter.f-warn .pd { background: var(--warn); }
.lvl-filter.f-error .pd { background: var(--err); }

/* buy-box summary (client detail) */
.buybox { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--s5); }
.bb-item { display: flex; flex-direction: column; gap: 4px; }
.bb-item .bb-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 600; }
.bb-item .bb-val { font-size: 14px; font-weight: 500; font-family: var(--font-mono); }
.bb-item.wide { grid-column: span 2; }

/* key-value meta strip (run detail header) */
.meta-strip { display: flex; flex-wrap: wrap; gap: var(--s7); padding: var(--s4) var(--s5); }
.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-item .mk { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 600; }
.meta-item .mv { font-size: 15px; font-weight: 600; font-family: var(--font-mono); }

/* empty state */
.empty { text-align: center; padding: var(--s9) var(--s5); color: var(--text-faint); }
.empty svg { width: 30px; height: 30px; margin-bottom: var(--s3); opacity: .6; }

/* divider */
.hr { height: 1px; background: var(--border); border: none; margin: 0; }

/* utility spacing */
.mt2 { margin-top: var(--s2); } .mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); }
.mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); } .mt7 { margin-top: var(--s7); }
.mb2 { margin-bottom: var(--s2); } .mb3 { margin-bottom: var(--s3); } .mb4 { margin-bottom: var(--s4); }
.gap2 { gap: var(--s2); } .gap3 { gap: var(--s3); } .gap4 { gap: var(--s4); }

/* responsive */
@media (max-width: 1080px) {
  .main-side { grid-template-columns: 1fr; }
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .suggest-grid { grid-template-columns: 1fr; }
  .buybox { grid-template-columns: 1fr 1fr; }
  .range-grid { grid-template-columns: 1fr; }
  .states-grid { grid-template-columns: repeat(8, 1fr); }
}
