:root {
  --font-serif: 'Newsreader', Georgia, serif;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --bg: #141412;
  --surface: #1c1b18;
  --surface-alt: #262420;
  --border: #38342e;
  --rule-strong: #ece8df;
  --text: #ece8df;
  --muted: #a8a29e;
  --accent: #dc5a52;
  --on-accent: #141412;
  --pos: #52b788;
  --pos-soft: rgba(82, 183, 136, 0.14);
  --neg: #e06c65;
  --neg-soft: rgba(224, 108, 101, 0.14);
  --neg-subtle: rgba(224, 108, 101, 0.08);
  --neg-border: rgba(224, 108, 101, 0.3);
  --warn: #e0a458;
  --warn-soft: rgba(224, 164, 88, 0.14);
  --info: #7ba3c9;
  --info-soft: rgba(123, 163, 201, 0.14);
  --backdrop: rgba(12, 12, 10, 0.68);
  --shadow: 0 12px 32px rgba(10, 10, 8, 0.42);
}

[data-theme="light"] {
  --bg: #faf7f2;
  --surface: #fffdf9;
  --surface-alt: #f2ece1;
  --border: #d6cec0;
  --rule-strong: #161614;
  --text: #161614;
  --muted: #57534e;
  --accent: #991b1b;
  --on-accent: #fffdf9;
  --pos: #166534;
  --pos-soft: rgba(22, 101, 52, 0.09);
  --neg: #b91c1c;
  --neg-soft: rgba(185, 28, 28, 0.09);
  --neg-subtle: rgba(185, 28, 28, 0.06);
  --neg-border: rgba(185, 28, 28, 0.25);
  --warn: #92400e;
  --warn-soft: rgba(146, 64, 14, 0.09);
  --info: #1e3a5f;
  --info-soft: rgba(30, 58, 95, 0.09);
  --backdrop: rgba(22, 22, 20, 0.42);
  --shadow: 0 10px 28px rgba(22, 22, 20, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

body.drawer-open { overflow: hidden; }

code, .meta-pill, .entity-sub {
  font-family: var(--font-mono);
}

:is(.tab, .btn-secondary, .btn-icon, .btn-link, .th-sort, .pill, .input, .select, .select-sm, tr.clickable, .svg-bar-row):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  border-top: 4px solid var(--accent);
  border-bottom: 2px solid var(--rule-strong);
  background: var(--surface);
  padding: 22px 0 18px;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px 24px;
  flex-wrap: wrap;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

h1 {
  margin: 6px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.2vw, 2.65rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 8px 0 0;
  font-size: 14.5px;
  color: var(--muted);
  max-width: 64ch;
  line-height: 1.45;
}

h2 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h3 {
  margin: 18px 0 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; max-width: 65ch; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.meta-pill {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 5px 9px;
  border-radius: 2px;
  background: var(--bg);
}

.btn-secondary, .btn-icon {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.btn-secondary:hover, .btn-icon:hover { border-color: var(--rule-strong); background: var(--surface-alt); }
.btn-icon { font-size: 22px; line-height: 1; padding: 4px 10px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 20px;
  margin: 20px 0 16px;
  padding: 14px 0;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
}

.kpi-card {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 2px 0 2px 16px;
}

.kpi-grid .kpi-card:first-child,
.moto-summary .kpi-card:first-child,
.drawer-kpis .kpi-card:first-child {
  border-left: none;
  padding-left: 0;
}

.kpi-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-val { font-family: var(--font-serif); font-size: clamp(1.4rem, 2vw, 1.8rem); font-weight: 600; margin: 4px 0 2px; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); line-height: 1.35; }

.notice-banner {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 2px;
  font-size: 13px;
  margin-bottom: 16px;
}

.notice-banner.compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.notice-banner.subtle { border-top-color: var(--warn); }

.btn-link {
  background: transparent;
  border: none;
  padding: 2px 4px;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.action-note {
  background: transparent;
  border: none;
  border-top: 1px solid var(--warn);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 2px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 14px;
}

.table-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.censo-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 2px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 4px 0 22px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab .count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border-radius: 2px;
  background: var(--surface-alt);
  color: var(--muted);
}
.tab .count.warn { color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 24px;
  margin-bottom: 16px;
}

.card {
  background: transparent;
  border: none;
  border-top: 2px solid var(--rule-strong);
  border-radius: 0;
  padding: 16px 0 8px;
  margin-bottom: 22px;
}

.card-head-inline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.chart-box { width: 100%; min-height: 240px; }
.chart-box svg { display: block; width: 100%; height: auto; }

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.input, .select, .select-sm {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
}

.input { flex: 1; min-width: 240px; }
.select-sm { padding: 5px 9px; font-size: 12px; }

.table-wrap {
  overflow-x: auto;
  max-height: 620px;
  overflow-y: auto;
  background: var(--surface);
  border: none;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  color: var(--muted);
  text-align: left;
  padding: 9px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--rule-strong);
  z-index: 1;
}

.data-table th.num, .data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.th-sort {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.th-sort:hover, .th-sort[data-active="true"] {
  color: var(--accent);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr.clickable { cursor: pointer; transition: background-color 120ms ease; }
.data-table tbody tr.clickable:hover { background: var(--surface-alt); }

.entity-name { font-weight: 600; display: block; }
.entity-sub { font-size: 11px; color: var(--muted); }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn-txt { color: var(--warn); }

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-pos { background: var(--pos-soft); color: var(--pos); border: 1px solid rgba(22, 101, 52, 0.22); }
.badge-neg { background: var(--neg-soft); color: var(--neg); border: 1px solid var(--neg-border); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(146, 64, 14, 0.22); }
.badge-info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(30, 58, 95, 0.22); }
.badge-muted { background: var(--surface-alt); color: var(--muted); border: 1px solid var(--border); }

.pill-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.pill:hover { border-color: var(--rule-strong); background: var(--surface-alt); }
.pill.active { background: var(--rule-strong); color: var(--bg); border-color: var(--rule-strong); font-weight: 600; }

.moto-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 20px;
  padding: 14px 0;
  margin-bottom: 14px;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--border);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}

.clean-list { padding-left: 18px; margin: 8px 0 0; }
.clean-list li { margin-bottom: 8px; font-size: 13.5px; max-width: 65ch; }

/* Drawer */
.hidden { display: none !important; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 40;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(860px, 96vw);
  height: 100dvh;
  background: var(--surface);
  border-left: 2px solid var(--rule-strong);
  box-shadow: var(--shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.drawer-body {
  padding: 18px 20px 36px;
  overflow-y: auto;
  flex: 1;
}

.drawer-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 12px 16px;
  padding: 12px 0;
  margin-bottom: 16px;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--border);
}

.svg-bar-row { cursor: pointer; }
.svg-bar-row:hover rect.bar-bg, .svg-bar-row:focus-visible rect.bar-bg { opacity: 0.25; }
.svg-label { fill: var(--text); font-size: 12px; }
.svg-sub { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.svg-axis { stroke: var(--border); stroke-width: 1; }

.badge-inline {
  margin-left: 8px;
  vertical-align: middle;
}

.dossier-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 2px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.dossier-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.dossier-head .badge {
  white-space: normal;
  line-height: 1.35;
}

.dossier-date {
  font-size: 12px;
}

.dossier-title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
}

.dossier-lead {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  max-width: 65ch;
}

.dossier-cost {
  background: var(--neg-subtle);
  border: 1px solid var(--neg-border);
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.dossier-sec {
  margin-bottom: 12px;
}

.dossier-sec h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: var(--accent);
}

.dossier-sec p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  max-width: 65ch;
}

