/* ---------------------------------------------------------------------------
   KidsBuddy Indsigt - brugsanalyse-dashboardet (KB-49, fase 3).
   Flyttet fra den godkendte mockup
   (kidsbuddy/docs/mockups/brugsanalyse-dashboard-mockup.html), fordi CSP'en
   forbyder inline-styles. Tokens foelger kidsbuddy/docs/DESIGN_SYSTEM.md.
   Serie-farverne er validerede med dataviz-validatoren i baade lys og moerk.
   Ingen scripts: temaet foelger prefers-color-scheme, tooltips er
   title-attributter.
   --------------------------------------------------------------------------- */

@font-face {
  font-family: Figtree;
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/figtree.woff2') format('woff2');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/plus-jakarta-sans.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-600.woff2') format('woff2');
}

:root {
  --bg: #FAF7F2;
  --bg-deep: #F3EEE5;
  --surface: #FFFFFF;
  --surface-alt: #F7F3EC;
  --ink: #1D3A4B;
  --ink-muted: #6B7F8A;
  --ink-faint: #93A5AE;
  --border: #E8DFD0;
  --border-strong: #D9CDB8;
  --accent: #E8735F;
  --accent-wash: #F8E0DA;
  --accent-ink: #A8452F;

  --good: #2E7D57;
  --good-wash: #E4F1EA;
  --warn: #B87309;
  --warn-wash: #FBEEDA;
  --crit: #BC4238;
  --crit-wash: #FAE3E1;

  --s1: #1B7FA6;
  --s2: #E8735F;
  --s3: #7A5CA8;
  --s4: #2E9B57;
  --grid: #EDE6D9;

  --shadow: 0 1px 2px rgba(29, 58, 75, .05), 0 6px 20px -12px rgba(29, 58, 75, .18);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101F28;
    --bg-deep: #0B171E;
    --surface: #1B303B;
    --surface-alt: #243B47;
    --ink: #EDE6D9;
    --ink-muted: #92A7B2;
    --ink-faint: #6E8794;
    --border: #2B4350;
    --border-strong: #3A5563;
    --accent: #F0907C;
    --accent-wash: #523128;
    --accent-ink: #F0907C;

    --good: #5FBF8A;
    --good-wash: #1D3A31;
    --warn: #D9A441;
    --warn-wash: #3A2F1B;
    --crit: #E06A64;
    --crit-wash: #3B2320;

    --s1: #2E93BD;
    --s2: #DA6A56;
    --s3: #8A6BB8;
    --s4: #2F9E68;
    --grid: #2B4350;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -14px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Figtree, "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Plus Jakarta Sans", Figtree, system-ui, sans-serif;
  text-wrap: balance;
  margin: 0;
}

.mono, .num {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --- skelet ------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }

.rail {
  border-right: 1px solid var(--border);
  background: var(--bg-deep);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #F5B594, #E8735F);
}
.brand-name { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--ink-faint); margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 9px; border-radius: 8px;
  color: var(--ink-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
}
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.nav a span.n { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-faint); }
.nav a:focus-visible, .theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.theme {
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-muted);
  border-radius: 8px; padding: 6px 9px; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
}
.theme:hover { color: var(--ink); }

main { padding: 22px 26px 60px; max-width: 1180px; }

/* --- topstrip ----------------------------------------------------------- */

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.head h1 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.head p { margin: 3px 0 0; color: var(--ink-muted); font-size: 13.5px; }

