:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-soft: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef2f7;
  --surface-translucent: rgba(255, 255, 255, 0.88);
  --sidebar: #111722;
  --sidebar-soft: #1a2230;
  --sidebar-text: #f7f9fc;
  --sidebar-muted: #98a4b5;
  --text: #172033;
  --text-soft: #667085;
  --text-faint: #98a2b3;
  --line: #dde3eb;
  --line-soft: #e9edf3;
  --accent: #6257f7;
  --accent-strong: #4d43db;
  --accent-soft: rgba(98, 87, 247, 0.11);
  --teal: #20a98f;
  --teal-soft: rgba(32, 169, 143, 0.12);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.12);
  --red: #e34f66;
  --red-soft: rgba(227, 79, 102, 0.12);
  --blue: #4285f4;
  --green: #28a56a;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 8px 24px rgba(29, 41, 57, 0.07);
  --shadow-md: 0 18px 48px rgba(29, 41, 57, 0.11);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --sidebar-width: 264px;
  --topbar-height: 76px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* UEC Gráficos Beta · Apple-like national atlas */
.beta-label,
.topbar-beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: .56rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand-copy strong {
  display: flex;
  align-items: center;
  gap: 7px;
}

.topbar-beta-badge {
  flex: 0 0 auto;
  margin-left: 4px;
}

.domain-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 6px 10px 14px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34);
}

.domain-button {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 56px;
  padding: 7px 4px;
  border: 0;
  border-radius: 13px;
  color: var(--text-faint);
  background: transparent;
  font: inherit;
  font-size: .64rem;
  font-weight: 750;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.domain-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.domain-button:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.domain-button.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(21, 28, 43, .1), inset 0 0 0 1px var(--line-soft);
}

body[data-domain="events"] .domain-button.is-active { color: #b65c00; }
body[data-domain="charts"] .domain-button.is-active { color: #6755d9; }
body[data-domain="sports"] .domain-button.is-active { color: #087c5a; }

.nav-domain-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 15px 7px;
  color: var(--text-faint);
}

.nav-domain-title span {
  color: var(--text);
  font-size: .71rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-domain-title small {
  font-size: .58rem;
}

.primary-nav [data-domain-nav] { display: none; }
body[data-domain="politics"] .primary-nav [data-domain-nav="politics"],
body[data-domain="events"] .primary-nav [data-domain-nav="events"],
body[data-domain="charts"] .primary-nav [data-domain-nav="charts"],
body[data-domain="sports"] .primary-nav [data-domain-nav="sports"] { display: flex; }

.topbar,
.sidebar {
  backdrop-filter: saturate(160%) blur(22px);
  -webkit-backdrop-filter: saturate(160%) blur(22px);
}

.panel,
.management-card,
.toolbar-card,
.archive-header-card {
  box-shadow: 0 14px 42px rgba(28, 38, 56, .055);
}

.chart-library-summary,
.map-event-stats,
.sports-kpis,
.stadium-network-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chart-library-summary article,
.map-event-stats article,
.sports-kpis article,
.stadium-network-summary article {
  display: grid;
  gap: 3px;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 96%, white 4%), var(--surface-2));
  box-shadow: 0 12px 32px rgba(27, 38, 56, .06);
}

.chart-library-summary span,
.map-event-stats span,
.sports-kpis span,
.stadium-network-summary span {
  color: var(--text-faint);
  font-size: .7rem;
  font-weight: 750;
}

.chart-library-summary strong,
.map-event-stats strong,
.sports-kpis strong,
.stadium-network-summary strong {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
}

.chart-library-summary small,
.map-event-stats small,
.sports-kpis small {
  color: var(--text-soft);
}

.chart-library-toolbar {
  align-items: end;
}

.compact-segment {
  flex: 0 0 auto;
}

.chart-library-list {
  display: grid;
  gap: 9px;
}

.chart-library-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 15px;
  align-items: center;
  min-height: 86px;
  padding: 13px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(25, 34, 50, .05);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.chart-library-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(25, 34, 50, .09);
}

.chart-library-row-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: #6755d9;
  background: rgba(103, 85, 217, .12);
}

.chart-library-row-icon svg {
  width: 22px;
  height: 22px;
}

.chart-library-row h3,
.chart-library-row p {
  margin: 4px 0 0;
}

.chart-library-row p,
.chart-library-row-meta small {
  color: var(--text-faint);
}

.library-category-pill {
  color: #6755d9;
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chart-library-row-meta {
  display: grid;
  gap: 4px;
  min-width: 130px;
  text-align: right;
}

.year-stepper {
  display: inline-grid;
  grid-template-columns: 38px minmax(68px, auto) 38px;
  align-items: center;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 7px 20px rgba(22, 31, 47, .06);
}

.year-stepper button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 11px;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
}

.year-stepper button:hover {
  color: var(--text);
  background: var(--surface-3);
}

.year-stepper svg {
  width: 17px;
  height: 17px;
}

.year-stepper strong {
  text-align: center;
  font-size: .9rem;
}

.event-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr);
  gap: 18px;
  align-items: start;
}

.apple-map-card,
.place-inspector {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(23, 34, 51, .11);
}

.apple-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: .67rem;
  font-weight: 750;
}

.map-legend i {
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(20, 29, 43, .35);
}

.map-legend .is-capital i { background: #d9a51d; }
.map-legend .is-city i { background: #23a36d; }
.map-legend .is-town i { background: #7c8592; }

.map-gesture-tip {
  color: var(--text-faint);
  font-size: .62rem;
}

.event-map-viewport {
  position: relative;
  height: min(74vh, 760px);
  min-height: 580px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background:
    radial-gradient(circle at 50% 35%, rgba(255,255,255,.9), transparent 55%),
    #dbeef7;
}

.event-map-viewport.is-dragging {
  cursor: grabbing;
}

.event-map-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 96%;
  aspect-ratio: 1296 / 1663;
  transform: translate(calc(-50% + var(--map-pan-x)), calc(-50% + var(--map-pan-y))) scale(var(--map-zoom));
  transform-origin: center;
  transition: transform 260ms cubic-bezier(.2,.75,.2,1);
  will-change: transform;
}

.event-map-viewport.is-dragging .event-map-canvas {
  transition: none;
}

.event-map-canvas > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.atlas-place-marker,
.atlas-region-label {
  position: absolute;
  left: var(--map-x);
  top: var(--map-y);
  border: 0;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.atlas-place-marker {
  z-index: 5;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}

.atlas-place-marker i {
  position: absolute;
  inset: 3px;
  border: 1.5px solid white;
  border-radius: 50%;
  background: #7c8592;
  box-shadow: 0 1px 5px rgba(11, 22, 36, .6), 0 0 0 1px rgba(21, 31, 46, .45);
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms ease;
}

.atlas-place-marker.is-capital i { background: #d9a51d; }
.atlas-place-marker.is-city i { background: #23a36d; }
.atlas-place-marker.is-town i { background: #7c8592; }

.atlas-place-marker span {
  position: absolute;
  top: 50%;
  left: calc(100% + 3px);
  max-width: 110px;
  padding: 2px 4px;
  overflow: hidden;
  border-radius: 5px;
  color: #172230;
  background: rgba(255,255,255,.82);
  font-size: .48rem;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  text-shadow: 0 1px white;
  white-space: nowrap;
  transform: translateY(-50%);
}

.atlas-place-marker:hover i,
.atlas-place-marker:focus-visible i,
.atlas-place-marker.is-selected i {
  transform: scale(1.65);
  box-shadow: 0 0 0 2px white, 0 0 0 5px #0a84ff, 0 5px 12px rgba(10,132,255,.35);
}

.atlas-region-label {
  z-index: 3;
  padding: 3px 6px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 6px;
  color: rgba(19, 31, 44, .67);
  background: rgba(255,255,255,.42);
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.atlas-region-label:hover {
  color: #172230;
  background: rgba(255,255,255,.86);
}

.map-zoom-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: 42px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 15px;
  background: rgba(255,255,255,.84);
  box-shadow: 0 12px 30px rgba(20, 34, 50, .18);
  backdrop-filter: blur(18px);
}

.map-zoom-controls button,
.map-zoom-controls span {
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid rgba(25,35,49,.1);
  color: #182432;
  background: transparent;
}

.map-zoom-controls button {
  cursor: pointer;
}

.map-zoom-controls button:hover {
  background: rgba(10,132,255,.1);
}

.map-zoom-controls span {
  font-size: .58rem;
  font-weight: 850;
}

.map-zoom-controls svg {
  width: 18px;
  height: 18px;
}

.place-inspector {
  position: sticky;
  top: 82px;
  padding: 22px;
}

.place-inspector-head,
.place-inspector-actions,
.event-card-tags,
.event-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.place-inspector-head {
  justify-content: space-between;
  color: var(--text-faint);
  font-size: .7rem;
}

.place-kind-badge {
  padding: 5px 8px;
  border-radius: 999px;
  color: white;
  background: #7c8592;
  font-size: .62rem;
  font-weight: 800;
}

.place-kind-badge.is-capital { color: #513600; background: #f3c957; }
.place-kind-badge.is-city { background: #23966a; }

.place-inspector > h2 {
  margin: 18px 0 3px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -.04em;
}

.place-inspector > p {
  margin: 0;
  color: var(--text-faint);
}

.place-facts {
  display: grid;
  gap: 8px;
  margin: 20px 0;
}

.place-facts article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--surface-2);
}

.place-facts span,
.place-facts small {
  color: var(--text-faint);
  font-size: .66rem;
}

.place-facts strong {
  display: flex;
  align-items: center;
  gap: 7px;
}

.place-facts strong i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--party-color);
}

.place-inspector-actions > * {
  flex: 1 1 120px;
}

.place-event-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.national-event-card {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(28, 38, 56, .055);
}

.national-event-card.is-compact {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 11px;
  border-radius: 14px;
  box-shadow: none;
}

.national-event-card.is-holiday {
  border-color: rgba(255,159,10,.35);
  background: linear-gradient(135deg, rgba(255,159,10,.1), var(--surface) 50%);
}

.event-date-block {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 64px;
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-3);
  text-align: center;
}

.event-date-block strong {
  font-size: .8rem;
}

.event-date-block small {
  margin-top: 3px;
  color: var(--text-faint);
}

.event-card-copy h3 {
  margin: 9px 0 5px;
  font-size: 1rem;
}

.event-card-copy > p {
  display: -webkit-box;
  margin: 0 0 9px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: .75rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-type-pill,
.holiday-pill,
.sport-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--event-color);
  background: color-mix(in srgb, var(--event-color) 12%, transparent);
  font-size: .62rem;
  font-weight: 800;
}

.event-type-pill svg {
  width: 13px;
  height: 13px;
}

.holiday-pill {
  color: #9a5700;
  background: rgba(255,159,10,.15);
}

.event-card-meta {
  color: var(--text-soft);
  font-size: .68rem;
}

.event-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.event-card-meta svg {
  width: 13px;
  height: 13px;
}

.event-edit-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  color: var(--text-soft);
  background: var(--surface-2);
  cursor: pointer;
}

.event-edit-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.event-edit-button svg {
  width: 15px;
  height: 15px;
}

.holiday-effect {
  display: grid;
  gap: 2px;
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #865000;
  background: rgba(255,159,10,.12);
}

.holiday-effect strong {
  font-size: .7rem;
}

.holiday-effect span {
  font-size: .63rem;
}

.country-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.event-special-detail,
.attendance-breakdown {
  display: grid;
  gap: 5px;
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-2);
}

.event-special-detail strong,
.attendance-breakdown > strong {
  color: var(--text-faint);
  font-size: .6rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.event-special-detail span {
  font-size: .7rem;
  font-weight: 750;
}

.attendance-breakdown > div {
  display: grid;
  gap: 4px;
}

.attendance-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-soft);
  font-size: .66rem;
}

