:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #65706c;
  --line: #dbe2dd;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --green: #1c7c54;
  --red: #b3403d;
  --gold: #b47b15;
  --blue: #2b6f9f;
  --teal: #198b8b;
  --shadow: 0 18px 50px rgba(20, 30, 26, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 32px;
  align-items: end;
  padding: 42px clamp(18px, 4vw, 56px) 28px;
  background:
    linear-gradient(rgba(251, 252, 250, 0.75), rgba(251, 252, 250, 0.92)),
    url("https://images.unsplash.com/photo-1529107386315-e1a2ed48a620?auto=format&fit=crop&w=1800&q=80") center 42% / cover;
  border-bottom: 1px solid var(--line);
  min-height: 360px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.methodology-link {
  background: none;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 10px;
  font: inherit;
  font-size: 0.7rem;
  color: var(--blue);
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
}

.methodology-link:hover {
  background: var(--blue);
  color: var(--paper);
}

.methodology-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 760px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  box-shadow: var(--shadow);
  background: var(--panel);
  color: var(--ink);
}

.methodology-dialog::backdrop {
  background: rgba(20, 30, 26, 0.55);
}

.methodology-dialog article {
  padding: 28px 32px 32px;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

.methodology-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.methodology-head h2 {
  margin: 0;
  font-size: 1.3rem;
}

.methodology-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 6px;
}

.methodology-close:hover {
  color: var(--ink);
}

.methodology-dialog h3 {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 18px 0 6px;
}

.methodology-dialog ul {
  margin: 0;
  padding-left: 20px;
}

.methodology-dialog li {
  margin-bottom: 6px;
  line-height: 1.45;
}

.methodology-dialog p {
  line-height: 1.55;
  margin: 0 0 8px;
}

.methodology-pipeline-body {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.methodology-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
}

.methodology-links {
  list-style: none;
  padding: 0;
}

.methodology-links li {
  margin-bottom: 4px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: #34413d;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.header-panel {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.header-panel strong {
  color: var(--ink);
}

.status-dot {
  width: 11px;
  height: 11px;
  background: var(--gold);
  border-radius: 50%;
}

.header-panel[data-status="live"] .status-dot {
  background: var(--green);
}

main {
  padding: 20px clamp(14px, 3vw, 40px) 48px;
}

.control-band,
.summary-grid,
.workspace,
.method-band {
  max-width: 1480px;
  margin-inline: auto;
}

.control-band {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(150px, 190px) minmax(190px, 230px) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  background: rgba(251, 252, 250, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(14px);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 210px;
  padding: 4px;
  background: #e8eeea;
  border-radius: 8px;
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segment.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(20, 30, 26, 0.12);
}

.search-box,
.select-box {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
}

.data-menu {
  position: relative;
  align-self: end;
}

.data-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 800;
  padding: 0 18px;
  white-space: nowrap;
}

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

.data-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(260px, calc(100vw - 32px));
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.data-menu-panel button,
.data-menu-panel label {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f5;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-transform: none;
}

.data-menu-panel button:hover,
.data-menu-panel label:hover {
  border-color: #b9c6bf;
  background: #eef3ef;
}

