:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1b2430;
  --ink-2: #475467;
  --ink-3: #6b7585;
  --line: #e2e5ea;
  --line-2: #eef0f3;
  --accent: #1f2937;
  --accent-ink: #ffffff;
  --accent-hover: #111827;
  --pie-fill: #3f4a5a;
  --focus: #2563eb;
  --field: #ffffff;
  --head: #fafbfc;
  --hover: #f4f7fb;
  --sel: #eef3fb;
  --hover-btn: #f1f3f6;
  --warn-bg: #fff6df;
  --warn-ln: #f0c66b;
  --warn-ink: #6b4500;
  --err-bg: #fdecec;
  --err-ln: #e7a0a0;
  --info-bg: #eef3fb;
  --info-ln: #c9d6ea;
  --good: #0f6b3c;
  --bad: #b42318;
  --track: #e6e9ee;
  --seat-empty: #d9dde3;
  --map-bg: #eef1f5;
  --scrim: rgba(15, 23, 42, .35);
  --shadow: rgba(0, 0, 0, .14);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --card: #182029;
    --ink: #e7ebf1;
    --ink-2: #b4bdca;
    --ink-3: #8e99a9;
    --line: #2a3441;
    --line-2: #222b36;
    --accent: #e7ebf1;
    --accent-ink: #0f141b;
    --accent-hover: #ffffff;
    --focus: #7aa7ff;
    --field: #121820;
    --head: #1c2530;
    --hover: #1e2834;
    --sel: #22304a;
    --hover-btn: #222c38;
    --warn-bg: #3a2f12;
    --warn-ln: #7a6128;
    --warn-ink: #f3d68a;
    --err-bg: #3d1a1a;
    --err-ln: #7d3535;
    --info-bg: #1b2a40;
    --info-ln: #34507a;
    --good: #5fd08e;
    --bad: #ff8f85;
    --track: #2a3441;
    --seat-empty: #333d4b;
    --pie-fill: #aab4c2;
    --map-bg: #111820;
    --scrim: rgba(0, 0, 0, .55);
    --shadow: rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { line-height: 1.4; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); margin: 0 0 8px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.muted { color: var(--ink-3); }
.small { font-size: 0.8rem; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top {
  display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-end;
  padding: 14px 20px 12px; background: var(--card); border-bottom: 1px solid var(--line);
}
.meta { margin-top: 6px; font-size: 0.85rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.meta b { color: var(--ink); font-weight: 600; }
.stage { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--line-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.status { color: var(--good); font-weight: 600; }
.status.warn { color: var(--warn-ink); }
.controls { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
button.primary {
  display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-ink); border: 0;
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 1rem; justify-content: center; white-space: nowrap;
}
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.85; cursor: progress; }
.spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(128,128,128,.4); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
button.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.auto { font-size: 0.85rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.auto select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); }

/* Banners */
.banners { padding: 0 20px; }
.banner { margin: 10px 0 0; padding: 10px 14px; border: 1px solid var(--warn-ln); background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); font-size: 0.9rem; }
.banner.err { background: var(--err-bg); border-color: var(--err-ln); color: var(--ink); }
.banner.info { background: var(--info-bg); border-color: var(--info-ln); color: var(--ink); }
.banner b { font-weight: 700; }
.banner.note { padding: 6px 12px; font-size: 0.82rem; background: transparent; border-color: var(--line); color: var(--ink-2); }
.banner details summary { cursor: pointer; font-size: 0.85rem; }
.banner details ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.82rem; }

