/* Dashboard sčítání voleb 2026 — minimální styl, bez build kroku. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --fg: #16181d;
  --muted: #666c78;
  --border: #dfe2e8;
  --accent: #0b5cad;
  --success: #1f7a3d;
  --warning: #b26a00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f25;
    --fg: #eef0f4;
    --muted: #9aa1ad;
    --border: #2c3038;
    --accent: #6aa6ee;
    --success: #5cd07a;
    --warning: #e0a94a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px; flex-wrap: wrap;
}
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.site-header nav { display: flex; gap: 16px; }
.site-header nav a { color: var(--accent); text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }
.meta { margin-left: auto; color: var(--muted); font-size: 13px; }

main { padding: 24px 0 48px; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a { color: var(--accent); }
.dim { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.metrics {
  display: grid; gap: 16px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
}
.metric .big { font-size: 30px; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; margin-bottom: 24px;
}
.scroll { overflow-x: auto; }
.scroll.tall { max-height: 70vh; overflow-y: auto; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.row-pirati { background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 600; }
.row-elected td { background: color-mix(in srgb, var(--success) 10%, transparent); }
.row-pending td { color: var(--muted); }

.party { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.party-chip { display: inline-flex; width: 30px; height: 30px; flex: 0 0 30px; align-items: center; justify-content: center; }
.party-logo { width: 30px; height: 30px; object-fit: contain; }
.party-logo.lg { width: 56px; height: 56px; }
.party-initials {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--party-color, #666); color: #fff;
  font-size: 12px; font-weight: 700;
}
.party-initials.lg { width: 56px; height: 56px; font-size: 18px; border-radius: 10px; }

.party-head { border-left: 5px solid var(--party-color, var(--accent)); }
.party-title { display: flex; align-items: center; gap: 16px; }

.mandaty { font-weight: 700; }
.mandaty .dim { display: block; font-weight: 400; font-size: 11px; }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 99px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent; margin-right: 4px;
}
.badge-elected { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); border-color: var(--success); }
.badge-shift { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); border-color: var(--accent); }
.badge-near { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); border-color: var(--warning); }

.podil.over { font-weight: 700; color: var(--accent); }

.tag {
  display: inline-block; padding: 3px 10px; margin: 0 6px 6px 0;
  border: 1px solid var(--border); border-radius: 99px;
  text-decoration: none; color: inherit; font-size: 13px;
}
.tag:hover { border-color: var(--accent); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-ok { background: var(--success); }
.dot-wait { background: var(--border); }

table.kv th { width: 45%; text-transform: none; font-size: 14px; color: var(--fg); }
.empty { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 32px; text-align: center; }

.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 18px 0; margin-top: 24px;
}
.site-footer p { margin: 4px 0; font-size: 13px; color: var(--muted); }
.site-footer .dim { font-size: 12px; }

.pulse { animation: pulse 1s ease 1; }
@keyframes pulse { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }

/* --- pozadí z ~/bg.png (namountováno na /bg/) --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/bg/bg.png") center / cover no-repeat fixed;
  opacity: .55;
  z-index: -2;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  z-index: -1;
}

/* --- horní lišta: název + čas aktualizace + tlačítko --- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; flex-wrap: wrap;
}
.topbar .brand { font-size: 15px; text-decoration: none; color: var(--fg); font-weight: 600; }
.aktualizace { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.aktualizace .mono { font-size: 12.5px; }
#btn-obnovit {
  font: inherit; font-size: 13px; padding: 5px 12px; cursor: pointer;
  border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #fff;
}
#btn-obnovit:hover:not(:disabled) { filter: brightness(1.1); }
#btn-obnovit:disabled { opacity: .55; cursor: progress; }

/* --- popup se zvolenými kandidáty ---
   Pozor: tabulka je v .scroll (overflow: auto), takže absolutně pozicovaný
   popup by se ořezal. Proto je position: fixed a umístění počítá JS. */
.mandaty-cislo { font-weight: 700; border-bottom: 1px dotted var(--muted); cursor: help; }
.popup {
  display: none;
  position: fixed; z-index: 50;
  width: max-content; min-width: 280px; max-width: min(420px, 90vw);
  max-height: 60vh; overflow-y: auto;
  padding: 10px 12px; text-align: left;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  font-weight: 400;
}
.popup.otevreny { display: block; }
.popup-head { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.popup-list { margin: 0; padding-left: 0; list-style: none; font-size: 13px; }
.popup-list li { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; }
.popup-por { color: var(--muted); min-width: 22px; }
.popup-jmeno { flex: 1 1 auto; }

/* --- navigace v patičce --- */
.footnav { display: flex; gap: 16px; margin-bottom: 10px; }
.footnav a { color: var(--accent); text-decoration: none; }
.footnav a:hover { text-decoration: underline; }