.attendance-breakdown em {
  color: var(--text);
  font-style: normal;
  font-weight: 800;
}

.country-chip-list span {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-3);
  font-size: .62rem;
}

.mini-empty {
  padding: 18px;
  color: var(--text-faint);
  text-align: center;
  font-size: .75rem;
}

.event-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 17px;
  background: var(--surface);
}

.event-filter-bar .soft-pill {
  margin: 0 0 7px auto;
}

.month-timeline {
  display: grid;
  gap: 9px;
}

.month-lane {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--surface);
}

.month-lane > header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  align-content: center;
  padding: 16px;
  border-right: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.month-lane > header span,
.month-lane > header small {
  color: var(--text-faint);
  font-size: .65rem;
}

.month-lane > header h3 {
  margin: 0;
  font-size: .88rem;
}

.month-lane > div {
  display: grid;
  gap: 8px;
  padding: 9px;
}

.month-empty {
  align-self: center;
  color: var(--text-faint);
  font-size: .72rem;
}

.table-holiday {
  display: inline-flex;
  margin-left: 7px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #945600;
  background: rgba(255,159,10,.13);
  font-size: .58rem;
  font-weight: 800;
}

.status-pill.is-complete {
  color: #08794d;
  background: rgba(32,164,107,.13);
}

.event-editor-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.event-editor-intro h3,
.event-editor-intro p {
  margin: 0;
}

.event-editor-intro p {
  margin-top: 4px;
  color: var(--text-faint);
}

.field textarea {
  width: 100%;
  resize: vertical;
}

.apple-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(255,159,10,.28);
  border-radius: 14px;
  background: rgba(255,159,10,.07);
}

.apple-checkbox input {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: #ff9f0a;
}

.apple-checkbox span,
.apple-checkbox strong,
.apple-checkbox small {
  display: block;
}

.apple-checkbox small {
  margin-top: 4px;
  color: var(--text-faint);
}

.sports-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  min-height: 300px;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px);
  border-radius: 28px;
  color: #f8fffc;
  background:
    radial-gradient(circle at 80% 25%, rgba(74,240,181,.22), transparent 28%),
    linear-gradient(135deg, #0a382f 0%, #0b5c48 55%, #0c7860 100%);
  box-shadow: 0 26px 70px rgba(4,66,51,.25);
}

.sports-hero-kicker {
  display: inline-flex;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sports-hero h2 {
  max-width: 700px;
  margin: 18px 0 12px;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.sports-hero p {
  max-width: 680px;
  margin: 0 0 24px;
  color: rgba(240,255,249,.76);
  line-height: 1.6;
}

.sports-hero .primary-button {
  color: #073e31;
  background: #8df1c9;
}

.sports-hero .secondary-button {
  color: white;
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.1);
}

.sports-orbit {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
}

.sports-orbit > span {
  z-index: 2;
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 34px;
  background: rgba(255,255,255,.13);
  box-shadow: 0 24px 50px rgba(0,0,0,.18);
  backdrop-filter: blur(14px);
  transform: rotate(-6deg);
}

.sports-orbit svg {
  width: 54px;
  height: 54px;
}

.sports-orbit i {
  position: absolute;
  width: 176px;
  height: 176px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
}

.sports-orbit i:nth-child(3) { width: 210px; height: 210px; }
.sports-orbit i:nth-child(4) { width: 245px; height: 245px; }

.sports-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sports-event-list {
  display: grid;
  gap: 9px;
}

.sport-event-card {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--surface-2);
}

.sport-event-card.is-league {
  border-left: 4px solid #25a77b;
}

.sport-date {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
}

.sport-date small,
.sport-event-card p,
.sport-event-card footer {
  color: var(--text-faint);
}

.sport-event-card h3 {
  margin: 8px 0 5px;
  font-size: .95rem;
}

.sport-event-card p {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: .7rem;
}

.sport-event-card p svg {
  width: 13px;
  height: 13px;
}

.sport-event-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 9px;
  font-size: .67rem;
}

.sport-source-pill {
  --event-color: #168b67;
  color: #087653;
  background: rgba(31,170,124,.12);
}

.stadium-compact-list {
  display: grid;
  gap: 8px;
}

.stadium-compact-list article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--surface-2);
}

.stadium-compact-list article > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #15916a;
  background: rgba(31,170,124,.12);
}

.stadium-compact-list strong,
.stadium-compact-list small {
  display: block;
}

.stadium-compact-list small {
  margin-top: 3px;
  color: var(--text-faint);
}

.stadium-network-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stadium-network-summary article {
  text-align: center;
}

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

.stadium-card {
  display: grid;
  gap: 8px;
  min-height: 230px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(24,34,49,.06);
}

.stadium-card-top,
.stadium-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stadium-card-top > span:first-child {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #13865f;
  background: rgba(31,170,124,.12);
}

.stadium-card h3,
.stadium-card p {
  margin: 0;
}

.stadium-card p,
.stadium-card > small {
  color: var(--text-faint);
}

.stadium-capacity {
  height: 7px;
  margin-top: auto;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.stadium-capacity i {
  display: block;
  width: var(--capacity);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1a9c71, #6fd5a9);
}

.stadium-card footer {
  align-items: flex-start;
  flex-direction: column;
}

.league-connected {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #13865f !important;
}

.league-connected svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 1100px) {
  .event-map-layout {
    grid-template-columns: 1fr;
  }

  .place-inspector {
    position: static;
  }

  .sports-kpis,
  .stadium-network-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stadium-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .domain-switcher {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-inline: 8px;
  }

  .domain-button {
    min-height: 48px;
  }

  .domain-button span,
  .nav-domain-title small {
    display: none;
  }

  .chart-library-summary,
  .map-event-stats {
    grid-template-columns: 1fr;
  }

  .chart-library-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .chart-library-row-meta {
    display: none;
  }

  .event-map-viewport {
    height: 66vh;
    min-height: 500px;
  }

  .map-gesture-tip {
    display: none;
  }

  .atlas-place-marker span,
  .atlas-region-label {
    font-size: .42rem;
  }

  .month-lane {
    grid-template-columns: 1fr;
  }

  .month-lane > header {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .sports-hero {
    grid-template-columns: 1fr;
  }

  .sports-orbit {
    display: none;
  }

  .sports-kpis,
  .stadium-network-summary,
  .stadium-grid {
    grid-template-columns: 1fr;
  }

  .sport-event-card {
    grid-template-columns: 1fr auto;
  }

  .sport-date {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .domain-button,
  .chart-library-row,
  .event-map-canvas,
  .atlas-place-marker i {
    transition: none !important;
  }
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1119;
  --bg-soft: #111722;
  --surface: #151b26;
  --surface-2: #19212e;
  --surface-3: #202a38;
  --surface-translucent: rgba(21, 27, 38, 0.9);
  --sidebar: #090d14;
  --sidebar-soft: #131a25;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #8996a8;
  --text: #f2f5f9;
  --text-soft: #aab4c2;
  --text-faint: #7f8b9d;
  --line: #2c3645;
  --line-soft: #232c39;
  --accent: #887eff;
  --accent-strong: #9d95ff;
  --accent-soft: rgba(136, 126, 255, 0.14);
  --teal: #3bc3aa;
  --teal-soft: rgba(59, 195, 170, 0.13);
  --orange-soft: rgba(245, 158, 11, 0.14);
  --red-soft: rgba(227, 79, 102, 0.14);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.32);
}

body[data-theme="google"] {
  color-scheme: dark;
  --bg: #22242a;
  --bg-soft: #282a31;
  --surface: #282a31;
  --surface-2: #30323a;
  --surface-3: #3a3d46;
  --surface-translucent: rgba(40, 42, 49, 0.91);
  --sidebar: #1b1d22;
  --sidebar-soft: #282a31;
  --sidebar-text: #f1f3f4;
  --sidebar-muted: #9aa0a6;
  --text: #f1f3f4;
  --text-soft: #bdc1c6;
  --text-faint: #9aa0a6;
  --line: #44474f;
  --line-soft: #383b43;
  --accent: #8ab4f8;
  --accent-strong: #aecbfa;
  --accent-soft: rgba(138, 180, 248, 0.14);
  --teal: #81c995;
  --teal-soft: rgba(129, 201, 149, 0.14);
  --orange: #fdd663;
  --red: #f28b82;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.23);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.36);
}

body[data-theme="comet"] {
  color-scheme: dark;
  --bg: #171615;
  --bg-soft: #1d1c1a;
  --surface: #1d1c1a;
  --surface-2: #242220;
  --surface-3: #302d2a;
  --surface-translucent: rgba(29, 28, 26, 0.92);
  --sidebar: #11100f;
  --sidebar-soft: #242220;
  --sidebar-text: #f3f0eb;
  --sidebar-muted: #aaa39a;
  --text: #f3f0eb;
  --text-soft: #c6c0b8;
  --text-faint: #aaa39a;
  --line: #403c38;
  --line-soft: #34312e;
  --accent: #b69df8;
  --accent-strong: #c8b6fa;
  --accent-soft: rgba(182, 157, 248, 0.14);
  --teal: #72c5ad;
  --teal-soft: rgba(114, 197, 173, 0.14);
  --orange: #e8b36a;
  --red: #e98086;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 84% -12%, rgba(98, 87, 247, 0.08), transparent 31rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  display: block;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 18px 14px 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 2%, rgba(98, 87, 247, 0.22), transparent 14rem),
    var(--sidebar);
  color: var(--sidebar-text);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.04);
  transition: width 180ms ease, transform 180ms ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  margin-bottom: 18px;
}

.brand-button {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 7px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.brand-button:hover {
  background: rgba(255, 255, 255, 0.055);
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 40px;
  height: 40px;
  padding: 9px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(126, 115, 255, 0.96), rgba(46, 193, 163, 0.88));
  box-shadow: 0 10px 24px rgba(87, 76, 228, 0.34);
}

.brand-mark span {
  width: 5px;
  border-radius: 999px 999px 3px 3px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.brand-mark span:nth-child(1) {
  height: 10px;
}

.brand-mark span:nth-child(2) {
  height: 16px;
}

.brand-mark span:nth-child(3) {
  height: 22px;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 0.96rem;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-button:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: var(--surface-2);
  color: var(--text);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button svg,
.nav-item svg,
.primary-button svg,
.secondary-button svg,
.ghost-button svg,
.danger-button svg,
.text-button svg,
.search-result-icon svg,
.modal-action svg,
.document-type-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-collapse {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  color: var(--sidebar-muted);
}

.sidebar-collapse:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.primary-nav,
.secondary-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 620;
  text-align: left;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.nav-item.is-active {
  background: linear-gradient(90deg, rgba(110, 97, 255, 0.2), rgba(110, 97, 255, 0.08));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #8b82ff;
}

.nav-item svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  min-width: 24px;
  min-height: 20px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font-size: 0.66rem;
  font-style: normal;
  line-height: 16px;
  text-align: center;
}

.sidebar-spacer {
  flex: 1 1 auto;
  min-height: 24px;
}

.data-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin-top: 14px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #45d6a8;
  box-shadow: 0 0 0 4px rgba(69, 214, 168, 0.12);
}

.data-status > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.data-status strong,
.data-status small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-status strong {
  font-size: 0.74rem;
}

.data-status small {
  color: var(--sidebar-muted);
  font-size: 0.66rem;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(280px, 560px) auto;
  align-items: center;
  gap: 24px;
  min-height: var(--topbar-height);
  padding: 12px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-translucent);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.015);
  backdrop-filter: blur(18px);
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-context > div {
  min-width: 0;
}

