/* ==========================================================================
   Radar revamp layer (2026)
   Loaded after radar.css. Owns the token palette and restyles the core
   surfaces: masthead, command bar, tabs, chips, results, record cards.
   Direction: modernized green. Near-white tinted paper, hairline borders,
   one accent doing real work, orange reserved for true urgency.
   ========================================================================== */

/* Geist (Vercel) token mapping. Values from the Geist design system:
   pure gray neutrals, #eaeaea hairlines, blue 600 for links/selection,
   amber for warnings, black primary actions. */
:root {
  --paper: #fafafa;
  --paper-2: #f2f2f2;
  --panel: #ffffff;
  --panel-quiet: #f2f2f2;
  --panel-warm: #f2f2f2;
  --white-tint: #ffffff;

  --ink: #171717;
  --ink-soft: #333333;
  --quiet: #444444;
  --muted: #666666;

  --rule: #eaeaea;
  --rule-soft: #d9d9d9;

  /* Geist blue: links, selection, focus, progress */
  --accent: #0070f3;
  --accent-hover: #0761d1;
  --accent-soft: rgba(0, 112, 243, 0.14);
  --accent-faint: #ebf5ff;

  /* Amber for urgency, red for errors */
  --warm: #f5a623;
  --warn: #ee0000;

  /* Primary actions: black, hover lifts to gray */
  --night: #171717;
  --night-soft: #383838;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04);

  --radar-radius-tight: 6px;
  --radar-radius-soft: 12px;
  --radar-radius-wide: 16px;
  --radar-green: var(--accent);
  --radar-mint: var(--accent-faint);
  --radar-clay: var(--warm);
  --radar-cream: var(--panel);

  --container: min(calc(100% - 64px), 1120px);
}

[data-theme="dark"] {
  --paper: #000000;
  --paper-2: #0a0a0a;
  --panel: #0a0a0a;
  --panel-quiet: #1a1a1a;
  --panel-warm: #1a1a1a;
  --white-tint: #0a0a0a;

  --ink: #ededed;
  --ink-soft: #d4d4d4;
  --quiet: #c2c2c2;
  --muted: #a1a1a1;

  --rule: #2e2e2e;
  --rule-soft: #3d3d3d;

  --accent: #52a8ff;
  --accent-hover: #78b6ff;
  --accent-soft: rgba(82, 168, 255, 0.18);
  --accent-faint: #10233d;

  --warm: #f5a623;
  --warn: #ff6166;

  /* Primary actions invert: white on black */
  --night: #ededed;
  --night-soft: #cccccc;

  --shadow: none;
  --shadow-soft: none;

  --radar-green: var(--accent);
  --radar-mint: var(--accent-faint);
  --radar-clay: var(--warm);
  --radar-cream: var(--panel);
}

/* --------------------------------------------------------------------------
   Base rhythm: product register runs denser than editorial
   -------------------------------------------------------------------------- */

body.radar-page {
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
  background: var(--paper);
}

/* Flat paper everywhere; ambient gradients read as decoration, not state */
body.radar-page #main-content {
  background: var(--paper);
}

/* --------------------------------------------------------------------------
   Masthead: title left, live coverage right, one hairline below
   -------------------------------------------------------------------------- */

body.radar-page .radar-masthead {
  display: block;
  width: var(--container);
  max-width: none;
  margin: 0 auto;
  padding: 36px 0 0;
  background: none;
  border: 0;
  box-shadow: none;
}

body.radar-page .radar-masthead-title {
  flex: 1 1 auto;
  min-width: 0;
}

body.radar-page .radar-masthead-meta {
  flex: 0 0 auto;
}

body.radar-page .radar-masthead-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

body.radar-page .radar-masthead h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}

body.radar-page .radar-masthead-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 52ch;
}

body.radar-page .radar-masthead-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

body.radar-page .radar-masthead-meta .meta-stat strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

body.radar-page .meta-stat--fresh {
  color: var(--muted);
}

body.radar-page .meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rule-soft);
}