/* Seat card */
.seatcard { margin: 12px 20px 0; }
.seat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin-bottom: 4px; }
.seat-head .hl { font-size: 1.2rem; font-weight: 700; }
.seat-head .hl .sub { font-weight: 400; color: var(--ink-2); font-size: 0.88rem; }
.seatbar-wrap { position: relative; padding-top: 22px; }
.seat-end { position: absolute; top: 0; right: 0; font-size: 0.8rem; font-weight: 700; line-height: 16px; color: var(--ink); }
.seat-total { font-size: 0.92rem; color: var(--ink-2); text-align: right; }
.seat-total b { font-size: 1.2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.seat-total span { display: block; font-size: 0.78rem; color: var(--ink-3); }
.seatbar { display: flex; height: 52px; border-radius: 6px; overflow: hidden; background: var(--seat-empty); }
.seatbar .seg { display: flex; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem; overflow: hidden; white-space: nowrap; min-width: 0; border-right: 1px solid rgba(255,255,255,.35); }
.seatbar .seg:last-child { border-right: 0; }
.seatbar .seg.sm { font-size: 0.72rem; font-weight: 600; }
/* Seat counts are the headline numbers: bigger than the vote % labels. */
.seatbar:not(.votebar) .seg { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; }
.seatbar:not(.votebar) .seg.sm { font-size: 1.05rem; font-weight: 700; }
.seatbar .seg.none { background: var(--seat-empty); }
.seatbar.thin { height: 14px; margin-top: 8px; opacity: .9; }
.seatbar.empty { display: flex; align-items: center; justify-content: flex-start; padding-left: 14px; font-size: 0.82rem; color: var(--ink-3); }
.majority { position: absolute; top: 0; bottom: -4px; width: 0; border-left: 2px solid var(--ink); z-index: 2; pointer-events: none; }
.majority span { position: absolute; top: 0; left: 0; transform: translate(-50%, 0); background: var(--card); padding: 0 4px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; line-height: 16px; color: var(--ink); }
.seat-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 0.82rem; color: var(--ink-2); }
.seat-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.seat-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.seat-legend.seats { font-size: 0.92rem; gap: 4px 16px; }
.seat-legend.seats b { font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.seat-legend.seats i { width: 12px; height: 12px; }
.ref-note { font-size: 0.78rem; color: var(--ink-3); margin-top: 6px; }
.vote-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin-top: 14px; margin-bottom: 6px; }
.vote-head .vh { font-weight: 700; font-size: 0.95rem; }
.seat-legend .zero, .seat-legend .pos, .seat-legend .neg { font-size: 0.76rem; }
.votetbl td, .votetbl th { padding: 7px 8px; }
.votetbl tbody tr { cursor: pointer; }
.votetbl .rname { font-weight: 600; min-width: 150px; }
.votetbl .sub { display: block; font-size: 0.7rem; color: var(--ink-3); font-weight: 400; }
.votetbl .vcell b { font-variant-numeric: tabular-nums; }
.votetbl .vcell .sub { font-size: 0.72rem; }
.votetbl tr.subreg .rname { padding-left: 22px; }
.votetbl tr.provrow td { border-bottom: 2px solid var(--line); }
.vmini { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 4px; background: var(--seat-empty); max-width: 180px; }
.vmini i { display: block; min-width: 0; }
#ridingsTable td.vlead { font-weight: 700; }
#ridingsTable th.vpct { white-space: nowrap; }
.boxsplit { margin-top: 14px; display: grid; gap: 8px; }
.pies { display: flex; flex-wrap: wrap; gap: 12px 36px; }
.pie-card { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pie { --p: 0; --sz: 78px; flex: none; position: relative; width: var(--sz); height: var(--sz); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--pie-fill) calc(var(--p) * 1%), var(--track) 0); }
.pie::before { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--card); }
.pie span { position: relative; font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: -0.01em; }
.pie-card.later .pie { background: repeating-conic-gradient(var(--track) 0 7deg, color-mix(in srgb, var(--ink-3) 35%, var(--track)) 7deg 14deg); }
.pie-card.later .pie span { font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.pie-l { font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.pie-s { font-size: 0.84rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pie-s b { color: var(--ink); }
.pie-c { color: var(--ink-3); }
.bs-note b { color: var(--ink); font-variant-numeric: tabular-nums; }
.boxsplit .bs-head { font-weight: 700; font-size: 0.95rem; }
.bs-note { font-size: 0.78rem; color: var(--ink-3); }
.side .boxsplit { margin-top: 12px; }
.side .pies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.side .pie-card { flex-direction: column; text-align: center; gap: 6px; }
.side .pie { --sz: 66px; }
.side .pie::before { inset: 10px; }
.side .pie span { font-size: 0.86rem; }
.side .pie-l { font-size: 0.8rem; }
.side .pie-s { font-size: 0.76rem; }
.leaders { margin-top: 14px; display: grid; gap: 2px; }
.leaders .bs-head { margin-bottom: 2px; }
.ldr { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(140px, 1fr) minmax(220px, 1.4fr); gap: 2px 14px; align-items: center; text-align: left;
  font: inherit; font-size: 0.88rem; color: var(--ink-2); background: none; border: 0; border-top: 1px solid var(--line-2); padding: 6px 4px; border-radius: 0; width: 100%; }
button.ldr { cursor: pointer; }
button.ldr:hover { background: var(--hover-btn); }
.ldr b { color: var(--ink); }
.ldr .pchip { margin-right: 6px; }
.st { font-weight: 700; }
.st.lead { color: var(--good); }
.st.trail { color: var(--bad); }
.st.tie { color: var(--warn-ink); }
.badge.cab { background: var(--info-bg); border-color: var(--info-ln); color: var(--ink); font-size: 0.66rem; padding: 0 6px; }
.badge.tag { font-weight: 600; font-size: 0.68rem; }
.ctags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.ppl-stats { margin: 10px 0; }
.ppl-filter { margin: 4px 0 10px; }
.ppltbl .role { font-size: 0.78rem; color: var(--ink-2); margin-top: 1px; }
.ppltbl tbody tr { cursor: pointer; }
.ppltbl .nowrap { white-space: nowrap; }
.ppltbl .mchip { display: none; }
.ppltbl td { vertical-align: top; }
.notrun { margin-top: 12px; font-size: 0.86rem; }
.notrun summary { cursor: pointer; font-weight: 700; }
.notrun ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; color: var(--ink-2); }
.notrun .role { color: var(--ink-2); }
.seat-prog { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: 0.82rem; color: var(--ink-2); }
.seat-prog b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Selectors */
.selectors { padding: 12px 20px 0; }
.regionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 14px; font-size: 0.88rem; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.sub { margin-left: -2px; padding: 3px 11px; font-size: 0.8rem; border-style: dashed; }
.chip.sub::before { content: "\21B3\00a0"; color: var(--ink-3); }
.chip.sub[aria-pressed="true"]::before { color: var(--accent-ink); }
.chips.small .chip { padding: 3px 11px; font-size: 0.8rem; }
.note { font-size: 0.82rem; color: var(--ink-3); }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); gap: 16px; padding: 12px 20px 8px; align-items: start; }
.main { min-width: 0; }
.side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tabs { display: flex; gap: 2px; margin-bottom: -1px; position: relative; z-index: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 8px 14px; font-weight: 600; font-size: 0.9rem; color: var(--ink-2); border-radius: var(--radius) var(--radius) 0 0; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--card); border-color: var(--line); color: var(--ink); }
.tabs button[data-tab] { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.tabs.reordering { cursor: grabbing; }
.tabs button.dragging { background: var(--card); border-color: var(--ink-3); color: var(--ink); box-shadow: 0 2px 8px rgba(15, 23, 42, .18); opacity: .92; cursor: grabbing; }
.tabs .tab-reset { margin-left: auto; font-weight: 500; font-size: 0.78rem; color: var(--ink-3); padding: 8px 10px; text-decoration: underline; }
.pane { border-top-left-radius: 0; min-width: 0; }

/* Map */
.map-toolbar { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; align-items: center; }
.tb-group { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tb-group .lbl { font-size: 0.78rem; color: var(--ink-3); margin-right: 2px; }
.tb-group button { border: 1px solid var(--line); background: var(--field); border-radius: 5px; padding: 3px 9px; font-size: 0.78rem; color: var(--ink-2); }
.tb-group button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mapwrap { position: relative; }
.map { height: clamp(420px, 70vh, 760px); background: var(--map-bg); border-radius: 6px; border: 1px solid var(--line); }
.leaflet-container { font: inherit; }
.leaflet-interactive { cursor: pointer; }
.mapmsg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--ink-2); background: var(--card); opacity: .92; z-index: 600; }
.leaflet-tooltip.tip { font-size: 0.82rem; line-height: 1.35; padding: 6px 9px; border: 1px solid #c9ced6; box-shadow: 0 2px 8px rgba(0,0,0,.18); color: #1b2430; background: #fff; }
.tip b { font-weight: 700; }
.tip .n { font-variant-numeric: tabular-nums; }
.tip .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: baseline; }
.tip .m { color: #475467; }
.leaflet-control-attribution { font-size: 10px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 10px; font-size: 0.78rem; color: var(--ink-2); align-items: flex-end; }
.lg-bands { display: grid; grid-template-columns: auto repeat(4, 44px); gap: 3px 0; align-items: center; }
.lg-bands .lg-title { font-weight: 600; margin-bottom: 0; color: var(--ink); font-size: 0.74rem; padding-right: 8px; }
.lg-bands .lg-h { text-align: center; font-size: 0.64rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-bands i { display: block; height: 11px; border: 1px solid rgba(128,128,128,.35); }
.lg-minor { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lg-misc { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; }
.lg-item i { display: inline-block; width: 18px; height: 12px; border: 1px solid rgba(128,128,128,.4); }
.lg-item i.gain { background: transparent; border: 2.5px solid var(--ink); }
.lg-note { flex-basis: 100%; font-size: 0.74rem; color: var(--ink-3); }

/* Party table & progress */
.sidecard .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sidecard .regnote { font-size: 0.8rem; color: var(--ink-3); margin: 2px 0 8px; }
.partytbl td, .partytbl th { padding: 6px 6px; }
.partytbl .pname { font-weight: 600; white-space: nowrap; }
.partytbl .pname .sw { margin-right: 6px; }
.partytbl .sub { display: block; font-size: 0.7rem; color: var(--ink-3); font-weight: 400; }
.partytbl .seatn { font-size: 1.15rem; font-weight: 700; }
.partytbl .vs { width: 100%; min-width: 74px; }
.partytbl .vs .bar { margin-top: 3px; height: 6px; }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.zero { color: var(--ink-3); }
.bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: #5b6676; }
.block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.block .row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; margin-bottom: 5px; flex-wrap: wrap; }
.block .row b { font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.stat { background: var(--head); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 10px; }
.stat .k { font-size: 0.74rem; color: var(--ink-3); }
.stat .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 0.74rem; color: var(--ink-2); }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-2); font-weight: 600; background: var(--head); white-space: nowrap; }
th.num, td.num { text-align: right; }
th[data-sort], th[data-csort] { cursor: pointer; user-select: none; }
th[data-sort]:hover, th[data-csort]:hover { color: var(--ink); }
th .arr { display: inline-block; width: 0.9em; color: var(--ink); }
tbody tr[data-ed] { cursor: pointer; }
tbody tr[data-ed]:hover { background: var(--hover); }
tr.sel { background: var(--sel); }
tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tablewrap { overflow: auto; max-width: 100%; }
#ridingsTable { max-height: 70vh; }
#ridingsTable thead th { position: sticky; top: 0; z-index: 2; }
#ridingsTable td:first-child, #ridingsTable th:first-child { position: sticky; left: 0; }
#ridingsTable th:first-child { background: var(--head); z-index: 3; }
#ridingsTable tbody td:first-child { background: var(--card); }
#ridingsTable tbody tr:hover td:first-child { background: var(--hover); }
#ridingsTable tbody tr.sel td:first-child { background: var(--sel); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; border: 1px solid rgba(128,128,128,.35); vertical-align: -1px; }
.pchip { display: inline-block; min-width: 38px; text-align: center; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; vertical-align: 1px; margin-right: 6px; }
.table-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.table-controls input { flex: 1 1 180px; max-width: 280px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line); background: var(--line-2); color: var(--ink-2); }
.badge.gain { background: var(--ink); border-color: var(--ink); color: var(--card); }
.badge.hold { background: transparent; }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-ln); color: var(--warn-ink); }
.badge.hot { background: var(--err-bg); border-color: var(--err-ln); color: var(--ink); }
.badge.ok { background: transparent; border-color: var(--good); color: var(--good); }
.badge.count { background: var(--info-bg); border-color: var(--info-ln); color: var(--ink); }
.tnote { margin: 10px 0 0; }
.intro { margin: 0 0 10px; font-size: 0.85rem; color: var(--ink-2); }

