:root {
  color-scheme: light;
  --surface-0: #f6f6f4;
  --surface-1: #fcfcfb;
  --surface-2: #efeeea;
  --border:    #dcdbd5;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #7a7975;
  --accent:    #2a78d6;
  --bar-ink:   #5b6472;
  --bar-track: #e6e5e0;
  --good:      #1baf7a;
  --warn:      #eda100;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #141413;
    --surface-1: #1a1a19;
    --surface-2: #242423;
    --border:    #383835;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #8f8e86;
    --accent:    #3987e5;
    --bar-ink:   #93a0b2;
    --bar-track: #2e2e2c;
    --good:      #199e70;
    --warn:      #c98500;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1060px; margin: 0 auto; padding: 24px 20px 64px; }

header.page { margin-bottom: 8px; }
header.page h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
header.page p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.updated { font-variant-numeric: tabular-nums; }
.stale { color: var(--warn); font-weight: 600; }

nav.tabs { display: flex; gap: 4px; margin: 20px 0 20px; border-bottom: 1px solid var(--border); }
nav.tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 9px 14px; font: inherit; font-weight: 550; color: var(--text-secondary);
  cursor: pointer; margin-bottom: -1px;
}
nav.tabs button:hover { color: var(--text-primary); }
nav.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
nav.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px 4px 0 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; }
.tile .value { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; font-variant-numeric: tabular-nums; }

.progress { height: 6px; border-radius: 3px; background: var(--bar-track); overflow: hidden; margin-top: 9px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

section.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 18px 18px 8px; margin-bottom: 20px; }
section.panel > h2 { font-size: 16px; margin: 0 0 2px; }
section.panel > .hint { font-size: 13px; color: var(--text-secondary); margin: 0 0 14px; max-width: 70ch; }

.scroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 650; border-top: 2px solid var(--border); border-bottom: 0; }

.party { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.chip { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgb(0 0 0 / .18) inset; }

/* Diverging bar: sign encoded by direction from the zero line, one neutral ink,
   because red/blue would read as Swedish political blocs rather than as +/-. */
.dv { position: relative; width: 132px; height: 16px; }
.dv .zero { position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: var(--border); }
.dv .fill { position: absolute; top: 3px; height: 10px; background: var(--bar-ink); }
.dv .fill.pos { left: 50%; border-radius: 0 3px 3px 0; }
.dv .fill.neg { right: 50%; border-radius: 3px 0 0 3px; }
td.dvcell { width: 148px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.on  { background: var(--good); }
.dot.off { background: var(--bar-track); box-shadow: 0 0 0 1px var(--border) inset; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select {
  font: inherit; padding: 6px 9px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-0); color: var(--text-primary);
}
.filters input { min-width: 210px; }
.filters .count { font-size: 13px; color: var(--text-muted); margin-left: auto; }

.note { font-size: 13px; color: var(--text-secondary); background: var(--surface-2);
        border-left: 3px solid var(--border); border-radius: 0 7px 7px 0; padding: 11px 14px; margin: 0 0 18px; }
.note strong { color: var(--text-primary); }
footer.page { margin-top: 28px; font-size: 13px; color: var(--text-muted); }
footer.page a, .note a { color: var(--accent); }
.loading, .empty { padding: 36px 0; text-align: center; color: var(--text-muted); }
.hidden { display: none !important; }
@media (max-width: 620px) { .dv { width: 84px; } td.dvcell { width: 100px; } }
