/* InsightxExpert — Election map + state pages (dark data theme) */
.el-page {
  --el-bg: #061024;
  --el-panel: #0b1a35;
  --el-panel-2: #0e2142;
  --el-line: rgba(148, 163, 184, 0.16);
  --el-line-strong: rgba(148, 163, 184, 0.28);
  --el-text: #e6edf7;
  --el-muted: #93a4bf;
  --el-accent: #2f6bff;
  --el-accent-soft: rgba(47, 107, 255, 0.16);
  --el-gold: #f59e0b;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(47, 107, 255, 0.14), transparent 60%),
    var(--el-bg);
  color: var(--el-text);
  min-height: 100vh;
  font-feature-settings: "tnum" 1;
}
.el-wrap { max-width: 1520px; margin: 0 auto; padding: 4.75rem 1rem 1.5rem; }
@media (min-width: 1024px) { .el-wrap { padding: 1.75rem 1.5rem 1.5rem; } }

/* Self-contained reset (zero specificity, so component classes always win) */
:where(.el-page) *, :where(.el-page) *::before, :where(.el-page) *::after { box-sizing: border-box; }
:where(.el-page) :is(ul, ol) { list-style: none; margin: 0; padding: 0; }
:where(.el-page) :is(h1, h2, h3, p, dl, dd, figure) { margin: 0; }
:where(.el-page) a { color: inherit; text-decoration: none; }
:where(.el-page) button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
:where(.el-page) :is(input, select) { font: inherit; }
:where(.el-page) table { border-spacing: 0; }

