:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --surface-2:      #f2f1ee;
  --page:           #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --axis:           #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --series-1:       #2a78d6; /* "ny bane" / efter chok */
  --series-2:       #eb6834; /* "baseline" steady state */
  --status-critical:#d03b3b;
  --status-good:    #0ca30c;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --surface-2:      #232322;
    --page:           #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --axis:           #383835;
    --border:         rgba(255,255,255,0.10);
    --series-1:       #3987e5;
    --series-2:       #d95926;
    --status-critical:#e66767;
    --status-good:    #0ca30c;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
}
header {
  padding: 20px 24px 8px;
}
header h1 { font-size: 1.25rem; margin: 0 0 4px; }
header p { margin: 0; color: var(--text-secondary); font-size: 0.9rem; max-width: 70ch; }

main {
  padding: 12px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}
.panel h2 {
  font-size: 0.95rem;
  margin: 0 0 12px;
  color: var(--text-primary);
}
.panel h2 .sub { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; }

.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 16px 24px;
}
.slider-row { display: flex; flex-direction: column; gap: 2px; }
.slider-row label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.slider-row label .val { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.slider-help { font-size: 0.74rem; color: var(--text-muted); line-height: 1.4; }
.slider-row input[type=range] { width: 100%; accent-color: var(--series-1); }
.slider-row .range-hint { font-size: 0.7rem; color: var(--text-muted); }

.row-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
button {
  font: inherit;
  font-size: 0.85rem;
  background: var(--series-1);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
}
button.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
button:disabled { opacity: 0.5; cursor: default; }

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 0.82rem;
}
.status-bar .stat { display: flex; flex-direction: column; gap: 2px; }
.status-bar .stat .label { color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.02em; }
.status-bar .stat .value { font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.status-bar .stat .value.ok { color: var(--status-good); }
.status-bar .stat .value.err { color: var(--status-critical); }

.ss-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-top: 10px; }
.ss-table th, .ss-table td { text-align: right; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.ss-table th:first-child, .ss-table td:first-child { text-align: left; }
.ss-table thead th { color: var(--text-muted); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; border-bottom: 1px solid var(--gridline); }
.ss-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--gridline); }

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 16px;
}
.chart-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.chart-card .chart-title { font-size: 0.85rem; margin-bottom: 4px; color: var(--text-primary); }
.chart-card .legend { display: flex; gap: 16px; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 6px; }
.chart-card .legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-card .legend .swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-card { min-width: 0; }
.chart-card .chart-title { font-weight: 600; }
.chart-card .chart-title .sym { color: var(--text-muted); font-weight: 400; font-size: 0.75rem; }
.chart-desc { font-size: 0.76rem; color: var(--text-secondary); margin: 0 0 6px; line-height: 1.4; }
.chart-wrap { position: relative; height: 240px; width: 100%; }

.error-box {
  display: none;
  background: color-mix(in srgb, var(--status-critical) 12%, var(--surface-1));
  border: 1px solid var(--status-critical);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
}
.error-box.show { display: block; }

footer { padding: 24px 24px 30px; color: var(--text-muted); font-size: 0.75rem; max-width: 90ch; margin: 0 auto; text-align: center; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--text-muted); font-weight: 400; }

/* ---- Hero ------------------------------------------------------------------------------ */
.hero {
  padding: 0;
  background: linear-gradient(160deg, color-mix(in srgb, var(--series-1) 14%, var(--page)), var(--page) 65%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 78ch; margin: 0 auto; padding: 44px 24px 36px; }
.hero h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 14px; }
.hero-lede { font-size: 1rem; line-height: 1.55; color: var(--text-secondary); margin: 0 0 20px; max-width: 68ch; }
.hero-cta {
  display: inline-block;
  background: var(--series-1);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 8px;
}
.hero-cta:hover { filter: brightness(1.08); }