/* Seat changes */
.chg-group { margin-bottom: 14px; }
.chg-group h4 { margin: 0 0 6px; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chg-list { display: grid; gap: 4px; }
.chg-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 7px 10px; text-align: left; font-size: 0.88rem; }
.chg-item:hover { background: var(--hover); }
.chg-item .r { color: var(--ink-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; text-align: right; }
.emptymsg { padding: 30px 10px; text-align: center; color: var(--ink-2); }

/* Trend */
.chartbox { position: relative; height: 320px; margin-bottom: 18px; }
.chartbox.small { height: 260px; }
.trendmsg { padding: 40px 10px; text-align: center; color: var(--ink-2); }
#trendCharts h3 { margin-top: 4px; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 900; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100vw); background: var(--card); z-index: 1000;
  border-left: 1px solid var(--line); box-shadow: -6px 0 24px var(--shadow);
  transform: translateX(105%); transition: transform .18s ease-out; display: flex; flex-direction: column; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.2rem; }
.close { border: 1px solid var(--line); background: var(--card); border-radius: 6px; width: 34px; height: 34px; font-size: 1.4rem; line-height: 1; color: var(--ink-2); }
.close:hover { background: var(--hover-btn); }
.drawer-body { overflow: auto; padding: 14px 16px 30px; display: grid; gap: 18px; align-content: start; }
.drawer-body section { min-width: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.leadline { font-size: 0.95rem; }
.leadline b { font-variant-numeric: tabular-nums; }
.candtbl .bar { height: 8px; min-width: 60px; }
.candtbl tr.first td { font-weight: 600; }
.candtbl td.nm { white-space: normal; min-width: 130px; }
.cmp td.pn { font-weight: 600; white-space: nowrap; }
.tag { white-space: nowrap; display: inline-block; font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); }
.ok { color: var(--good); font-weight: 700; }

