:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --border: #e3e2de;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --series: #2a78d6;
  --series-soft: #e3eefb;
  --accent: #2a78d6;
  --good: #1a7f37;
  --bad: #c62828;
  --warn: #9a6200;
  --grid: #ebeae6;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --border: #2e2d2b; --text: #f0efec; --text-2: #c3c2b7;
    --muted: #8f8e86; --series: #3987e5; --series-soft: #1d2e44; --accent: #3987e5;
    --good: #4cb86a; --bad: #ef6b6b; --warn: #e0a83a; --grid: #262624;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --border: #2e2d2b; --text: #f0efec; --text-2: #c3c2b7;
  --muted: #8f8e86; --series: #3987e5; --series-soft: #1d2e44; --accent: #3987e5;
  --good: #4cb86a; --bad: #ef6b6b; --warn: #e0a83a; --grid: #262624;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(16px, calc((100% - 1200px) / 2)); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-size: 17px; color: var(--text); margin: 0; }
.brand b { color: var(--accent); }
.top nav { display: flex; gap: 18px; align-items: center; }
.top nav a { color: var(--text-2); }
.top nav a[aria-current] { color: var(--text); font-weight: 600; }
.top form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 24px; margin: 18px 0 14px; }
h1 small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 8px; }
h3 { font-size: 14px; margin: 0 0 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
select, input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; }
.site-pick select { min-width: 220px; font-weight: 600; }
.periods { display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.periods a { padding: 5px 10px; border-radius: 6px; color: var(--text-2); font-size: 14px; }
.periods a:hover { text-decoration: none; background: var(--bg); }
.periods a[aria-current] { background: var(--accent); color: #fff; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .k-label { font-size: 13px; color: var(--text-2); }
.kpi strong { font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.accent { border-color: var(--accent); }

.chg { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg-good { color: var(--good); } .chg-bad { color: var(--bad); }
.chg-flat, .chg-new { color: var(--muted); }

/* Diagram */
.chart { margin: 0; position: relative; }
.plot { position: relative; height: 220px; margin-left: 44px; }
.grid-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.grid-line span { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bars.dense { gap: 1px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; outline: none; min-width: 0; }
.bar i { display: block; width: 100%; background: var(--series); border-radius: 4px 4px 0 0; min-height: 1px; transition: opacity .1s; }
.bars.dense .bar i { border-radius: 2px 2px 0 0; }
.bars:hover .bar i, .bars:focus-within .bar i { opacity: .55; }
.bars .bar:hover i, .bars .bar:focus i { opacity: 1; }
.x-labels { display: flex; justify-content: space-between; margin: 6px 0 0 44px; font-size: 12px; color: var(--muted); }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 6px 10px; border-radius: 6px;
  font-size: 13px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 2; }
.tip b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tip span { opacity: .75; }

/* Tabeller */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 0 6px; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 16px; }
.list td { padding: 0; height: 32px; }
.list td:first-child { position: relative; width: 100%; }
.list .fill { position: absolute; top: 3px; bottom: 3px; left: 0; background: var(--series-soft); border-radius: 4px; }
.list .lbl { position: relative; padding: 0 8px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.list em { font-style: normal; color: var(--muted); margin-right: 4px; }
.list tbody tr + tr td { border-top: 2px solid var(--surface); }
.empty { color: var(--muted); margin: 0; }

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); margin-bottom: 16px; }
.list th[title] { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }

/* Ugedag × time – én nuance, lys → mørk */
.heat-wrap { position: relative; }
.heat-sum { margin: -4px 0 12px; color: var(--text-2); font-size: 14px; }
.heat-sum strong { color: var(--text); }
.heat { border-collapse: separate; border-spacing: 2px; min-width: 560px; table-layout: fixed; }
.heat th { font-size: 11px; font-weight: 500; color: var(--muted); padding: 0 0 2px; text-align: left; white-space: nowrap; }
.heat thead th { overflow: visible; }
.heat tbody th { width: 36px; padding-right: 6px; font-size: 12px; }
.heat td { height: 24px; border-radius: 3px; padding: 0; outline: none; }
.heat td:hover, .heat td:focus { box-shadow: inset 0 0 0 2px var(--text); }
.l0 { background: var(--grid); }
.l1 { background: color-mix(in oklab, var(--series) 18%, var(--surface)); }
.l2 { background: color-mix(in oklab, var(--series) 36%, var(--surface)); }
.l3 { background: color-mix(in oklab, var(--series) 56%, var(--surface)); }
.l4 { background: color-mix(in oklab, var(--series) 78%, var(--surface)); }
.l5 { background: var(--series); }
.heat-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; font-size: 12px; color: var(--muted); margin-top: 8px; }
.heat-legend i { width: 14px; height: 12px; border-radius: 2px; display: inline-block; }
.heat-legend span { margin: 0 4px; }

.scroll { overflow-x: auto; }
.sites td, .sites th { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sites th { padding-top: 0; }
.sites tbody tr:last-child td { border-bottom: 0; }
.sites td small { display: block; color: var(--muted); font-size: 12px; }
.status { font-size: 13px; white-space: nowrap; }
.status-ok { color: var(--text-2); } .status-ok span { color: var(--good); }
.status-bad { color: var(--bad); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.foot { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* Formularer / sites */
.btn { font: inherit; font-weight: 600; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.row-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.row-form label, .login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.site-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.site-head h3 { text-transform: none; letter-spacing: 0; font-size: 17px; color: var(--text); margin-bottom: 2px; }
.label { font-size: 13px; color: var(--text-2); margin: 14px 0 6px; }
.snippet { display: flex; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.snippet code, .snippet pre { flex: 1; overflow-x: auto; white-space: pre; margin: 0; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
.help ul { padding-left: 18px; margin: 8px 0 0; } .help li { margin: 6px 0; }
.error { color: var(--bad); font-weight: 600; }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.login-box .brand { font-size: 20px; text-align: center; }

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .plot { height: 180px; margin-left: 36px; } .x-labels { margin-left: 36px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .site-pick, .site-pick select { width: 100%; }
}

/* Filtre */
.site-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 16px; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--series-soft); color: var(--text); border: 1px solid var(--series);
  border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.chip:hover { text-decoration: none; background: var(--surface); }
.chip span { color: var(--text-2); font-size: 16px; line-height: 1; }
.chip-clear { font-size: 14px; }
.chips-note { color: var(--muted); font-size: 13px; }
.list a.flt { color: var(--text); }
.list a.flt:hover { color: var(--accent); }
.h-note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); margin-left: 6px; }
.sortable th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable th[data-sort]:hover { color: var(--text); }
.sortable th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
.sortable th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
.sites td strong { font-variant-numeric: tabular-nums; }
.sites td .chg { margin-left: 4px; }
@media (max-width: 600px) { .site-pick select { flex: 1 1 100%; } }
