/* Election-night results dashboard: controls (left), live map (middle), race card
   and county breakdown (right), turnout cards (bottom). */

.el {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
  min-width: 0;
}

@media (min-width: 1200px) {
  .el {
    grid-template-columns: 280px minmax(0, 1fr) 380px;
  }
}

.el-side,
.el-map,
.el-detail,
.el-bottom section {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

[hidden] {
  display: none !important;
}

/* ---- Left column: status and controls ---- */

.el-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.el-side h1 {
  margin: 0;
  font-size: 1.35rem;
}

.el-updated {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

.el-every {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
}

.el-view,
.el-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.el-view button,
.el-mode button {
  flex: 1 1 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
}

.el-view button[aria-pressed="true"],
.el-mode button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink, #fff);
}

.el-race,
.el-find {
  display: grid;
  gap: 6px;
  font-size: .85rem;
  font-weight: 650;
}

.el-race select,
.el-find input {
  width: 100%;
  padding: 8px 10px;
  font-size: .85rem;
}

.el-mine {
  justify-self: start;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
}

.el-mine:hover {
  background: var(--surface-2, var(--line));
}

.el-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: .82rem;
  font-weight: 400;
}

.el-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.el-legend i {
  width: 14px;
  height: 14px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.el-legend .early {
  background: var(--el-early, #b9a7d6);
}

.el-legend .none {
  background: repeating-linear-gradient(135deg,
    var(--line) 0,
    var(--line) 1px,
    var(--surface-2, var(--surface)) 1px,
    var(--surface-2, var(--surface)) 4px);
}

.el-ramp {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.el-ramp i {
  width: auto;
  height: 10px;
  border: none;
  border-radius: 5px;
  background: linear-gradient(to right, #f3efff, var(--accent));
}

/* ---- Middle column: the map ---- */

.el-map {
  padding: 12px;
}

.el-svg {
  width: 100%;
  height: auto;
  display: block;
}

.el-svg .outline-counties path {
  cursor: pointer;
  stroke: var(--surface);
  stroke-width: .4;
}

.el-svg path.selected {
  stroke: var(--ink);
  stroke-width: 2;
}

/* ---- Right column: race card and county breakdown ---- */

.el-detail {
  display: grid;
  gap: 14px;
  align-content: start;
}

.el-race-card h2,
.el-counties h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.el-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .9rem;
}

.el-cand {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  column-gap: 8px;
  row-gap: 6px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}

.el-cand .el-track {
  grid-column: 1 / -1;
}

.el-letter {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--party-i);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
}

.el-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.el-pct {
  font-weight: 700;
}

.el-votes {
  color: var(--muted);
  font-size: .82rem;
}

.el-track,
.el-bar,
.el-tbar,
.el-tc-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2, var(--line));
  overflow: hidden;
}

.el-track i,
.el-bar i,
.el-tbar i,
.el-tc-bar i {
  display: block;
  height: 100%;
}

.el-reporting {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: .82rem;
}

.el-clear {
  margin-top: 10px;
  justify-self: start;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 650;
  cursor: pointer;
}

.el-clear:hover {
  background: var(--surface-2, var(--line));
}

.el-counties table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.el-counties th,
.el-counties td {
  padding: 7px 4px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.el-counties th:first-child,
.el-counties td:first-child {
  text-align: left;
}

.el-counties tbody tr {
  cursor: pointer;
}

.el-counties tbody tr:hover {
  background: var(--surface-2, var(--line));
}

.el-counties tbody tr.selected {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.el-counties .el-letter {
  width: 18px;
  height: 18px;
  font-size: .6rem;
}

.el-all {
  margin-top: 10px;
  justify-self: start;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: .85rem;
  font-weight: 650;
  cursor: pointer;
}

/* ---- Bottom row: turnout ---- */

.el-bottom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .el-bottom {
    grid-template-columns: 1fr 1fr;
  }
}

.el-bottom h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.el-turnout {
  display: grid;
  gap: 10px;
  align-content: start;
}

.el-ring-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.el-ring {
  width: 84px;
  height: 84px;
  flex: none;
}

.el-ring circle {
  fill: none;
  stroke-width: 10;
}

.el-ring-track {
  stroke: var(--surface-2, var(--line));
}

.el-ring-fg {
  stroke: var(--accent);
}

.el-ring-num {
  display: block;
  font-size: 1.4rem;
  line-height: 1.2;
}

.el-ring-cap {
  color: var(--muted);
  font-size: .8rem;
}

.el-trow {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: .85rem;
}

.el-tlab {
  color: var(--muted);
}

.el-tval {
  font-weight: 700;
}

.el-delta {
  margin: 0;
  font-size: .85rem;
  font-weight: 650;
}

.el-turnout-counties {
  display: grid;
  gap: 8px;
  align-content: start;
}

.el-tc-row {
  display: grid;
  grid-template-columns: minmax(0, 130px) 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: .85rem;
}

.el-tc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.el-tc-pct {
  font-weight: 700;
}

.el-empty {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

/* ---- Phones ---- */

@media (max-width: 600px) {
  .el {
    padding: 10px;
    gap: 10px;
  }

  .el-side,
  .el-map,
  .el-detail,
  .el-bottom section {
    padding: 12px;
  }

  .el-side h1 {
    font-size: 1.2rem;
  }

  .el-view button,
  .el-mode button {
    flex: 1 1 45%;
  }

  .el-trow {
    grid-template-columns: 76px 1fr auto;
  }

  .el-tc-row {
    grid-template-columns: minmax(0, 90px) 1fr auto;
    gap: 6px;
  }

  .el-ring-wrap {
    gap: 10px;
  }

  .el-ring {
    width: 64px;
    height: 64px;
  }
}

/* Reporting and turnout bars fill in the accent colour (candidate bars set their party colour inline) */
.el-bar i, .el-tbar i, .el-tc-bar i { background: var(--accent); }