.topbar-context p,
.topbar-context h1 {
  margin: 0;
}

.topbar-context p {
  margin-bottom: 2px;
  color: var(--text-faint);
  font-size: 0.65rem;
  font-weight: 740;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-context h1 {
  overflow: hidden;
  font-size: 1.16rem;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-menu {
  display: none;
}

.global-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow-xs);
}

.global-search-wrap > svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.global-search-wrap input {
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
}

.global-search-wrap input::placeholder {
  color: var(--text-faint);
}

.global-search-wrap kbd {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-faint);
  font-family: inherit;
  font-size: 0.62rem;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 80;
  max-height: min(420px, calc(100vh - 120px));
  padding: 7px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.search-result:hover,
.search-result.is-active {
  background: var(--surface-2);
}

.search-result-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.search-result-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.search-result-copy strong,
.search-result-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-copy strong {
  font-size: 0.78rem;
}

.search-result-copy span,
.search-result > span:last-child {
  color: var(--text-faint);
  font-size: 0.68rem;
}

.topbar-actions,
.view-actions,
.button-row,
.segmented-control,
.filter-row,
.panel-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions {
  justify-content: flex-end;
}

.theme-icon-dark {
  display: none;
}

body:not([data-theme="light"]) .theme-icon-light {
  display: none;
}

body:not([data-theme="light"]) .theme-icon-dark {
  display: block;
}

.theme-control {
  position: relative;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 95;
  display: grid;
  width: 248px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.theme-menu button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.theme-menu button:hover,
.theme-menu button.is-active {
  background: var(--surface-2);
}

.theme-menu button.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.theme-menu button > span {
  display: grid;
  gap: 2px;
}

.theme-menu strong {
  font-size: 0.74rem;
}

.theme-menu small {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.theme-swatch {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(127, 127, 127, 0.28);
  border-radius: 9px;
  box-shadow: inset 0 0 0 7px var(--swatch-inner);
}

.theme-swatch.is-light { background: #f4f6f9; --swatch-inner: #ffffff; }
.theme-swatch.is-dark { background: #0d1119; --swatch-inner: #151b26; }
.theme-swatch.is-google { background: #22242a; --swatch-inner: #30323a; }
.theme-swatch.is-comet { background: #171615; --swatch-inner: #242220; }

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: var(--surface-2);
}

#syncButton.is-online svg {
  color: var(--teal);
}

#syncButton.is-syncing svg {
  color: var(--accent);
  animation: sync-pulse 0.9s ease-in-out infinite alternate;
}

#syncButton.is-error svg {
  color: var(--red);
}

#syncButton.sync-indicator {
  cursor: default;
  user-select: none;
}

#syncButton:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes sync-pulse {
  from { transform: scale(0.88); opacity: 0.55; }
  to { transform: scale(1.06); opacity: 1; }
}

.ghost-button,
.text-button {
  border-color: transparent;
  background: transparent;
  color: var(--text-soft);
}

.ghost-button {
  border-color: var(--line);
}

.text-button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--accent);
}

.danger-button {
  border-color: color-mix(in srgb, var(--red) 24%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 40px;
  padding: 0 13px;
}

.small-button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  font-size: 0.7rem;
}

.main-content {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 26px 28px 52px;
}

.main-content:focus {
  outline: none;
}

.view-page {
  display: none;
}

.view-page.is-active {
  display: block;
  animation: page-in 180ms ease;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-stack {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 2px;
}

.view-head h2,
.view-head p,
.panel-head h3,
.panel-head p,
.card-title,
.metric-card p,
.metric-card strong,
.hero-copy h2,
.hero-copy p {
  margin: 0;
}

.view-kicker,
.panel-kicker,
.mini-kicker {
  margin: 0 0 7px;
  color: var(--text-faint);
  font-size: 0.65rem;
  font-weight: 780;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.view-head h2 {
  font-size: clamp(1.55rem, 2.6vw, 2.2rem);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.view-head > div > p:last-child {
  max-width: 68ch;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.55;
}

.overview-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  min-height: 270px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.22), transparent 14rem),
    linear-gradient(135deg, #171f33 0%, #29315c 56%, #4b43a7 100%);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.overview-hero::after {
  content: "";
  position: absolute;
  right: -7rem;
  bottom: -11rem;
  width: 25rem;
  height: 25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow:
    0 0 0 4rem rgba(255, 255, 255, 0.025),
    0 0 0 8rem rgba(255, 255, 255, 0.018);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 34px 38px;
}

.hero-copy .view-kicker {
  color: rgba(255, 255, 255, 0.64);
}

.hero-copy h2 {
  max-width: 13ch;
  font-size: clamp(2rem, 4.2vw, 3.6rem);
  letter-spacing: -0.065em;
  line-height: 0.97;
}

.hero-copy > p:not(.view-kicker) {
  max-width: 62ch;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  line-height: 1.6;
}

.hero-copy .button-row {
  margin-top: 24px;
}

.overview-hero .primary-button {
  background: #ffffff;
  color: #252b4e;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.overview-hero .ghost-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.hero-signal {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
  padding: 32px 36px 32px 12px;
}

.hero-signal-card {
  display: grid;
  gap: 7px;
  padding: 16px 17px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.075);
  backdrop-filter: blur(12px);
}

.hero-signal-card span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-signal-card strong {
  overflow: hidden;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-signal-card small {
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.7rem;
}

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

.metric-card,
.panel,
.compact-card,
.management-card,
.party-profile-card,
.history-event,
.archive-day,
.poll-snapshot,
.territory-summary-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.metric-card {
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -36px;
  bottom: -48px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--metric-tone, var(--accent-soft));
}

.metric-card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-card-head span:first-child {
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 690;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--metric-tone, var(--accent-soft));
  color: var(--metric-color, var(--accent));
}

.metric-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 13px;
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  letter-spacing: -0.055em;
  line-height: 1;
}

.metric-card p {
  position: relative;
  z-index: 1;
  margin-top: 9px;
  color: var(--text-faint);
  font-size: 0.7rem;
  line-height: 1.4;
}

.dashboard-grid,
.analysis-grid,
.management-grid,
.demography-grid,
.election-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius-lg);
}

.panel.span-8 {
  grid-column: span 8;
}

.panel.span-7 {
  grid-column: span 7;
}

.panel.span-6 {
  grid-column: span 6;
}

.panel.span-5 {
  grid-column: span 5;
}

.panel.span-4 {
  grid-column: span 4;
}

.panel.span-12 {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h3 {
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.panel-head p:not(.panel-kicker) {
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.panel-subsection {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

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

.panel-subsection-head p,
.panel-subsection-head h4 {
  margin: 0;
}

.panel-subsection-head p {
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: 0.62rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel-subsection-head h4 {
  font-size: 0.82rem;
  letter-spacing: -0.02em;
}

.panel-meta,
.soft-pill,
.status-pill,
.date-pill,
.tag,
.change-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.64rem;
  font-weight: 680;
  white-space: nowrap;
}

.status-pill.is-live {
  border-color: color-mix(in srgb, var(--teal) 26%, var(--line));
  background: var(--teal-soft);
  color: var(--teal);
}

.status-pill.is-warning {
  border-color: color-mix(in srgb, var(--orange) 28%, var(--line));
  background: var(--orange-soft);
  color: var(--orange);
}

.chart-frame {
  min-width: 0;
  overflow: hidden;
}

.line-chart {
  width: 100%;
  min-height: 250px;
  overflow: visible;
}

.line-chart .grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.line-chart .axis-label {
  fill: var(--text-faint);
  font-size: 10px;
  font-family: inherit;
}

.line-chart .series-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart .series-area {
  opacity: 0.08;
}

.line-chart .series-dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.line-chart .series-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: crosshair;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 0.67rem;
}

.legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--legend-color);
}

.hemicycle-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 285px;
  padding: 4px 0 0;
}

.hemicycle-svg {
  width: min(100%, 620px);
  overflow: visible;
}

.hemicycle-svg circle {
  stroke: color-mix(in srgb, var(--surface) 80%, transparent);
  stroke-width: 0.65;
}

.hemicycle-seat {
  cursor: crosshair;
}

.hemicycle-center {
  position: absolute;
  left: 50%;
  bottom: 24px;
  display: grid;
  min-width: 138px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-translucent);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.hemicycle-center strong {
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}

.hemicycle-center span {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.hemicycle-wrap.is-election-night .hemicycle-center strong {
  font-size: clamp(1.15rem, 2.5vw, 1.8rem);
}

.election-night-banner {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(190px, 1fr) minmax(190px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line-soft));
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%, var(--surface) 62%);
  box-shadow: var(--shadow-soft);
}

.election-night-banner > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.election-night-banner p {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.election-night-banner h2 {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: -0.025em;
}

.election-night-live-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 6px color-mix(in srgb, #ef4444 14%, transparent);
  animation: election-live-pulse 1.8s ease-in-out infinite;
}

@keyframes election-live-pulse {
  50% { box-shadow: 0 0 0 10px color-mix(in srgb, #ef4444 3%, transparent); }
}

.election-night-progress {
  display: grid;
  gap: 7px;
}

.election-night-progress > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
}

.election-night-progress > div {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.election-night-progress > div i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.election-night-progress.is-turnout > div i {
  background: var(--teal);
}

.result-list,
.compact-list,
.timeline-preview,
.party-profile-list,
.poll-snapshot-list,
.archive-doc-list,
.management-stack,
.history-timeline {
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(110px, 1.5fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 44px;
}

.result-party {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.party-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--party-color, #64748b);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--party-color, #64748b) 12%, transparent);
}

.result-party span,
.result-party strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-party span {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.result-bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.result-bar[data-chart-tooltip] {
  cursor: crosshair;
}

.result-bar > span {
  display: block;
  width: var(--bar-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--party-color, var(--accent));
}

.result-value {
  min-width: 68px;
  text-align: right;
}

.result-value strong {
  display: block;
  font-size: 0.82rem;
}

.result-value span {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
}

.donut-chart {
  position: relative;
  width: min(100%, 190px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.donut-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.donut-segment {
  cursor: crosshair;
  transition: opacity 140ms ease, stroke-width 140ms ease;
}

.donut-segment:hover,
.donut-segment:focus-visible {
  opacity: 0.88;
  stroke-width: 25;
  outline: none;
}

.donut-chart::before {
  content: "";
  position: absolute;
  inset: 23%;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  z-index: 1;
}

.donut-center {
  position: absolute;
  inset: 27%;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.donut-center strong {
  font-size: 1rem;
  letter-spacing: -0.04em;
}

.donut-center span {
  color: var(--text-faint);
  font-size: 0.58rem;
}

.donut-legend {
  display: grid;
  gap: 10px;
}

.donut-legend-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  cursor: default;
}

.donut-legend-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.donut-legend-row i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--legend-color);
}

.donut-legend-row span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-legend-row strong {
  font-size: 0.7rem;
}

.compact-list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.compact-list-row > i {
  width: 9px;
  height: 32px;
  border-radius: 999px;
  background: var(--row-color, var(--accent));
}

.compact-list-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.compact-list-copy strong,
.compact-list-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-list-copy strong {
  font-size: 0.74rem;
}

.compact-list-copy span {
  color: var(--text-faint);
  font-size: 0.64rem;
}

.compact-list-row > strong {
  font-size: 0.76rem;
}

.timeline-preview-row {
  position: relative;
  display: grid;
  grid-template-columns: 70px auto minmax(0, 1fr);
  gap: 11px;
  min-height: 50px;
}

.timeline-preview-row::before {
  content: "";
  position: absolute;
  left: 82px;
  top: 23px;
  bottom: -11px;
  width: 1px;
  background: var(--line);
}

.timeline-preview-row:last-child::before {
  display: none;
}

.timeline-preview-row time {
  padding-top: 4px;
  color: var(--text-faint);
  font-size: 0.64rem;
  text-align: right;
}

.timeline-preview-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--timeline-color, var(--accent));
  box-shadow: 0 0 0 1px var(--timeline-color, var(--accent));
}

.timeline-preview-copy {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 3px;
}

.timeline-preview-copy strong {
  font-size: 0.72rem;
}

.timeline-preview-copy span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.64rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.toolbar-card {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.toolbar-fields {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.field,
.field-inline {
  display: grid;
  gap: 7px;
}

.field > span,
.field-inline > span {
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 680;
}

.field input,
.field select,
.field textarea,
.field-inline input,
.field-inline select,
.table-input,
.table-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.76rem;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.table-input:focus,
.table-select:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-wide {
  grid-column: 1 / -1;
}

.segmented-control {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.segmented-control button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
}

.segmented-control button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.election-summary-strip,
.territory-metrics,
.demography-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.summary-stat {
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-2);
}

.summary-stat span {
  display: block;
  color: var(--text-faint);
  font-size: 0.62rem;
}

.summary-stat strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  font-size: 0.92rem;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pollManagementTotals {
  margin-bottom: 14px;
}

#pollManagementTotals .summary-stat small {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.data-table,
.manage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.data-table th,
.data-table td,
.manage-table th,
.manage-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tr:last-child td,
.manage-table tr:last-child td {
  border-bottom: 0;
}

.data-table thead th,
.manage-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.62rem;
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody tr:hover,
.manage-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
}

.table-party {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-party i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--party-color);
}

.change-pill.is-up {
  border-color: color-mix(in srgb, var(--teal) 25%, var(--line));
  background: var(--teal-soft);
  color: var(--teal);
}

.change-pill.is-down {
  border-color: color-mix(in srgb, var(--red) 25%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}

.poll-snapshot-list {
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
}

.poll-snapshot {
  padding: 15px;
  border-radius: 16px;
}

.poll-snapshot-button {
  width: 100%;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.poll-snapshot-button:hover {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  transform: translateY(-1px);
}

.poll-snapshot-button.is-selected {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-xs);
}

.poll-snapshot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.poll-snapshot-head strong {
  font-size: 0.78rem;
}

.poll-snapshot-head span {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.poll-mini-bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.poll-mini-bar span {
  min-width: 1px;
  height: 100%;
  background: var(--party-color);
}

.poll-mini-bar span[data-chart-tooltip],
.territory-composition span[data-chart-tooltip] {
  cursor: crosshair;
}

.poll-mini-legend {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.poll-mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.65rem;
}

.territory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
}

.territory-composition {
  display: flex;
  min-height: 22px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-3);
}

.territory-composition span {
  min-width: 2px;
  background: var(--party-color);
}

.government-band {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(52px, 1fr);
  gap: 3px;
  min-width: max-content;
}

.government-band-item {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 7px 5px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--party-color) 14%, var(--surface-2));
  box-shadow: inset 0 3px 0 var(--party-color);
  text-align: center;
}

