:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1d1f23;
  --muted: #6a6f78;
  --line: #e2e0da;
  --accent: #2b4c7e;
  --yes: #2a9d66;
  --no: #d8403a;
  --abs: #e0a526;
  --off: #c9c7c0;
  --seat-empty: #e8e6e0;
  --hover: #efede8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1b1e23;
    --ink: #e8e8e6;
    --muted: #979ca5;
    --line: #2a2e35;
    --accent: #8fb0e6;
    --yes: #3cc887;
    --no: #f0605a;
    --abs: #f0bd45;
    --off: #454a53;
    --seat-empty: #23262c;
    --hover: #22262c;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.app { display: grid; grid-template-columns: 420px 1fr; height: 100vh; }

/* sidebar */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
h1 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h1 span { color: var(--muted); font-weight: 400; }
.filters { display: grid; gap: 10px; }
input[type=search], input[type=date] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit;
}
input:focus-visible, button:focus-visible, .list:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.dates { display: flex; gap: 8px; align-items: end; }
.dates label { flex: 1; font-size: 12px; color: var(--muted); display: grid; gap: 3px; }
.dates input { padding: 6px 8px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 6px 2px; }
.link:hover { text-decoration: underline; }
.count { font-size: 12px; color: var(--muted); }

.list { flex: 1; overflow-y: auto; position: relative; }
#spacer { position: relative; }
.row {
  position: absolute; left: 0; right: 0; height: 84px; padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
.row:hover { background: var(--hover); }
.row[aria-selected=true] { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
.row .top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.row .t {
  margin: 2px 0 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .e {
  margin: 0 0 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.mini { display: flex; height: 5px; border-radius: 3px; overflow: hidden; background: var(--line); }
.mini i { display: block; height: 100%; }

/* main */
.main { overflow-y: auto; min-width: 0; }
.detail { max-width: 1100px; margin: 0 auto; padding: 24px 28px 48px; }
.empty { display: grid; place-items: center; height: 100%; color: var(--muted); }
.meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
h2 { font-size: 22px; line-height: 1.25; margin: 6px 0 8px; font-weight: 650; }
.expediente {
  margin: 0; color: var(--muted); max-width: 80ch; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.expediente.open { display: block; }
.result { margin: 18px 0 6px; }
.nums { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 8px; }
.num b { font-size: 26px; font-weight: 650; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.num span { font-size: 12px; color: var(--muted); }
.num.yes b { color: var(--yes); } .num.no b { color: var(--no); } .num.abs b { color: var(--abs); }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); }
.bar i { display: block; height: 100%; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { padding: 5px 14px; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--panel); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.hemi-wrap { position: relative; margin-top: 4px; }
#hemi { width: 100%; height: auto; display: block; }
#hemi circle { transition: fill .15s, opacity .15s; }
#hemi .vacant { fill: var(--seat-empty); }
#hemi .seat { cursor: pointer; }
#hemi .seat:hover { stroke: var(--ink); stroke-width: 2; }
#hemi .est { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 2 2.4; }
#hemi .dim { opacity: .14; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; padding: 7px 10px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.35; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.tip b { display: block; font-weight: 600; }
.unseated { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.unseated i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

.groups { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13.5px; }
.groups th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.groups td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.groups .n { text-align: right; font-variant-numeric: tabular-nums; width: 64px; }
.groups tbody tr:hover { background: var(--hover); }
.groups .gname { display: flex; align-items: center; gap: 8px; }
.groups .gname i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.groups .gbar { width: 140px; }
.note { color: var(--muted); font-size: 12px; margin-top: 14px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; height: 100vh; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail { padding: 18px 16px 40px; }
  .groups .gbar { display: none; }
}

/* colores de escaño */
#hemi[data-mode=vote] .v-S { fill: var(--yes); }
#hemi[data-mode=vote] .v-N { fill: var(--no); }
#hemi[data-mode=vote] .v-A { fill: var(--abs); }
#hemi[data-mode=vote] .v-X { fill: var(--off); }
#hemi[data-mode=group] .seat { fill: var(--g); }
#hemi[data-mode=group] .v-X { opacity: .45; }

.pres summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.pres summary span { color: var(--accent); font-weight: 600; }
.pres .chips { margin-top: 8px; max-height: 150px; overflow-y: auto; }
.chip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.chip[aria-pressed=true] i { outline: 1.5px solid var(--panel); }
.notice { margin: 10px 0 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }
