:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #000000;
  --muted: #5f5e58;
  --line: #dedcd3;
  --accent: #b4321f;
  --chip: #efede6;
  --heat: 180, 50, 31;
  --pro: #2f7d4f;
  --proti: #b4321f;
  --podm: #a36b00;
  --jinak: #4b5fa8;
  --p-8zije: #3b8a3e;
  --p-stan-top09: #7a3f98;
  --p-ods: #1f4fa3;
  --p-ano: #1696c8;
  --p-patrioti: #c0532b;
  --p-pirati: #3c3c3c;
  --radius: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #161614; --surface: #201f1c; --ink: #ecebe6; --muted: #a9a79f; --line: #3a3934;
  --accent: #ef7a62; --chip: #2c2b27; --heat: 239, 122, 98;
  --pro: #6cc28f; --proti: #ef7a62; --podm: #e0b04f; --jinak: #8fa1e6;
  --p-8zije: #70c173; --p-stan-top09: #b88ad4; --p-ods: #7fa4ec; --p-ano: #5cc3ec;
  --p-patrioti: #ec8d64; --p-pirati: #c8c8c8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 56px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-left: auto; }
.tabs a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.tabs a[aria-current="page"] { background: var(--chip); color: var(--ink); font-weight: 600; }
main { padding: 24px 16px 48px; }
main.wrap { padding-bottom: 40px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.party-card { border-top: 4px solid var(--pc); display: flex; flex-direction: column; gap: 6px; }
.party-card h3 { margin: 0; }
.party-card .seats { font-size: 1.6rem; font-weight: 700; color: var(--pc); }
.role { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.role.koalice { background: color-mix(in srgb, var(--pro) 18%, transparent); color: var(--ink); }
.warn { border-left: 3px solid var(--podm); padding: 8px 12px; background: color-mix(in srgb, var(--podm) 10%, transparent); border-radius: 0 8px 8px 0; }

/* seat bar */
.seatbar { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin: 12px 0 6px; border: 1px solid var(--line); }
.seatbar span { background: var(--pc); color: #fff; font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; min-width: 0; }
.seatlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); margin-right: 5px; vertical-align: baseline; }
.majority { position: relative; }
.majority::after { content: "23 = většina"; position: absolute; left: 51.1%; top: -4px; bottom: -4px; border-left: 2px dashed var(--ink); font-size: .7rem; padding-left: 4px; color: var(--muted); white-space: nowrap; transform: translateY(-100%); height: 0; }

/* chips and filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 16px; }
.filters input[type="search"], .filters select {
  font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); min-width: 0;
}
.filters input[type="search"] { flex: 1 1 220px; }
.chip {
  font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 5px 10px; border-radius: 99px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] .dot { outline: 2px solid var(--bg); }
label.check { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; }

/* heatmap */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 560px; }
table.heat th { font-size: .8rem; font-weight: 600; color: var(--muted); text-align: left; padding: 4px; }
table.heat thead th { text-align: center; vertical-align: bottom; }
table.heat thead th .dot { display: block; margin: 0 auto 4px; }
table.heat td { text-align: center; padding: 0; }
table.heat td button {
  width: 100%; min-height: 34px; border: 0; border-radius: 6px; font: inherit; font-size: .85rem; cursor: pointer;
  background: rgba(var(--heat), var(--a)); color: var(--ink);
}
table.heat td button.hot { color: #fff; font-weight: 700; }
table.heat td button:disabled { cursor: default; color: var(--muted); background: var(--chip); }
table.heat td.na { color: var(--muted); font-size: .75rem; }

/* clusters */
.cluster { padding: 14px 16px; }
.cluster + .cluster { margin-top: 10px; }
.cluster header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.cluster h3 { margin: 0; }
.cluster .topic { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.positions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pos {
  display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; border-radius: 99px; padding: 3px 10px 3px 6px;
  border: 1px solid var(--line); background: var(--surface);
}
.pos .st { font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; color: #fff; }
.st.pro { background: var(--pro); } .st.proti { background: var(--proti); }
.st.podminene { background: var(--podm); } .st.jinak { background: var(--jinak); }
.pos.absent { opacity: .55; border-style: dashed; }
details.quotes { margin-top: 10px; }
details.quotes summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.flag { font-size: .75rem; font-weight: 700; color: var(--podm); }

/* pair matrix */
table.pairs td button { min-height: 40px; }

/* promises */
.promise { padding: 12px 14px; border-left: 4px solid var(--pc); }
.promise + .promise { margin-top: 8px; }
.promise p { margin: 0 0 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--muted); }
.meta a { color: var(--muted); }
.tag { font-size: .72rem; padding: 1px 7px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.tag.spec { background: color-mix(in srgb, var(--pro) 18%, transparent); color: var(--ink); }
.tag.shared { background: color-mix(in srgb, var(--jinak) 18%, transparent); color: var(--ink); text-decoration: none; }
.group-title { display: flex; align-items: baseline; gap: 8px; margin-top: 1.4em; }
.count { color: var(--muted); font-weight: 400; font-size: .9rem; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* dialog */
dialog {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 20px;
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .close { float: right; font-size: 1.5rem; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; }
blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--pc, var(--line)); background: var(--chip); border-radius: 0 8px 8px 0; }
.track { margin-top: 16px; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .9rem; }

.prose { max-width: 760px; }
.prose li + li { margin-top: 4px; }
code { font-size: .9em; background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0; }
.stats div b { display: block; font-size: 1.6rem; }

@media (max-width: 600px) {
  main { padding-top: 16px; }
  .tabs { margin-left: 0; width: 100%; order: 3; }
  .theme-toggle { margin-left: auto; }
  .majority::after { content: "většina"; }
}

/* zasedání */
.player { position: sticky; top: 64px; z-index: 4; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin: 12px 0; }
.player audio { flex: 1 1 260px; min-width: 0; width: 100%; height: 40px; }
.toc summary { cursor: pointer; }
.toc ol, .toc .toc-list { margin: 10px 0 0; padding-left: 0; list-style: none; }
.toc li + li { margin-top: 4px; }
.agenda h2 { font-size: 1.15rem; display: flex; gap: 10px; align-items: baseline; scroll-margin-top: 140px; }
.turn { margin: 8px 0; border-left: 4px solid var(--pc, var(--line)); padding: 10px 14px; }
.turn .who { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: .92rem; }
.turn p { margin: 6px 0 0; overflow-wrap: anywhere; }
.turn p span { cursor: pointer; border-radius: 3px; }
.turn p span:hover { background: var(--chip); }
.ts { font: inherit; font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--chip);
  border: 0; border-radius: 99px; padding: 1px 8px; cursor: pointer; flex: none; }
.ts:hover { color: var(--ink); }
@media (max-width: 600px) { .player { top: 0; } }
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 16px; padding: 8px; background: var(--chip);
  border: 1px solid var(--line); border-radius: 14px; }
.subtabs a { flex: 1 1 auto; text-align: center; padding: 10px 16px; text-decoration: none; color: var(--ink); font-weight: 600;
  font-size: 1.02rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; white-space: nowrap; }
.subtabs a:hover { border-color: var(--ink); }
.subtabs a .count { font-weight: 700; font-size: .8rem; color: var(--muted); background: var(--chip); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.subtabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.subtabs a[aria-current="page"] .count { background: rgba(255,255,255,.25); color: #fff; }
@media (max-width: 600px) { .subtabs a { flex: 1 1 40%; padding: 9px 10px; font-size: .95rem; } }
.turn p span.hit { background: color-mix(in srgb, var(--accent) 22%, transparent); }
table.stat { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.stat th, table.stat td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.stat thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
table.stat tr:last-child th, table.stat tr:last-child td { border-bottom: 0; }
table.stat .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.stat th a { color: var(--ink); text-decoration: none; }
.barcell { width: 35%; min-width: 80px; }
.bar { display: block; height: 10px; border-radius: 99px; background: var(--pc, var(--muted)); min-width: 2px; }
.person { white-space: nowrap; }
.qst { color: #fff; font-size: .72rem; padding: 1px 7px; border-radius: 99px; font-weight: 600; }
.qa .qline { margin: 8px 0 4px; font-weight: 600; }
.qa > p { margin: 4px 0; }
.qa .answer { margin-top: 10px; padding: 8px 12px; background: var(--chip); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.qa .answer .meta { flex-basis: 100%; }
.qa, .promise { margin: 10px 0; }

/* hlasování */
.v-pro { background: var(--pro); } .v-proti { background: var(--proti); } .v-zdrzel { background: var(--podm); }
.v-nehl { background: color-mix(in srgb, var(--muted) 45%, transparent); } .v-nepr { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.t-pro { color: var(--pro); } .t-proti { color: var(--proti); }
.legend { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; margin-right: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
table.vgrid { border-collapse: separate; border-spacing: 2px; font-size: .78rem; }
table.vgrid th { font-weight: 400; text-align: left; white-space: nowrap; padding: 0 6px 0 0; }
table.vgrid thead th { text-align: center; padding: 0; font-size: .68rem; }
table.vgrid thead a { color: var(--muted); text-decoration: none; display: block; min-width: 14px; }
table.vgrid thead a.failed { color: var(--proti); font-weight: 700; }
table.vgrid td { width: 14px; min-width: 14px; height: 16px; border-radius: 3px; padding: 0; }
table.vgrid td.num { background: none; width: auto; padding: 0 4px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
table.vgrid tr.club th { padding-top: 10px; font-weight: 700; font-size: .85rem; }
table.vgrid tbody th a { color: var(--ink); text-decoration: none; }
.cellv { display: block; padding: 6px 4px; border-radius: 6px; text-align: center; background: rgba(var(--heat), var(--a)); font-variant-numeric: tabular-nums; }
.cellv.hot { color: #fff; }
.vote { margin: 8px 0; scroll-margin-top: 140px; }
.vote .vhead { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.votebar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; margin: 8px 0 6px; gap: 1px; }
.votebar span { min-width: 3px; }
.vote details { margin-top: 8px; }
.vote summary { cursor: pointer; color: var(--muted); }
.vclub { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.vclub > .small { margin-right: 4px; }
.vchip { font-size: .75rem; padding: 1px 7px; border-radius: 99px; color: #fff; }
.vchip.v-nehl, .vchip.v-nepr { color: var(--ink); }
.vchip.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.mine { font-size: .78rem; padding: 1px 8px; border-radius: 99px; color: #fff; font-weight: 600; }
.mine.v-nehl, .mine.v-nepr { color: var(--ink); }

/* přepínač denní/noční režim */
.theme-toggle { margin-left: 0; flex: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 99px;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.theme-toggle:hover { background: var(--chip); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* přehrávač: zvuk / video */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; flex: none; }
.seg button { font: inherit; font-size: .85rem; background: none; border: 0; padding: 4px 12px; color: var(--muted); cursor: pointer; }
.player[data-mode="audio"] .seg [data-mode="audio"], .player[data-mode="video"] .seg [data-mode="video"] { background: var(--ink); color: var(--bg); }
.player[data-mode="audio"] video, .player[data-mode="video"] audio { display: none; }
.player video { flex: 1 1 100%; width: 100%; max-height: 34vh; background: #000; border-radius: 6px; }
@media (max-width: 600px) { .player video { max-height: 28vh; } }

/* zastupitelé */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.person-card { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); padding: 10px 12px; border-left: 4px solid var(--pc); }
.person-card:hover { background: var(--chip); }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--chip); box-shadow: 0 0 0 2px var(--pc); }
.avatar.ini { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, var(--surface)); }
.avatar.big { width: 160px; height: 160px; font-size: 2.6rem; box-shadow: 0 0 0 4px var(--pc); }
.profile { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; border-top: 4px solid var(--pc); }
.profile .ph { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.profile h1 { margin-bottom: 4px; }
.profile .titles { font-size: 1rem; font-weight: 400; }
.profile .lead { margin: 0 0 8px; }
.credit { font-size: .72rem; max-width: 170px; text-align: center; }
.credit a { color: var(--muted); }
.facts { padding-left: 1.2em; }
.facts li + li { margin-top: 6px; }
@media (max-width: 600px) { .avatar.big { width: 120px; height: 120px; } }

/* sdílení */
.share-btn { font: inherit; font-size: .8rem; display: inline-flex; align-items: center; gap: 5px; background: var(--chip); color: var(--ink);
  border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; cursor: pointer; margin-left: auto; }
.share-btn:hover { border-color: var(--ink); }
.share-menu { position: absolute; z-index: 6; display: flex; flex-direction: column; padding: 6px; gap: 2px; margin-top: 4px; right: 16px; min-width: 170px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.share-menu a, .share-menu button { font: inherit; font-size: .9rem; text-align: left; padding: 6px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; }
.share-menu a:hover, .share-menu button:hover { background: var(--chip); }
.vote { position: relative; }
.vote.focus { box-shadow: 0 0 0 2px var(--accent); }
a.pname { color: inherit; text-decoration: none; }
a.pname:hover { text-decoration: underline; }
a.vchip { text-decoration: none; }
a.vchip:hover { filter: brightness(1.12); text-decoration: underline; }
a.person { text-decoration: none; color: inherit; }
a.person:hover { text-decoration: underline; }
h2.h-share { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: relative; scroll-margin-top: 140px; }
h2.h-share .share-btn { font-size: .8rem; font-weight: 400; margin-left: auto; }
h2.h-share .share-menu { font-size: 1rem; font-weight: 400; top: 100%; }
.qa, .promise { position: relative; }
.qa.focus, .promise.focus { box-shadow: 0 0 0 2px var(--accent); }
.qa, .promise { scroll-margin-top: 140px; }
.vgrid-box { margin: 24px 0 8px; }
.vgrid-box summary { cursor: pointer; }
.vgrid-box[open] summary { margin-bottom: 8px; }
.player .autoplay { flex: 1 1 100%; font: inherit; font-weight: 700; font-size: 1rem; padding: 10px 14px; border-radius: 8px;
  border: 0; background: var(--accent); color: #fff; cursor: pointer; }
.player .autoplay:hover { filter: brightness(1.08); }

/* hlasování „je to důležité“ */
.vote-btn { font: inherit; font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--accent); border-radius: 99px; padding: 2px 10px; }
.vote-btn b { font-variant-numeric: tabular-nums; }
.vote-btn:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.vote-btn.on { background: var(--accent); color: #fff; }
.vote-btn:disabled { opacity: .6; cursor: wait; }
.vote-budget { margin: 0 0 12px; padding: 10px 14px; border-left: 4px solid var(--accent); font-size: .92rem; }
#ts-box { position: fixed; z-index: 20; bottom: 16px; left: 50%; transform: translateX(-50%); }
#ts-box:empty { display: none; }
#toast { position: fixed; z-index: 21; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .92rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* logo v hlavičce */
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.08rem; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-accent { color: var(--accent); }