/* ---------- Header ---------- */
.el-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.25rem; }
.el-head__title { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.el-head h1 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.el-head p { color: var(--el-muted); font-size: .9rem; margin-top: .2rem; }
.el-back { flex: none; width: 2.5rem; height: 2.5rem; border-radius: .75rem; display: grid; place-items: center; background: var(--el-panel); border: 1px solid var(--el-line); color: var(--el-text); }
.el-back:hover { border-color: var(--el-line-strong); background: var(--el-panel-2); }
.el-back svg { width: 1.15rem; height: 1.15rem; }

.el-tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .3rem; background: var(--el-panel); border: 1px solid var(--el-line); border-radius: .85rem; }
.el-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: .6rem; font-size: .875rem; font-weight: 500; color: var(--el-muted); transition: background .15s, color .15s; }
.el-tab:hover { color: var(--el-text); background: rgba(255, 255, 255, .04); }
.el-tab.is-active { background: var(--el-accent); color: #fff; box-shadow: 0 6px 18px -6px rgba(47, 107, 255, .7); }
.el-tab.is-empty:not(.is-active) { opacity: .6; }
.el-tab__n { font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: rgba(255, 255, 255, .14); }

/* ---------- Grid ---------- */
.el-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .el-grid { grid-template-columns: 250px minmax(0, 1fr); } .el-detail { grid-column: 1 / -1; } }
@media (min-width: 1280px) {
  .el-grid { grid-template-columns: 260px minmax(0, 1fr) 370px; align-items: start; }
  .el-grid--empty { grid-template-columns: 260px minmax(0, 1fr); }
  .el-detail { grid-column: auto; position: sticky; top: 1rem; }
  .el-side { position: sticky; top: 1rem; }
}
.el-side, .el-main, .el-detail { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
/* Mobile: state + year pickers first, then map/table, then detail, then party stats */
@media (max-width: 767px) {
  .el-side { display: contents; }
  .el-side > * { order: 5; }
  .el-side > form { order: 1; }
  .el-main { order: 3; }
  .el-detail { order: 4; }
}

/* ---------- Cards ---------- */
.el-card { background: linear-gradient(180deg, var(--el-panel-2), var(--el-panel)); border: 1px solid var(--el-line); border-radius: 1rem; }
.el-card--pad { padding: 1rem; }
.el-card__row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.el-card__title { font-size: .95rem; font-weight: 600; }
.el-label { display: block; font-size: .8rem; font-weight: 600; color: var(--el-muted); margin-bottom: .4rem; }
.el-select {
  width: 100%; appearance: none; padding: .6rem 2.2rem .6rem .8rem; border-radius: .6rem; font-size: .9rem;
  background: #0a1730 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a4bf' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center / 1rem;
  color: var(--el-text); border: 1px solid var(--el-line-strong);
}
.el-select:disabled { opacity: .8; }
.el-select:focus, .el-search input:focus { outline: 2px solid var(--el-accent); outline-offset: 1px; }
.el-search { position: relative; margin-top: .75rem; }
.el-search--flush { margin: 0 1rem .75rem; }
.el-search input { width: 100%; padding: .6rem 2.4rem .6rem .8rem; border-radius: .6rem; font-size: .875rem; background: #0a1730; color: var(--el-text); border: 1px solid var(--el-line-strong); }
.el-search input::placeholder { color: #6b7d99; }
.el-search svg { position: absolute; right: .75rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: var(--el-muted); pointer-events: none; }
.el-link { font-size: .8rem; font-weight: 600; color: #6ea0ff; }
.el-link:hover { text-decoration: underline; }
.el-muted { color: var(--el-muted); font-size: .85rem; }
.el-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .875rem; background: var(--el-accent); color: #fff; }
.el-btn--sm { padding: .35rem .8rem; margin-top: .5rem; }
.el-btn--outline { background: transparent; border: 1px solid #4b7dff; color: #b9cdff; margin-top: 1rem; align-self: flex-end; }
.el-btn--outline:hover { background: var(--el-accent-soft); color: #fff; }
.el-dot { display: inline-block; flex: none; width: .7rem; height: .7rem; border-radius: .2rem; background: var(--c, #94a3b8); }
.el-dot--none { background: #22324f; border: 1px solid var(--el-line-strong); }
.el-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: .4rem; font-size: .75rem; font-weight: 700; white-space: nowrap;
  color: #fff; background: color-mix(in srgb, var(--c, #94a3b8) 30%, transparent); border: 1px solid color-mix(in srgb, var(--c, #94a3b8) 60%, transparent); }
.el-chip--none { --c: #475569; color: var(--el-muted); }

/* ---------- Sidebar: parties, summary ---------- */
.el-parties { display: flex; flex-direction: column; gap: .15rem; }
.el-parties button { width: 100%; display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: .5rem; font-size: .875rem; color: var(--el-text); text-align: left; border: 1px solid transparent; }
.el-parties button:hover { background: rgba(255, 255, 255, .04); }
.el-parties button[aria-pressed="true"] { background: var(--el-accent-soft); border-color: rgba(47, 107, 255, .45); }
.el-parties__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-parties__n { font-weight: 700; }

.el-summary { display: flex; align-items: center; gap: .85rem; margin-bottom: .9rem; }
.el-shape { flex: none; width: 3.75rem; height: 3.75rem; display: grid; place-items: center; }
.el-shape svg { width: 100%; height: 100%; overflow: visible; }
.el-shape__path { fill: var(--c); stroke: rgba(255, 255, 255, .55); stroke-width: .6; vector-effect: non-scaling-stroke; }
.el-summary__name { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.el-summary__sub { color: var(--el-muted); font-size: .85rem; }
.el-bars { display: flex; flex-direction: column; gap: .5rem; }
.el-bars li { display: grid; grid-template-columns: auto 4.2rem 1fr 1.8rem; align-items: center; gap: .5rem; font-size: .8rem; }
.el-bars__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-bars__track { height: .5rem; border-radius: 999px; background: rgba(148, 163, 184, .14); overflow: hidden; }
.el-bars__track span { display: block; height: 100%; border-radius: inherit; }
.el-bars__n { text-align: right; font-weight: 700; }
.el-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--el-line); }
.el-facts dt { font-size: .7rem; color: var(--el-muted); }
.el-facts dd { font-size: 1rem; font-weight: 700; }
.el-source { display: flex; gap: .7rem; align-items: flex-start; }
.el-source svg { flex: none; width: 1.6rem; height: 1.6rem; color: #6ea0ff; }
.el-source strong { font-size: .9rem; }
.el-source p { font-size: .8rem; color: var(--el-muted); margin-top: .15rem; }

/* ---------- Map ---------- */
.el-mapcard { position: relative; overflow: hidden; min-height: 360px; }
.el-mapcanvas { width: 100%; height: clamp(360px, 58vh, 560px); display: grid; place-items: center; padding: .75rem; }
.el-mapcard--big .el-mapcanvas { height: clamp(420px, 78vh, 760px); }
.el-svg { width: 100%; height: 100%; touch-action: none; }
.el-svg.is-panning { cursor: grabbing; }
.el-state { fill: var(--fill, #1c2b48); stroke: #08142b; stroke-width: .7; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .2s, opacity .2s, filter .2s; }
.el-state:not(.has-data) { --fill: #1c2b48; }
.el-state:hover, .el-state:focus-visible { filter: brightness(1.25); stroke: #e2e8f0; stroke-width: 1.2; outline: none; }
.el-state.is-dim { --fill: #1a2945; opacity: .85; }
.el-state.is-dim:hover { --fill: #2a3d63; }
.el-state.is-current { stroke: #fff; stroke-width: 1.6; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--fill) 70%, transparent)); }
.el-state.is-off { fill: #142039; pointer-events: none; }
.el-maptip {
  position: absolute; z-index: 5; transform: translate(-50%, -100%); pointer-events: none;
  padding: .5rem .75rem; border-radius: .6rem; background: #0a1730; border: 1px solid #3a5ba8;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .4); font-size: .8rem; white-space: nowrap;
}
.el-maptip strong { display: block; font-size: .875rem; }
.el-maptip span { color: var(--el-muted); }
.el-maphint { position: absolute; left: 1rem; top: 1rem; font-size: .8rem; color: var(--el-muted); }
.el-legend { position: absolute; top: .9rem; right: .9rem; z-index: 2; max-width: calc(100% - 4.5rem); padding: .7rem .85rem; border-radius: .8rem; background: rgba(8, 20, 43, .88); border: 1px solid var(--el-line); backdrop-filter: blur(6px); }
.el-legend--left { right: auto; left: .9rem; top: auto; bottom: .9rem; }
.el-legend__title { display: flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .85rem; margin-bottom: .45rem; }
.el-legend__row { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.el-legend__row > div { display: flex; flex-direction: column; font-size: .75rem; color: var(--el-muted); }
.el-legend__row > div > span { display: inline-flex; align-items: center; gap: .35rem; }
.el-legend__row strong { color: var(--el-text); font-size: 1rem; padding-left: 1.05rem; }
.el-zoom { position: absolute; right: .9rem; bottom: .9rem; display: flex; flex-direction: column; gap: .35rem; z-index: 2; }
.el-zoom button { width: 2.4rem; height: 2.4rem; border-radius: .6rem; display: grid; place-items: center; font-size: 1.15rem; font-weight: 600; color: var(--el-text); background: rgba(8, 20, 43, .9); border: 1px solid var(--el-line-strong); }
.el-zoom button:hover { background: var(--el-panel-2); border-color: #4b7dff; }
.el-zoom button[data-zoom="reset"] { font-size: .7rem; letter-spacing: .04em; }
.el-zoom svg { width: 1.1rem; height: 1.1rem; }
@media (max-width: 639px) {
  .el-legend { position: static; margin: 0 .75rem .75rem; max-width: none; }
  .el-mapcanvas { height: 340px; }
  .el-zoom { top: .75rem; bottom: auto; flex-direction: row; }
  .el-tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .el-tab { white-space: nowrap; flex: none; }
  .el-maphint { display: none; }
}

/* ---------- Table ---------- */
.el-tablecard { overflow: hidden; }
.el-tablecard__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--el-line); }
.el-tablecard__head h2 { font-size: 1rem; font-weight: 600; }
.el-tablecard__head span { font-size: .8rem; color: var(--el-muted); white-space: nowrap; }
.el-tablewrap { max-height: 520px; overflow: auto; }
.el-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.el-table th { position: sticky; top: 0; z-index: 1; background: #0c1c3a; text-align: left; font-weight: 600; font-size: .75rem; color: var(--el-muted); padding: .65rem .8rem; border-bottom: 1px solid var(--el-line); white-space: nowrap; }
.el-table td { padding: .6rem .8rem; border-bottom: 1px solid var(--el-line); vertical-align: middle; }
.el-table td small { display: block; color: var(--el-muted); font-size: .72rem; }
.el-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.el-table tbody tr { cursor: pointer; transition: background .12s; }
.el-table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.el-table tbody tr:focus-visible { outline: 2px solid var(--el-accent); outline-offset: -2px; }
.el-table tbody tr.is-selected { background: var(--el-accent-soft); box-shadow: inset 3px 0 0 var(--el-accent); }
.el-table__i { color: var(--el-muted); width: 2.5rem; }
.el-table--compact td, .el-table--compact th { padding: .5rem .6rem; font-size: .8rem; }
.el-table--compact tbody tr { cursor: default; }
.el-table--compact tr.is-winner { background: rgba(245, 158, 11, .08); }
.el-person { display: inline-flex; align-items: center; gap: .55rem; font-weight: 500; }
.el-person img, .el-person .el-avatar, .el-person__img { width: 1.9rem; height: 1.9rem; border-radius: .45rem; object-fit: cover; flex: none; }
.el-avatar { display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; background: color-mix(in srgb, var(--c, #64748b) 55%, #0b1a35); border: 1px solid color-mix(in srgb, var(--c, #64748b) 70%, transparent); }
.el-noresult { padding: 1.5rem; text-align: center; color: var(--el-muted); }
.el-empty { padding: 2.5rem 1.5rem; text-align: center; }
.el-empty h2 { font-size: 1.1rem; font-weight: 600; }
.el-empty p { color: var(--el-muted); margin-top: .6rem; }
.el-empty a { color: #8fb3ff; text-decoration: underline; margin: 0 .3rem; }
.el-empty__about { max-width: 60ch; margin: 1.25rem auto 0; text-align: left; }

/* ---------- Detail panel ---------- */
.el-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: .85rem; color: var(--el-muted); }
.el-crumbs a { color: var(--el-text); }
.el-crumbs a:hover { color: #8fb3ff; }
.el-crumbs span:last-child { color: var(--el-text); font-weight: 500; }
.el-profile { padding: 1.1rem; display: flex; flex-direction: column; }
.el-profile__top { display: flex; gap: 1rem; align-items: flex-start; }
.el-profile__photo { flex: none; width: 7.5rem; height: 8.5rem; border-radius: .8rem; object-fit: cover; background: #10223f; }
span.el-profile__photo { font-size: 2.2rem; }
.el-profile__info { min-width: 0; }
.el-badge { display: inline-block; padding: .15rem .5rem; border-radius: .35rem; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--el-gold); }
.el-profile h2 { font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-top: .4rem; overflow-wrap: anywhere; }
.el-profile__role { color: #b9c7dd; font-size: .9rem; margin-top: .15rem; }
.el-profile__line { color: var(--el-muted); font-size: .82rem; margin-top: .25rem; }
.el-profile__line span { opacity: .8; }
.el-profile__party { display: inline-flex; align-items: center; gap: .45rem; margin-top: .55rem; font-size: .88rem; font-weight: 600; color: color-mix(in srgb, var(--c) 75%, #fff); }
.el-plogo { width: 1.35rem; height: 1.35rem; object-fit: contain; border-radius: .25rem; background: #fff; }
.el-stats, .el-meta { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 1rem; border: 1px solid var(--el-line); border-radius: .75rem; background: rgba(6, 16, 36, .5); }
.el-meta { margin-top: .5rem; }
.el-stats > div, .el-meta > div { padding: .7rem .75rem; min-width: 0; }
.el-stats > div + div, .el-meta > div + div { border-left: 1px solid var(--el-line); }
.el-stats span, .el-meta span { display: block; font-size: .72rem; color: var(--el-muted); }
.el-stats strong { display: block; font-size: 1.15rem; font-weight: 700; margin-top: .15rem; }
.el-meta strong { display: block; font-size: .85rem; font-weight: 600; margin-top: .15rem; overflow-wrap: anywhere; }
.el-profile__about { margin-top: 1rem; }
.el-profile__about h3 { font-size: .95rem; font-weight: 600; margin-bottom: .35rem; }
.el-profile__about p, .el-about { font-size: .875rem; line-height: 1.65; color: #c3cfe2; }
.el-contenders { overflow: hidden; }
.el-contenders .el-card__row { padding: .9rem 1rem 0; }

.el-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--el-line); font-size: .8rem; color: var(--el-muted); white-space: pre; }
.el-alert { margin-bottom: 1rem; padding: .7rem 1rem; border-radius: .7rem; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); color: #fde68a; font-size: .875rem; }

/* ---------- National page ---------- */
.el-national { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .el-national { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.el-statelist { overflow: hidden; }
.el-statelist__head { display: flex; justify-content: space-between; align-items: baseline; padding: 1rem; }
.el-statelist__head h2 { font-weight: 600; }
.el-states { max-height: 640px; overflow: auto; border-top: 1px solid var(--el-line); }
.el-states a { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name chip" "meta chip"; gap: .1rem .75rem; align-items: center; padding: .65rem 1rem; border-bottom: 1px solid var(--el-line); }
.el-states a:hover { background: rgba(255, 255, 255, .03); }
.el-states__name { grid-area: name; font-weight: 500; font-size: .9rem; }
.el-states__meta { grid-area: meta; font-size: .75rem; color: var(--el-muted); }
.el-states .el-chip { grid-area: chip; }

/* Footer of the site stays light; give it a crisp edge after the dark page */
.page-state .ix-footer, .page-map .ix-footer { border-top: 1px solid rgba(148, 163, 184, .15); }

@media print {
  .el-page { background: #fff; color: #000; }
  .el-zoom, .el-tabs, .el-side form { display: none; }
}