.dossier-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.dossier-sources ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

/* Interactive Network Graph Explorer */
.net-banner {
  border-top-color: var(--accent);
}

.net-presets {
  margin-bottom: 10px;
}

.net-toggles {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.net-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.net-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.net-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .net-workspace {
    grid-template-columns: 1fr;
  }
}

.net-stage {
  position: relative;
  height: clamp(500px, 68vh, 720px);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface);
}

.net-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.net-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 4;
}

.net-ctrl-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.net-ctrl-btn:hover,
.net-ctrl-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.net-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.94;
  pointer-events: none;
}

.net-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pos);
  display: inline-block;
}

.leg-diamond {
  width: 9px;
  height: 9px;
  background: var(--warn);
  transform: rotate(45deg);
  display: inline-block;
}

.leg-square {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 2px solid var(--accent);
  background: var(--surface-alt);
  display: inline-block;
}

.leg-line-solid {
  width: 18px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}

.leg-line-dash {
  width: 18px;
  height: 0;
  border-top: 2px dashed var(--warn);
  display: inline-block;
}

.net-tooltip {
  position: absolute;
  z-index: 6;
  max-width: 240px;
  padding: 8px 11px;
  border-radius: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.net-tt-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.net-tt-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.net-inspector {
  height: clamp(500px, 68vh, 720px);
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.net-ins-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 12px;
}

.net-ins-title {
  margin: 8px 0 4px;
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  line-height: 1.3;
}

.net-mini-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.net-mk {
  flex: 1;
  min-width: 90px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.net-mk strong {
  font-size: 13.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.net-ins-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.btn-primary-sm {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 120ms ease;
}

.btn-primary-sm:hover { opacity: 0.9; }

.net-ins-block h3 {
  margin: 0 0 8px;
  font-size: 12px;
}

.net-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.net-item-btn {
  width: 100%;
  text-align: left;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.net-item-btn:hover,
.net-item-btn:focus-visible {
  border-color: var(--accent);
  background: var(--surface-alt);
}

.net-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.net-item-name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

.net-item-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

/* Dual Mode: Citizen ("Al grano") vs Analyst */
html[data-mode="citizen"] [data-analyst-only="true"] { display: none !important; }
html[data-mode="analyst"] [data-citizen-only="true"] { display: none !important; }

html[data-mode="citizen"] .toolbar-advanced { display: none; }
html[data-mode="citizen"] .toolbar-advanced.open { display: flex; }

.global-search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--rule-strong);
  border-radius: 2px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.global-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.global-search-input {
  font-size: 14px;
  padding: 10px 14px;
}

.global-quick-pills {
  margin-top: 10px;
  margin-bottom: 0;
}

.global-search-results {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  max-height: 360px;
  overflow-y: auto;
}

.global-result-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  transition: background-color 150ms ease;
}

.global-result-item:last-child { border-bottom: none; }
.global-result-item:hover,
.global-result-item:focus-visible {
  background: var(--surface-alt);
  outline: none;
}

.global-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.spotlight-section {
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 8px;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 14px;
}

.spotlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 2px;
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.spotlight-card:hover,
.spotlight-card:focus-visible {
  border-color: var(--rule-strong);
  background: var(--surface-alt);
  outline: none;
}

.spotlight-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spotlight-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.25;
}

.spotlight-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}

