/* TGAA Kontrollpanel. Samme stil og oppsett som tgaa.no (eier 02.11.2026): fargene, Inter og radiene er kopiert fra
   assets/css/tgaa.css (v2.45-paletten), toppen ligner templates/base.html (flytende topp med logo, navn og temaknapp),
   og på mobil er det en fanelinje som på tgaa.no. Mørk er standard (data-theme="dark"); temaknappen bytter til lys.
   Bare det panelet trenger er kopiert hit; CSP tillater ikke stilark fra tgaa.no. Trykkflater minst 44 px. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonter/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonter/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonter/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonter/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url(fonter/inter-latin-800-normal.woff2) format("woff2"); }

/* ---------- tokens (assets/css/tgaa.css: lys :root, mørk via prefers-color-scheme og data-theme="dark") ---------- */
:root {
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f0f3f8; --ink: #0f172a; --ink-2: #334155; --muted: #5d6b82; --line: #dfe5ee; --line-2: #cbd4e1;
  --brand: #14131c; --brand-ink: #ffffff; --link: #2459d6; --accent: #2459d6; --accent-2: #1d4ab4;
  --pos: #15803d; --noy: #a16207; --neg: #b91c1c; --na: #64748b;
  --pos-bg: rgba(21, 128, 61, .08); --noy-bg: rgba(161, 98, 7, .09); --neg-bg: rgba(185, 28, 28, .08); --bla-bg: rgba(36, 89, 214, .09);
  --pos-t: #166534; --noy-t: #8a5300; --neg-t: #b91c1c; --bla-t: #2459d6;   /* tekst i merker: ≥ 4,5:1 på merkets bakgrunn */
  --skygge: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .06);
  --bar: rgba(255, 255, 255, .88);
  --r: 16px; --r-s: 10px; --maks: 1280px; --fane-h: 56px;
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0a101b; --surface: #0f1724; --surface-2: #142033; --ink: #e6edf7; --ink-2: #b9c5d8; --muted: #8394ad; --line: #1f2c42; --line-2: #2a3a55;
  --brand: #e6edf7; --brand-ink: #0a101b; --link: #6b9bff; --accent: #6b9bff; --accent-2: #8fb3ff;
  --pos: #22c55e; --noy: #eab308; --neg: #ef4444; --na: #64748b;
  --pos-bg: rgba(34, 197, 94, .10); --noy-bg: rgba(234, 179, 8, .10); --neg-bg: rgba(239, 68, 68, .10); --bla-bg: rgba(107, 155, 255, .12);
  --pos-t: #4ade80; --noy-t: #facc15; --neg-t: #f87171; --bla-t: #8fb3ff;
  --skygge: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 26px rgba(0, 0, 0, .35);
  --bar: rgba(15, 23, 36, .9);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0a101b; --surface: #0f1724; --surface-2: #142033; --ink: #e6edf7; --ink-2: #b9c5d8; --muted: #8394ad; --line: #1f2c42; --line-2: #2a3a55;
  --brand: #e6edf7; --brand-ink: #0a101b; --link: #6b9bff; --accent: #6b9bff; --accent-2: #8fb3ff;
  --pos: #22c55e; --noy: #eab308; --neg: #ef4444; --na: #64748b;
  --pos-bg: rgba(34, 197, 94, .10); --noy-bg: rgba(234, 179, 8, .10); --neg-bg: rgba(239, 68, 68, .10); --bla-bg: rgba(107, 155, 255, .12);
  --pos-t: #4ade80; --noy-t: #facc15; --neg-t: #f87171; --bla-t: #8fb3ff;
  --skygge: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 26px rgba(0, 0, 0, .35);
  --bar: rgba(15, 23, 36, .9);
  color-scheme: dark;
}