.government-band-item strong {
  color: var(--text);
  font-size: 0.61rem;
}

.government-band-item span {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 0.56rem;
}

.national-government-band {
  grid-auto-columns: minmax(88px, 1fr);
}

.national-government-band-item {
  position: relative;
  min-height: 78px;
  border: 1px solid transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.national-government-band-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--party-color) 45%, var(--line));
}

.national-government-band-item.is-selected {
  border-color: var(--party-color);
  background: color-mix(in srgb, var(--party-color) 22%, var(--surface));
  box-shadow: inset 0 4px 0 var(--party-color), 0 7px 18px color-mix(in srgb, var(--party-color) 14%, transparent);
}

.national-government-band-item small {
  margin-top: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--text-faint);
  background: var(--surface);
  font-size: 0.49rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.national-government-band-item.is-midterm small {
  border: 1px dashed color-mix(in srgb, var(--party-color) 40%, var(--line));
}

.horizontal-scroll {
  overflow-x: auto;
  padding-bottom: 5px;
}

.city-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
}

.city-matrix-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.city-matrix-card > i {
  width: 8px;
  height: 36px;
  border-radius: 999px;
  background: var(--party-color);
}

.city-matrix-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.city-matrix-copy strong,
.city-matrix-copy span,
.city-matrix-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-matrix-copy strong {
  font-size: 0.72rem;
}

.city-matrix-copy span {
  color: var(--text-faint);
  font-size: 0.61rem;
}

.city-matrix-copy small {
  color: var(--text-soft);
  font-size: 0.58rem;
}

.city-matrix-card > strong {
  font-size: 0.74rem;
}

.age-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}

.age-card {
  position: relative;
  min-height: 124px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.age-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--age-color) 13%, transparent);
}

.age-card span,
.age-card strong,
.age-card small {
  position: relative;
  z-index: 1;
  display: block;
}

.age-card span {
  color: var(--text-soft);
  font-size: 0.68rem;
}

.age-card strong {
  margin-top: 13px;
  font-size: 1.18rem;
  letter-spacing: -0.045em;
}

.age-card small {
  margin-top: 7px;
  color: var(--text-faint);
  font-size: 0.62rem;
}

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.indicator-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.indicator-card h4,
.indicator-card p {
  margin: 0;
}

.indicator-card h4 {
  font-size: 0.78rem;
}

.indicator-card p {
  margin-top: 5px;
  color: var(--text-faint);
  font-size: 0.62rem;
  line-height: 1.45;
}

.indicator-bars {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.indicator-row {
  display: grid;
  grid-template-columns: 86px minmax(80px, 1fr) 54px;
  align-items: center;
  gap: 8px;
}

.indicator-row > span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.indicator-row > strong {
  font-size: 0.62rem;
  text-align: right;
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-timeline {
  position: relative;
}

.history-timeline::before {
  content: "";
  position: absolute;
  left: 121px;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: var(--line);
}

.history-event {
  position: relative;
  display: grid;
  grid-template-columns: 104px 16px minmax(0, 1fr);
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
}

.history-event time {
  padding-top: 2px;
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 680;
  text-align: right;
}

.history-event-dot {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: 2px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--event-color, var(--accent));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--event-color, var(--accent)) 25%, transparent);
}

.history-event-copy h3,
.history-event-copy p {
  margin: 0;
}

.history-event-copy h3 {
  font-size: 0.82rem;
}

.history-event-copy p {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.7rem;
  line-height: 1.55;
}

.archive-header-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface));
  box-shadow: var(--shadow-xs);
}

.archive-header-card h3,
.archive-header-card p {
  margin: 0;
}

.archive-header-card h3 {
  font-size: 1rem;
}

.archive-header-card p {
  max-width: 70ch;
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.5;
}

.archive-timeline {
  position: relative;
  display: grid;
  gap: 16px;
}

.archive-timeline::before {
  content: "";
  position: absolute;
  left: 109px;
  top: 24px;
  bottom: 24px;
  width: 1px;
  background: var(--line);
}

.archive-day {
  position: relative;
  display: grid;
  grid-template-columns: 92px 16px minmax(0, 1fr);
  gap: 10px;
  padding: 17px;
  border-radius: 18px;
}

.archive-date {
  display: grid;
  align-content: start;
  gap: 2px;
  text-align: right;
}

.archive-date strong {
  font-size: 0.78rem;
}

.archive-date span {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.archive-day-dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 2px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.archive-doc-list {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.document-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.document-card:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface-2));
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.document-type-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 52px;
  border-radius: 11px;
  background: var(--red-soft);
  color: var(--red);
}

.document-card-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.document-card-copy strong,
.document-card-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-card-copy strong {
  font-size: 0.75rem;
  white-space: nowrap;
}

.document-card-copy span {
  display: -webkit-box;
  color: var(--text-faint);
  font-size: 0.63rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.document-card-meta {
  display: grid;
  gap: 5px;
  color: var(--text-faint);
  font-size: 0.6rem;
  text-align: right;
}

.management-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.management-tabs button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
}

.management-tabs button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.management-pane {
  display: none;
}

.management-pane.is-active {
  display: block;
}

.management-card {
  padding: 20px;
  border-radius: var(--radius-lg);
}

.management-card + .management-card {
  margin-top: 14px;
}

.management-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.management-card-head h3,
.management-card-head p {
  margin: 0;
}

.management-card-head h3 {
  font-size: 0.92rem;
}

.management-card-head p {
  max-width: 70ch;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 0.68rem;
  line-height: 1.45;
}

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

.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manage-table .table-input,
.manage-table .table-select {
  min-width: 110px;
}

.manage-table input[type="color"] {
  width: 42px;
  min-width: 42px;
  height: 34px;
  padding: 3px;
}

.manage-table .number-input {
  min-width: 88px;
  width: 88px;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.table-icon-button {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.table-icon-button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.table-icon-button.danger {
  color: var(--red);
}

.table-icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--text-faint);
  font-size: 0.66rem;
}

.feedback.is-success {
  color: var(--teal);
}

.feedback.is-error {
  color: var(--red);
}

.field-grow {
  min-width: min(360px, 100%);
}

.field > small {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.59rem;
  line-height: 1.35;
}

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

.theme-choice-card {
  display: grid;
  align-content: start;
  min-height: 170px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.theme-choice-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: translateY(-2px);
}

.theme-choice-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-choice-preview {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.5fr;
  height: 54px;
  margin-bottom: 13px;
  overflow: hidden;
  border: 1px solid rgba(127, 127, 127, 0.22);
  border-radius: 11px;
}

.theme-choice-preview i {
  background: var(--swatch);
}

.theme-choice-card > strong {
  font-size: 0.8rem;
}

.theme-choice-card > small {
  min-height: 34px;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 0.63rem;
  line-height: 1.4;
}

.theme-choice-card > b {
  align-self: end;
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.62rem;
}

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

.appearance-color-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
}

.appearance-color-field > span {
  display: grid;
  gap: 5px;
}

.appearance-color-field b {
  font-size: 0.75rem;
}

.appearance-color-field small {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.appearance-color-field input[type="color"] {
  flex: 0 0 auto;
  width: 58px;
  height: 52px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.64rem;
  font-weight: 700;
}

.locked-badge svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.regional-party-table tbody tr {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.regional-party-table code {
  color: var(--text-faint);
  font-size: 0.62rem;
}

.primary-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.primary-record-card {
  display: grid;
  gap: 7px;
  min-height: 148px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.primary-record-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: translateY(-1px);
}

.primary-record-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-record-date {
  color: var(--text-faint);
  font-size: 0.61rem;
}

.primary-record-party {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 0.64rem;
}

.primary-record-party i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--party-color);
}

.primary-record-card > strong {
  font-size: 0.76rem;
  line-height: 1.35;
}

.primary-record-card > span:last-child {
  align-self: end;
  color: var(--text-faint);
  font-size: 0.62rem;
}

.primary-results {
  display: grid;
  gap: 12px;
}

.primary-candidate-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.05fr) minmax(150px, 1.3fr) 110px;
  align-items: center;
  gap: 14px;
  min-height: 58px;
}

.primary-candidate-copy {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.primary-candidate-copy > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 0.66rem;
}

.primary-candidate-row.is-winner .primary-candidate-copy > span {
  background: color-mix(in srgb, var(--party-color, var(--accent)) 15%, var(--surface));
  color: var(--party-color, var(--accent));
}

.primary-candidate-copy svg,
.winner-emblem svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-candidate-copy > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.primary-candidate-copy strong,
.primary-candidate-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-candidate-copy strong {
  font-size: 0.73rem;
}

.primary-candidate-copy small {
  color: var(--text-faint);
  font-size: 0.6rem;
}

.primary-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
  cursor: crosshair;
}