.foot { padding: 14px 20px 28px; font-size: 0.78rem; color: var(--ink-3); }

/* Narrow screens */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { order: -1; }
}
@media (max-width: 720px) {
  .top, .selectors, .layout, .banners, .foot { padding-left: 16px; padding-right: 16px; }
  .seatcard { margin-left: 16px; margin-right: 16px; }
  h1 { font-size: 1.1rem; }
  .map { height: 380px; }
  .card { padding: 10px; }
  .controls { width: 100%; }
  .btn-share span { display: none; }
  .btn-share { padding: 9px 11px; }
  .seatbar { height: 48px; }
  .seatbar:not(.votebar) .seg { font-size: 1.3rem; }
  .seat-head .hl { font-size: 1.12rem; }
  .seat-total { text-align: left; }
  .pies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .pie-card { flex-direction: column; text-align: center; gap: 6px; }
  .pie { --sz: 70px; }
  .pie::before { inset: 10px; }
  .pie span { font-size: 0.9rem; }
  .pie-l { font-size: 0.8rem; }
  .pie-s { font-size: 0.76rem; }
  .trendtbl .tt-of { display: none; }
  .trendtbl th { white-space: normal; }
  .trendtbl th, .trendtbl td { padding-left: 6px; padding-right: 6px; }
  .ldr { grid-template-columns: 1fr auto; font-size: 0.84rem; }
  .ppltbl th:nth-child(3), .ppltbl td:nth-child(3), .ppltbl th:nth-child(5), .ppltbl td:nth-child(5) { display: none; }
  .ppltbl .mchip { display: inline; margin-right: 5px; }
  .ppltbl .nowrap { white-space: normal; }
  .ldr .ldr-st { grid-column: 1 / -1; }
  .ldr .ldr-where { text-align: right; }
}

