/* Insider Atlas — main stylesheet.
   Tokens locked from research/visual-design.md §3.2 (dark research default,
   light mirror). Chrome rules per §6.3: one accent, hairline borders,
   hover translateY(-1px) only, buy/sell reserved for data. */

/* ---------- Fonts (OFL, self-hosted) ---------- */
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-var.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-var.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-italic-var.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg-0: #0b0f14;
  --bg-1: #121821;
  --bg-2: #1a222e;
  --border: #243041;
  --text-1: #e8eef6;
  --text-2: #a8b3c4;
  --text-3: #7b8699;
  --accent: #5b9fd4;
  --buy: #3d9a6a;
  --sell: #c45c5c;
  --warn: #c9a227;
  --info: #6b8cae;
  --mono-tick: #9ec5e8;
  /* diverging heatmap ramp: sell ← neutral → buy (§3.2) */
  --heat-n3: #8b4a4a;
  --heat-n2: #6b4245;
  --heat-n1: #4a3a42;
  --heat-0:  #2a3340;
  --heat-p1: #2e4a48;
  --heat-p2: #356252;
  --heat-p3: #3d7a5c;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
/* Light mode (Phase 5): slate-50 / slate-900 mirror; accent stays steel-blue.
   Buy/sell use teal-600 / red-600 for WCAG AA on light surfaces. */
[data-theme="light"] {
  --bg-0: #f8fafc;
  --bg-1: #ffffff;
  --bg-2: #eef2f7;
  --border: #d5dbe6;
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #475569;
  --accent: #5b9fd4;
  /* teal-700 / red-700 — teal-600 fails 4.5:1 on slate-50; keep hue, deepen for AA */
  --buy: #0f766e;
  --sell: #b91c1c;
  --warn: #a16207;
  --info: #4d6d8f;
  --mono-tick: #0369a1;
  --heat-n3: #d99c9c;
  --heat-n2: #e2b4b0;
  --heat-n1: #ead0c9;
  --heat-0:  #e4e9f0;
  --heat-p1: #c8ddd0;
  --heat-p2: #a8ccb6;
  --heat-p3: #86ba9d;
}
/* Light accent links: deepen for AA contrast on white */
[data-theme="light"] a { color: #0369a1; }
[data-theme="light"] .brand:hover { color: #0369a1; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Phase 5 a11y: 3px focus ring + offset on every interactive control */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.meta { color: var(--text-3); font-size: 0.8rem; }
.buy, .val-buy { color: var(--buy); }
.sell, .val-sell { color: var(--sell); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--bg-1);
  color: var(--text-1); padding: 0.5rem 1rem; z-index: 100;
  border: 1px solid var(--accent);
}
.skip-link:focus, .skip-link:focus-visible { left: 0; outline: 3px solid var(--accent); outline-offset: 3px; }
/* Screen-reader-only text for icon-only controls */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

h1, h2, h3 { font-family: var(--sans); font-weight: 600; line-height: 1.2; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }

.prose { font-family: var(--serif); font-size: 1.05rem; max-width: 46rem; }
.prose h1, .prose h2, .prose h3 { font-family: var(--sans); }
.prose table { font-family: var(--sans); font-size: 0.85rem; border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; text-align: left; }
.prose th { background: var(--bg-2); }
.prose code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-2); padding: 0.1em 0.3em; border-radius: 3px; }
.prose pre { background: var(--bg-1); border: 1px solid var(--border); padding: 0.75rem; overflow-x: auto; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--border); margin-left: 0; padding-left: 1rem; color: var(--text-2); }

.page-head { margin: 1.75rem 0 1.25rem; }
.lede { color: var(--text-2); max-width: 46rem; font-size: 1.05rem; }

