:root {
  --bg: #0a1218;
  --panel: #111c24;
  --panel-soft: #162733;
  --card: #0f1a22;
  --line: #284150;
  --text: #edf4f8;
  --muted: #a9bbc7;
  --red: #cf4c3f;
  --gold: #d3a33a;
  --green: #2d9c63;
  --blue: #52a8ff;
  --orange: #e47a25;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(82, 168, 255, 0.16), transparent 22rem),
    radial-gradient(circle at left center, rgba(207, 76, 63, 0.14), transparent 24rem),
    var(--bg);
  color: var(--text);
}

.hero {
  padding: 3rem 1.2rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.top-tab {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  padding: 0.62rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.top-tab.is-active {
  background: linear-gradient(180deg, #e15e50 0%, #b93f33 100%);
  border-color: rgba(225, 94, 80, 0.85);
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--red);
  font-weight: 700;
}

.hero h1 {
  margin: 0.5rem 0 0.6rem;
  font-family: "Space Grotesk", "Arial Black", sans-serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
}

.lede {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
}

.lede-red {
  color: var(--red);
}

.page {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2.5rem;
}

.search-shell {
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(280px, 1fr);
  gap: 1rem;
  align-items: start;
}

.search-bar,
.help-card,
.result-card,
.empty-state,
.metric-card,
.detail-card,
.timeline-row {
  border: 1px solid var(--line);
  background: rgba(17, 28, 36, 0.95);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.search-bar {
  padding: 1rem;
}

.search-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.search-row input {
  width: 100%;
  border: 1px solid #39515f;
  background: #0a1319;
  color: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
}

.search-row button,
.sample-btn {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #e15e50 0%, #b93f33 100%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.search-row button {
  padding: 0 1.05rem;
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.sample-btn {
  padding: 0.48rem 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.metric-resource-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.metric-resource-link.is-button {
  font: inherit;
}

.metric-resource-link:hover,
.metric-resource-link:focus-visible {
  border-color: rgba(82, 168, 255, 0.45);
  background: rgba(82, 168, 255, 0.14);
  outline: none;
}

.help-card {
  padding: 1rem;
}

.help-card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.help-card ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
}

.results {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.network-view {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.network-intro,
.network-card {
  border: 1px solid var(--line);
  background: rgba(17, 28, 36, 0.95);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.network-intro {
  padding: 1rem;
}

.network-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.network-card {
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.network-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.network-id {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(82, 168, 255, 0.55);
  background: rgba(82, 168, 255, 0.12);
  color: #d4eeff;
  border-radius: 999px;
  padding: 0.18rem 0.58rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.network-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.network-metric {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.03);
}

.network-metric-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.73rem;
}

.network-metric-total {
  margin-top: 0.25rem;
  font-size: 1.25rem;
  font-weight: 800;
}

.network-reason {
  color: var(--text);
  line-height: 1.45;
}

.network-targets {
  display: grid;
  gap: 0.45rem;
}

.network-target {
  border-left: 3px solid rgba(82, 168, 255, 0.6);
  padding-left: 0.65rem;
}

.network-target .detail-link {
  display: inline-block;
  margin-top: 0.2rem;
}

.empty-state {
  padding: 1.2rem;
}

.result-card {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-title {
  margin: 0;
  font-size: 1.5rem;
}

.result-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.metric-card {
  padding: 0.95rem;
  min-height: 118px;
  display: grid;
  gap: 0.45rem;
  align-self: start;
}

.metric-label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-total {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-weight: 800;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.metric-card.red { border-color: rgba(207, 76, 63, 0.7); }
.metric-card.orange { border-color: rgba(228, 122, 37, 0.7); }
.metric-card.blue { border-color: rgba(82, 168, 255, 0.7); }
.metric-card.gold { border-color: rgba(211, 163, 58, 0.7); }
.metric-card.green { border-color: rgba(45, 156, 99, 0.7); }

.opponent-block {
  border: 1px solid rgba(82, 168, 255, 0.6);
  background: linear-gradient(180deg, rgba(82, 168, 255, 0.16), rgba(82, 168, 255, 0.06));
  border-radius: 20px;
  padding: 1rem;
}

.opponent-header h3 {
  margin: 0.4rem 0 0;
  font-size: 1.15rem;
  color: #9df0be;
}

.opponent-list {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.6rem;
}

.opponent-row {
  border: 1px solid rgba(82, 168, 255, 0.38);
  border-radius: 14px;
  padding: 0.85rem;
  background: rgba(82, 168, 255, 0.11);
}

.opponent-row.is-republican {
  border-color: rgba(255, 103, 103, 0.42);
  background: rgba(255, 103, 103, 0.12);
}

.opponent-row.is-highlight {
  border-color: rgba(82, 168, 255, 0.88);
  background: rgba(82, 168, 255, 0.17);
}

.opponent-row.is-republican.is-highlight {
  border-color: rgba(255, 103, 103, 0.92);
  background: rgba(255, 103, 103, 0.18);
}

.opponent-row.is-courage {
  box-shadow:
    0 0 0 1px rgba(69, 211, 197, 0.34),
    0 0 24px rgba(69, 211, 197, 0.3),
    0 0 48px rgba(69, 211, 197, 0.18);
}

.opponent-foldout {
  border: 1px solid rgba(82, 168, 255, 0.28);
  border-radius: 14px;
  background: rgba(7, 15, 29, 0.48);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(45, 156, 99, 0.18),
    0 0 20px rgba(45, 156, 99, 0.16);
}

.opponent-foldout summary {
  cursor: pointer;
  list-style: none;
  padding: 0.8rem 0.9rem;
  font-weight: 700;
  color: #9df0be;
}

.opponent-foldout summary::-webkit-details-marker {
  display: none;
}

.opponent-foldout summary::before {
  content: "+";
  display: inline-block;
  width: 1rem;
  margin-right: 0.35rem;
  color: #9df0be;
}

.opponent-foldout[open] summary::before {
  content: "-";
}

.opponent-foldout-list {
  display: grid;
  gap: 0.6rem;
  padding: 0 0.75rem 0.75rem;
}

.opponent-aipac-amount {
  margin-top: 0.35rem;
  color: #9df0be;
  font-weight: 800;
}

.opponent-block .query-kicker {
  color: #9df0be;
  border-color: rgba(45, 156, 99, 0.55);
  background: rgba(45, 156, 99, 0.14);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.detail-card {
  padding: 0.95rem;
}

.detail-card h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.detail-row,
.timeline-row {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.detail-list {
  display: grid;
  gap: 0.6rem;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: baseline;
}

.detail-name {
  font-weight: 700;
}

.detail-meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-link {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.35);
}

.browse-row.is-challenger {
  border-color: rgba(255, 255, 255, 0.08);
}

.browse-row.is-courage {
  box-shadow:
    0 0 0 1px rgba(69, 211, 197, 0.34),
    0 0 24px rgba(69, 211, 197, 0.28),
    0 0 48px rgba(69, 211, 197, 0.16);
}

.browse-row.is-rep {
  border-color: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.browse-stats {
  display: grid;
  justify-items: end;
  gap: 0.2rem;
  text-align: right;
}

.aipac-amount.is-some {
  color: #ff8b8b;
}

.aipac-amount.is-none {
  color: #9df0be;
}

.challenger-foldout {
  overflow: hidden;
}

.challenger-summary {
  cursor: pointer;
  list-style: none;
}

.challenger-summary::-webkit-details-marker {
  display: none;
}

.challenger-foldout-body {
  margin-top: 0.85rem;
}

.challenger-block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
  align-items: start;
}

.challenger-block-grid .metric-card {
  min-height: 0;
}

.challenger-block-grid .detail-meta {
  font-size: 0.82rem;
}

.metric-foldout {
  overflow: hidden;
}

.metric-summary {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  width: 100%;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.metric-foldout-body {
  display: none;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.metric-foldout.is-open .metric-foldout-body {
  display: grid;
}

.metric-topline {
  color: #9df0be;
  font-weight: 700;
}

.contributor-select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 15, 29, 0.72);
  color: #fff;
  padding: 0.55rem 0.7rem;
  font: inherit;
}

.metric-contributor-detail {
  display: grid;
  gap: 0.5rem;
}
.metric-detail-screen {
  display: grid;
  gap: 1rem;
}

.metric-back-button {
  margin-bottom: 0.55rem;
}

.metric-detail-copy {
  font-size: 0.98rem;
}

.metric-detail-list {
  display: grid;
  gap: 0.75rem;
}


.metric-detail-row {
  background: rgba(7, 15, 29, 0.34);
}

.browse-name-link,
.result-title-button {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.browse-name-link:hover,
.result-title-button:hover {
  color: #9df0be;
}

.query-kicker {
  display: inline-block;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .hero {
    padding: 2.2rem 1rem 1.2rem;
  }

  .page {
    width: min(100%, calc(100% - 1rem));
    padding: 1rem 0 2rem;
  }

  .search-shell {
    grid-template-columns: 1fr;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .search-row button {
    min-height: 2.9rem;
  }

  .result-header,
  .detail-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .browse-stats {
    width: 100%;
    justify-items: start;
    text-align: left;
  }

  .metric-grid,
  .challenger-block-grid,
  .detail-grid,
  .network-grid {
    grid-template-columns: 1fr;
  }

  .network-metrics {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .detail-card,
  .result-card,
  .search-bar,
  .help-card,
  .network-card,
  .empty-state {
    border-radius: 16px;
  }
}

@media (max-width: 560px) {
  .top-tabs {
    gap: 0.5rem;
  }

  .top-tab,
  .sample-btn,
  .metric-resource-link {
    width: 100%;
    justify-content: center;
  }

  .sample-row,
  .metric-resource-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: clamp(1.85rem, 10vw, 2.5rem);
  }

  .result-title {
    font-size: 1.25rem;
  }

  .metric-total {
    font-size: 1.35rem;
  }

  .detail-row,
  .timeline-row,
  .opponent-row {
    padding: 0.7rem;
  }
}


.donor-foldout {
  overflow: hidden;
}

.donor-stats {
  justify-items: end;
}

.donor-recipient-list {
  display: grid;
  gap: 0.6rem;
}

.pac-foldout {
  overflow: hidden;
}

.pac-foldout-body {
  display: grid;
  gap: 0.65rem;
}

.pac-target-list {
  margin-top: 0.25rem;
}

.pac-stats {
  min-width: 12rem;
}

.donor-recipient-row {
  background: rgba(7, 15, 29, 0.34);
}