.status { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 12px; margin-bottom: 26px; }
.st {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; box-shadow: var(--shadow); display: flex; gap: 11px; align-items: flex-start;
}
.st .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.st.ok .dot { background: var(--good); }
.st.warn .dot { background: var(--warn); }
.st.crit .dot { background: var(--crit); }
.st .lab { font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.st .val { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin-top: 1px; }
.st .sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

/* --- sektioner og kort -------------------------------------------------- */

section { margin-bottom: 34px; scroll-margin-top: 16px; }
.sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sec-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.sec-head .why { font-size: 12.5px; color: var(--ink-faint); }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px 16px; box-shadow: var(--shadow); min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
.card h3 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.card .note { font-size: 12px; color: var(--ink-faint); margin: 0 0 12px; }
.card .note.tight { margin-bottom: 8px; }
.card .footnote { font-size: 12px; color: var(--ink-faint); margin: 12px 0 0; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 0; font-size: 12px; color: var(--ink-muted); }
.legend i { width: 9px; height: 9px; border-radius: 2.5px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* --- aerlige tomme tilstande -------------------------------------------- */

.missing {
  border: 1px dashed var(--border-strong);
  background: var(--surface-alt);
  border-radius: 9px;
  padding: 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* --- tabeller ----------------------------------------------------------- */

.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; color: var(--ink); background: transparent; }
tbody, tr, td { color: inherit; }
th, td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 500;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
  border-bottom: 1px solid var(--border-strong);
}
td.n, th.n { text-align: right; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; padding-right: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--ink-faint); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  padding: 2px 9px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pill.ok { background: var(--good-wash); color: var(--good); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.crit { background: var(--crit-wash); color: var(--crit); }
.pill.mute { background: var(--surface-alt); color: var(--ink-muted); }

/* --- heartbeat-stribe --------------------------------------------------- */

.strip { display: flex; gap: 3px; flex-wrap: wrap; }
.strip .d { width: 15px; height: 26px; border-radius: 3px; background: var(--good); opacity: .82; }
.strip .d.miss { background: var(--border-strong); }
.strip .d.err { background: var(--crit); }
.strip .d:hover { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }

/* --- tragt -------------------------------------------------------------- */

.funnel { display: flex; flex-direction: column; gap: 7px; }
.fstep { display: grid; grid-template-columns: 168px minmax(0, 1fr) 96px; align-items: center; gap: 10px; }
.fstep .fl { font-size: 12.5px; color: var(--ink-muted); }
.fstep .pctbar { border-radius: 0 4px 4px 0; }
.fstep .fv { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; text-align: right; }
.fstep .fv em { font-style: normal; color: var(--crit); font-size: 11.5px; margin-left: 6px; }

/* --- dynamiske procent-soejler -------------------------------------------
   CSP'en tillader ingen inline style-attributter, saa bredder er
   SVG-attributter (pctBar i charts.ts) og farver er klasser her. */

.pctbar { display: block; width: 100%; border-radius: 3px; }
.pctbar.h9 { height: 9px; }
.pctbar.h10 { height: 10px; }
.pctbar.h26 { height: 26px; }
.pctbar .c-s1 { fill: var(--s1); }
.pctbar .c-s2 { fill: var(--s2); }
.pctbar .c-s3 { fill: var(--s3); }
.pctbar .c-s4 { fill: var(--s4); }

.legend i.b-good { background: var(--good); }
.legend i.b-warn { background: var(--warn); }
.legend i.b-crit { background: var(--crit); }
.legend i.b-border { background: var(--border-strong); }
.legend i.b-s1 { background: var(--s1); }
.legend i.b-s2 { background: var(--s2); }
.legend i.b-s3 { background: var(--s3); }
.legend i.b-s4 { background: var(--s4); }

th.w180 { width: 180px; }
th.w220 { width: 220px; }

svg { display: block; max-width: 100%; }
svg text { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; fill: var(--ink-faint); }
svg .lbl { font-family: Figtree, sans-serif; font-size: 11.5px; font-weight: 600; }

footer { border-top: 1px solid var(--border); padding-top: 16px; color: var(--ink-muted); font-size: 12.5px; }
footer b { color: var(--ink); }
footer ul { margin: 8px 0 0; padding-left: 18px; }
footer li { margin-bottom: 4px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; overflow-x: auto; }
  .rail .nav { flex-direction: row; }
  .rail-foot { margin: 0; }
  main { padding: 18px 14px 50px; }
  .fstep { grid-template-columns: 120px minmax(0, 1fr) 84px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------------------------------------------------------------------
   Login og 2FA (auth-siderne). Samme tokens som resten; ingen inline styles,
   CSP'en haandhaever det. Tilfoejet 2026-08-28 efter Mikaels foerste login:
   siderne var skelet-HTML, kun de syv sider bag login var designet.
   --------------------------------------------------------------------------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: linear-gradient(180deg, var(--bg), var(--bg-deep)); }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 28px; }
.auth-card .brand { margin-bottom: 24px; }
.auth-card h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.auth-lead { font-size: 13px; color: var(--ink-muted); margin: 0 0 16px; line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); }
.auth-form input { font: inherit; font-size: 14.5px; color: var(--ink); background: var(--surface-alt); border: 1px solid var(--border-strong); border-radius: 9px; padding: 10px 12px; }
.auth-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.auth-form button { font: inherit; font-weight: 700; font-size: 14px; color: #FFF7F2; background: var(--accent); border: 0; border-radius: 9px; padding: 11px 14px; cursor: pointer; margin-top: 2px; }
.auth-form button:hover { background: var(--accent-ink); }
.auth-form button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.auth-error { font-size: 13px; color: var(--crit); background: var(--crit-wash); border-radius: 9px; padding: 10px 12px; margin: 0 0 8px; }
.auth-note { font-size: 12.5px; color: var(--ink-faint); margin: 16px 0 0; }
.auth-note a { color: var(--accent-ink); }
.auth-alt { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 16px; }
.auth-alt h2 { font-size: 13px; font-weight: 700; color: var(--ink-muted); margin: 0; }
.auth-secret { font-family: "IBM Plex Mono", monospace; font-size: 13px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; margin: 0 0 8px; overflow-wrap: anywhere; }
.auth-otpauth { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-faint); overflow-wrap: anywhere; margin: 0 0 6px; }
.auth-codes { font-family: "IBM Plex Mono", monospace; font-size: 13.5px; columns: 2; column-gap: 28px; margin: 12px 0 0; padding-left: 24px; }
.auth-codes li { margin: 0 0 6px; }
.auth-qr { display: flex; justify-content: center; margin: 0 0 14px; }
.auth-qr svg { width: 172px; height: 172px; border-radius: 8px; }

/* ---------------------------------------------------------------------------
   Fuld skaermbredde (Mikael, 2026-08-28): indholdet laa fastlaast paa 1180 px
   med en tom hoejre halvdel paa brede skaerme. Loftet er haevet, gitrene
   folder ud med auto-fit, og paa store skaerme skrues typografi og luft et
   noek op. Graferne er SVG i procentbredde og vokser med af sig selv.
   --------------------------------------------------------------------------- */
main { max-width: 1720px; }
@media (min-width: 1500px) {
  body { font-size: 16px; }
  main { padding: 28px 36px 70px; }
  .head h1 { font-size: 28px; }
  .head p { font-size: 14.5px; }
  .grid { gap: 18px; }
  .g2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
  .g3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .status { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
  .st .val { font-size: 19px; }
  .st .lab { font-size: 12.5px; }
  .st .sub { font-size: 12.5px; }
  .card { padding: 18px 20px 20px; }
  .card h3 { font-size: 15px; }
  .card .note { font-size: 12.75px; }
  .sec-head h2 { font-size: 18px; }
  .sec-head .why { font-size: 13px; }
}
/* Paa ultrabrede skaerme centreres indholdet i sin kolonne i stedet for at
   klaebe til venstre med al luften samlet i hoejre side. */
main { margin-inline: auto; width: 100%; }