.primary-bar > span {
  display: block;
  width: var(--bar-width);
  height: 100%;
  border-radius: inherit;
  background: var(--party-color);
}

.primary-values {
  display: grid;
  gap: 3px;
  text-align: right;
}

.primary-values strong {
  font-size: 0.76rem;
}

.primary-values span {
  color: var(--text-faint);
  font-size: 0.58rem;
}

.primary-winner-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, color-mix(in srgb, var(--party-color) 12%, var(--surface)), var(--surface) 58%);
}

.winner-emblem {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 20px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--party-color) 16%, var(--surface));
  color: var(--party-color);
}

.primary-winner-panel > h3,
.primary-winner-panel > p {
  margin: 0;
}

.primary-winner-panel > h3 {
  margin-top: 6px;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.primary-winner-panel > strong {
  display: block;
  margin-top: 8px;
  color: var(--party-color);
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.primary-winner-panel > p:not(.panel-kicker) {
  margin-top: 7px;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.primary-summary-list {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.primary-summary-list > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.63rem;
}

.primary-summary-list b {
  color: var(--text-faint);
  font-weight: 600;
}

.president-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.president-node {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 3px 0 var(--party-color);
}

.president-node.is-current {
  border-color: color-mix(in srgb, var(--party-color) 58%, var(--line));
  background: color-mix(in srgb, var(--party-color) 8%, var(--surface-2));
}

.president-node > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--party-color) 14%, var(--surface));
  color: var(--party-color);
  font-size: 0.64rem;
  font-weight: 800;
}

.president-node > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.president-node strong,
.president-node small,
.president-node > b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.president-node strong {
  font-size: 0.7rem;
}

.president-node small {
  color: var(--text-faint);
  font-size: 0.59rem;
}

.president-node > b {
  grid-column: 2;
  color: var(--party-color);
  font-size: 0.58rem;
}

.president-party-bars .indicator-row {
  grid-template-columns: 105px minmax(70px, 1fr) 28px;
  min-height: 34px;
}

.data-table tr.is-current-row {
  background: color-mix(in srgb, var(--teal) 7%, var(--surface));
}

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

.data-action-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 176px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.data-action-card h4,
.data-action-card p {
  margin: 0;
}

.data-action-card h4 {
  font-size: 0.78rem;
}

.data-action-card p {
  color: var(--text-soft);
  font-size: 0.67rem;
  line-height: 1.5;
}

.data-action-card .primary-button,
.data-action-card .secondary-button,
.data-action-card .danger-button {
  align-self: end;
  justify-self: start;
  margin-top: auto;
}

.recovery-point-list {
  display: grid;
  gap: 10px;
}

.recovery-point-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-2);
}

.recovery-point-card > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.recovery-point-card > div > span,
.recovery-point-card > div > small {
  color: var(--text-faint);
}

.recovery-point-card > div > span {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.recovery-point-card > div > strong {
  font-size: 0.78rem;
}

.recovery-point-card > div > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.63rem;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  text-align: center;
}

.empty-state > div {
  display: grid;
  justify-items: center;
  max-width: 360px;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state strong {
  font-size: 0.85rem;
}

.empty-state p {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 0.7rem;
  line-height: 1.5;
}

.modal-host {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(6, 10, 18, 0.68);
  cursor: default;
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.modal-panel.document-viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  height: min(90vh, 900px);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.modal-title strong,
.modal-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-title strong {
  font-size: 0.88rem;
}

.modal-title span {
  color: var(--text-faint);
  font-size: 0.65rem;
}

.modal-close {
  flex: 0 0 auto;
}

.document-viewer-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #e9edf3;
}

.modal-body {
  padding: 18px;
}

.modal-actions {
  flex-wrap: wrap;
}

.chart-tooltip {
  position: fixed;
  z-index: 320;
  display: grid;
  min-width: 158px;
  max-width: min(290px, calc(100vw - 24px));
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(24, 25, 29, 0.96);
  color: #f8fafc;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.chart-tooltip-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c4c8d0;
  font-size: 0.66rem;
  line-height: 1.25;
}

.chart-tooltip-head i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.chart-tooltip > strong {
  font-size: 0.78rem;
  line-height: 1.3;
}

.chart-tooltip > small {
  color: #aeb4bf;
  font-size: 0.62rem;
  line-height: 1.35;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 220;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100% - 40px));
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: toast-in 180ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--teal-soft);
  color: var(--teal);
}

.toast.is-error .toast-icon {
  background: var(--red-soft);
  color: var(--red);
}

.toast-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast-copy {
  display: grid;
  gap: 3px;
}

.toast-copy strong {
  font-size: 0.74rem;
}

.toast-copy span {
  color: var(--text-soft);
  font-size: 0.65rem;
  line-height: 1.4;
}

.sidebar-backdrop {
  display: none;
}

body.sidebar-collapsed {
  --sidebar-width: 76px;
}

body.sidebar-collapsed .sidebar {
  align-items: center;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .data-status > span:last-child {
  display: none;
}

body.sidebar-collapsed .sidebar-head {
  flex-direction: column;
  min-height: auto;
}

body.sidebar-collapsed .brand-button {
  flex: 0 0 auto;
  padding: 4px;
}

body.sidebar-collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  width: 46px;
  padding: 0;
}

body.sidebar-collapsed .data-status {
  justify-content: center;
  width: 46px;
  padding: 0;
}

/* Gráficos personalizados · espacio independiente */

.custom-chart-board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}

.custom-chart-card {
  grid-column: span var(--custom-chart-span, 6);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.custom-chart-card.is-preview {
  grid-column: 1 / -1;
  box-shadow: none;
}

.custom-chart-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-xs);
}

.custom-chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 8px;
}

.custom-chart-card-head h3,
.custom-chart-card-head p {
  margin: 0;
}

.custom-chart-card-head h3 {
  margin-top: 6px;
  font-size: 1rem;
  letter-spacing: -0.035em;
}

.custom-chart-card-head p {
  max-width: 66ch;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 0.7rem;
  line-height: 1.45;
}

.custom-chart-kind {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.custom-chart-card-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.custom-chart-card-actions .table-icon-button {
  width: 29px;
  height: 29px;
}

.custom-chart-stage {
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  padding: 4px 14px 14px;
}

.custom-chart-height-compact {
  --custom-chart-density: 0.85;
}

.custom-chart-height-normal {
  --custom-chart-density: 1;
}

.custom-chart-height-tall {
  --custom-chart-density: 1.2;
}

.custom-chart-graphic {
  min-width: 0;
  min-height: 0;
}

.custom-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.custom-grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.custom-zero-line {
  stroke: color-mix(in srgb, var(--text-faint) 56%, var(--line));
  stroke-width: 1.2;
}

.custom-axis-label,
.custom-category-label,
.custom-value-label,
.custom-donut-total {
  fill: var(--text-faint);
  font-family: inherit;
  font-size: 10px;
}

.custom-category-label {
  fill: var(--text-soft);
  font-weight: 650;
}

.custom-value-label {
  fill: var(--text-soft);
  font-weight: 700;
}

.custom-value-label.is-inside {
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.18);
  stroke-width: 2px;
}

.custom-donut-total {
  fill: var(--text);
  font-size: 18px;
  font-weight: 760;
}

.custom-chart-mark,
.custom-chart-point {
  cursor: help;
  outline: none;
  transition: opacity 140ms ease, filter 140ms ease;
}

.custom-chart-mark:hover,
.custom-chart-mark:focus,
.custom-chart-point:hover,
.custom-chart-point:focus {
  filter: brightness(1.06) saturate(1.08);
  opacity: 0.88;
}

.custom-chart-mark:focus-visible,
.custom-chart-point:focus-visible {
  stroke: var(--text);
  stroke-width: 2.5;
}

.custom-line-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.custom-area-fill {
  opacity: 0.16;
}

.custom-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 13px;
  padding: 0 4px;
}

.custom-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.62rem;
}

.custom-chart-legend i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--legend-color);
}

.custom-chart-legend strong {
  overflow: hidden;
  max-width: 22ch;
  color: var(--text-soft);
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-chart-legend em {
  color: var(--text-faint);
  font-style: normal;
}

.custom-chart-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 0 18px;
  padding: 12px 0 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-soft);
  font-size: 0.64rem;
  line-height: 1.45;
}

.custom-chart-footer small {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: inherit;
}

.custom-chart-empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.custom-chart-empty .empty-state {
  width: 100%;
  border: 0;
  background: transparent;
}

.custom-chart-mode-tabs {
  width: fit-content;
  max-width: 100%;
}

.custom-chart-editor {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.custom-chart-editor > *,
.custom-chart-editor .management-card {
  min-width: 0;
  max-width: 100%;
}

.table-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.custom-chart-editor .management-card + .management-card {
  margin-top: 0;
}

.custom-chart-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}

.custom-chart-switches label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 650;
}

.custom-chart-switches input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.custom-data-table {
  min-width: 680px;
}

.custom-data-table th,
.custom-data-table td {
  min-width: 128px;
}

.custom-data-table th:first-child,
.custom-data-table td:first-child {
  min-width: 170px;
}

.custom-data-table th:nth-child(2),
.custom-data-table td:nth-child(2) {
  min-width: 96px;
}

.custom-data-table th:last-child,
.custom-data-table td:last-child {
  min-width: 46px;
}

.custom-preview-section {
  background: var(--surface-2);
}