@media (max-width: 860px) {
  body.radar-page .radar-masthead {
    padding-top: 24px;
  }
  body.radar-page .radar-masthead-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* --------------------------------------------------------------------------
   Command area: search promoted to the hero position
   -------------------------------------------------------------------------- */

body.radar-page .radar-command {
  padding: 0;
  margin: 0 auto;
  width: var(--container);
}

body.radar-page .command-panel {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 20px 0 0;
}

/* .radar-command and .command-panel are display:contents in the legacy CSS,
   so container width lives on their children */
body.radar-page .results-bar {
  width: var(--container);
  margin: 20px auto 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

body.radar-page .source-disclosure {
  width: var(--container);
  margin: 14px auto 0;
}

body.radar-page .results-actions {
  border: 0;
  padding-top: 0;
}

body.radar-page .results-search {
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radar-radius-soft);
  box-shadow: var(--shadow-soft);
  padding: 4px 4px 4px 14px;
  gap: 10px;
  min-height: 52px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

body.radar-page .results-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

body.radar-page .results-search::after {
  display: none;
}

body.radar-page .results-search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

/* The mode badge restates the page; the masthead already covers it */
body.radar-page .search-mode-badge {
  display: none;
}

body.radar-page .command-search-input {
  font-size: 15px;
  color: var(--ink);
}

body.radar-page .command-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

body.radar-page .search-submit-btn {
  background: var(--night);
  color: var(--paper);
  border: 1px solid var(--night);
  border-radius: var(--radar-radius-tight);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
  transition: background 160ms var(--ease), opacity 160ms var(--ease);
}

body.radar-page .search-submit-btn:hover:not(:disabled) {
  background: var(--night-soft);
}

body.radar-page .search-submit-btn:disabled {
  opacity: 0.45;
  background: var(--night);
  color: var(--paper);
}

body.radar-page .search-clear-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
}

body.radar-page .command-shortcut {
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 6px;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Dataset tabs: underline, not pills
   -------------------------------------------------------------------------- */

body.radar-page .filter-workstation-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: var(--container);
  min-height: 0;
  margin: 8px auto 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding: 12px 0 0;
  gap: 10px;
}

body.radar-page .filter-workstation-strip .dataset-tabs {
  margin-right: 12px;
}

body.radar-page .dataset-tabs {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 4px;
  box-shadow: none;
}

body.radar-page .view-tab {
  background: none;
  border: 0;
  border-radius: var(--radar-radius-tight);
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  position: relative;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}

body.radar-page .view-tab:hover {
  color: var(--ink);
  background: var(--panel-quiet);
}

body.radar-page .view-tab[aria-selected="true"] {
  background: none;
  color: var(--ink);
  box-shadow: none;
}

/* Geist tabs mark the active item with the foreground color, not blue */
body.radar-page .view-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
}

body.radar-page .view-tab .tab-count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: none;
  padding: 0 0 0 4px;
}

/* --------------------------------------------------------------------------
   Filter chips: quiet ghosts until active
   -------------------------------------------------------------------------- */

body.radar-page .filter-toggle-btn,
body.radar-page .quick-action-chip {
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  box-shadow: none;
  color: var(--quiet);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  transition: border-color 160ms var(--ease), background 160ms var(--ease),
    color 160ms var(--ease);
}

body.radar-page .filter-toggle-btn:hover,
body.radar-page .quick-action-chip:hover {
  border-color: var(--muted);
  color: var(--ink);
  background: var(--panel);
}

body.radar-page .quick-action-chip[aria-pressed="true"],
body.radar-page .quick-action-chip.is-active,
body.radar-page .filter-toggle-btn[aria-expanded="true"] {
  background: var(--accent-faint);
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   Results: no giant container, no display heading
   -------------------------------------------------------------------------- */

body.radar-page .results-section {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 0 48px;
  width: var(--container);
  margin: 0 auto;
}

body.radar-page .section-heading {
  padding: 24px 0 4px;
  border: 0;
}

/* Kicker + count: quiet text, not chips */
body.radar-page .intro-label {
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  box-shadow: none;
}

body.radar-page .results-count {
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-sans);
}

body.radar-page .results-count strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

body.radar-page .compare-hint {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 34ch;
}

body.radar-page .section-heading h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--ink);
}

body.radar-page .section-heading p {
  font-size: 13.5px;
  color: var(--muted);
}

body.radar-page .results-meta,
body.radar-page .stats-strip {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Record cards: white surface, hairline, quiet hover lift
   The newest legacy generation scopes card styles under #grid/#completedGrid,
   so these overrides anchor to the same IDs to win the cascade.
   -------------------------------------------------------------------------- */

#grid .full-result-card,
#completedGrid .full-result-card,
body.radar-page .card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radar-radius-soft);
  box-shadow: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

