:root { --gap:12px; --border:#ddd; --bg:#fafafa; --card:#fff; }
*{ box-sizing:border-box; }
body{ margin:0; font:14px system-ui,-apple-system,Segoe UI,Roboto,Arial; background:#fff; color:#111; }
.muted{ color:#666; font-size:12px; }
.mb8{ margin-bottom:8px; }

.topbar{ display:flex; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--bg); }
.topbar .brand{ font-weight:600; }
.topbar .ctl{ display:flex; align-items:center; gap:8px; }
label{ font-size:12px; color:#333; }
select, button, input[type="number"]{ padding:8px; font:inherit; }

.panel{ border:1px solid var(--border); border-radius:12px; background:var(--card); overflow:hidden; }
.panel h2{ margin:0; padding:10px 12px; font-size:15px; background:var(--bg); border-bottom:1px solid var(--border); }
.panel .content{ padding:12px; }
.panel.wide{ margin:12px; }

.grid{ display:grid; gap:12px; padding:12px; align-items:start; }
.grid.map-right{ grid-template-columns: 1fr 1fr; } /* 50/50 */

.map-wrap #map{ height:60vh; min-height:460px; border:1px solid var(--border); border-radius:12px; }
.sim-side .card{ border:1px solid var(--border); border-radius:12px; background:#fff; padding:10px; }

.grid-controls{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:10px;
}
.grid-controls .align-end{ display:flex; align-items:end; }
.cards-2{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; margin-top:12px; }
.card h3{ margin:0 0 8px 0; font-size:14px; }

.tabs{ display:flex; gap:6px; margin-bottom:8px; }
.tab{ padding:6px 8px; border:1px solid var(--border); border-radius:6px; background:#fff; cursor:pointer; }
.tab.active{ background:var(--bg); font-weight:600; }

table{ border-collapse:collapse; width:100%; }
th,td{ border-bottom:1px solid var(--border); padding:6px 8px; text-align:left; }
th{ background:var(--bg); position:sticky; top:0; z-index:1; }
tfoot td{ font-weight:600; }

details>summary{ cursor:pointer; list-style:none; }
details>summary::-webkit-details-marker{ display:none; }
summary h2.inline{ display:inline; background:none; border:none; padding:0; }

.precincts-pane{ mix-blend-mode:normal; opacity:1; }

@media (max-width: 1100px){
  .grid.map-right{ grid-template-columns: 1fr; }
  .map-wrap #map{ height:50vh; min-height:380px; }
  .grid-controls{ grid-template-columns: 1fr; }
  .cards-2{ grid-template-columns: 1fr; }
}

.topline{
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:18px; padding:10px; border:1px solid var(--border);
  border-radius:10px; background:#fff; margin:8px 0 12px;
}
.leaflet-tooltip-pane{ z-index:800; } /* ensure tooltips sit above precinct pane */

#simTable input[type="number"]{ width:110px; }
#simTable td:nth-child(3) input{ width:90px; }  /* turnout% */
#simTable td:nth-child(4) input,
#simTable td:nth-child(5) input{ text-align:right; }