.custom-chart-preview {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.custom-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding-bottom: 8px;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(190px, auto) minmax(240px, 1fr) auto;
    gap: 15px;
    padding-inline: 20px;
  }

  .main-content {
    padding-inline: 22px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel.span-8,
  .panel.span-7 {
    grid-column: span 7;
  }

  .panel.span-5,
  .panel.span-4 {
    grid-column: span 5;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-choice-grid,
  .president-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-chart-card.custom-chart-width-third,
  .custom-chart-card.custom-chart-width-half {
    grid-column: span 6;
  }

  .custom-chart-card.custom-chart-width-wide,
  .custom-chart-card.custom-chart-width-full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1020px) {
  :root {
    --sidebar-width: 230px;
  }

  .topbar {
    grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
  }

  .topbar-actions {
    display: none;
  }

  .overview-hero {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding-bottom: 22px;
  }

  .hero-signal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 32px 30px;
  }

  .panel.span-8,
  .panel.span-7,
  .panel.span-6,
  .panel.span-5,
  .panel.span-4 {
    grid-column: 1 / -1;
  }

  .territory-hero {
    grid-template-columns: 1fr;
  }

  .data-actions-grid {
    grid-template-columns: 1fr;
  }

  .primary-candidate-row {
    grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr) 105px;
  }

  .custom-chart-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-height: 68px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    width: min(286px, calc(100vw - 54px));
    transform: translateX(-102%);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.32);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .sidebar {
    width: min(286px, calc(100vw - 54px));
    align-items: stretch;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-item span,
  body.sidebar-collapsed .nav-badge,
  body.sidebar-collapsed .data-status > span:last-child {
    display: initial;
  }

  body.sidebar-collapsed .sidebar-head {
    flex-direction: row;
  }

  body.sidebar-collapsed .brand-button {
    flex: 1 1 auto;
  }

  body.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    width: 100%;
    padding: 0 12px;
  }

  body.sidebar-collapsed .data-status {
    justify-content: flex-start;
    width: auto;
    padding: 10px 11px;
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    border: 0;
    background: rgba(5, 8, 14, 0.54);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    backdrop-filter: blur(3px);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
    min-height: var(--topbar-height);
    padding: 10px 14px;
  }

  .mobile-menu {
    display: inline-grid;
    width: 38px;
    height: 38px;
  }

  .global-search-wrap {
    min-height: 40px;
  }

  .global-search-wrap kbd {
    display: none;
  }

  .main-content {
    padding: 18px 14px 42px;
  }

  .view-head {
    align-items: stretch;
    flex-direction: column;
  }

  .view-actions {
    flex-wrap: wrap;
  }

  .hero-copy {
    padding: 28px 24px 20px;
  }

  .hero-signal {
    grid-template-columns: 1fr;
    padding: 0 24px 24px;
  }

  .dashboard-grid,
  .analysis-grid,
  .management-grid,
  .demography-grid,
  .election-grid {
    display: block;
  }

  .panel + .panel {
    margin-top: 14px;
  }

  .toolbar-card {
    align-items: stretch;
    flex-direction: column;
  }

  .election-summary-strip,
  .territory-metrics,
  .demography-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }

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

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

  .archive-header-card .button-row {
    flex-wrap: wrap;
  }

  .form-grid,
  .form-grid.cols-3,
  .form-grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .management-card-head {
    flex-direction: column;
  }

  .appearance-color-grid {
    grid-template-columns: 1fr;
  }

  .custom-chart-board {
    display: block;
  }

  .custom-chart-card + .custom-chart-card {
    margin-top: 14px;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .global-search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .topbar {
    min-height: auto;
    padding-bottom: 11px;
  }

  .topbar-context h1 {
    font-size: 1rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .overview-hero {
    min-height: 0;
  }

  .hero-copy h2 {
    font-size: 2.25rem;
  }

  .hero-copy .button-row {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .hero-copy .button-row > * {
    width: 100%;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .custom-chart-card-head,
  .custom-chart-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .custom-chart-card-actions {
    flex-wrap: wrap;
  }

  .custom-chart-stage {
    padding-inline: 8px;
  }

  .panel-actions {
    flex-wrap: wrap;
  }

  .result-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .result-row .result-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .theme-choice-grid,
  .president-timeline {
    grid-template-columns: 1fr;
  }

  .primary-candidate-row {
    grid-template-columns: 1fr auto;
  }

  .primary-candidate-row .primary-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .primary-values {
    grid-column: 2;
    grid-row: 1;
  }

  .hemicycle-wrap {
    min-height: 230px;
  }

  .hemicycle-center {
    bottom: 12px;
  }

  .election-summary-strip,
  .territory-metrics,
  .demography-metrics {
    grid-template-columns: 1fr;
  }

  .history-timeline::before {
    left: 25px;
  }

  .history-event {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .history-event time {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
  }

  .history-event-dot {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .history-event-copy {
    grid-column: 2;
  }

  .archive-timeline::before {
    left: 25px;
  }

  .archive-day {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .archive-date {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
  }

  .archive-day-dot {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .archive-doc-list {
    grid-column: 2;
  }

  .document-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .document-card-meta {
    display: none;
  }

  .modal-host {
    padding: 0;
  }

  .modal-panel,
  .modal-panel.document-viewer {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1020px) {
  .topbar {
    grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
  }

  .topbar-actions {
    display: flex;
  }

  .topbar-actions .theme-control,
  .topbar-actions #manageShortcutButton {
    display: none;
  }

  .topbar-actions #syncButton {
    width: 42px;
    min-width: 42px;
    padding: 0;
    justify-content: center;
  }

  .topbar-actions #syncButton span {
    display: none;
  }
}

@media (max-width: 820px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar {
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr) auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .topbar-actions {
    grid-column: 2;
    grid-row: 1;
  }
}
.party-profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--party-color) 28%, var(--line-soft));
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--party-color) 14%, var(--surface)) 0%, var(--surface) 72%);
  box-shadow: var(--shadow-xs);
}

.party-profile-mark {
  display: grid;
  flex: 0 0 74px;
  width: 74px;
  height: 74px;
  place-items: center;
  border-radius: 20px;
  background: var(--party-color);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--party-color) 28%, transparent);
}

.party-profile-hero span,
.party-profile-hero p {
  color: var(--text-faint);
}

.party-profile-hero h3 {
  margin: 3px 0 4px;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  letter-spacing: -0.05em;
}

.regional-party-notice {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.regional-party-notice p {
  max-width: 360px;
  color: var(--text-faint);
}

.campaign-view-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-2);
}

.campaign-view-filter > div:first-child {
  display: grid;
  gap: 3px;
}

.campaign-view-filter > div:first-child > span {
  font-size: 0.75rem;
  font-weight: 800;
}

.campaign-view-filter > div:first-child > small {
  color: var(--text-faint);
  font-size: 0.64rem;
}

.campaign-view-filter .segmented-control {
  flex: 0 0 auto;
}

.campaign-view-filter .segmented-control button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.campaign-view-filter .segmented-control b {
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.58rem;
}

.campaign-view-filter .segmented-control button.is-active b {
  color: var(--accent);
  background: var(--accent-soft);
}

.campaign-period {
  padding: 18px 0 2px;
}

.campaign-timeline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.campaign-timeline-all {
  min-width: 72px;
  min-height: 54px;
  display: grid;
  place-content: center;
  gap: 2px;
  margin-bottom: 25px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.campaign-timeline-all span {
  color: var(--text-faint);
  font-size: 0.64rem;
}

.campaign-timeline-all.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
}

.campaign-day-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.campaign-day-strip {
  position: relative;
  display: flex;
  width: max-content;
  min-width: 100%;
  padding: 7px 6px 10px;
}

.campaign-day-strip::before {
  content: "";
  position: absolute;
  top: 54px;
  right: 6px;
  left: 6px;
  height: 3px;
  border-radius: 99px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.campaign-day {
  position: relative;
  z-index: 1;
  flex: 1 0 72px;
  min-width: 72px;
  min-height: 92px;
  display: grid;
  grid-template-rows: 42px 12px auto auto;
  justify-items: center;
  gap: 2px;
  padding: 2px 5px 5px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.campaign-day:hover,
.campaign-day:focus-visible {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  transform: translateY(-2px);
}

.campaign-day.is-selected {
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.campaign-day strong {
  margin-top: 2px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.campaign-day small {
  color: var(--text-faint);
  font-size: 0.6rem;
  white-space: nowrap;
}

.campaign-day-dots {
  display: grid;
  grid-template-columns: repeat(7, 5px);
  align-content: end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 42px;
}

.campaign-day-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--party-color);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--party-color) 25%, transparent);
}

.campaign-day-node {
  width: 11px;
  height: 11px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 1px var(--line);
}

.campaign-day.is-selected .campaign-day-node {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.campaign-period-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.campaign-event-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 8px;
}

.campaign-attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 18px;
}

.campaign-party-attendance {
  display: grid;
  gap: 7px;
}

.campaign-party-attendance > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.campaign-party-attendance > div:first-child > span:last-child {
  text-align: right;
}

.campaign-attendance-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.campaign-attendance-track i {
  display: block;
  width: max(2px, var(--attendance-width));
  height: 100%;
  border-radius: inherit;
  background: var(--party-color);
}

.campaign-event {
  position: relative;
  display: block;
  min-width: 0;
  padding: 10px 11px 10px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}

.campaign-event > i {
  position: absolute;
  inset: 9px auto 9px 6px;
  width: 3px;
  border-radius: 99px;
  background: var(--party-color);
}

.campaign-event.is-activity {
  border-style: dashed;
}

.campaign-event.is-activity > i {
  background: color-mix(in srgb, var(--party-color) 58%, var(--text-faint));
}

.campaign-event-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.campaign-event-top,
.campaign-event-date,
.campaign-event-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.campaign-event-date {
  justify-content: flex-start;
  font-size: 0.72rem;
}