.data-menu-panel input {
  display: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-grid article {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-grid strong {
  font-size: clamp(1.45rem, 3vw, 2.4rem);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 430px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.member-list,
.detail-pane,
.method-band {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-list {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.list-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.list-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.list-heading span {
  color: var(--muted);
  font-size: 0.82rem;
}

.cards {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.card-skeleton {
  height: 84px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--line) 0%, var(--paper) 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card-skeleton { animation: none; }
}

.member-card {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.member-card.is-selected {
  border-color: var(--blue);
  box-shadow: inset 4px 0 0 var(--blue);
}

.member-card strong {
  font-size: 1rem;
}

.card-title {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.member-avatar,
.member-photo,
.tooltip-avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #edf3ef;
  color: var(--ink);
  font-weight: 900;
  object-fit: cover;
}

.member-avatar {
  width: 38px;
  height: 38px;
  font-size: 0.8rem;
}

.card-meta,
.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf3ef;
  color: #294039;
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.negative {
  background: #f9e9e8;
  color: var(--red);
}

.pill.positive {
  background: #e5f3ec;
  color: var(--green);
}

.pill.muted {
  background: #f2f4f3;
  color: var(--muted);
}

.data-missing {
  padding: 14px;
  border: 1px dashed #b9c6bf;
  border-radius: 8px;
  background: #f6f8f6;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.financial-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.financial-facts div {
  min-width: 0;
  padding: 10px;
  background: #f4f7f5;
  border-radius: 6px;
}

.financial-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.financial-facts dd {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 900;
  overflow-wrap: normal;
}

.detail-pane {
  min-height: 720px;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 520px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--ink);
}

.detail-content {
  display: grid;
  gap: 14px;
  padding: 18px;
  min-width: 0;
}

.detail-topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.member-identity {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.member-photo {
  width: 92px;
  height: 92px;
  font-size: 1.45rem;
  border: 1px solid var(--line);
}

.detail-topline h2 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1;
}

.detail-topline p:last-child {
  color: var(--muted);
  margin-bottom: 0;
}

.impact-badge {
  flex: 0 0 auto;
  min-width: 150px;
  padding: 12px;
  border-radius: 8px;
  background: #edf3ef;
  text-align: center;
  font-weight: 900;
}

.impact-badge.negative {
  background: #f9e9e8;
  color: var(--red);
}

.impact-badge.positive {
  background: #e5f3ec;
  color: var(--green);
}

.viz-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.8rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  font-size: 0.88rem;
}

.bar-track {
  height: 14px;
  background: #e9efeb;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: var(--teal);
}

.bar-fill.aipac {
  background: var(--gold);
}

.bar-fill.pac {
  background: var(--blue);
}

.bar-fill.individual {
  background: var(--green);
}

.bar-fill.outside-support {
  background: var(--gold);
}

.bar-fill.outside-oppose {
  background: var(--red);
}

.sparkline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
  align-items: end;
  gap: clamp(3px, 0.7vw, 8px);
  min-height: 150px;
  padding: 12px 0 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.spark {
  min-width: 0;
  border-radius: 5px 5px 0 0;
  background: var(--blue);
  position: relative;
}

.spark span {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: clamp(0.58rem, 0.65vw, 0.75rem);
  max-width: 4ch;
  overflow: hidden;
}

.economy-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 38px 0 0;
}

.economy-facts div {
  padding: 10px;
  background: #f5f7f5;
  border-radius: 6px;
}

.economy-facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.economy-facts dd {
  margin: 4px 0 0;
  font-weight: 900;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.impact-card {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: #f7f9f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.impact-card strong,
.impact-card span {
  display: block;
}

.impact-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.impact-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.impact-card dl div {
  min-width: 0;
  padding: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.impact-card dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.impact-card dd {
  margin: 3px 0 0;
  font-size: 1.35rem;
  font-weight: 900;
}

.impact-card .positive dd {
  color: var(--green);
}

.impact-card .negative dd {
  color: var(--red);
}

.table {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.1fr) minmax(84px, 0.7fr) minmax(94px, 0.7fr) minmax(130px, 1fr) minmax(130px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row.header {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.table-row small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.table-row .conduit-note {
  color: var(--gold);
  font-weight: 800;
}

.table-row .support-note {
  color: var(--green);
  font-weight: 800;
}

.table-row .oppose-note {
  color: var(--red);
  font-weight: 800;
}

.table-row.funder {
  grid-template-columns: minmax(130px, 1.1fr) minmax(84px, 0.7fr) minmax(94px, 0.7fr) minmax(130px, 1fr) minmax(130px, 1fr);
  padding: 8px 0 8px 18px;
  background: #f6f8f6;
  border-bottom: 1px dashed var(--line);
  font-size: 0.9rem;
}

.table-row.funder .funder-name {
  color: #2a3a35;
  font-weight: 700;
}

.vehicle-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: #edf3ef;
  color: #294039;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.vehicle-pill.vehicle-pac {
  background: #e3edf6;
  color: var(--blue);
}

.vehicle-pill.vehicle-individual {
  background: #e5f3ec;
  color: var(--green);
}

.vehicle-pill.vehicle-superpac {
  background: #fbeede;
  color: var(--gold);
}

.vehicle-pill.vehicle-superpac-donor {
  background: #f3e8ef;
  color: #7b3b6b;
}

.vehicle-pill.vehicle-conduit {
  background: #f5ecd6;
  color: var(--gold);
}

.laws {
  display: grid;
  gap: 10px;
}

.law {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f7f9f7;
  border-radius: 8px;
}

.law-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.law p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.law a {
  color: var(--blue);
  font-weight: 800;
}

.law-source {
  white-space: nowrap;
}

.sources {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.sources .source-group {
  display: grid;
  gap: 4px;
}

.sources .source-group strong {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.sources .source-group ul {
  list-style: disc;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  margin: 0;
}

.sources a,
.source-grid a {
  color: var(--blue);
  font-weight: 700;
}

.method-band {
  margin-top: 16px;
  padding: 20px;
}

.method-band h2 {
  margin-bottom: 8px;
}

.method-band p {
  color: var(--muted);
  line-height: 1.55;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.source-grid a {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 12px;
  background: #f2f6f3;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.view-toggle {
  display: inline-flex;
  gap: 4px;
  max-width: 1480px;
  margin: 0 auto 12px;
  padding: 4px;
  background: #e8eeea;
  border-radius: 8px;
  width: fit-content;
}

.view-tab {
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.view-tab.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(20, 30, 26, 0.12);
}

.network-view {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.network-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.network-compare-control {
  min-width: 220px;
}

.network-legend {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 4px;
  background: var(--muted);
  vertical-align: -2px;
}

.legend-swatch.politician.d { background: var(--blue); }
.legend-swatch.politician.r { background: var(--red); }
.legend-swatch.politician.i { background: var(--green); }
.legend-swatch.donor { background: #9aa6a1; }
.legend-swatch.donor.lean-d {
  background: var(--blue);
  box-shadow: inset 0 0 0 4px #d8e8f6;
}
.legend-swatch.donor.lean-r {
  background: var(--red);
  box-shadow: inset 0 0 0 4px #f4d8d6;
}
.legend-swatch.donor.lean-i {
  background: var(--green);
  box-shadow: inset 0 0 0 4px #d7ecdf;
}
.legend-swatch.donor.shared {
  background: #f3e3c2;
  box-shadow: 0 0 0 2px var(--gold);
}
.legend-swatch.donor.cross-party {
  background: #e8dcf2;
  border: 1.5px dashed #7a4ea3;
}

.network-stage {
  position: relative;
  background: linear-gradient(180deg, #fcfdfb 0%, #f3f6f1 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 620px;
  overflow: hidden;
}

#networkSvg {
  display: block;
  width: 100%;
  height: 620px;
}

.net-links line {
  stroke: #b9c2bd;
  stroke-opacity: 0.55;
  transition: stroke-opacity 0.15s ease, stroke 0.15s ease;
}

.net-links line.dim {
  stroke-opacity: 0.08;
}

.net-links line.focus {
  stroke: var(--gold);
  stroke-opacity: 0.95;
}

.net-node {
  cursor: pointer;
  transition: opacity 0.15s ease;
  outline: none;
}

.net-node circle {
  stroke: #fff;
  stroke-width: 2;
}

.net-node .hit-target {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.net-node.politician.party-d circle { fill: var(--blue); }
.net-node.politician.party-r circle { fill: var(--red); }
.net-node.politician.party-i circle { fill: var(--green); }
.net-node.politician circle:not([fill]) { fill: var(--muted); }

.net-node.donor circle {
  fill: #ffffff;
  stroke: #8e9994;
  stroke-width: 1.6;
}

.net-node.donor.lean-d circle {
  fill: #d8e8f6;
  stroke: var(--blue);
  stroke-width: 2.4;
}

.net-node.donor.lean-r circle {
  fill: #f4d8d6;
  stroke: var(--red);
  stroke-width: 2.4;
}

.net-node.donor.lean-i circle {
  fill: #d7ecdf;
  stroke: var(--green);
  stroke-width: 2.4;
}

.net-node.donor.shared circle {
  stroke-width: 2.6;
}

.net-node.donor.shared:not(.lean-d):not(.lean-r):not(.lean-i):not(.cross-party) circle {
  fill: #fdf3dc;
  stroke: var(--gold);
}

.net-node.donor.cross-party circle {
  stroke-width: 2.2;
  stroke-dasharray: 3 3;
}

.net-node.donor.cross-party:not(.lean-d):not(.lean-r):not(.lean-i) circle {
  fill: #e8dcf2;
  stroke: #7a4ea3;
}

.net-node .hit-target {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.net-label {
  font-size: 11px;
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(251, 252, 250, 0.9);
  stroke-width: 3;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.15s ease;
}

.net-node.donor .net-label {
  opacity: 0;
}

.net-node.donor.shared .net-label,
.net-node.donor.cross-party .net-label,
.net-node.focus .net-label,
.net-node:hover .net-label {
  opacity: 0.96;
}

.net-node.dim {
  opacity: 0.18;
}

.net-node.focus circle {
  stroke: var(--ink);
  stroke-width: 3;
}

.net-node:focus-visible .hit-target {
  stroke: var(--gold);
  stroke-width: 3;
  stroke-dasharray: 5 4;
}

.network-tooltip {
  position: absolute;
  display: grid;
  gap: 2px;
  max-width: 240px;
  padding: 10px 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(20, 30, 26, 0.25);
  z-index: 3;
}

.network-tooltip strong {
  font-size: 0.92rem;
}

.network-tooltip span {
  color: #cdd6d1;
}

.tooltip-person {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.tooltip-avatar {
  width: 42px;
  height: 42px;
  background: #2a3a35;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.network-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  width: min(320px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 2;
}

.panel-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
}

.panel-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.network-panel h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  line-height: 1.2;
}

.panel-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel-section {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 12px;
  background: #f6f8f6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-section.compact {
  padding: 10px;
}

.panel-section h4 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-section p,
.panel-section small {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.country-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.country-list li {
  display: grid;
  gap: 2px;
}

.country-list span,
.country-list em {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
}

.panel-cta {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.panel-cta:hover {
  background: #2a3a35;
}

.panel-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.panel-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name amount" "meta meta";
  gap: 2px 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.panel-list button:hover {
  border-color: var(--ink);
}

.panel-list strong {
  grid-area: name;
  font-size: 0.92rem;
}

.panel-list em {
  grid-area: amount;
  font-style: normal;
  font-weight: 800;
  color: var(--ink);
}

.panel-list span {
  grid-area: meta;
  color: var(--muted);
  font-size: 0.78rem;
}

.network-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  color: var(--muted);
}

.network-hint {
  margin: 0;
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .app-header,
  .workspace,
  .viz-grid {
    grid-template-columns: 1fr;
  }

  .member-list {
    position: static;
    max-height: none;
  }

  .control-band {
    grid-template-columns: 1fr 1fr;
  }

  .summary-grid,
  .source-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .network-legend {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .app-header {
    min-height: 520px;
    align-content: end;
  }

  .control-band,
  .summary-grid,
  .source-grid,
  .impact-grid,
  .economy-facts,
  .table-row {
    grid-template-columns: 1fr;
  }

  .impact-card {
    grid-template-columns: 1fr;
  }

  .detail-topline,
  .law-topline {
    display: grid;
  }

  .member-identity {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .member-photo {
    width: 72px;
    height: 72px;
    font-size: 1.1rem;
  }

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