.spotlight-cost {
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 2px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.table-expand-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.drawer-details {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-alt);
  padding: 10px 14px;
}

.drawer-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-details summary::-webkit-details-marker { display: none; }
.drawer-details summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 16px;
}
.drawer-details[open] summary::after { content: "−"; }
.drawer-details[open] summary { margin-bottom: 10px; }

.net-citizen-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

html[data-mode="citizen"] .net-adv-bar { display: none; }
html[data-mode="citizen"] .net-adv-bar.open { display: flex; }

.trust-strip {
  border-top-color: var(--pos);
  margin-top: 0;
}

.salaries-card {
  margin-bottom: 16px;
}

.drawer-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-share-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.profile-summary-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface-alt);
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.profile-summary-lead {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

.profile-summary-lead strong {
  color: var(--text);
}

.profile-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.timeline-list {
  list-style: none;
  margin: 12px 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--border);
  display: grid;
  gap: 10px;
}

.timeline-item {
  position: relative;
  padding-left: 8px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-period {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  margin-right: 8px;
}

.timeline-role {
  font-size: 13px;
  color: var(--text);
}

.badge-sm {
  font-size: 10.5px;
  padding: 1px 6px;
  margin-top: 4px;
  display: inline-block;
}

.clickable-row:hover .person-link-cue {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 640px) {
  .kpi-grid,
  .moto-summary,
  .drawer-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
  }
  .kpi-card {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 10px;
  }
  .kpi-grid .kpi-card:first-child,
  .moto-summary .kpi-card:first-child,
  .drawer-kpis .kpi-card:first-child {
    border-top: none;
    padding-top: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}