/* Share */
.btn-share {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 16px; border-radius: 6px; font-weight: 600; font-size: 0.95rem;
}
.btn-share:hover { background: var(--hover-btn); border-color: var(--ink-3); }
.btn-share .ico-share { margin-top: -2px; }
.drawer-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.drawer-actions .btn-share { padding: 6px 12px; font-size: 0.88rem; height: 34px; }
dialog.share {
  border: 0; padding: 0; border-radius: 14px; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 0 24px 64px rgba(15, 23, 42, .35); color: var(--ink); background: var(--card); overflow: auto;
}
dialog.share::backdrop { background: rgba(15, 23, 42, .55); }
.share-in { padding: 16px 18px 14px; display: grid; gap: 12px; }
.share-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.share-head h2 { font-size: 1.15rem; }
.share-preview {
  height: min(300px, 38vh); overflow: auto; background: var(--map-bg); border: 1px solid var(--line); border-radius: 8px;
  display: grid; place-items: start center;
}
.share-preview img { width: 100%; display: block; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.share-wait { align-self: center; color: var(--ink-3); font-size: 0.9rem; padding: 40px 0; }
.share-fmt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mini-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.mini-seg button { border: 0; background: var(--field); padding: 5px 12px; font-size: 0.82rem; color: var(--ink-2); }
.mini-seg button + button { border-left: 1px solid var(--line); }
.mini-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.share-main {
  display: flex; align-items: center; gap: 14px; width: 100%; border: 0; border-radius: 10px; padding: 12px 16px;
  background: var(--accent); color: var(--accent-ink); text-align: left;
}
.share-main:hover:not(:disabled) { background: var(--accent-hover); }
.share-main b { display: block; font-size: 1rem; }
.share-main small { display: block; font-size: 0.8rem; opacity: .8; }
.share-lbl { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; margin-bottom: -4px; }
.share-targets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.share-targets button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; border-radius: 10px;
  padding: 6px 2px; font-size: 0.78rem; color: var(--ink-2);
}
.share-targets button:hover:not(:disabled) { background: var(--hover-btn); }
.tile { width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.t-msg { background: linear-gradient(#5ff777, #12bc3a); }
.t-mail { background: linear-gradient(#3fb4ff, #1a73e8); }
.t-plain { background: var(--line-2); color: var(--ink); border: 1px solid var(--line); }
dialog.share button:disabled { opacity: .5; cursor: progress; }
.share-hint { margin: 0; min-height: 1.2em; font-size: 0.82rem; color: var(--good); }
.share-hint.warn { color: var(--bad); }
.trendtbl { max-height: 360px; overflow-y: auto; margin-bottom: 10px; }
.trendtbl thead th { position: sticky; top: 0; background: var(--card); }
.trendtbl td:first-child { white-space: nowrap; }