/* ---------- Nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-0) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 1rem; min-height: 3.25rem; flex-wrap: wrap; padding-top: 0.35rem; padding-bottom: 0.35rem; }
.brand { font-weight: 700; color: var(--text-1); letter-spacing: 0.02em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.9rem; }
.nav-links a { color: var(--text-2); }
.nav-links a:hover { color: var(--text-1); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text-1); border-bottom: 2px solid var(--accent); }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.data-as-of { font-size: 0.7rem; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }

.btn-chip {
  font-family: var(--mono); font-size: 0.75rem;
  background: var(--bg-1); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.3rem 0.75rem; cursor: pointer;
  min-height: 2rem;
}
.btn-chip:hover { color: var(--text-1); transform: translateY(-1px); }
.btn-chip.is-active { color: var(--text-1); border-color: var(--accent); background: var(--bg-2); }
.btn-chip-label { margin-left: 0.4rem; }
.theme-dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--text-2); border: 2px solid var(--border); }
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* ---------- KPI chips ---------- */
.kpi-strip {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.kpi-chip {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.15rem;
}
.kpi-value { font-size: 1.6rem; font-weight: 600; }
.kpi-denom { font-size: 0.9rem; color: var(--text-3); }
.kpi-label { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.kpi-sub { display: block; font-family: var(--mono); font-size: 0.62rem; color: var(--text-3); }

/* ---------- Dashboard layout ---------- */
.dash-cols { display: grid; grid-template-columns: 58fr 42fr; gap: 1.5rem; align-items: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.dash-heat, .dash-lit { margin-top: 2rem; }
.lit-feature { font-family: var(--serif); background: var(--bg-1); border: 1px solid var(--border); border-left: 3px solid var(--accent); margin: 0; padding: 1rem 1.25rem; border-radius: 4px; max-width: 46rem; }

/* ---------- Stream table ---------- */
.table-wrap { overflow-x: auto; }
.stream-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.8rem;
}
.stream-table th {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3); text-align: left;
  background: var(--bg-2); padding: 0.45rem 0.6rem;
  position: sticky; top: 0; /* offset is vs .table-wrap (overflow), not viewport — 3.3rem overlapped rows */
  border-bottom: 1px solid var(--border);
}
.stream-table th.sortable {
  cursor: pointer; user-select: none;
}
.stream-table th.sortable:hover { color: var(--text-1); }
.stream-table th.sortable::after {
  content: " ↕"; opacity: 0.35; font-size: 0.7em;
}
.stream-table th.is-sorted-asc::after { content: " ↑"; opacity: 1; color: var(--accent); }
.stream-table th.is-sorted-desc::after { content: " ↓"; opacity: 1; color: var(--accent); }
.stream-table td, .stream-table tbody th {
  padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top;
  font-weight: inherit;
}
.stream-table tbody tr:hover { background: var(--bg-1); }
.stream-table .num { text-align: right; }
.stream-table .tick a { color: var(--mono-tick); }
.stream-table tr[hidden] { display: none !important; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.06em; padding: 0.1rem 0.4rem; border-radius: 3px;
  border: 1px solid var(--border); color: var(--text-2); vertical-align: middle;
  text-transform: uppercase;
}
.badge-code { font-weight: 600; }
.badge-buy { color: var(--buy); border-color: var(--buy); }
.badge-sell { color: var(--sell); border-color: var(--sell); }
.badge-routine, .badge-plan { color: var(--text-3); }
.badge-opp { color: var(--info); border-color: var(--info); }
.badge-cluster { color: var(--warn); border-color: var(--warn); }
.badge-synthetic { color: var(--warn); border-color: var(--warn); }
.badge-rank { color: var(--accent); border-color: var(--accent); }
.badge-sev-high { color: var(--sell); border-color: var(--sell); }
.badge-sev-elevated { color: var(--warn); border-color: var(--warn); }
.badge-sev-watch { color: var(--info); border-color: var(--info); }

/* ---------- Cluster cards ---------- */
.cluster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin: 1rem 0; }
.cluster-card {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.9rem 1rem; margin-bottom: 1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.cluster-grid .cluster-card { margin-bottom: 0; }
.cluster-card:hover { transform: translateY(-1px); border-color: var(--accent); }
.cluster-card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.cluster-title { margin: 0; }
.cluster-meta { margin: 0; font-size: 0.85rem; color: var(--text-2); }
.member-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.member-chip {
  display: inline-block; font-size: 0.72rem; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.55rem;
  color: var(--text-2);
}
.cluster-spark { display: flex; align-items: center; gap: 0.6rem; }
.cluster-spark .spark { color: var(--accent); }
.cluster-spark.buy .spark { color: var(--buy); }
.cluster-spark.sell .spark { color: var(--sell); }
.cluster-card-foot { font-size: 0.85rem; }

/* ---------- Calendar view ---------- */
.cluster-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 480px; margin: 1rem 0; }
.cal-cell {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-1); font-family: var(--mono); font-size: 0.7rem;
  color: var(--text-3); padding: 0.25rem; position: relative;
}
.cal-cell.cal-head { border: none; background: none; aspect-ratio: auto; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.6rem; }
.cal-cell.cal-empty { border: none; background: none; }
.cal-cell .cal-dot { position: absolute; bottom: 0.25rem; right: 0.3rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.cal-dot.sev-high { background: var(--sell); }
.cal-dot.sev-elevated { background: var(--warn); }
.cal-dot.sev-watch { background: var(--info); }

/* ---------- Sector grid heatmap ---------- */
.sector-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin: 1rem 0 0.5rem; }
.sector-cell {
  display: flex; flex-direction: column; justify-content: space-between; gap: 0.75rem;
  min-height: 5.5rem; padding: 0.6rem 0.7rem; border-radius: 4px;
  border: 1px solid var(--border); color: var(--text-1);
}
.sector-cell:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--accent); }
.sector-name { font-size: 0.85rem; font-weight: 600; }
.sector-caption { font-size: 0.65rem; color: var(--text-2); }
[data-theme="light"] .sector-caption { color: var(--text-2); }
.heatn3 { background: var(--heat-n3); }
.heatn2 { background: var(--heat-n2); }
.heatn1 { background: var(--heat-n1); }
.heatp0, .heatn0 { background: var(--heat-0); }
.heatp1 { background: var(--heat-p1); }
.heatp2 { background: var(--heat-p2); }
.heatp3 { background: var(--heat-p3); }
.legend { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.legend-swatch { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 2px; border: 1px solid var(--border); }

/* ---------- Caveat callout ---------- */
.caveat {
  font-family: var(--serif); font-size: 0.9rem; color: var(--text-2);
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-1));
  border: 1px solid var(--border); border-left: 3px solid var(--warn);
  border-radius: 4px; padding: 0.7rem 1rem; margin: 1rem 0; max-width: 46rem;
}