#grid .full-result-card:hover,
#grid .full-result-card:focus-within,
#completedGrid .full-result-card:hover,
#completedGrid .full-result-card:focus-within,
body.radar-page .card:hover,
body.radar-page .card:focus-within {
  border-color: var(--rule-soft);
  box-shadow: var(--shadow);
  transform: none;
}

#grid .frc-bill-number,
#completedGrid .frc-bill-number,
body.radar-page .bill-number {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--quiet);
  background: var(--panel-quiet);
  border: 0;
  border-radius: 6px;
  padding: 2px 7px;
  min-height: 22px;
}

#grid .frc-title,
#completedGrid .frc-title,
body.radar-page .card .title {
  max-width: none;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.35;
  color: var(--ink);
}

body.radar-page .frc-title-link {
  color: inherit;
}

body.radar-page .frc-title-link:hover .frc-title {
  color: var(--accent-hover);
}

#grid .frc-summary,
#completedGrid .frc-summary,
#grid .frc-meta-line,
#completedGrid .frc-meta-line {
  font-size: 13px;
  color: var(--muted);
}

/* Status chips: tinted quiet, urgency gets the warm tone */
#grid .frc-status-chip,
#completedGrid .frc-status-chip {
  border: 0;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0 9px;
  min-height: 22px;
  background: var(--panel-quiet);
  color: var(--quiet);
}

/* Urgency means "act this week," not "emergency": Geist amber, not red */
#grid .frc-status-chip.urgent,
#completedGrid .frc-status-chip.urgent {
  background: rgba(245, 166, 35, 0.16);
  border: 0;
  color: #a35200;
}

[data-theme="dark"] #grid .frc-status-chip.urgent,
[data-theme="dark"] #completedGrid .frc-status-chip.urgent {
  background: rgba(245, 166, 35, 0.14);
  color: var(--warm);
}

#grid .frc-topic-pill,
#completedGrid .frc-topic-pill {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.01em;
}

#grid .frc-state-badge,
#completedGrid .frc-state-badge,
body.radar-page .state-badge {
  background: none;
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--quiet);
  padding: 2px 7px;
}

/* Progress: slim segmented track, filled segments in accent */
#grid .frc-progress-bar,
#completedGrid .frc-progress-bar,
body.radar-page .bill-progress-bar {
  height: 3px;
  border-radius: 2px;
  background: none;
  gap: 4px;
}

#grid .frc-progress-bar span,
#completedGrid .frc-progress-bar span,
body.radar-page .bill-progress-bar span {
  background: var(--panel-quiet);
  border-radius: 2px;
  height: 3px;
}

#grid .frc-progress-bar span.active,
#completedGrid .frc-progress-bar span.active,
body.radar-page .bill-progress-bar span.active {
  background: var(--accent);
}

#grid .frc-progress-labels,
#completedGrid .frc-progress-labels,
body.radar-page .bill-progress-labels {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#grid .frc-footer,
#completedGrid .frc-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12.5px;
}

#grid .frc-date,
#completedGrid .frc-date,
body.radar-page .bill-progress-updated {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#grid .bookmark-btn,
#completedGrid .bookmark-btn,
body.radar-page .bookmark-btn {
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--radar-radius-tight);
  box-shadow: none;
}

#grid .bookmark-btn:hover,
#completedGrid .bookmark-btn:hover,
body.radar-page .bookmark-btn:hover {
  color: var(--ink);
  background: var(--panel-quiet);
}

/* --------------------------------------------------------------------------
   Supporting surfaces
   -------------------------------------------------------------------------- */

body.radar-page .state-filter-banner {
  background: var(--accent-faint);
  border: 1px solid var(--rule);
  border-radius: var(--radar-radius-tight);
  color: var(--ink-soft);
  box-shadow: none;
}

body.radar-page .source-disclosure {
  color: var(--muted);
  font-size: 13px;
}

body.radar-page .source-disclosure a {
  color: var(--quiet);
  text-decoration-color: var(--rule-soft);
  text-underline-offset: 3px;
}

body.radar-page .source-disclosure a:hover {
  color: var(--accent-hover);
}

body.radar-page .loading-spinner {
  border-color: var(--rule);
  border-top-color: var(--accent);
}

/* Focus: one consistent ring everywhere */
body.radar-page :is(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}

/* Respect users who opt out of motion */
@media (prefers-reduced-motion: reduce) {
  body.radar-page * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