.campaign-event-tags {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.campaign-event .event-kind-pill {
  color: var(--text-soft);
  background: var(--surface-3);
}

.campaign-event.is-activity .event-kind-pill {
  color: var(--accent);
  background: var(--accent-soft);
}

.campaign-event-date span,
.campaign-event-copy p,
.campaign-event-meta {
  color: var(--text-faint);
  font-size: 0.68rem;
}

.campaign-event-copy .soft-pill {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 3px 7px;
  font-size: 0.65rem;
}

.campaign-event-copy h4 {
  margin: 0;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-event-meta strong {
  color: var(--text-soft);
  font-size: 0.68rem;
}

.campaign-event-meta .activity-no-attendance {
  color: var(--text-faint);
  font-weight: 600;
}

.campaign-event-copy p {
  margin: 0;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-manage-table {
  min-width: 1160px;
}

.campaign-manage-table [data-field="attendance"]:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
  background: var(--surface-3);
}

@media (max-width: 760px) {
  html,
  body,
  .app-shell,
  .workspace,
  .main-content,
  .view-page,
  .view-stack {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .main-content {
    padding: 14px 10px max(38px, env(safe-area-inset-bottom));
  }

  .view-stack {
    gap: 13px;
  }

  .view-head {
    gap: 13px;
  }

  .view-head h2 {
    font-size: 1.65rem;
  }

  .view-head > div > p:last-child {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .view-actions,
  .view-actions > *,
  .toolbar-fields,
  .toolbar-fields > .field,
  .management-card-head > .field,
  .management-card-head > .button-row,
  .management-card-head > .button-row > .field {
    width: 100%;
  }

  .view-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    min-height: 44px;
  }

  .panel,
  .management-card,
  .toolbar-card,
  .archive-header-card,
  .party-profile-hero {
    padding: 14px;
    border-radius: 16px;
  }

  .panel-head,
  .management-card-head {
    gap: 11px;
    margin-bottom: 13px;
  }

  .toolbar-fields {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .toolbar-card .status-pill {
    align-self: flex-start;
  }

  .field input,
  .field select,
  .field textarea,
  .field-inline input,
  .field-inline select,
  .table-input,
  .table-select {
    min-width: 0 !important;
    min-height: 44px;
    font-size: 16px;
  }

  .management-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
  }

  .management-tabs button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 7px 8px;
    white-space: normal;
  }

  .management-card-head > .button-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .management-card-head > .button-row > button,
  .management-card > .button-row > button {
    min-height: 44px;
  }

  .poll-snapshot-list,
  .primary-record-grid,
  .indicator-grid,
  .city-matrix,
  .archive-doc-list,
  .campaign-attendance-grid {
    grid-template-columns: 1fr;
  }

  .poll-snapshot,
  .poll-snapshot-button,
  .primary-record-card,
  .indicator-card {
    min-width: 0;
  }

  .poll-snapshot-head,
  .poll-mini-row,
  .campaign-party-attendance > div:first-child {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .data-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table.is-mobile-ready,
  table.is-mobile-ready tbody {
    display: grid;
    width: 100%;
    min-width: 0 !important;
    gap: 10px;
  }

  table.is-mobile-ready thead {
    display: none;
  }

  table.is-mobile-ready tbody tr {
    display: grid;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-2);
    box-shadow: var(--shadow-xs);
  }

  table.is-mobile-ready tbody tr[hidden] {
    display: none !important;
  }

  table.is-mobile-ready tbody td {
    display: grid;
    grid-template-columns: minmax(88px, 0.42fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line-soft);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  table.is-mobile-ready tbody td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 0.61rem;
    font-weight: 780;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  table.is-mobile-ready tbody td[data-label=""] {
    display: flex;
    justify-content: flex-end;
  }

  table.is-mobile-ready tbody td[data-label=""]::before {
    display: none;
  }

  table.is-mobile-ready tbody td:last-child {
    border-bottom: 0;
  }

  table.is-mobile-ready .table-party {
    min-width: 0;
    white-space: normal;
  }

  .manage-table .table-input,
  .manage-table .table-select,
  .manage-table .number-input,
  .manage-table input[type="color"] {
    width: 100%;
    min-width: 0;
  }

  .manage-table input[type="color"] {
    height: 44px;
  }

  .table-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .table-icon-button {
    width: 42px;
    height: 42px;
  }

  .campaign-manage-table,
  .custom-data-table {
    min-width: 0;
  }

  .campaign-view-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .campaign-view-filter .segmented-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .campaign-view-filter .segmented-control button {
    min-width: 0;
    min-height: 42px;
    padding: 0 6px;
  }

  .campaign-timeline {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .campaign-timeline-all {
    width: 100%;
    min-height: 44px;
    margin: 0;
  }

  .campaign-day-scroll {
    overflow: visible;
  }

  .campaign-day-strip {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 2px;
    padding: 6px 0 6px;
  }

  .campaign-day-strip::before {
    top: 10px;
    right: auto;
    bottom: 10px;
    left: 10px;
    width: 3px;
    height: auto;
  }

  .campaign-day {
    display: grid;
    grid-template-columns: 20px 72px minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    justify-items: start;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 6px 5px;
    text-align: left;
  }

  .campaign-day-dots {
    grid-column: 3;
    grid-row: 1;
    grid-template-columns: repeat(auto-fill, 5px);
    align-content: center;
    justify-content: start;
    width: 100%;
    min-height: 20px;
  }

  .campaign-day-node {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }

  .campaign-day strong {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .campaign-day small {
    grid-column: 4;
    grid-row: 1;
  }

  .campaign-period-labels {
    display: none;
  }

  .party-profile-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .party-profile-mark {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .campaign-event {
    padding: 10px 11px 10px 15px;
  }

  .campaign-event-list {
    grid-template-columns: 1fr;
  }

  .campaign-period-labels span:nth-child(2) {
    display: none;
  }

  .election-night-banner {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .hemicycle-wrap {
    min-height: 205px;
  }

  .hemicycle-svg {
    width: 100%;
  }

  .custom-chart-stage,
  .custom-chart-graphic,
  .custom-chart-svg {
    max-width: 100%;
  }

  .custom-chart-card-head,
  .custom-chart-footer,
  .custom-chart-switches {
    align-items: stretch;
    flex-direction: column;
  }

  .custom-chart-card-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .document-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .document-card-meta {
    display: none;
  }

  .horizontal-scroll {
    max-width: 100%;
    overflow-x: hidden;
  }

  .government-band {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  .recovery-point-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .recovery-point-card > .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 8px;
    padding: 8px 10px 10px;
  }

  .topbar-context p {
    display: none;
  }

  .topbar-context h1 {
    font-size: 0.92rem;
  }

  .global-search-wrap {
    min-height: 42px;
  }

  .management-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .management-tabs button {
    font-size: 0.66rem;
  }

  .government-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .election-summary-strip,
  .territory-metrics,
  .demography-metrics,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .management-card,
  .toolbar-card,
  .archive-header-card {
    padding: 12px;
  }

  table.is-mobile-ready tbody td {
    grid-template-columns: 78px minmax(0, 1fr);
    padding: 8px;
  }

  .button-row {
    flex-wrap: wrap;
  }

  .management-card > .button-row > button,
  .archive-header-card .button-row > button {
    width: 100%;
  }
}

/* Beta 14 · national atlas and synchronized population */
.map-event-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.map-toolbar-leading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.map-country-selector {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 6px 11px 6px 9px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, #0a84ff 22%);
  border-radius: 13px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 92%, #0a84ff 8%);
  box-shadow: 0 5px 16px rgba(28, 45, 70, .06);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.map-country-selector:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 132, 255, .55);
}

.map-country-selector.is-selected {
  border-color: rgba(10, 132, 255, .72);
  color: #075fae;
  background: color-mix(in srgb, var(--surface) 80%, #d9efff 20%);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, .12), 0 8px 22px rgba(10, 132, 255, .12);
}

.map-country-selector > svg {
  width: 18px;
  height: 18px;
}

.map-country-selector > span {
  display: grid;
  gap: 1px;
  text-align: left;
}

.map-country-selector small {
  color: var(--text-faint);
  font-size: .56rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.map-country-selector strong {
  font-size: .72rem;
  line-height: 1.1;
}

.place-kind-badge.is-country {
  background: linear-gradient(135deg, #075fae, #30b0c7);
}

.place-inspector.is-country {
  background:
    radial-gradient(circle at 100% 0, rgba(48, 176, 199, .13), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 94%, #0a84ff 6%), var(--surface));
}

@media (max-width: 980px) {
  .map-event-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .apple-map-toolbar,
  .map-toolbar-leading {
    align-items: flex-start;
  }

  .apple-map-toolbar {
    flex-direction: column;
  }

  .map-event-stats {
    grid-template-columns: 1fr;
  }
}

/* Beta 13 · mapa vivo, analítica de eventos y navegación compacta */
.event-map-viewport,
.apple-map-card {
  background: #d7eaf4;
}

.event-map-viewport {
  isolation: isolate;
}

.event-map-canvas {
  height: 100%;
  --marker-scale: 1;
}

.event-map-canvas > img {
  object-fit: contain;
  background: #d7eaf4;
}

.atlas-place-marker,
.atlas-region-label {
  transform: translate(-50%, -50%) scale(var(--marker-scale));
  transform-origin: center;
}

.atlas-place-marker {
  transition: opacity 160ms ease;
}

.atlas-place-marker span {
  top: 50%;
  left: calc(100% + 5px);
  max-width: 148px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 4px 12px rgba(28, 43, 58, .12);
  font-size: .66rem;
  line-height: 1.05;
  transition: opacity 150ms ease, transform 150ms ease;
}

.atlas-place-marker.label-west span {
  right: calc(100% + 5px);
  left: auto;
}

.atlas-place-marker.label-north span {
  right: auto;
  bottom: calc(100% + 5px);
  left: 50%;
  top: auto;
  transform: translateX(-50%);
}

.atlas-place-marker.label-south span {
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
}

.event-map-canvas[data-zoom-band="overview"] .atlas-place-marker.is-city span,
.event-map-canvas[data-zoom-band="overview"] .atlas-place-marker.is-town span,
.event-map-canvas[data-zoom-band="mid"] .atlas-place-marker.is-town span {
  opacity: 0;
  pointer-events: none;
}

.event-map-canvas[data-zoom-band="overview"] .atlas-place-marker.is-town {
  opacity: .56;
}

.event-map-canvas .atlas-place-marker.is-selected,
.event-map-canvas .atlas-place-marker.is-selected span {
  z-index: 18;
  opacity: 1 !important;
}

.event-map-canvas[data-zoom-band="detail"] .atlas-region-label:not(.is-selected) {
  opacity: .26;
}

.atlas-region-label {
  padding: 5px 8px;
  border-radius: 9px;
  font-size: .62rem;
  box-shadow: 0 4px 14px rgba(24, 38, 52, .08);
  transition: opacity 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.atlas-region-label.is-selected {
  z-index: 16;
  color: #0a4e8b;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 0 0 2px #0a84ff, 0 8px 22px rgba(10, 132, 255, .24);
}

.place-kind-badge.is-region {
  background: linear-gradient(135deg, #0a84ff, #5ac8fa);
}

.place-inspector.is-region {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 93%, #0a84ff 7%), var(--surface));
}

.event-analytics-view .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.event-analytics-grid .panel {
  min-height: 280px;
}

.analytics-onboarding {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, #0a84ff 28%, var(--line-soft));
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(10, 132, 255, .1), var(--surface));
}

.analytics-onboarding > svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: #0a84ff;
}

.analytics-onboarding > div {
  min-width: 0;
  flex: 1;
}

.analytics-onboarding h3,
.analytics-onboarding p {
  margin: 0;
}

.analytics-onboarding p {
  margin-top: 4px;
  color: var(--text-soft);
}

.analytics-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  color: var(--text-faint);
  text-align: center;
}

.event-analytics-bars {
  display: grid;
  gap: 13px;
}

.event-analytics-bars article {
  display: grid;
  gap: 6px;
}

.event-analytics-bars article > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.event-analytics-bars span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-analytics-bars strong {
  font-size: .76rem;
}

.event-analytics-bars i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.event-analytics-bars b {
  display: block;
  width: var(--bar-size);
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color);
  box-shadow: 0 0 18px color-mix(in srgb, var(--bar-color) 42%, transparent);
}

.sport-event-card.is-cancelled {
  opacity: .72;
  filter: grayscale(.18);
}

@media (min-width: 821px) {
body.sidebar-collapsed .domain-switcher {
    grid-template-columns: 1fr;
    width: 48px;
    margin: 8px auto 14px;
    padding: 4px;
    gap: 4px;
    border-radius: 16px;
  }

  body.sidebar-collapsed .domain-button {
    width: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 12px;
  }

  body.sidebar-collapsed .domain-button span,
  body.sidebar-collapsed .nav-domain-title {
    display: none !important;
  }

  body.sidebar-collapsed .primary-nav,
  body.sidebar-collapsed .secondary-nav {
    width: 100%;
    align-items: center;
  }

  body.sidebar-collapsed .sidebar {
    overflow-x: hidden;
  }
}

/* Selector de áreas compacto */
.domain-switcher{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:3px!important;padding:4px!important;border-radius:14px!important}
.domain-button{min-height:52px!important;padding:7px 3px!important;border-radius:10px!important;gap:4px!important}
.domain-button svg{width:17px!important;height:17px!important}.domain-button span{font-size:.61rem!important}
@media (min-width:821px){body.sidebar-collapsed .domain-switcher{grid-template-columns:1fr!important;width:48px!important}body.sidebar-collapsed .domain-button{width:38px!important;min-height:38px!important;padding:0!important}body.sidebar-collapsed .domain-button span{display:none!important}}

@media (max-width: 980px) {
  .event-analytics-view .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .domain-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .domain-button span {
    display: inline !important;
    font-size: .62rem;
  }

  .atlas-place-marker span {
    max-width: 120px;
    font-size: .6rem;
  }

  .atlas-region-label {
    font-size: .56rem;
  }

  .event-analytics-view .metric-grid {
    grid-template-columns: 1fr;
  }

  .analytics-onboarding {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .analytics-onboarding .primary-button {
    width: 100%;
  }
}

/* National map, pactometer and government */
.national-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  align-items: center;
}

.national-map-stage {
  position: relative;
  width: min(100%, 690px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: #dceef7;
  box-shadow: 0 18px 44px rgba(23, 39, 61, 0.12);
}

.national-map-stage > img {
  display: block;
  width: 100%;
  height: auto;
}

.map-city-hotspot {
  position: absolute;
  left: var(--map-x);
  top: var(--map-y);
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.map-city-hotspot span {
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(19, 32, 48, 0.65);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.map-city-hotspot:hover span,
.map-city-hotspot:focus-visible span,
.map-city-hotspot.is-selected span {
  transform: scale(1.45);
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(255, 255, 255, 0.8);
}

.map-ruler {
  position: absolute;
  inset: 5.5% auto 5.5% 16px;
  width: 62px;
  color: #1d2b3a;
  font-size: 0.61rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.95);
}

.map-ruler > i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: #1d2b3a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.map-ruler > span {
  position: absolute;
  top: var(--ruler-y);
  left: 18px;
  transform: translateY(-50%);
  white-space: nowrap;
}

.map-ruler > span::before {
  content: "";
  position: absolute;
  right: calc(100% + 5px);
  top: 50%;
  width: 10px;
  height: 2px;
  background: #1d2b3a;
}

.map-scale-notes {
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--surface-2);
}

.map-scale-notes h4,
.map-scale-notes p {
  margin: 12px 0 0;
}

.map-scale-notes > strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
}

.map-scale-notes p,
.map-scale-notes small {
  color: var(--text-faint);
  line-height: 1.55;
}

.map-scale-bar {
  position: relative;
  margin: 22px 0 8px;
  padding-top: 13px;
  border-top: 4px solid var(--text);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.map-scale-bar::before,
.map-scale-bar::after,
.map-scale-bar i {
  content: "";
  position: absolute;
  top: -8px;
  width: 2px;
  height: 12px;
  background: var(--text);
}

.map-scale-bar::before { left: 0; }
.map-scale-bar::after { right: 0; }
.map-scale-bar i { left: 50%; }

.map-distance-list {
  display: grid;
  gap: 7px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.map-distance-list h5 {
  margin: 0 0 3px;
  font-size: 0.82rem;
}

.map-distance-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
}

.map-distance-list > div span {
  color: var(--text-soft);
}

.pactometer-main-panel {
  overflow: hidden;
}

.parliament-grouping-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 18px;
  padding: 5px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-2);
}

.parliament-grouping-tabs button {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-soft);
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.parliament-grouping-tabs button:hover {
  color: var(--text);
  background: var(--surface-3);
}

.parliament-grouping-tabs button.is-active {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 10%, transparent);
}

.parliament-composition {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(280px, 1.05fr);
  gap: 26px;
  align-items: center;
}

.composition-gauge {
  margin-top: 0;
}

.parliament-composition-legend {
  display: grid;
  gap: 7px;
}

.parliament-composition-legend > div {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 52px;
  padding: 8px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}

.parliament-composition-legend i {
  width: 5px;
  height: 30px;
  border-radius: 99px;
  background: var(--party-color);
}

.parliament-composition-legend span,
.parliament-composition-legend small {
  display: block;
  min-width: 0;
}

.parliament-composition-legend strong {
  font-size: 0.82rem;
}

.parliament-composition-legend small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parliament-composition-legend > div > b {
  font-size: 1.05rem;
}

.pactometer-gauge {
  position: relative;
  width: min(100%, 620px);
  margin: 18px auto 0;
}

.pactometer-gauge svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.pactometer-track,
.pactometer-segment {
  fill: none;
  stroke-width: 48;
}

.pactometer-track {
  stroke: var(--surface-3);
}

.pactometer-segment {
  opacity: 0.52;
  transition: opacity 160ms ease, filter 160ms ease;
}

.pactometer-segment.is-selected {
  opacity: 1;
  filter: drop-shadow(0 4px 5px rgba(26, 36, 52, 0.2));
}

.pactometer-segment.is-partial {
  opacity: 0.78;
  filter: drop-shadow(0 3px 4px rgba(26, 36, 52, 0.12));
}

.pactometer-majority-line {
  stroke: var(--text);
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.pactometer-majority-label {
  fill: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
}

.pactometer-center {
  position: absolute;
  left: 50%;
  bottom: 4%;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
}

.pactometer-center strong {
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1;
}

.pactometer-center span {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 0.74rem;
}

.pactometer-center b {
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-3);
  font-size: 0.68rem;
}

.pactometer-center b.is-reached {
  color: #08794d;
  background: rgba(32, 164, 107, 0.14);
}

.pactometer-party-list {
  display: grid;
  gap: 8px;
}

.pactometer-selection-panel {
  display: flex;
  flex-direction: column;
}

.pactometer-selected-list {
  display: grid;
  gap: 8px;
  min-height: 78px;
}

.pactometer-selection-empty {
  display: grid;
  place-content: center;
  min-height: 78px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--text-faint);
  text-align: center;
}

.pactometer-selection-empty strong,
.pactometer-selection-empty span {
  display: block;
}

.pactometer-selection-empty strong {
  color: var(--text-soft);
}

.pactometer-selection-empty span {
  margin-top: 4px;
  font-size: 0.72rem;
}

.pactometer-available-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 9px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.pactometer-available-head small {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
}

.pactometer-party {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}

.pactometer-party > i {
  width: 5px;
  height: 34px;
  border-radius: 99px;
  background: var(--party-color);
}

.pactometer-party span,
.pactometer-party span small {
  display: block;
}

.pactometer-party span small {
  margin-top: 3px;
  color: var(--text-faint);
}

.pactometer-party > b {
  font-size: 1.05rem;
}

.pactometer-party.is-selected {
  border-color: color-mix(in srgb, var(--party-color) 60%, var(--line));
  background: color-mix(in srgb, var(--party-color) 9%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--party-color) 18%, transparent);
}

.pactometer-party.is-partial {
  border-color: color-mix(in srgb, var(--party-color) 38%, var(--line));
  background: color-mix(in srgb, var(--party-color) 5%, var(--surface));
}

.pactometer-coalition-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
}

.pactometer-coalition-summary > div {
  display: grid;
  gap: 5px;
}

.pactometer-coalition-summary span {
  color: var(--text-faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.government-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%, var(--surface) 70%);
}

.government-hero span,
.government-hero p {
  color: var(--text-faint);
}

.government-hero h3 {
  margin: 5px 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.government-hero p {
  margin: 0;
}

.government-coalition,
.government-party-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.government-coalition > span,
.government-party-checks > label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 750;
}

.government-coalition i,
.government-party-checks i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--party-color);
}