/* ---------- grunnlag ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; font-feature-settings: "tnum" 1, "cv11" 1; overflow-x: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border-radius: 6px; padding: 1px 5px; }
.demp { color: var(--muted); }
.liten-tekst { font-size: 12.5px; }
.skjult-tekst { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- toppen (som templates/base.html: flytende, avrundet, logo, navn og temaknapp) ---------- */
.ramme { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topp { position: sticky; top: 0; z-index: 50; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); }
.topp-inner { max-width: calc(var(--maks) - 32px); margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 6px 8px 6px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--skygge); }
.merke { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; white-space: nowrap; min-width: 0; }
.logo-bred { display: block; height: 40px; width: auto; border-radius: 6px; }
.logo-mini { display: none; width: 32px; height: 32px; border-radius: 8px; }
.merke-tekst { font-size: 15px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; min-width: 0; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 11px; color: var(--ink); font-size: 14.5px; font-weight: 500; text-decoration: none;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { border-bottom-color: var(--line-2); }
.nav a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 600; }
.topp-verktoy { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tema { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.tema-ikon { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 2px solid var(--ink); }

.innhold { flex: 1; width: 100%; max-width: var(--maks); margin: 0 auto; min-width: 0;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.vis { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.vis-sentrert { min-height: 64vh; justify-content: center; align-items: center; }
.sidetopp { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.undertittel { margin-top: 10px; }

/* ---------- mobil: fanelinje nederst (som ios.css på tgaa.no) og «Mer»-ark ---------- */
.fanelinje { display: none; }
@media (max-width: 899px) {
  .nav { display: none !important; }
  .logo-bred { display: none; }
  .logo-mini { display: block; }
  .topp { padding-top: 8px; }
  .topp-inner { padding: 4px 6px 4px 10px; gap: 8px; }
  .ramme[data-innlogget="ja"] .innhold { padding-bottom: calc(var(--fane-h) + 28px + env(safe-area-inset-bottom, 0px)); }
  .ramme[data-innlogget="ja"] .fanelinje:not([hidden]) { display: flex; }
  .fanelinje { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; justify-content: space-around; align-items: stretch;
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
  .fanelinje a, .fanelinje button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--fane-h);
    padding: 4px 2px; border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; cursor: pointer; min-width: 0; }
  .fanelinje span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .fanelinje [aria-current="page"] { color: var(--accent); }
  .fanelinje svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .fanelinje svg .f { fill: currentColor; stroke: none; }
  .fanelinje [aria-current="page"] svg path:first-child { fill: currentColor; fill-opacity: .14; }
}
.ark { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; justify-content: flex-end; }
.ark-bak { position: absolute; inset: 0; border: 0; padding: 0; background: rgba(0, 0, 0, .4); cursor: pointer; }
.ark-panel { position: relative; background: var(--bg); border-radius: 14px 14px 0 0; padding: 6px 16px calc(20px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px rgba(0, 0, 0, .3); }
.ark-topp { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; }
.ark-topp h2 { font-size: 17px; font-weight: 600; text-align: center; }
.ark-lukk { justify-self: end; min-height: 44px; padding: 0 6px; border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.gruppe { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.gruppe li + li { border-top: 1px solid var(--line); }
.gruppe a { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; color: var(--ink); text-decoration: none; font-size: 16px; }
.gruppe a::after { content: "›"; color: var(--muted); font-size: 20px; }
.gruppe a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ---------- knapper og skjema (som .knapp på tgaa.no) ---------- */
.knapp { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; border: 2px solid transparent; text-decoration: none; }
.knapp.liten { min-height: 44px; padding: 0 14px; font-size: 13.5px; }
.knapp-prim { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.knapp-prim:hover { opacity: .88; }
.knapp-sek { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.knapp-sek:hover { background: var(--surface-2); }
.knapp-fare { background: var(--neg-bg); color: var(--neg-t); border: 1px solid color-mix(in srgb, var(--neg) 40%, transparent); }
.knapp:disabled { opacity: .55; cursor: default; }
.knapperad { display: flex; flex-wrap: wrap; gap: 10px; }
.lenke-knapp { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 8px; font-size: 14px; color: var(--link); }
.inngang { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; text-align: center; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px 22px; box-shadow: var(--skygge); }
.inngang .logo { align-self: center; border-radius: 10px; max-width: 100%; height: auto; }
.felt { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.felt input { min-height: 48px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 16px; width: 100%; }
.melding { padding: 10px 12px; border-radius: var(--r-s); background: var(--neg-bg); color: var(--neg-t); font-size: 14px; text-align: left; }
.melding.ok { background: var(--pos-bg); color: var(--pos-t); }

/* ---------- varsler ---------- */
.gammel { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 6px 6px 6px 14px; border-radius: var(--r-s); background: var(--noy-bg); border: 1px solid color-mix(in srgb, var(--noy) 40%, transparent); color: var(--noy-t); font-size: 14px; font-weight: 600; }
.advarsler { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.advarsler p { padding: 10px 14px; border-radius: var(--r-s); background: var(--noy-bg); border: 1px solid color-mix(in srgb, var(--noy) 40%, transparent); color: var(--noy-t); font-size: 14px; font-weight: 600; }

/* ---------- kort og merker (som .kort og .badge på tgaa.no) ---------- */
.kortrutenett { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 700px) { .kortrutenett { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kortrutenett { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kort { display: flex; flex-direction: column; gap: 6px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--skygge); color: inherit; text-decoration: none; }
a.kort { min-height: 44px; }
a.kort:hover { border-color: var(--line-2); }
.kort.s-feil { border-color: color-mix(in srgb, var(--neg) 55%, transparent); }
.kort.s-undersokes { border-color: color-mix(in srgb, var(--noy) 45%, transparent); }
.kort-topp { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kort-topp h2, .kort-topp h3 { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.kort .linje { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.kort .verdi { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.kort-full { grid-column: 1 / -1; }

.pille { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); }
.p-ok { background: var(--pos-bg); color: var(--pos-t); }
.p-feil { background: var(--neg-bg); color: var(--neg-t); }
.p-gul { background: var(--noy-bg); color: var(--noy-t); }
.p-gra { background: var(--surface-2); color: var(--ink-2); }
.p-bla { background: var(--bla-bg); color: var(--bla-t); }

/* ---------- tabeller (stables til kort på smal skjerm) ---------- */
.tabell { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--skygge); overflow: hidden; }
.tabell table { border-collapse: collapse; width: 100%; font-size: 13.5px; table-layout: auto; }
.tabell th, .tabell td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.tabell th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.tabell tr:last-child td { border-bottom: 0; }
.tabell a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
@media (max-width: 699px) {
  .tabell { border: 0; background: transparent; box-shadow: none; }
  .tabell thead { display: none; }
  .tabell table, .tabell tbody, .tabell tr, .tabell td { display: block; width: 100%; }
  .tabell tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 12px; margin-bottom: 8px; }
  .tabell td { border: 0; padding: 3px 0; }
  .tabell td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .tabell td:first-child { font-weight: 700; }
  .tabell td:first-child::before { content: none; }
  .tabell a { margin: 0; }
  .tabell.kompakt tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 8px 12px; margin-bottom: 6px; }
  .tabell.kompakt td { width: auto; padding: 0; color: var(--ink-2); font-size: 13px; }
  .tabell.kompakt td[data-l]::before { content: none; }
  .tabell.kompakt td:first-child { width: 100%; color: var(--ink); font-size: 14px; }
}

.stabel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.blokk { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.blokk-topp { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tall-rad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .tall-rad { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tall { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--skygge); }
.tall b { font-size: 20px; font-weight: 700; }
.tall span { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.forklaring { color: var(--muted); font-size: 13.5px; }

/* ---------- Dokumenter ---------- */
.dok-gruppe { display: flex; flex-direction: column; gap: 6px; }
.dok-gruppe h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.dok-rader { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--skygge); overflow: hidden; }
.dok-rader li + li { border-top: 1px solid var(--line); }
.dok-rad { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; color: var(--ink); text-decoration: none; }
.dok-rad:hover { background: var(--surface-2); }
.dok-rad::after { content: "›"; color: var(--muted); font-size: 20px; }
.dok-rad-tekst { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.dok-rad-tekst b { font-weight: 600; overflow-wrap: anywhere; }
.dok-rad-tekst span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.dok-grupper-rutenett { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 900px) { .dok-grupper-rutenett { display: block; columns: 2; column-gap: 18px; } .dok-gruppe { break-inside: avoid; margin-bottom: 20px; } }
.dok-topp { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dok-undertittel { color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.dok-lesing { gap: 10px; }
.dok-lesing { padding: 18px 20px; }
@media (max-width: 699px) { .dok-lesing { padding: 14px 14px; } }

/* Markdown (markdown.js) */
.md { display: flex; flex-direction: column; gap: 12px; min-width: 0; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.md h2 { font-size: 22px; margin-top: 10px; } .md h3 { font-size: 18px; margin-top: 8px; } .md h4 { font-size: 16px; margin-top: 6px; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.md li > ul, .md li > ol { margin-top: 4px; }
.md pre { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; overflow-x: auto; max-width: 100%; }
.md pre code { background: none; padding: 0; font-size: 13px; white-space: pre; }
.md blockquote { margin: 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.md .pille { font-size: 10.5px; padding: 2px 8px; vertical-align: 1px; }
.md-tabell { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.md-tabell table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13.5px; line-height: 1.45; }
.md-tabell th, .md-tabell td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); overflow-wrap: normal; word-break: normal; }
.md-tabell th { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.md-tabell tr:last-child td { border-bottom: 0; }
.md a { word-break: break-word; }