/* ---------- Literature ---------- */
.lit-entry { border-top: 1px solid var(--border); padding: 1.25rem 0; max-width: 46rem; }
.lit-entry h2 { margin-bottom: 0.2rem; }
.lit-entry h3 { margin-bottom: 0.2rem; }
.lit-rank-group { margin: 2rem 0; }
.badge-tag { text-transform: none; letter-spacing: 0.02em; }
.badge-lit { text-transform: none; letter-spacing: 0.01em; white-space: normal; }
.lit-anchor-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.65rem 0; }
.lit-synthesis { margin-bottom: 1.5rem; }
.page-list { line-height: 2; }
.literature-callout {
  font-family: var(--serif); background: color-mix(in srgb, var(--accent) 7%, var(--bg-1));
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: 0.7rem 1rem; margin: 1.25rem 0; max-width: 46rem;
}
.literature-callout .section-head { margin-top: 0; }

/* ---------- Search overlay ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 90; }
.search-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.55); }
.search-panel {
  position: relative; max-width: 560px; margin: 10vh auto 0; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.4);
}
#search-input {
  width: 100%; font-size: 1rem; padding: 0.6rem 0.8rem;
  background: var(--bg-0); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 6px;
}
.search-results { list-style: none; margin: 0.5rem 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.search-results li a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0.6rem; border-radius: 4px; color: var(--text-1);
}
.search-results li a:hover, .search-results li a.is-selected { background: var(--bg-2); text-decoration: none; }
.search-results .sub { color: var(--text-3); font-size: 0.8rem; }
.search-hint { padding: 0.4rem 0.6rem 0; margin: 0; }
.search-hint kbd { font-family: var(--mono); background: var(--bg-2); border: 1px solid var(--border); border-radius: 3px; padding: 0 0.3rem; }

/* ---------- Sparkline ---------- */
.spark { display: inline-block; vertical-align: middle; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 1.5rem 0 2.5rem; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 0.75rem; }
.disclaimer { font-family: var(--serif); color: var(--text-3); font-size: 0.85rem; max-width: 46rem; }

/* ---------- Data-quality footer (Phase 6.1, Senate condition 2) ---------- */
.data-quality-footer { border-top: 1px solid var(--border); padding: 1.25rem 0 2rem; background: var(--bg-1); }
.data-quality-footer .dq-title { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin: 0 0 0.6rem; }
.data-quality-footer .dq-list { margin: 0 0 0.75rem; padding-left: 1.1rem; max-width: 46rem; }
.data-quality-footer .dq-list li { color: var(--text-3); font-size: 0.8rem; margin-bottom: 0.35rem; }
.data-quality-footer .dq-anchor { font-family: var(--serif); font-size: 0.8rem; max-width: 46rem; }

/* Cluster index counts (Phase 6.1, Senate condition 1) */
.cluster-counts { display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 60rem; }
.cluster-counts strong { color: var(--text-2); }

/* ---------- Responsive (visual-design.md §7) ---------- */
@media (max-width: 1024px) {
  .dash-cols { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .sector-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .nav-links { order: 3; flex-basis: 100%; padding-bottom: 0.3rem; }
  .btn-chip-label, .data-as-of { display: none; }
  .sector-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1.25rem; }

  /* Card-stack tables: never 12 columns at 8px (§7.2 rule 1) */
  .stream-table, .stream-table tbody, .stream-table tr, .stream-table td { display: block; }
  .stream-table thead { display: none; }
  .stream-table tr {
    background: var(--bg-1); border: 1px solid var(--border); border-radius: 6px;
    margin-bottom: 0.6rem; padding: 0.5rem 0.7rem;
  }
  .stream-table td { border: none; padding: 0.15rem 0; display: flex; justify-content: space-between; gap: 0.75rem; text-align: left; }
  .stream-table td.num { text-align: right; }
  .stream-table td::before {
    content: attr(data-label);
    font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-3); align-self: center;
  }
}