/* ---- "Sådan virker modellen" ------------------------------------------------------------ */
.intro-panel h2 { font-size: 1.15rem; }
.intro-sub { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.5; max-width: 80ch; margin: 0 0 18px; }
.model-elements {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.model-element {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px 14px 16px;
}
.model-icon { font-size: 1.6rem; margin-bottom: 6px; line-height: 1; }
.model-element h3 { font-size: 0.9rem; margin: 0 0 6px; }
.model-element p { font-size: 0.8rem; line-height: 1.45; color: var(--text-secondary); margin: 0; }

/* ---- Fold-ud-detaljer (<details>) ------------------------------------------------------- */
.details-panel { margin-top: 18px; border-top: 1px solid var(--gridline); padding-top: 4px; }
.details-panel summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 12px 4px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.details-panel summary::-webkit-details-marker { display: none; }
.details-panel summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}
.details-panel[open] summary::before { transform: rotate(90deg); }
.details-body { padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 22px; }
.details-intro { font-size: 0.82rem; color: var(--text-secondary); margin: 0; max-width: 80ch; }
.subpanel { border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; background: var(--surface-2); }
.subpanel h3 { font-size: 0.9rem; margin: 0 0 10px; }
.subpanel h3 .sub { color: var(--text-muted); font-weight: 400; font-size: 0.78rem; }
.source-note { font-size: 0.72rem; color: var(--text-muted); margin: 0 0 14px; max-width: 80ch; line-height: 1.5; }

/* ---- "Lav dit eget forslag" ------------------------------------------------------------- */
.preset-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.preset-card {
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
  transition: border-color 0.12s ease, transform 0.06s ease;
}
.preset-card:hover { border-color: var(--series-1); }
.preset-card:active { transform: translateY(1px); }
.preset-card.secondary-preset { background: transparent; }
.preset-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 5px; }
.preset-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; }

.shock-controls { display: flex; flex-direction: column; gap: 14px; }
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
}
.checkbox-row input[type=checkbox] { width: auto; margin-top: 3px; accent-color: var(--series-1); }
.checkbox-row .muted { display: block; font-size: 0.76rem; margin-top: 2px; }

/* ---- Resultat: headline + hvorfor -------------------------------------------------------- */
.headline-box {
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.headline-box.positive { background: color-mix(in srgb, var(--status-good) 12%, var(--surface-1)); border-color: var(--status-good); }
.headline-box.negative { background: color-mix(in srgb, var(--status-critical) 12%, var(--surface-1)); border-color: var(--status-critical); }
.headline-text { font-size: 1.15rem; font-weight: 600; line-height: 1.4; }
.headline-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; }

.insight-box {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.insight-box h3 { font-size: 0.85rem; margin: 0 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.insight-box p { font-size: 0.9rem; line-height: 1.55; margin: 0; }

/* ---- Graf-faner --------------------------------------------------------------------------- */
.chart-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.chart-tab {
  font: inherit;
  font-size: 0.82rem;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
}
.chart-tab.active { background: var(--series-1); color: #fff; border-color: var(--series-1); }
.chart-note { font-size: 0.72rem; color: var(--text-muted); margin: 0 0 14px; max-width: 80ch; }

/* ---- Forslag: ændring ift. i dag ---------------------------------------------------------- */
.shock-diff.changed { color: var(--series-1); font-weight: 600; }
.change-summary { font-size: 0.82rem; color: var(--text-secondary); }

/* ---- Resultat: forældet + nøgletal ------------------------------------------------------- */
.section-h3 { font-size: 0.95rem; margin: 22px 0 6px; }
.stale-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--series-1);
  background: color-mix(in srgb, var(--series-1) 10%, var(--surface-1));
  border-radius: 10px; padding: 10px 16px; margin-bottom: 14px; font-size: 0.86rem;
  position: sticky; top: 8px; z-index: 5;
}
#resultat.is-stale .headline-box,
#resultat.is-stale .key-figures,
#resultat.is-stale .insight-box,
#resultat.is-stale .charts { opacity: 0.45; }
.key-figures { margin-bottom: 18px; }
.key-figures .section-h3 { margin-top: 0; }
.kf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .kf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kf-card { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.kf-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.kf-explain { display: block; font-weight: 400; font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.kf-vals { display: flex; gap: 18px; }
.kf-vals > div { display: flex; flex-direction: column; gap: 2px; }
.kf-when { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.kf-num { white-space: nowrap; font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kf-num.good { color: var(--status-good); }
.kf-num.bad { color: var(--status-critical); }

/* ---- Små skærme ------------------------------------------------------------------------- */
.ss-table-wrap { overflow-x: auto; }
@media (max-width: 600px) {
  main { padding: 12px 12px 32px; }
  .panel { padding: 14px 14px; }
  .hero-inner { padding: 32px 16px 28px; }
  .hero h1 { font-size: 1.35rem; }
  .chart-wrap { height: 210px; }
}