.government-party-checks input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.government-party-checks label:has(input:checked) {
  border-color: var(--party-color);
  background: color-mix(in srgb, var(--party-color) 10%, var(--surface));
}

.government-coalition-field {
  margin-top: 16px;
}

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

.ministry-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 15px 15px 15px 19px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--surface-2);
}

.ministry-card > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--party-color);
}

.ministry-card > span,
.ministry-card > small {
  color: var(--text-faint);
}

.ministry-card > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ministry-card > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.government-archive-list,
.government-snapshot-list {
  display: grid;
  gap: 10px;
}

.government-archive-card {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: var(--surface-2);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.government-archive-card[open] {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 12px 28px rgba(20, 27, 45, 0.07);
}

.government-archive-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 13px 16px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.government-archive-card > summary::-webkit-details-marker {
  display: none;
}

.government-archive-title,
.government-archive-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.government-archive-title > i {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.government-archive-title svg {
  width: 20px;
  height: 20px;
}

.government-archive-title > span,
.government-archive-title strong,
.government-archive-title small {
  display: block;
  min-width: 0;
}

.government-archive-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}

.government-archive-title small,
.government-archive-meta small {
  margin-top: 4px;
  color: var(--text-faint);
}

.government-archive-meta {
  flex: 0 0 auto;
  justify-content: flex-end;
  text-align: right;
}

.government-archive-meta > b,
.government-archive-meta > small {
  white-space: nowrap;
}

.government-archive-meta > svg {
  width: 18px;
  height: 18px;
  margin-left: 5px;
  color: var(--text-faint);
  transition: transform 160ms ease;
}

.government-archive-card[open] .government-archive-meta > svg {
  transform: rotate(180deg);
}

.government-archive-content {
  padding: 18px 16px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}

.government-archive-content .government-coalition {
  margin-bottom: 14px;
}

.government-archive-create {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-2);
}

.government-archive-create .primary-button {
  min-height: 44px;
}

.government-snapshot-list {
  margin-top: 14px;
}

.government-snapshot-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--surface-2);
}

.government-snapshot-item .metric-icon {
  width: 38px;
  height: 38px;
}

.government-snapshot-item > span:nth-child(2),
.government-snapshot-item strong,
.government-snapshot-item small {
  display: block;
  min-width: 0;
}

.government-snapshot-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.government-snapshot-item small {
  margin-top: 4px;
  color: var(--text-faint);
}

.vote-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 22px;
  align-items: start;
}

.vote-copy > h4 {
  margin: 10px 0 6px;
  font-size: 1.3rem;
}

.vote-copy > p {
  margin: 0;
  color: var(--text-faint);
}

.vote-hemicycle {
  position: relative;
  margin-top: 12px;
}

.vote-result-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.vote-result-badge.is-approved {
  color: #08794d;
  background: rgba(32, 164, 107, 0.15);
}

.vote-result-badge.is-rejected {
  color: #b8263b;
  background: rgba(227, 79, 95, 0.14);
}

.vote-totals,
.vote-party-list {
  display: grid;
  gap: 8px;
}

.vote-totals {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.vote-totals > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--surface-2);
}

.vote-totals i,
.vote-party-list strong > i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vote-color);
}

.vote-party-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.vote-party-list strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--vote-color);
  font-size: 0.75rem;
}

.vote-party-list .vote-party-breakdown {
  color: var(--text-muted);
  text-align: right;
  line-height: 1.35;
}

.government-vote-breakdown-row > td {
  padding: 0 12px 12px;
  background: var(--surface-2);
}

/* Keep the public Government cards visually identical to their original article rows. */
.ministry-grid button.ministry-card { display:grid; gap:5px; position:relative; min-width:0; padding:15px 15px 15px 19px; overflow:hidden; border:1px solid var(--line-soft); border-radius:13px; background:var(--surface-2); font:inherit; color:inherit; text-align:left; appearance:none; }
.vote-party-list > div > button { display:flex; align-items:center; justify-content:space-between; flex:1; gap:12px; margin:0; padding:0; border:0; background:transparent; color:inherit; font:inherit; text-align:left; appearance:none; }

.government-vote-breakdown {
  padding: 9px 0 0;
}

.government-vote-breakdown summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.government-vote-breakdown summary small {
  margin-left: 6px;
  color: var(--text-faint);
  font-weight: 650;
}

.government-vote-breakdown-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.government-vote-breakdown-fields label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.government-vote-breakdown > small {
  display: block;
  margin-top: 8px;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.vote-number {
  font-weight: 850;
}

.vote-number.is-for { color: #20a46b; }
.vote-number.is-against { color: #e34f5f; }
.vote-number.is-abstain { color: #8d96a6; }

@media (max-width: 980px) {
  .national-map-layout,
  .vote-detail-grid {
    grid-template-columns: 1fr;
  }

  .map-scale-notes {
    max-width: 690px;
    margin: 0 auto;
  }

  .ministry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .government-vote-breakdown-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .national-map-panel {
    padding: 10px;
  }

  .national-map-layout {
    gap: 12px;
  }

  .national-map-stage {
    border-radius: 13px;
  }

  .map-ruler {
    left: 8px;
    transform: scale(0.82);
    transform-origin: left center;
  }

  .map-scale-notes {
    padding: 15px;
  }

  .pactometer-gauge {
    margin-top: 8px;
  }

  .parliament-composition {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .parliament-grouping-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .parliament-grouping-tabs button {
    width: 100%;
  }

  .pactometer-track,
  .pactometer-segment {
    stroke-width: 42;
  }

  .pactometer-coalition-summary,
  .government-hero {
    grid-template-columns: 1fr;
  }

  .government-hero {
    display: grid;
    align-items: start;
    padding: 16px;
  }

  .ministry-grid,
  .vote-totals {
    grid-template-columns: 1fr;
  }

  .government-archive-card > summary {
    align-items: flex-start;
    gap: 10px;
  }

  .government-archive-meta {
    display: grid;
    grid-template-columns: auto auto;
    gap: 2px 8px;
  }

  .government-archive-meta > small {
    grid-column: 1;
  }

  .government-archive-meta > svg {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .government-archive-create {
    grid-template-columns: 1fr;
  }

  .government-archive-create .primary-button {
    width: 100%;
  }

  .vote-detail-grid {
    gap: 14px;
  }

  .vote-party-list > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .government-party-checks > label {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (max-width: 420px) {
  .map-city-hotspot {
    width: 22px;
    height: 22px;
  }

  .map-ruler {
    display: none;
  }

  .pactometer-center strong {
    font-size: 2rem;
  }

  .pactometer-center b {
    font-size: 0.58rem;
  }

  .parliament-composition-legend small {
    white-space: normal;
  }

  .government-party-checks > label {
    flex-basis: 100%;
  }
}