/* ---------- Phase 2: entity pages, cluster detail, filters ---------- */
.table-filter {
  font-family: var(--mono); font-size: 0.85rem;
  background: var(--bg-1); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.45rem 0.7rem; width: 100%; max-width: 26rem;
}
.table-filter:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.timeline-day { border-left: 2px solid var(--border); margin: 0 0 1rem 0.4rem; padding-left: 1rem; }
.timeline-date { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--text-2); }
.timeline-entries { list-style: none; margin: 0; padding: 0; }
.timeline-entry { padding: 0.25rem 0; font-size: 0.9rem; border-bottom: 1px dashed var(--border); }
.timeline-entry:last-child { border-bottom: none; }
.timeline-entry .tick-dot { font-weight: 600; margin-right: 0.25rem; }
.timeline-entry a.meta { font-family: var(--mono); font-size: 0.75rem; }
.routine-drilldown { margin: 1.5rem 0; border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.9rem; background: var(--bg-1); }
.routine-drilldown summary { cursor: pointer; color: var(--text-2); font-size: 0.9rem; }
.routine-drilldown[open] summary { margin-bottom: 0.5rem; }
.cluster-card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }

/* ---------- Phase 3: 13F holdings ---------- */
.caveat-13f ul { margin: 0.4rem 0 0.4rem 1.1rem; padding: 0; }
.caveat-13f li { margin-bottom: 0.25rem; }
.badge-chg-new { color: var(--buy); border-color: var(--buy); }
.badge-chg-increased { color: var(--info); border-color: var(--info); }
.badge-chg-decreased { color: var(--warn); border-color: var(--warn); }
.badge-chg-closed { color: var(--sell); border-color: var(--sell); }
.badge-chg-unchanged { color: var(--text-3); }
a.badge { text-decoration: none; }
.sector-bars { max-width: 46rem; display: grid; gap: 0.35rem; margin: 0.5rem 0 1rem; }
.sector-bar-row { display: grid; grid-template-columns: 11rem 1fr 3.5rem; gap: 0.6rem; align-items: center; }
.sector-bar-label { font-size: 0.85rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sector-bar-track { background: var(--bg-1); border: 1px solid var(--border); border-radius: 3px; height: 0.75rem; overflow: hidden; }
.sector-bar-fill { display: block; height: 100%; background: var(--accent); }
.sector-bar-pct { font-size: 0.8rem; text-align: right; }
.compare-picker { border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem 1rem; margin: 0.5rem 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.35rem 1rem; }
.compare-option { display: flex; align-items: baseline; gap: 0.45rem; font-size: 0.9rem; cursor: pointer; }
.compare-option input[disabled] + span { color: var(--text-3); }

/* ---------- Phase 5: filter bar, empty/skeleton, polish ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.85rem 1.25rem;
  align-items: flex-end;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.85rem 1rem; margin: 0.75rem 0 1.25rem;
}
.filter-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 8rem; }
.filter-field label, .filter-label {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
.filter-select { max-width: 14rem; min-height: 2.1rem; }
.filter-toggle { justify-content: flex-end; min-width: auto; }
.toggle-label {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.85rem; color: var(--text-2); cursor: pointer;
  min-height: 2.1rem;
}
.filter-count { margin: 0; align-self: center; }
.empty-state {
  border: 1px dashed var(--border); border-radius: 6px;
  background: var(--bg-1); padding: 1.1rem 1.25rem; margin: 1rem 0;
  max-width: 36rem; color: var(--text-2);
}
.empty-state strong { color: var(--text-1); }
.empty-state ul { margin: 0.4rem 0 0 1.1rem; }
.empty-state kbd, .search-hint kbd {
  font-family: var(--mono); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 3px; padding: 0 0.3rem;
}
/* Skeleton shimmer for async-feel filter apply */
.skeleton-host.is-loading { position: relative; min-height: 4rem; }
.skeleton-host.is-loading::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 12%, transparent), transparent);
  animation: ia-shimmer 0.9s ease-in-out infinite;
  pointer-events: none; border-radius: 4px;
}
@keyframes ia-shimmer {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(40%); }
}
[data-cluster-card][hidden] { display: none !important; }
@media (max-width: 640px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-select { max-width: none; width: 100%; }
  .stream-table tbody th {
    display: flex; justify-content: space-between; gap: 0.75rem;
    border: none; padding: 0.15rem 0; text-align: left;
  }
  .stream-table tbody th::before {
    content: attr(data-label);
    font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-3); align-self: center;
  }
}
