/* ==========================================================================
   Atlas Planvask — designsystem (ds.css)
   Tokens fra Atlas (_ds/colors_and_type.css + fig-tokens.css) og komponenter
   fra designoverleveringen (docs/design/README.md, Revisjon §3).
   Mål og farger er lest fra de rendrede tegnebrettene (A1–D4).

   Bruk:  <link rel="stylesheet" href="ds.css?v=…">
          <script src="icons.js?v=…"></script> <script src="fmt.js?v=…"></script> <script src="vocab.js?v=…"></script>
   Referanse: docs/design/components.md · levende stilguide: designsystem.html

   Innhold
     1  Tokens            7  Data (tabell, liste, stat, fakta, fremdrift)
     2  Base              8  Tillit (funn, sikkerhet, anslag, kontroll, varsler, tilstander)
     3  Hjelpeklasser     9  Overlegg (skuff, modal, popover, meny)
     4  Knapper           10 Kart (paneler, tegnforklaring, kontroller, tidslinje)
     5  Merker og tagger  11 Arbeidsflyt (stepper, faser, regler, tavle, massehandling)
     6  Skjemaelementer   12 App-skall (sidepanel, toppfelt, hovedflate, høyrepanel, fanelinje)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* 1 ─ Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Atlas-blå (primær) */
  --blue-50:  #F3F6FF;   /* valgt rad, avkrysset rad, «Til deg» */
  --blue-100: #E7EEFF;   /* valgt flate, aktiv filterbrikke, aktivt menypunkt */
  --blue-200: #CFDEFF;
  --blue-300: #B9CCF7;
  --blue-400: #0E58FF;   /* PRIMÆR: hovedhandling, valg, fremdrift */
  --blue-500: #0B46CC;   /* hover/trykket */
  --blue-600: #083599;
  /* Fokus (WCAG 2.4.7/1.4.11): Atlas-ringen rgba(135,172,255,.45) var 1,4:1 – nå blå 400 (≥ 3:1 på hvit, N50–N100, blå 50/100). */
  --focus-border: #0E58FF;
  --focus-ring: #0E58FF;                                   /* outline: 2px solid + 2px offset */
  --ring-focus: 0 0 0 2px var(--n0), 0 0 0 4px #0E58FF;   /* ring som box-shadow (hvit luft + blå) */
  --ring-focus-input: 0 0 0 1px #0E58FF;                   /* felt: 1 px kant + 1 px skygge = 2 px blå */

  /* Nøytraler (kjølig blågrå) */
  --n0:   #FFFFFF;
  --n50:  #FBFCFD;   /* høyrepanel, tabellhode */
  --n75:  #F4F7FA;   /* sidepanel, hover på rader */
  --n100: #EDF2F6;   /* inndatafelt, sekundærknapp, skjelett */
  --n200: #EAEFF4;   /* skillelinjer i rader */
  --n300: #DFE6EC;
  --n400: #D3DCE4;   /* standard kantlinje */
  --n500: #B6C6D6;   /* dekor, deaktivert (ikke for tekst eller kontrollgrenser) */
  --n550: #7C91A5;   /* Atlas N600: grenser og ikoner i kontroller (≥ 3:1 på hvit, N50, N75) */
  --n600: #5B7085;   /* dempet tekst – mørknet fra Atlas #7C91A5 for ≥ 4,5:1 på hvit, N50, N75, N100 og blå 50 */
  --n700: #374B5E;   /* brødtekst */
  --n800: #242C38;   /* overskrifter */
  --n900: #0E101A;   /* mørke verktøylinjer */

  /* Semantiske tekst/bakgrunn-par: tekst ≥ 4,5:1 på egen tone, hvit, N50, N75, N100 og blå 50.
     Mørknet minimalt fra Atlas (samme kulør og metning): #299745 → #227E3A, #996A13 → #926512,
     #DC2625 → #D52322, #6E62B6 → #685CB3. Se docs/design/components.md «Avvik fra Atlas-tokens (WCAG)». */
  --success: #227E3A;  --success-bg: #EBFBEE;
  --warning: #926512;  --warning-bg: #FEF6D3;  --warning-border: #D4A012;
  --danger:  #D52322;  --danger-bg:  #FFEEEE;
  --info:    #0B46CC;  --info-bg:    #E8EFFF;
  --discovery: #685CB3; --discovery-bg: #EAE6FF;

  /* Dispensasjonsrampe (kun kart) — «discovery»-lilla, 4 trinn */
  --disp-0: #FFFFFF;
  --disp-1: #E0DAFD;
  --disp-1-border: #B7ACEB;
  --disp-2: #A79BE0;
  --disp-3: #4E4391;

  /* Lagfarger (pastell) — kartfyll og avatarer */
  --layer-darkblue: #D1E2FF; --layer-lightblue: #C4ECFF; --layer-turquoise: #C1F5F0;
  --layer-green: #CFF5D1;    --layer-yellow: #FFEAB6;    --layer-orange: #FFE0CC;
  --layer-red: #FFD4E0;      --layer-pink: #FAD2FC;      --layer-purple: #E0DAFD;
  --layer-gray: #E5E9F0;
  --avatar-1: #D1E2FF; --avatar-2: #E0DAFD; --avatar-3: #CFF5D1; --avatar-4: #FFE0CC;

  /* Kartfarger per fargemodus (C3) */
  --map-pulje-oppheves: #E5E9F0; --map-pulje-evalueres: #D1E2FF; --map-pulje-stort: #FFE0CC;
  --map-pulje-middels: #FFEAB6;  --map-pulje-lite: #CFF5D1;
  --map-kat-gjennomfort: #E5E9F0; --map-kat-ikke-gjennomfort: #C4ECFF; --map-kat-utgatt: #FAD2FC;
  --map-forrang-a: #C1F5F0; --map-forrang-a-usikker: #FFEAB6; --map-forrang-ovrige: #E5E9F0;
  --map-alder-1: #EAEFF4; --map-alder-2: #B6C6D6; --map-alder-3: #7C91A5; --map-alder-4: #374B5E;
  --map-status-ikke-vurdert: #EAEFF4; --map-status-til-vurdering: #B9CCF7; --map-status-anbefalt: #0E58FF;
  --map-status-klar: #0B46CC; --map-status-vedtatt: #242C38;
  /* Forenkle / «Hva endres ved oppheving» (kart) */
  --map-fk-enkel: #5DB97A; --map-fk-sjekk: #F2B366; --map-fk-krevende: #D9534F; --map-fk-ny: #DFE6EC;
  --map-fk-veg-k: #E8590C; --map-fk-veg-f: #C92A2A; --map-fk-formal: #7048E8; --map-fk-gront: #2F9E44;
  --map-fk-bolig: #C92A2A; --map-fk-bygg: #F08C00; --map-fk-urort: #5B7085;
  --map-fk-plan: #4C3FB0; --map-fk-under: #B35C00; --map-fk-kpa: #2F6F3A; --map-fk-over: #0B46CC;
  /* Planenes egne data (planlag.py): 1985-formål uten KPA-motstykke, hensynssoner, datagrunnlag */
  --map-pf-fare: #E8A0A0; --map-pf-spesial: #C9B8E6; --map-pf-felles: #D6D0C4;
  --map-pf-hensyn-angitt: #8E24AA; --map-pf-hensyn-fare: #D52322; --map-pf-hensyn-sikring: #1565C0; --map-pf-hensyn-stoy: #E07B2A; --map-pf-hensyn-annet: #5B7085;
  --map-dg-formal: #2E9E5B; --map-dg-maskinelt: #8FD19E; --map-dg-plankart: #9CC3F0; --map-dg-omrade: #F2B366;
  --map-plan-line: #7C91A5;      /* tynt planomriss */
  --map-grense: #374B5E;         /* kommunegrense, stiplet */
  --map-missing: #B6C6D6;        /* skravur for manglende geometri */

  /* Kartlag (C3 «Kartlag»): plangrunnlag og DOK. Brukes av app.js via getComputedStyle,
     så MapLibre-uttrykkene aldri har egne heks-verdier. Dempede, adskillbare farger på grått kart. */
  --map-disp-point-0: #F3DFB0; --map-disp-point-1: #8A5A00; --map-disp-avslatt: #A03578;  /* dispensasjonspunkter: vedtaksår */
  --map-bygg-bolig: #B5533C; --map-bygg-garasje: #D0973A; --map-bygg-industri: #6E5FA0; --map-bygg-fritid: #3E8E7E;
  --map-bygg-kontor: #3D6FA8; --map-bygg-offentlig: #7C8C34; --map-bygg-annet: #75807B;
  --map-buffer-veg: #5B7A9A; --map-buffer-bane: #9A5B7A;
  --map-fare-hoy: #B3261E; --map-fare-middels: #E07B2A; --map-fare-lav: #E8C547; --map-fare-ukjent: #B8B8B8;
  --map-kvikk-akt: #C98A5B; --map-flom: #2F6FAF; --map-flom-klima: #5B8FD0; --map-flom-akt: #7FB3E0; --map-skred: #8A5A2B;
  --map-natur-1: #1B5E20; --map-natur-2: #2E7D32; --map-natur-3: #66BB6A; --map-natur-4: #A5D6A7;
  --map-ku-1: #004D40; --map-ku-2: #00796B; --map-ku-3: #4DB6AC; --map-ku-4: #B2DFDB;
  --map-vern: #2E7D32; --map-utvalgt: #8BC34A; --map-art: #9C27B0; --map-friluft: #00ACC1; --map-forurenset: #6D4C41;
  --map-kultur: #B71C1C; --map-kultur-sikring: #E57373; --map-sefrak: #8D6E63; --map-vassdrag: #1565C0;
  --map-ar50-bebygd: #9E9E9E; --map-ar50-jordbruk: #F9D976; --map-ar50-skog: #A5D6A7; --map-ar50-myr: #B39DDB;
  --map-ar50-vann: #90CAF9; --map-ar50-annet: #EEEEEE;
  --map-ssb-bolig: #F57C00; --map-ssb-naering: #7B1FA2; --map-ssb-fritid: #00897B;
  /* Arealregnskap (B3): reserveflater farget etter største konflikt (jordbruk og myr som i B3-skissen) */
  --map-areal-jordbruk: #4E4391; --map-areal-myr: #A79BE0; --map-areal-natur: #2E7D32; --map-areal-fare: #E07B2A;
  --map-areal-skog: #8DB592; --map-areal-ingen: #FFFFFF; --map-areal-line: #374B5E;
  /* Tegnforklaring for eksterne WMS-lag (farger slik DiBK tegner dem) */
  --map-kpa-bebyggelse: #F5F0A0; --map-kpa-sentrum: #A0603C; --map-kpa-naering: #9668A8; --map-kpa-samferdsel: #B0B0B0;
  --map-kpa-gronn: #63C24C; --map-kpa-lnfr: #D8DBA2; --map-kpa-vann: #9FD3EE; --map-kpa-forsvar: #6C7042;
  --map-nap-bebyggelse: #F5F07D;

  /* Semantiske alias (Atlas-navn) */
  --color-text-headlines: var(--n800);
  --color-text-default: var(--n700);
  --color-text-subtle: var(--n600);
  --color-text-disabled: var(--n500);
  --color-text-inverse: var(--n0);
  --color-text-brand: var(--blue-400);
  --color-background-default: var(--n0);
  --color-background-subtle: var(--n75);
  --color-background-input-default: var(--n100);
  --color-background-input-hovered: var(--n200);
  --color-background-selected-default: var(--blue-100);
  --color-background-toolbar-default: var(--n900);
  --color-border-default: var(--n400);
  --color-border-subtle: var(--n200);

  /* Typografi */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-display: 32px;  /* store tall, 600 */
  --fs-h1: 24px;       /* H1, 600 */
  --fs-h2: 20px;       /* sidetittel, 600 */
  --fs-h3: 16px;       /* seksjon, 600 */
  --fs-h4: 14px;       /* underseksjon, 600 */
  --fs-body: 13px;     /* brødtekst og tabell */
  --fs-meta: 12px;     /* metadata */
  --fs-label: 11px;    /* etiketter, 600 */
  --fs-field: 10px;    /* feltetiketter, 700 */
  --lh-tight: 1.2;
  --lh-body: 1.5;

  /* Avstander og størrelser */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --control-h: 28px; --control-h-sm: 24px; --control-h-lg: 36px; --control-h-touch: 44px;

  /* Radier */
  --radius: 7px;        /* kontroller, kort, paneler */
  --radius-seg: 5px;    /* segmenter, regelbrikker */
  --radius-modal: 8px;  /* modaler, popovere */
  --radius-xl: 12px;    /* kartkontrollgruppe, massehandlingslinje */
  --radius-sm: 4px;     /* avkrysningsboks, tastetips */
  --radius-full: 999px;

  /* Skygger */
  --shadow-xs: 0 1px 2px rgba(14, 16, 26, .06);
  --shadow-sm: 0 1px 3px rgba(14, 16, 26, .08), 0 1px 2px rgba(14, 16, 26, .04);
  --shadow-lg: 0 12px 32px rgba(14, 16, 26, .14), 0 4px 8px rgba(14, 16, 26, .06);
  --scrim: rgba(14, 16, 26, .32);

  /* Bevegelse: 120–200 ms, ingen sprett */
  --ease: cubic-bezier(.2, .6, .2, 1);
  --dur-fast: 120ms;
  --dur: 160ms;
  --dur-slow: 200ms;

  /* App-skall */
  --sidebar-w: 216px;
  --topbar-h: 52px;
  --rightpanel-w: 340px;
  --tabbar-h: 64px;
  --drawer-w: 520px;
  --modal-w: 680px;
  --popover-w: 400px;
}

/* 2 ─ Base ───────────────────────────────────────────────────────────────── */
/* Lav spesifisitet (:where) så sidenes egen CSS alltid vinner. */
:where(html) { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:where(body) {
  margin: 0;
  background: var(--n0);
  color: var(--n700);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
:where(*, *::before, *::after) { box-sizing: border-box; }
:where(h1, h2, h3, h4, h5, h6) { margin: 0; color: var(--n800); font-weight: 600; line-height: var(--lh-tight); }
:where(h1) { font-size: var(--fs-h1); letter-spacing: -.01em; }
:where(h2) { font-size: var(--fs-h2); }
:where(h3) { font-size: var(--fs-h3); }
:where(h4) { font-size: var(--fs-h4); }
:where(h5, h6) { font-size: var(--fs-body); }
:where(p) { margin: 0; }
:where(a) { color: var(--blue-400); text-decoration: none; }
:where(a:hover) { text-decoration: underline; }
/* Lenker i løpende tekst understrekes (WCAG 1.4.1): lenker uten klasse er tekstlenker; komponentlenker har egen klasse. */
:where(a:not([class])) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
:where(p, li) > :where(a.ds-link, a.ds-tag) { text-decoration: underline; text-underline-offset: 2px; }
:where(a.ds-meta, a.ds-caption, a.ds-muted) { text-decoration: underline; text-underline-offset: 2px; }   /* grå lenker skilles ellers bare på farge */
:where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(button) { cursor: pointer; }
:where(table) { border-collapse: collapse; }
:where(b, strong) { font-weight: 600; }
:where(code, kbd, samp) { font-family: var(--font-mono); font-size: .92em; }
:where(svg.ds-icon) { flex: none; display: inline-block; vertical-align: -0.125em; }
::selection { background: var(--blue-400); color: var(--n0); }
/* hidden-attributtet skal alltid skjule, også komponenter med egen display (flex/grid). */
[hidden] { display: none !important; }

/* Synlig fokusring (README Accessibility, WCAG 2.4.7/1.4.11): 2 px blå 400 med 2 px luft (≥ 3:1). outline følger border-radius. */
:where(a, button, input, select, textarea, summary, [tabindex], [role="button"], [role="switch"], [role="tab"], [role="option"], [role="radio"]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
/* På mørke flater (massehandling, toast, zoomgruppe) er blå 300 synlig mot N900. */
:where(.ds-bulkbar, .ds-toast, .ds-mapctl) :focus-visible { outline-color: var(--blue-300); }
:where(input, select, textarea):focus { outline: none; }

/* 3 ─ Hjelpeklasser ──────────────────────────────────────────────────────── */
.ds-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ds-tnum { font-variant-numeric: tabular-nums; }
.ds-display { font-size: var(--fs-display); font-weight: 600; color: var(--n800); letter-spacing: -.01em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ds-h1 { font-size: var(--fs-h1); font-weight: 600; color: var(--n800); letter-spacing: -.01em; line-height: 1.2; margin: 0; }
.ds-pagetitle { font-size: var(--fs-h2); font-weight: 600; color: var(--n800); line-height: 1.25; margin: 0; }
.ds-h3 { font-size: var(--fs-h3); font-weight: 600; color: var(--n800); margin: 0; }
.ds-h4 { font-size: var(--fs-h4); font-weight: 600; color: var(--n800); margin: 0; }
.ds-eyebrow { font-size: var(--fs-meta); font-weight: 600; color: var(--n600); }
.ds-label { display: block; font-size: var(--fs-field); font-weight: 700; color: var(--n700); margin-bottom: 5px; }
.ds-meta { font-size: var(--fs-meta); color: var(--n600); }
.ds-caption { font-size: var(--fs-label); color: var(--n600); }
.ds-lead { font-size: 14px; line-height: 1.55; color: var(--n700); max-width: 72ch; text-wrap: pretty; }
.ds-strong { color: var(--n800); font-weight: 500; }
.ds-muted { color: var(--n600); }
.ds-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ds-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ds-spacer { flex: 1 1 0; }
.ds-hstack { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.ds-vstack { display: flex; flex-direction: column; gap: var(--sp-2); }
.ds-text-success { color: var(--success); } .ds-text-warning { color: var(--warning); }
.ds-text-danger { color: var(--danger); }   .ds-text-info { color: var(--info); }
.ds-text-subtle { color: var(--n600); }     .ds-text-strong { color: var(--n800); }
.ds-link { color: var(--blue-400); font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
.ds-link:hover { text-decoration: underline; }
.ds-link--subtle { color: var(--n700); font-weight: 400; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ds-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; font: 11px/1 var(--font-mono); color: var(--n700); background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius-sm); }
.ds-divider { height: 1px; background: var(--n400); border: 0; margin: 0; }

/* Tonevariabler: brukes av komponenter med tone (vurdering, anbefaling, kontroll). */
.ds-tone-neutral, [data-tone="neutral"] { --tone: var(--n700); --tone-bg: var(--n100); --tone-border: var(--n500); }
.ds-tone-success, [data-tone="success"] { --tone: var(--success); --tone-bg: var(--success-bg); --tone-border: var(--success); }
.ds-tone-warning, [data-tone="warning"] { --tone: var(--warning); --tone-bg: var(--warning-bg); --tone-border: var(--warning-border); }
.ds-tone-danger,  [data-tone="danger"]  { --tone: var(--danger);  --tone-bg: var(--danger-bg);  --tone-border: var(--danger); }
.ds-tone-info,    [data-tone="info"]    { --tone: var(--info);    --tone-bg: var(--info-bg);    --tone-border: var(--info); }

/* 4 ─ Knapper (Atlas Button: sm 24 / md 28 / lg 36, 7 px radius) ─────────── */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 12px;
  font: 500 13px/1.2 var(--font-sans); white-space: nowrap; text-decoration: none;
  color: var(--n700); background: var(--n100);
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; user-select: none;
  transition: background-color 100ms ease-in-out, border-color 100ms ease-in-out, color 100ms ease-in-out;
}
.ds-btn:hover { background: var(--n300); text-decoration: none; }
.ds-btn:active { background: var(--n400); }
.ds-btn svg { flex: none; }
.ds-btn--primary { background: var(--blue-400); color: var(--n0); }
.ds-btn--primary:hover { background: var(--blue-500); }
.ds-btn--primary:active { background: var(--blue-600); }
.ds-btn--secondary { background: var(--n100); color: var(--n700); }
.ds-btn--ghost { background: var(--n0); color: var(--n700); border-color: var(--n400); }
.ds-btn--ghost:hover { background: var(--n75); }
.ds-btn--ghost:active { background: var(--n100); }
.ds-btn--minimal { background: transparent; color: var(--n700); }
.ds-btn--minimal:hover { background: var(--n75); }
.ds-btn--minimal:active { background: var(--n100); }
.ds-btn--danger { background: var(--danger-bg); color: var(--danger); }
.ds-btn--danger:hover { background: #FFD9E0; }
.ds-btn--inverse { background: var(--n900); color: var(--n0); }
.ds-btn--inverse:hover { background: var(--n800); }
.ds-btn--sm { height: var(--control-h-sm); padding: 0 8px; font-size: 12px; gap: 6px; }
.ds-btn--lg { height: var(--control-h-lg); padding: 0 16px; font-size: 15px; }
.ds-btn--touch { height: var(--control-h-touch); padding: 0 16px; font-size: 15px; }
.ds-btn--block { display: flex; width: 100%; }
.ds-btn--icon { width: var(--control-h); padding: 0; }
.ds-btn--icon.ds-btn--sm { width: var(--control-h-sm); }
.ds-btn--icon.ds-btn--lg { width: var(--control-h-lg); }
.ds-btn--icon.ds-btn--touch { width: var(--control-h-touch); }
.ds-btn.is-active, .ds-btn[aria-pressed="true"] { background: var(--blue-100); color: var(--blue-400); border-color: transparent; }
.ds-btn[disabled], .ds-btn[aria-disabled="true"] { opacity: .5; cursor: default; pointer-events: none; }
.ds-btn__kbd { font: 500 12px/1 var(--font-sans); opacity: .75; letter-spacing: .02em; }
.ds-btn-group { display: inline-flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }

/* 5 ─ Merker og tagger ──────────────────────────────────────────────────── */
/* Badge = solid pille. Brukes for beslutninger og fakta (kategori, pulje, kildestatus). */
.ds-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
  border-radius: var(--radius-full); font: 600 11px/1 var(--font-sans); white-space: nowrap;
  background: var(--n100); color: var(--n700); vertical-align: middle;
}
.ds-badge svg { width: 12px; height: 12px; }
.ds-badge--neutral { background: var(--n100); color: var(--n700); }
.ds-badge--brand { background: var(--blue-100); color: var(--blue-500); }
.ds-badge--success { background: var(--success-bg); color: var(--success); }
.ds-badge--warning { background: var(--warning-bg); color: var(--warning); }
.ds-badge--danger { background: var(--danger-bg); color: var(--danger); }
.ds-badge--info { background: var(--info-bg); color: var(--info); }
.ds-badge--discovery { background: var(--discovery-bg); color: var(--discovery); }
.ds-badge--lg { height: 24px; padding: 0 10px; font-size: 12px; }
/* «Demo – ikke kvalitetssikret»: ds-badge ds-badge--warning + flask-conical. Se også .ds-sidebar__demo. */

/* RecommendationTag — «Anbefaling, aldri vedtak»: stiplet, Sparkles, tonefarget tekst, ingen fyll. */
.ds-rec {
  --tone: var(--n700); --tone-border: var(--n500);
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; min-height: 20px;
  border: 1px dashed var(--tone-border); border-radius: var(--radius-full);
  background: transparent; color: var(--tone);
  font: 400 12px/1.35 var(--font-sans); white-space: nowrap; vertical-align: middle;
}
.ds-rec svg { width: 11px; height: 11px; }
.ds-rec__prefix { color: var(--n600); margin-right: 1px; }
.ds-rec--success { --tone: var(--success); --tone-border: var(--success); }
.ds-rec--warning { --tone: var(--warning); --tone-border: var(--warning-border); }
.ds-rec--danger { --tone: var(--danger); --tone-border: var(--danger); }
.ds-rec--info { --tone: var(--info); --tone-border: var(--info); }
.ds-rec--neutral { --tone: var(--n700); --tone-border: var(--n500); }
.ds-rec--strong { font-weight: 600; }

/* Liten tag: «KDD 2025», eiere i fasene, «Fase 2», «Planvask»/«Kommunen». */
.ds-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px;
  font: 600 11px/1.3 var(--font-sans); color: var(--n700); white-space: nowrap;
  background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius-full);
}
.ds-tag--filled { background: var(--n100); border-color: transparent; }
.ds-tag--square { border-radius: var(--radius-seg); }

/* ANSLAG — følger alle estimater (realisering, reserve, fortettingspotensial) sammen med kilde og dato. */
.ds-anslag {
  display: inline-flex; align-items: center; padding: 1px 6px;
  font: 700 10px/1.3 var(--font-sans); letter-spacing: .03em; text-transform: uppercase; color: var(--n700);
  border: 1px dashed var(--n500); border-radius: var(--radius-full); white-space: nowrap; vertical-align: middle;
}
.ds-anslag-src { font-size: var(--fs-label); color: var(--n600); }

/* Teller-prikk (bjelle, uleste) */
.ds-count-dot {
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--blue-400); color: var(--n0); font: 700 9px/15px var(--font-sans); text-align: center;
}
.ds-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--n400); flex: none; }
.ds-dot--sm { width: 6px; height: 6px; }
.ds-dot--done { background: var(--n800); }
.ds-dot--current { background: var(--blue-400); }
.ds-dot--unread { background: var(--blue-400); }

/* Avatar — pastell, mørk tekst, innvendig hårfin kant. 24 standard, 22 tabell, 20 stabel, 18 tavle. */
.ds-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--avatar-1); color: var(--n800);
  font: 600 9px/1 var(--font-sans); letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(14, 16, 26, .10);
}
.ds-avatar--22 { width: 22px; height: 22px; font-size: 8px; }
.ds-avatar--20 { width: 20px; height: 20px; font-size: 8px; }
.ds-avatar--18 { width: 18px; height: 18px; font-size: 7px; }
.ds-avatar--28 { width: 28px; height: 28px; font-size: 10px; }
.ds-avatar--c1 { background: var(--avatar-1); } .ds-avatar--c2 { background: var(--avatar-2); }
.ds-avatar--c3 { background: var(--avatar-3); } .ds-avatar--c4 { background: var(--avatar-4); }
.ds-avatar-stack { display: inline-flex; gap: 2px; }

/* Arbeidsflytstatus: statusfarget ikon + nøytralt ord (aldri semantisk farge). */
.ds-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--n700); white-space: nowrap; }
.ds-status svg { width: 13px; height: 13px; }
.ds-status--ikke_vurdert svg { color: var(--n500); }
.ds-status--til_vurdering svg { color: var(--blue-300); }
.ds-status--anbefalt svg { color: var(--blue-400); }
.ds-status--klar_for_vedtak svg { color: var(--blue-500); }
.ds-status--vedtatt svg { color: var(--n800); }
.ds-status--neutral svg { color: var(--n700); }

/* 6 ─ Skjemaelementer ──────────────────────────────────────────────────── */
.ds-field { display: block; }
.ds-input, .ds-select, .ds-textarea {
  display: block; width: 100%; height: 30px; padding: 0 10px;
  font: 400 13px/1.4 var(--font-sans); color: var(--n700);
  background: var(--n100); border: 1px solid var(--n550); border-radius: var(--radius);   /* kant ≥ 3:1 (WCAG 1.4.11) */
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--n600); }
.ds-input:hover, .ds-select:hover, .ds-textarea:hover { background: var(--n200); }
.ds-input:focus, .ds-select:focus, .ds-textarea:focus,
.ds-inputwrap:focus-within { background: var(--n0); border-color: var(--focus-border); box-shadow: var(--ring-focus-input); outline: none; }
.ds-input--sm { height: var(--control-h); }
.ds-input--num { text-align: left; font-variant-numeric: tabular-nums; }
.ds-input[aria-invalid="true"] { border-color: var(--danger); }
.ds-textarea { height: auto; min-height: 72px; padding: 8px 10px; line-height: 1.5; color: var(--n800); resize: vertical; }
.ds-select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237C91A5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
/* Felt med ikon / tastetips: <label class="ds-inputwrap">ikon <input> <kbd class="ds-kbd">/</kbd></label> */
.ds-inputwrap {
  display: flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 10px;
  background: var(--n100); border: 1px solid var(--n550); border-radius: var(--radius); color: var(--n600);
  font-size: 13px; transition: background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.ds-inputwrap:hover { background: var(--n200); }
.ds-inputwrap svg { width: 14px; height: 14px; flex: none; }
.ds-inputwrap input { flex: 1 1 0; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--n700); padding: 0; }
.ds-inputwrap input::placeholder { color: var(--n600); }
.ds-field__hint { display: block; margin-top: 5px; font-size: var(--fs-label); color: var(--n600); line-height: 1.5; }
.ds-field__error { display: block; margin-top: 5px; font-size: var(--fs-label); color: var(--danger); }
.ds-autosave { font-size: var(--fs-label); color: var(--n600); display: inline-flex; gap: 5px; align-items: center; }

/* Avkrysningsboks: <label class="ds-checkbox"><input type="checkbox"><span class="ds-checkbox__box"></span>Tekst</label> */
.ds-checkbox, .ds-radio { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--n700); cursor: pointer; }
.ds-checkbox input, .ds-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.ds-checkbox__box {
  width: 16px; height: 16px; flex: none; border-radius: var(--radius-sm);
  border: 1px solid var(--n550); background: var(--n0) center / 10px 10px no-repeat;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.ds-checkbox:hover .ds-checkbox__box { border-color: var(--n600); }
.ds-checkbox input:checked + .ds-checkbox__box {
  background-color: var(--blue-400); border-color: var(--blue-400);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 5 8.6 9.5 3.8' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.ds-checkbox input:indeterminate + .ds-checkbox__box {
  background-color: var(--blue-400); border-color: var(--blue-400);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6h6' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.ds-checkbox input:focus-visible + .ds-checkbox__box,
.ds-radio input:focus-visible + .ds-radio__dot { box-shadow: var(--ring-focus); }
.ds-checkbox input:disabled ~ *, .ds-radio input:disabled ~ * { opacity: .5; }
/* Radio: <label class="ds-radio"><input type="radio"><span class="ds-radio__dot"></span>Tekst</label> */
.ds-radio__dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1px solid var(--n550); background: var(--n0); transition: border-width var(--dur-fast) var(--ease), border-color var(--dur-fast) ease; }
.ds-radio input:checked + .ds-radio__dot { border: 5px solid var(--blue-400); }

/* Valgkort (radiokort): saksbehandlingsrute (A4) og strategi (D1, --card). */
.ds-choice {
  position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px;
  border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.ds-choice:hover { border-color: var(--n500); }
.ds-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ds-choice .ds-radio__dot { margin-top: 2px; }
.ds-choice.is-selected, .ds-choice:has(input:checked) { border-color: var(--blue-400); }
.ds-choice.is-selected .ds-radio__dot, .ds-choice input:checked + .ds-radio__dot { border: 5px solid var(--blue-400); }
.ds-choice:has(input:focus-visible) { box-shadow: var(--ring-focus); }
.ds-choice__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 0; }
.ds-choice__title { font-size: 13px; font-weight: 500; color: var(--n800); }
.ds-choice__desc { font-size: var(--fs-label); color: var(--n600); line-height: 1.45; }
.ds-choice.is-invalid { border-color: var(--danger); }
.ds-choice.is-disabled { opacity: .55; cursor: not-allowed; }
.ds-choice--card { flex-direction: column; gap: 8px; padding: 16px; }
.ds-choice--card .ds-choice__head { display: flex; align-items: center; gap: 10px; width: 100%; }
.ds-choice--card .ds-choice__title { font-size: 15px; font-weight: 600; flex: 1 1 0; }
.ds-choice--card .ds-choice__desc { font-size: 13px; color: var(--n700); line-height: 1.5; }
.ds-choice--card.is-selected, .ds-choice--card:has(input:checked) { border: 2px solid var(--blue-400); background: var(--blue-50); padding: 15px; }
.ds-choices { display: flex; flex-direction: column; gap: 6px; }

/* Switch: <button class="ds-switch" role="switch" aria-checked="false"></button> (30×18) */
.ds-switch {
  position: relative; flex: none; width: 30px; height: 18px; padding: 0; border: 0; border-radius: var(--radius-full);
  background: var(--n550); cursor: pointer; transition: background-color 150ms ease;   /* av-spor ≥ 3:1 mot hvit */
}
.ds-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--n0); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left 150ms var(--ease);
}
.ds-switch[aria-checked="true"], .ds-switch.is-on { background: var(--blue-400); }
.ds-switch[aria-checked="true"]::after, .ds-switch.is-on::after { left: 14px; }
.ds-switch[disabled] { opacity: .5; cursor: default; }

/* SegmentedControl: fylt N100-spor, hvit valgt del. <div class="ds-seg" role="group"><button aria-pressed="true">… */
.ds-seg {
  display: inline-flex; align-items: stretch; padding: 3px; gap: 0;
  background: var(--n100); border-radius: var(--radius); font: 500 13px/1.3 var(--font-sans);
}
.ds-seg__opt, .ds-seg > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 4px 12px; border: 0; border-radius: var(--radius-seg); background: transparent; color: var(--n700);
  font: inherit; white-space: nowrap; cursor: pointer; transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.ds-seg__opt:hover, .ds-seg > button:hover { color: var(--n800); }
.ds-seg__opt svg, .ds-seg > button svg { width: 13px; height: 13px; }
.ds-seg .is-active, .ds-seg [aria-pressed="true"], .ds-seg [aria-selected="true"], .ds-seg [aria-checked="true"] {
  background: var(--n0); color: var(--n800); box-shadow: var(--shadow-xs);
}
.ds-seg--sm { font-size: 12px; }
.ds-seg--sm .ds-seg__opt, .ds-seg--sm > button { padding: 4px 10px; }
.ds-seg--block { display: flex; width: 100%; }
.ds-seg--block .ds-seg__opt, .ds-seg--block > button { flex: 1 1 0; padding: 4px 0; }
/* Kartvariant: hvitt spor med kant, mørk valgt del (A3 Totalt / Siden 2020). */
.ds-seg--map { background: var(--n0); border: 1px solid var(--n400); box-shadow: var(--shadow-sm); font-size: 12px; }
.ds-seg--map .ds-seg__opt, .ds-seg--map > button { padding: 4px 10px; }
.ds-seg--map .is-active, .ds-seg--map [aria-pressed="true"], .ds-seg--map [aria-selected="true"] { background: var(--n800); color: var(--n0); box-shadow: none; }

/* FilterChip: <button class="ds-chip">Pulje ⌄</button> · aktiv: .is-active med × */
.ds-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px;
  font: 400 12px/1 var(--font-sans); color: var(--n700); white-space: nowrap;
  background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius-full); cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.ds-chip:hover { background: var(--n75); }
.ds-chip svg { width: 12px; height: 12px; }
.ds-chip--sm { height: 24px; padding: 0 8px; }
.ds-chip.is-active, .ds-chip[aria-pressed="true"] { background: var(--blue-100); color: var(--blue-500); border-color: var(--blue-100); font-weight: 500; }
.ds-chip.is-active:hover { background: var(--blue-200); border-color: var(--blue-200); }
.ds-chip__clear { display: inline-flex; margin-right: -3px; padding: 1px; border-radius: 50%; }
.ds-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Evalueringsskjema (ThemeRating) — tre 28×28-fliser per tema.
   Forslag = 1 px stiplet tonekant · Valgt = 2 px tonekant + tonet bakgrunn. */
.ds-rating { display: grid; grid-template-columns: repeat(3, 28px); gap: 4px; justify-content: center; }
.ds-rating__opt {
  width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--n0); border: 1px solid var(--n550); border-radius: var(--radius); color: var(--n550); cursor: pointer;   /* ≥ 3:1 (WCAG 1.4.11) */
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.ds-rating__opt svg { width: 14px; height: 14px; }
.ds-rating__opt:hover { border-color: var(--tone-border, var(--n500)); color: var(--tone, var(--n700)); }
.ds-rating__opt.is-suggested { border: 1px dashed var(--tone-border); color: var(--tone); }
.ds-rating__opt.is-chosen, .ds-rating__opt[aria-checked="true"] { border: 2px solid var(--tone-border); background: var(--tone-bg); color: var(--tone); }
.ds-ratingtable { border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-ratingtable__row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--n200); }
.ds-ratingtable__row:last-child { border-bottom: 0; }
.ds-ratingtable__head { font-size: var(--fs-label); font-weight: 600; color: var(--n600); }
.ds-ratingtable__head > :last-child { text-align: center; }
.ds-ratingtable__theme { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ds-ratingtable__theme > :first-child { font-size: 13px; font-weight: 500; color: var(--n800); }
.ds-ratingtable__theme > :last-child:not(:first-child) { font-size: var(--fs-label); color: var(--n600); }
.ds-ratingtable__legend { display: flex; gap: 14px; padding: 8px 12px; font-size: var(--fs-label); color: var(--n600); }
.ds-ratingtable__legend span { display: inline-flex; gap: 5px; align-items: center; }
.ds-legend-sugg { width: 12px; height: 12px; border: 1px dashed var(--n600); border-radius: 3px; }
.ds-legend-chosen { width: 12px; height: 12px; background: var(--n800); border-radius: 3px; }

/* DecisionPicker — Samlet revisjonsbehov (tre fliser m/ ikon, ord, tastetips). */
.ds-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ds-pick__opt {
  display: flex; align-items: center; gap: 5px; padding: 7px 10px; min-height: 36px;
  background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius);
  font: 600 13px/1.25 var(--font-sans); color: var(--tone, var(--n700)); text-align: left; cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.ds-pick__opt svg { width: 14px; height: 14px; }
.ds-pick__opt:hover { border-color: var(--tone-border, var(--n500)); }
.ds-pick__opt.is-suggested { border-style: dashed; border-color: var(--tone-border); }
.ds-pick__opt.is-chosen, .ds-pick__opt[aria-checked="true"] { border: 2px solid var(--tone-border); background: var(--tone-bg); padding: 6px 9px; }
.ds-pick__key { margin-left: auto; font: 500 11px/1 var(--font-mono); color: var(--n600); }
.ds-pick--lg .ds-pick__opt { min-height: 48px; justify-content: center; font-size: 14px; gap: 6px; }
.ds-pick--lg { gap: 8px; }
.ds-pick__note { display: flex; gap: 6px; font-size: var(--fs-label); line-height: 1.5; color: var(--n700); margin-top: 8px; }
.ds-pick__note svg { width: 12px; height: 12px; margin-top: 2px; }
.ds-swatchrow { display: inline-flex; gap: 3px; }
.ds-swatchrow > span { width: 10px; height: 10px; border-radius: 2px; background: var(--n300); }

/* 7 ─ Data ──────────────────────────────────────────────────────────────── */
/* Tabell: 44 px rader, klebrig hode på N50, tall høyrejustert (.ds-num). */
.ds-table-wrap { overflow: auto; min-height: 0; position: relative; }
.ds-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; color: var(--n700); }
.ds-table th {
  position: sticky; top: 0; z-index: 1;
  height: 33px; padding: 8px 12px; text-align: left; white-space: nowrap; vertical-align: middle;
  font: 600 11px/1.3 var(--font-sans); color: var(--n600); background: var(--n50); border-bottom: 1px solid var(--n400);
}
.ds-table th.ds-num, .ds-table td.ds-num { text-align: right; }
.ds-table th[aria-sort] { color: var(--n800); cursor: pointer; }
.ds-table th button { all: unset; cursor: pointer; display: inline-flex; gap: 3px; align-items: center; }
.ds-table th button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }
.ds-table td { height: 44px; padding: 0 12px; border-bottom: 1px solid var(--n200); vertical-align: middle; white-space: nowrap; }
.ds-table--wrap td, .ds-table td.ds-wrap { white-space: normal; }
.ds-table td.ds-num, .ds-table .ds-tnum { font-variant-numeric: tabular-nums; }
.ds-table th:first-child, .ds-table td:first-child { padding-left: 24px; }
.ds-table th:last-child, .ds-table td:last-child { padding-right: 24px; }
.ds-table tbody tr { transition: background-color var(--dur-fast) ease; }
.ds-table tbody tr:hover { background: var(--n75); }
.ds-table tbody tr.is-checked { background: var(--blue-50); }
.ds-table tbody tr.is-focused > td:first-child, .ds-table tbody tr:focus-visible > td:first-child { box-shadow: inset 3px 0 0 var(--blue-400); }
.ds-table tbody tr:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.ds-table tbody tr.is-selected { background: var(--blue-50); }
.ds-table tbody tr.is-selected > td:first-child { box-shadow: inset 3px 0 0 var(--blue-400); }
.ds-table tbody tr.is-muted td { color: var(--n600); }
.ds-table tfoot td { font-weight: 600; color: var(--n800); border-bottom: 0; }
.ds-table__check { width: 36px; padding-right: 0 !important; }
.ds-table__id { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--n700); }
.ds-table__name { max-width: 0; width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--n800); font-weight: 500; }
.ds-table__sub { display: block; font-size: var(--fs-label); color: var(--n600); font-weight: 400; }
.ds-table__dim { color: var(--n600); font-size: 12px; }
.ds-table__empty { color: var(--n500); }
/* Kompakt (D3, C4, A1): mindre rader, hode med kant over og under. */
.ds-table--compact th { padding: 8px 10px; border-top: 1px solid var(--n400); height: auto; }
.ds-table--compact td { height: auto; padding: 9px 10px; white-space: normal; }
.ds-table--compact th:first-child, .ds-table--compact td:first-child { padding-left: 10px; }
.ds-table--compact th:last-child, .ds-table--compact td:last-child { padding-right: 10px; }
/* Tett (A4 «Hvis planen oppheves», DOK-lag): 12 px, ingen hodefarge. */
.ds-table--dense { font-size: 12px; }
.ds-table--dense th { position: static; background: transparent; padding: 6px 8px 6px 0; height: auto; border-bottom-color: var(--n200); }
.ds-table--dense td { height: auto; padding: 6px 8px 6px 0; color: var(--n800); white-space: normal; }
.ds-table--dense th:first-child, .ds-table--dense td:first-child { padding-left: 0; }
.ds-table--dense th:last-child, .ds-table--dense td:last-child { padding-right: 0; }
.ds-table--dense tbody tr:hover { background: transparent; }
.ds-table--boxed { border: 1px solid var(--n400); border-radius: var(--radius); overflow: hidden; }
.ds-table--boxed tbody tr:last-child td { border-bottom: 0; }
.ds-table--plain tbody tr:hover { background: transparent; }
.ds-table-foot { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--n400); font-size: var(--fs-label); color: var(--n600); }

/* Liste (A3 planliste, D3 kontroller, B4 planer i pakken, C5 pakker). */
.ds-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ds-list__head {
  position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
  padding: 8px 16px; font: 600 11px/1.3 var(--font-sans); color: var(--n600); background: var(--n50); border-bottom: 1px solid var(--n400);
}
.ds-list__item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center;
  padding: 9px 16px; border-bottom: 1px solid var(--n200); border-left: 3px solid transparent; padding-left: 13px;
  color: inherit; text-decoration: none; background: transparent; cursor: pointer;
  transition: background-color var(--dur-fast) ease;
}
.ds-list__item:hover { background: var(--n75); text-decoration: none; }
.ds-list__item.is-selected, .ds-list__item[aria-selected="true"], .ds-list__item[aria-current="true"] { border-left-color: var(--blue-400); background: var(--blue-50); }
.ds-list__item.is-selected .ds-list__title { font-weight: 600; }
.ds-list__item.is-highlight { background: var(--n75); }
.ds-list__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ds-list__title { font-size: 13px; font-weight: 500; color: var(--n800); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-list__title--wrap { white-space: normal; }
.ds-list__meta { font-size: var(--fs-label); color: var(--n600); display: flex; gap: 5px; align-items: center; min-width: 0; }
.ds-list__meta svg { width: 12px; height: 12px; }
.ds-list__meta--warning { color: var(--warning); }
.ds-list__value { font-size: 13px; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; text-align: right; }
.ds-list__value--dim { font-weight: 400; color: var(--n700); }
.ds-list__group { display: flex; align-items: center; gap: 8px; padding: 12px 20px 6px; font: 600 12px/1.3 var(--font-sans); color: var(--tone, var(--n700)); }
.ds-list__group svg { width: 14px; height: 14px; }
.ds-list__group-meta { color: var(--n600); font-weight: 400; }
.ds-list--inset .ds-list__item { padding-left: 17px; padding-right: 20px; }
.ds-list__foot { display: flex; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--n400); font-size: var(--fs-label); color: var(--n600); }
.ds-list__foot b { font-family: var(--font-mono); font-weight: 500; color: var(--n700); }

/* Rader med flisikon (A2 «Neste steg», C5 dokumenter). */
.ds-rows { display: flex; flex-direction: column; border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--n200); }
.ds-row:last-child { border-bottom: 0; }
.ds-row__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-row__title { font-size: 14px; font-weight: 500; color: var(--n800); }
.ds-row__meta { font-size: var(--fs-meta); color: var(--n600); }
.ds-row__aside { display: flex; align-items: center; gap: 12px; }
.ds-row--sm { padding: 11px 14px; }
.ds-row--sm .ds-row__title { font-size: 13px; }
.ds-tile-icon { width: 28px; height: 28px; border-radius: var(--radius); background: var(--n100); color: var(--n700); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ds-tile-icon svg { width: 16px; height: 16px; }

/* Nøkkeltall-stripe (A2, B3, C4): kantet, skillelinjer, ett tall per celle. */
.ds-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); overflow: hidden; }
.ds-stat { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-right: 1px solid var(--n400); min-width: 0; }
.ds-stat:last-child { border-right: 0; }
.ds-stat__label { font-size: var(--fs-meta); font-weight: 600; color: var(--n600); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ds-stat__value { font-size: var(--fs-display); font-weight: 600; color: var(--n800); line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ds-stat__unit { font-size: 14px; font-weight: 400; color: var(--n700); letter-spacing: 0; margin-left: 4px; }
.ds-stat__note { font-size: var(--fs-meta); line-height: 1.5; color: var(--n700); }
.ds-stat__link { margin-top: auto; font-size: 13px; font-weight: 500; }
.ds-stat--muted { background: var(--n75); }
.ds-stats--md .ds-stat { padding: 14px 16px; gap: 4px; }
.ds-stats--md .ds-stat__value { font-size: 24px; }
.ds-stats--md .ds-stat__unit { font-size: 13px; }
.ds-stats--sm .ds-stat { padding: 12px 14px; gap: 2px; }
.ds-stats--sm .ds-stat__label { font-size: var(--fs-label); }
.ds-stats--sm .ds-stat__value { font-size: 22px; }
.ds-stats--sm .ds-stat__unit { font-size: 13px; }

/* Faktarutenett (A4): 4 kolonner, etikett 11/600, verdi 13/500, under 11. */
.ds-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--n200); border: 1px solid var(--n400); border-radius: var(--radius); overflow: hidden; }
.ds-fact { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--n0); min-width: 0; }
.ds-fact__label { font-size: var(--fs-label); font-weight: 600; color: var(--n600); display: flex; gap: 4px 6px; align-items: center; flex-wrap: wrap; }
.ds-fact__value { font-size: 13px; font-weight: 500; color: var(--n800); font-variant-numeric: tabular-nums; }
.ds-fact__sub { font-size: var(--fs-label); color: var(--n600); }
.ds-facts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ds-facts--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Definisjonsliste (D1 «Slik blir planene fordelt», C2 puljeregler). */
.ds-deflist { display: flex; flex-direction: column; }
.ds-def { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 5px 0; border-bottom: 1px solid var(--n200); font-size: 13px; align-items: baseline; }
.ds-def__value { font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; text-align: right; }
.ds-def__desc { grid-column: 1 / -1; font-size: var(--fs-meta); line-height: 1.5; color: var(--n700); }
.ds-deflist--rules .ds-def { padding: 10px 0; border-bottom: 0; border-top: 1px solid var(--n200); }
.ds-deflist--rules .ds-def__term { font-weight: 600; color: var(--n800); }
.ds-deflist--rules .ds-def__value { font-size: var(--fs-meta); font-weight: 400; color: var(--n600); }

/* Fremdriftslinje (puljetabell, vedtakspakke). */
.ds-progress { position: relative; height: 6px; border-radius: 3px; background: var(--n100); overflow: hidden; flex: 1 1 0; min-width: 40px; }
.ds-progress__bar { height: 100%; background: var(--blue-400); width: 0; transition: width var(--dur-slow) var(--ease); }
.ds-progress--lg { height: 10px; border-radius: 5px; }
.ds-progress--dark .ds-progress__bar { background: var(--n600); }
.ds-progress-row { display: flex; align-items: center; gap: 8px; }
.ds-progress-row__label { font-size: var(--fs-meta); color: var(--n600); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Stolpeliste (A2 kategorier, B3 boligreserve). */
.ds-barlist { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.ds-barlist__row { display: grid; grid-template-columns: minmax(0, 1fr) 40px 70px; gap: 8px; align-items: center; }
.ds-barlist__value { text-align: right; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; }
.ds-barlist__track { height: 6px; border-radius: 3px; background: var(--n100); overflow: hidden; }
.ds-barlist__fill { height: 100%; background: var(--n600); border-radius: 3px; }
.ds-barlist--wide { font-size: 12px; gap: 10px; }
.ds-barlist--wide .ds-barlist__row { grid-template-columns: 110px minmax(0, 1fr) 56px; gap: 10px; }
.ds-barlist--wide .ds-barlist__row > :last-child { text-align: right; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; }
.ds-barlist--wide .ds-barlist__track { height: 14px; }
.ds-barlist--wide .ds-barlist__fill { background: var(--n700); border-radius: 0; }

/* Segmentert statuslinje (A2): 10 px, segment per arbeidsflytstatus + forklaring med ikon og tall. */
.ds-statusbar { display: flex; height: 10px; gap: 2px; border-radius: 5px; overflow: hidden; background: var(--n200); }
.ds-statusbar__seg { height: 100%; border: 0; padding: 0; min-width: 2px; background: var(--n200); cursor: pointer; transition: opacity var(--dur-fast) ease; }
.ds-statusbar__seg:hover { opacity: .8; }
.ds-statusbar__seg--vedtatt { background: var(--n800); }
.ds-statusbar__seg--klar_for_vedtak { background: var(--blue-500); }
.ds-statusbar__seg--anbefalt { background: var(--blue-400); }
.ds-statusbar__seg--til_vurdering { background: var(--blue-200); }
.ds-statusbar__seg--ikke_vurdert { background: var(--n200); flex: 1 1 0; }
.ds-statusbar__legend { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 4px; font-size: var(--fs-meta); color: var(--n700); }
.ds-statusbar__legend .ds-status { font-variant-numeric: tabular-nums; }
.ds-statusbar__legend button.ds-status { background: none; border: 0; padding: 0; cursor: pointer; }
.ds-statusbar__legend button.ds-status:hover { color: var(--n800); text-decoration: underline; }

/* Fremdriftsoverskrift (A2: «127 av 450 planer vurdert»). */
.ds-headline { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ds-headline__value { font-size: var(--fs-display); font-weight: 600; color: var(--n800); letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ds-headline__label { font-size: 16px; color: var(--n700); }
.ds-headline__delta { font-size: 13px; color: var(--n600); }

/* Seksjon og bokser */
.ds-section { display: flex; flex-direction: column; gap: 10px; }
.ds-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ds-section__title { font-size: 16px; font-weight: 600; color: var(--n800); margin: 0; display: flex; align-items: center; gap: 10px; }
.ds-section__title--sm { font-size: 14px; }
.ds-section__meta { font-size: var(--fs-meta); color: var(--n600); display: inline-flex; gap: 5px; align-items: center; }
.ds-box { border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-box--pad { padding: 14px; }
.ds-box--sub { background: var(--n75); border-color: transparent; padding: 14px; }
.ds-box--card { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.ds-box__title { font-size: 13px; font-weight: 600; color: var(--n800); }
.ds-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }

/* 8 ─ Tillit ────────────────────────────────────────────────────────────── */
/* FindingRow: ikon · funn · kilde (lag/dokument/side/dato) · ConfidenceMeter */
.ds-findings { display: flex; flex-direction: column; border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); overflow: hidden; }
.ds-finding { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--n200); }
.ds-finding:last-child { border-bottom: 0; }
.ds-finding__icon { color: var(--n700); margin-top: 2px; }
.ds-finding__icon svg { width: 16px; height: 16px; }
.ds-finding__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ds-finding__text { font-size: 13px; line-height: 1.5; color: var(--n800); }
.ds-finding__source { font-size: var(--fs-meta); color: var(--blue-400); }
.ds-finding__source--plain { color: var(--n600); }
.ds-finding--nohit .ds-finding__text, .ds-finding--nohit .ds-finding__icon { color: var(--n600); }
.ds-finding--unchecked .ds-finding__text, .ds-finding--unchecked .ds-finding__icon { color: var(--warning); }
.ds-findings__intro { display: inline-flex; gap: 5px; align-items: center; font-size: var(--fs-meta); color: var(--n600); }
.ds-findings__intro svg { width: 13px; height: 13px; }

/* ConfidenceMeter: tre 14×5-stolper + ord. Lesbar uten farge og uten falsk presisjon. */
.ds-conf { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-label); color: var(--n600); white-space: nowrap; }
.ds-conf__bars { display: inline-flex; gap: 2px; }
.ds-conf__bar { width: 14px; height: 5px; border-radius: 1px; background: var(--n300); }
.ds-conf[data-level="1"] .ds-conf__bar:nth-child(-n+1),
.ds-conf[data-level="2"] .ds-conf__bar:nth-child(-n+2),
.ds-conf[data-level="3"] .ds-conf__bar:nth-child(-n+3) { background: var(--n700); }

/* CheckRow (D3, D4, inline i A4): alvorsikon · tittel · forklaring · referanse · handling */
.ds-checklist { display: flex; flex-direction: column; }
.ds-checkrow { --tone: var(--n700); display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--n200); }
.ds-checkrow__icon { color: var(--tone); margin-top: 1px; }
.ds-checkrow__icon svg { width: 16px; height: 16px; }
.ds-checkrow__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ds-checkrow__title { font-size: 13px; font-weight: 500; color: var(--n800); }
.ds-checkrow__text { font-size: var(--fs-meta); line-height: 1.5; color: var(--n700); }
.ds-checkrow__ref { font-size: var(--fs-label); color: var(--n600); }
.ds-checkrow__cta { font: 500 12px/1.4 var(--font-sans); color: var(--blue-400); white-space: nowrap; background: none; border: 0; padding: 0; cursor: pointer; }
.ds-checkrow__cta:hover { text-decoration: underline; }
.ds-checkrow--danger { --tone: var(--danger); }
.ds-checkrow--warning { --tone: var(--warning); }
.ds-checkrow--success { --tone: var(--success); }
.ds-checkrow--info { --tone: var(--info); }
.ds-checkrow--inline { padding: 8px 10px; border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-checkrow--inline.ds-checkrow--danger { border-color: var(--danger); background: var(--danger-bg); }
.ds-checkrow--inline.ds-checkrow--warning { border-color: var(--warning-border); background: var(--warning-bg); }

/* Melding/varselboks (B7 feil, B3 advarsel, C5 info, D2 uplassert). */
.ds-callout { --tone: var(--info); align-self: start; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--info-bg); color: var(--n800); font-size: 13px; line-height: 1.5; }
.ds-callout > svg { color: var(--tone); width: 16px; height: 16px; margin-top: 2px; flex: none; }
.ds-callout__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 0; }
.ds-callout__title { font-weight: 600; color: var(--tone); }
.ds-callout__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ds-callout--info { --tone: var(--info); background: var(--info-bg); }
.ds-callout--success { --tone: var(--success); background: var(--success-bg); }
.ds-callout--warning { --tone: var(--warning); background: var(--warning-bg); }
.ds-callout--danger { --tone: var(--danger); background: var(--danger-bg); }
.ds-callout--neutral { --tone: var(--n700); background: var(--n75); }
.ds-callout--outline { background: var(--n0); border: 1px solid var(--n400); }
.ds-callout--dashed { border: 1px dashed var(--warning-border); }
.ds-callout--sm { font-size: var(--fs-meta); padding: 10px 12px; gap: 8px; }
.ds-callout--sm > svg { width: 14px; height: 14px; margin-top: 1px; }

/* Tilstander (B7) */
.ds-empty { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 24px 0; max-width: 520px; }
.ds-empty__title { font-size: 16px; font-weight: 600; color: var(--n800); margin: 0; display: flex; align-items: center; gap: 10px; }
.ds-empty__text { font-size: 13px; line-height: 1.5; color: var(--n700); }
.ds-empty__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ds-empty--center { align-items: center; text-align: center; margin: 0 auto; }
.ds-done-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ds-done-icon svg { width: 16px; height: 16px; }

/* Mangler data (B7 «Kart · mangler dispensasjoner»): forklaring + opplasting + reserveløsning. */
.ds-state { position: relative; display: flex; align-items: center; justify-content: center; padding: 24px; border-radius: var(--radius); background: var(--n100); min-height: 160px; }
.ds-state__card { width: 320px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--n0); box-shadow: var(--shadow-lg); }
.ds-state__title { font-size: 14px; font-weight: 600; color: var(--n800); display: flex; gap: 8px; align-items: center; }
.ds-state__text { font-size: var(--fs-meta); line-height: 1.5; color: var(--n700); }
.ds-state__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ds-state--inline { background: transparent; padding: 0; min-height: 0; justify-content: flex-start; }
.ds-state--inline .ds-state__card { box-shadow: none; border: 1px dashed var(--n500); width: auto; }
/* Delvis data: verdien holdes tilbake under 90 % dekning. */
.ds-withheld { display: inline-flex; align-items: center; gap: 4px; color: var(--warning); white-space: nowrap; }
.ds-withheld svg { width: 12px; height: 12px; }
.ds-coverage { font-size: var(--fs-meta); line-height: 1.5; color: var(--n700); }

/* Skjelett og lasting */
@keyframes ds-shimmer { 0% { opacity: 1; } 50% { opacity: .55; } 100% { opacity: 1; } }
@keyframes ds-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@keyframes ds-spin { to { transform: rotate(360deg); } }
.ds-skel { display: block; height: 10px; width: 100%; background: var(--n100); border-radius: 5px; animation: ds-shimmer 1.4s ease infinite; }
.ds-skel--title { height: 28px; width: 60%; }
.ds-skel--line { height: 10px; }
.ds-skel--block { height: 80px; border-radius: var(--radius); }
.ds-skel--row { height: 44px; border-radius: 0; border-bottom: 1px solid var(--n0); }
.ds-skel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ds-loadline { position: relative; height: 2px; background: var(--n100); overflow: hidden; border-radius: 1px; }
.ds-loadline::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--blue-400); animation: ds-indeterminate 1.2s var(--ease) infinite; }
.ds-loadline--determinate::after { animation: none; width: var(--p, 0%); }
.ds-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--n300); border-top-color: var(--blue-400); border-radius: 50%; animation: ds-spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .ds-skel, .ds-loadline::after, .ds-spinner { animation-duration: 3s; }
  .ds-drawer, .ds-modal, .ds-popover { animation: none !important; }
}

/* Samtidig redigering (PresenceChip / LiveCursor) — krever delt tilstand; brukes bare med ekte kilde. */
.ds-presence { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 4px; border-radius: var(--radius-full); background: var(--n75); font-size: var(--fs-meta); color: var(--n700); white-space: nowrap; }
.ds-cofield { position: relative; border: 1px solid var(--discovery); border-radius: var(--radius); padding: 10px; }
.ds-cofield__tag { position: absolute; top: -10px; right: 10px; padding: 1px 6px; border-radius: var(--radius-sm); background: var(--discovery); color: var(--n0); font: 600 10px/1.4 var(--font-sans); }
.ds-cofield__caret { display: inline-block; width: 2px; height: 15px; background: var(--discovery); vertical-align: middle; }

/* Aktivitetslogg (A2 «Aktivitet», C7) — kun ekte, lokale hendelser. */
.ds-feed { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ds-feed__item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; font-size: 13px; line-height: 1.45; }
.ds-feed__item--card { padding: 10px 12px; border-radius: var(--radius); background: var(--blue-50); }
.ds-feed__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-feed__body b, .ds-feed__obj { color: var(--n800); }
.ds-feed__obj { font-weight: 500; }
.ds-feed__time { font-size: var(--fs-meta); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-feed__icon { width: 24px; height: 24px; border-radius: 50%; background: var(--n100); color: var(--n700); display: inline-flex; align-items: center; justify-content: center; }
.ds-feed__icon svg { width: 13px; height: 13px; }
.ds-notif { display: grid; grid-template-columns: 8px 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--n200); }
.ds-notif .ds-dot { margin-top: 9px; }
.ds-notif:not(.is-unread) .ds-dot { background: transparent; }

/* 9 ─ Overlegg ───────────────────────────────────────────────────────────── */
@keyframes ds-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-slide-in-right { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ds-pop-in { from { transform: translateY(4px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
/* Overlegg = slør + innhold. <div class="ds-overlay"> <div class="ds-modal">…</div> </div>
   Skuff: <div class="ds-overlay ds-overlay--right"> <aside class="ds-drawer">…</aside> </div> */
.ds-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--scrim); animation: ds-fade-in var(--dur) var(--ease); }
.ds-overlay[hidden] { display: none; }
.ds-overlay--right { justify-content: flex-end; align-items: stretch; padding: 0; }
.ds-scrim { position: fixed; inset: 0; background: var(--scrim); }

/* Skuff (C2): 520 px fra høyre over 32 % N900-slør. */
.ds-drawer { position: relative; width: var(--drawer-w); max-width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--n0); box-shadow: var(--shadow-lg); animation: ds-slide-in-right var(--dur-slow) var(--ease); }
.ds-drawer__head { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--n400); }
.ds-drawer__title { flex: 1 1 0; margin: 0; font-size: 16px; font-weight: 600; color: var(--n800); }
.ds-drawer__body { flex: 1 1 0; min-height: 0; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.ds-drawer__foot { flex: none; display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--n400); background: var(--n50); }

/* Modal (C6, D4): 680 px, 8 px radius. */
.ds-modal { position: relative; width: var(--modal-w); max-width: 100%; max-height: calc(100vh - 64px); display: flex; flex-direction: column; background: var(--n0); border-radius: var(--radius-modal); box-shadow: var(--shadow-lg); animation: ds-pop-in var(--dur) var(--ease); }
.ds-modal__head { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--n400); }
.ds-modal__titles { flex: 1 1 0; display: flex; flex-direction: column; min-width: 0; }
.ds-modal__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--n800); }
.ds-modal__sub { font-size: var(--fs-meta); color: var(--n600); }
.ds-modal__tabs { padding: 0 20px; flex: none; }
.ds-modal__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.ds-modal__body--list { padding: 6px 20px 12px; gap: 0; }
/* Flex-kolonner som ruller: barn skal aldri krympes (kantede bokser med overflow:hidden kollapser ellers). */
.ds-modal__body > *, .ds-drawer__body > *, .ds-page > *, .ds-rightpanel > * { flex-shrink: 0; }
.ds-modal__foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--n400); background: var(--n50); border-radius: 0 0 var(--radius-modal) var(--radius-modal); }
.ds-modal__summary { flex: 1 1 0; font-size: var(--fs-meta); color: var(--n700); }
.ds-modal--sm { --modal-w: 480px; }
/* Tallrader i modal (C6 «Utenfor oversikten»). */
.ds-countrow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--n200); }
.ds-countrow__n { font-size: 18px; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; text-align: right; }
.ds-countrow__title { font-size: 13px; font-weight: 500; color: var(--n800); }
.ds-countrow__desc { font-size: var(--fs-meta); line-height: 1.5; color: var(--n600); }
.ds-countrow__more { grid-column: 1 / -1; padding: 4px 0 4px 68px; display: flex; flex-direction: column; gap: 6px; }
.ds-om__rows { display: flex; flex-direction: column; border-bottom: 1px solid var(--n200); }
.ds-om__list { margin: 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; font-size: var(--fs-meta); color: var(--n700); }
.ds-om__list li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--n100); }
.ds-om__list .ds-table__id { font-variant-numeric: tabular-nums; color: var(--n600); overflow: hidden; text-overflow: ellipsis; }
/* Terskler i C2: etikett til venstre, tallfelt til høyre */
.ds-thresholds { display: flex; flex-direction: column; gap: 10px; }
.ds-thresholds__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ds-threshold { display: grid; grid-template-columns: minmax(0, 1fr) 80px; align-items: center; gap: 12px; font-size: 13px; color: var(--n700); }
.ds-threshold .ds-input { background: var(--n0); }
.ds-def.is-highlight { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--blue-400); padding-left: 10px; padding-right: 10px; }
/* Kort bekreftelse (toast): mørk pille nederst midt på */
.ds-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-full); background: var(--n900); color: var(--n0); font-size: 13px; box-shadow: var(--shadow-lg); animation: ds-fade-in var(--dur) var(--ease); }
.ds-toast[hidden] { display: none; }
/* Toast løftes over BulkActionBar så den aldri dekker «Legg i vedtakspakke». */
body:has(.ds-bulkbar:not([hidden])) .ds-toast { bottom: 84px; }
@media (max-width: 1024px) { body:has(.ds-bulkbar:not([hidden])) .ds-toast { bottom: calc(var(--tabbar-h) + 76px); } }
@media (max-width: 1024px) { .ds-toast { bottom: calc(var(--tabbar-h) + 16px); } }

/* Popover (C7) og meny (C3 fargemodus). */
.ds-popover { position: absolute; z-index: 90; width: var(--popover-w); max-width: calc(100vw - 24px); display: flex; flex-direction: column; background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius-modal); box-shadow: var(--shadow-lg); animation: ds-fade-in var(--dur-fast) var(--ease); }
.ds-popover[hidden] { display: none; }
.ds-popover--static { position: relative; z-index: auto; }
.ds-popover__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--n400); }
.ds-popover__title { flex: 1 1 0; font-size: 14px; font-weight: 600; color: var(--n800); margin: 0; }
.ds-popover__body { max-height: 420px; overflow: auto; }
.ds-popover__foot { display: flex; align-items: center; gap: 6px; padding: 10px 16px; font-size: var(--fs-meta); color: var(--n600); }
.ds-menu { display: flex; flex-direction: column; padding: 6px; min-width: 220px; background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.ds-menu__label { padding: 6px 8px; font-size: var(--fs-label); font-weight: 600; color: var(--n600); }
.ds-menu__item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 8px; border: 0; border-radius: var(--radius-seg); background: transparent; text-align: left; color: var(--n700); cursor: pointer; width: 100%; }
.ds-menu__item:hover { background: var(--n75); }
.ds-menu__item.is-active, .ds-menu__item[aria-checked="true"] { background: var(--blue-50); }
.ds-menu__item .ds-menu__check { color: var(--blue-400); visibility: hidden; }
.ds-menu__item.is-active .ds-menu__check, .ds-menu__item[aria-checked="true"] .ds-menu__check { visibility: visible; }
.ds-menu__text { display: flex; flex-direction: column; min-width: 0; }
.ds-menu__title { font-size: 13px; font-weight: 500; color: var(--n800); }
.ds-menu__desc { font-size: var(--fs-label); color: var(--n600); }
.ds-menu__sep { height: 1px; background: var(--n200); margin: 4px -6px; }
.ds-swatches { display: flex; gap: 1px; height: 8px; width: 56px; }
.ds-swatches > span { flex: 1 1 0; }

/* Faner: understrek (C6/C7), lagrede visninger (B1, --views) og piller (B4, --pill). */
.ds-tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--n400); font: 500 13px/1.3 var(--font-sans); overflow-x: auto; scrollbar-width: none; }
.ds-tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 0; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--n600); font: inherit; white-space: nowrap; cursor: pointer; text-decoration: none; }
.ds-tab:hover { color: var(--n800); text-decoration: none; }
.ds-tab.is-active, .ds-tab[aria-selected="true"], .ds-tab[aria-current="page"] { color: var(--n800); border-bottom-color: var(--n800); }
.ds-tab__count { color: var(--n600); font-weight: 400; font-variant-numeric: tabular-nums; }
.ds-tab--add { color: var(--blue-400); gap: 4px; }
.ds-tab--add svg { width: 13px; height: 13px; }
.ds-tabs--sm { gap: 14px; border-bottom-color: var(--n200); }
.ds-tabs--sm .ds-tab { padding: 8px 0; }
.ds-tabs--views { gap: 2px; border-bottom-color: var(--n200); }
.ds-tabs--views .ds-tab { padding: 8px 10px; color: var(--n700); }
.ds-tabs--pill { gap: 2px; border-bottom: 0; }
.ds-tabs--pill .ds-tab { padding: 5px 10px; margin: 0; border: 0; border-radius: var(--radius); color: var(--n700); }
.ds-tabs--pill .ds-tab.is-active, .ds-tabs--pill .ds-tab[aria-selected="true"] { background: var(--n100); color: var(--n800); }

/* Trekkspill: <details class="ds-acc"><summary class="ds-acc__head">…</summary><div class="ds-acc__body">… */
.ds-acc { border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-acc__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; user-select: none; }
.ds-acc__head::-webkit-details-marker { display: none; }
.ds-acc__chev { color: var(--n700); transition: transform var(--dur) var(--ease); }
.ds-acc__chev svg, svg.ds-acc__chev { width: 16px; height: 16px; }
.ds-acc[open] > .ds-acc__head .ds-acc__chev { transform: rotate(90deg); }
.ds-acc[open] > .ds-acc__head { border-bottom: 1px solid var(--n200); }
.ds-acc__title { flex: 1 1 0; font-size: 14px; font-weight: 600; color: var(--n800); }
.ds-acc__meta { font-size: var(--fs-meta); color: var(--n600); }
.ds-acc__body { padding: 12px 14px 14px 40px; font-size: 13px; line-height: 1.55; }
.ds-acc--sub { border: 0; border-radius: 0; border-top: 1px solid var(--n200); }
.ds-acc--sub > .ds-acc__head { padding: 10px 14px; background: var(--n50); }
.ds-acc--sub .ds-acc__title { font-size: 13px; }
.ds-acc--sub .ds-acc__body { padding: 0 14px 8px 40px; }
.ds-acc--flush { border: 0; border-radius: 0; background: transparent; }
.ds-acc--flush > .ds-acc__head { padding: 6px 0; }
.ds-acc--flush[open] > .ds-acc__head { border-bottom: 0; }
.ds-acc--flush .ds-acc__title { font-size: 13px; }
.ds-acc--flush .ds-acc__body { padding: 4px 0 10px 26px; }
.ds-kvgrid { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; }
.ds-kvgrid > :nth-child(odd) { font-weight: 600; color: var(--n800); }
.ds-kvgrid > :nth-child(even) { text-wrap: pretty; }

/* 10 ─ Kart ─────────────────────────────────────────────────────────────── */
.ds-mapwrap { position: relative; min-width: 0; min-height: 0; background: var(--n100); overflow: hidden; }
.ds-mapwrap__layer { position: absolute; inset: 0; }
/* Antall i en dispensasjonsklynge (kart.html): ligger over sirkelen, slipper klikk gjennom. */
.ds-cluster-count { pointer-events: none; font-size: 11px; font-weight: 600; line-height: 1; color: var(--n0); font-variant-numeric: tabular-nums; text-shadow: 0 0 2px rgba(0,0,0,.35); }
.ds-map-tl, .ds-map-tr, .ds-map-bl, .ds-map-br { position: absolute; z-index: 5; display: flex; gap: 8px; pointer-events: none; }
.ds-map-tl > *, .ds-map-tr > *, .ds-map-bl > *, .ds-map-br > * { pointer-events: auto; }
.ds-map-tl { top: 14px; left: 14px; }
.ds-map-tr { top: 14px; right: 14px; flex-direction: column; align-items: flex-end; }
.ds-map-bl { bottom: 14px; left: 14px; flex-direction: column; align-items: flex-start; }
.ds-map-br { bottom: 14px; right: 14px; flex-direction: column; align-items: flex-end; }
/* Flytende hvitt panel (7 px, shadow-sm). */
.ds-mappanel { background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.ds-mappanel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--n200); font-size: 12px; font-weight: 600; color: var(--n800); background: none; border-top: 0; border-left: 0; border-right: 0; width: 100%; cursor: pointer; text-align: left; }
.ds-mappanel__head svg { width: 14px; height: 14px; color: var(--n600); transition: transform var(--dur) var(--ease); }
.ds-mappanel.is-collapsed .ds-mappanel__head { border-bottom: 0; }
.ds-mappanel.is-collapsed .ds-mappanel__head svg { transform: rotate(180deg); }
.ds-mappanel.is-collapsed > :not(.ds-mappanel__head) { display: none; }
.ds-mappanel__group { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--n200); }
.ds-mappanel__group:last-child { border-bottom: 0; padding-bottom: 10px; }
.ds-mappanel__label { font-size: var(--fs-label); font-weight: 600; color: var(--n600); }
.ds-layerrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--n700); min-height: 20px; }
.ds-layerrow__name { flex: 1 1 0; min-width: 0; }
.ds-layerrow__src { font-size: var(--fs-label); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-mapbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius); box-shadow: var(--shadow-sm); font-size: 12px; color: var(--n700); cursor: pointer; }
.ds-mapbtn:hover { background: var(--n75); }
.ds-mapbtn svg { width: 14px; height: 14px; }
.ds-mapbtn svg:last-child:not(:first-child) { width: 12px; height: 12px; }
/* Tegnforklaring (A3, B3). */
.ds-legend { width: 250px; padding: 10px 12px; gap: 8px; }
.ds-legend__title { font-size: 12px; font-weight: 600; color: var(--n800); }
.ds-legend__ramp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.ds-legend__step { height: 12px; }
.ds-legend__step--0 { background: var(--disp-0); border: 1px solid var(--n500); }
.ds-legend__step--1 { background: var(--disp-1); border: 1px solid var(--disp-1-border); }
.ds-legend__step--2 { background: var(--disp-2); }
.ds-legend__step--3 { background: var(--disp-3); }
.ds-legend__step.is-over { outline: 2px solid var(--n800); outline-offset: 1px; }
.ds-legend__ticks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; font-size: var(--fs-label); color: var(--n700); font-variant-numeric: tabular-nums; }
.ds-legend__ticks .is-over { font-weight: 600; color: var(--n800); }
.ds-legend__keys { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px solid var(--n200); font-size: var(--fs-label); color: var(--n700); }
.ds-legend__key { display: flex; align-items: center; gap: 6px; }
.ds-legend__sw { width: 14px; height: 10px; flex: none; background: var(--n300); }
.ds-legend__sw--over { background: var(--disp-3); outline: 2px solid var(--n800); outline-offset: 1px; margin: 0 2px 0 1px; }
.ds-legend__sw--selected { background: transparent; border: 2px solid var(--blue-400); }
.ds-legend__sw--missing { background: repeating-linear-gradient(45deg, var(--n300) 0 2px, transparent 2px 5px); border: 1px solid var(--n500); }
.ds-legend__sw--outline { background: transparent; border: 1px solid var(--n500); }
.ds-legend__source { font-size: var(--fs-label); color: var(--n600); }
/* Mørk kontrollgruppe (zoom), 12 px radius. */
.ds-mapctl { display: flex; flex-direction: column; gap: 2px; padding: 4px; background: var(--n900); border-radius: var(--radius-xl); }
.ds-mapctl button { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius); background: transparent; color: var(--n0); cursor: pointer; }
.ds-mapctl button:hover { background: var(--n800); }
.ds-mapctl button.is-active { background: var(--n700); }
.ds-mapattr { font-size: var(--fs-label); color: var(--n700); background: rgba(255, 255, 255, .85); padding: 2px 6px; border-radius: var(--radius-sm); }
/* Utvalgs-popup på kartet. */
.ds-mappop { width: 260px; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--n0); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.ds-mappop__id { font-size: var(--fs-label); color: var(--n600); }
.ds-mappop__name { font-size: 14px; font-weight: 600; color: var(--n800); line-height: 1.3; }
.ds-mappop__stats { display: flex; gap: 16px; font-size: 12px; }
.ds-mappop__stat { display: flex; flex-direction: column; }
.ds-mappop__stat b { font-size: 20px; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; line-height: 1.2; }
.ds-mappop__stat span { color: var(--n600); }
/* Tidslinje (C3). */
.ds-timeline { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px; }
.ds-timeline__play { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 0; background: var(--n900); color: var(--n0); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ds-timeline__play svg { width: 13px; height: 13px; }
.ds-timeline__track { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ds-timeline__ticks { display: flex; justify-content: space-between; font-size: var(--fs-label); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-timeline__now { display: flex; flex-direction: column; align-items: flex-end; }
.ds-timeline__year { font-size: 16px; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; }
.ds-timeline__count { font-size: var(--fs-label); color: var(--n600); }
/* Glidebryter: <input type="range" class="ds-range" style="--p:62%"> */
.ds-range { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; margin: 0; background: transparent; cursor: pointer; }
.ds-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--n800) var(--p, 50%), var(--n200) var(--p, 50%)); }
.ds-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--n200); }
.ds-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--n800); }
.ds-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--n0); border: 2px solid var(--n800); }
.ds-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--n0); border: 2px solid var(--n800); }
.ds-range:focus-visible { outline: none; }
.ds-range:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring-focus); }
.ds-range:focus-visible::-moz-range-thumb { box-shadow: var(--ring-focus); }
/* Kartfyll-forklaring (rad med fargefelt). */
.ds-mapkey { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--n700); }
.ds-mapkey__sw { width: 12px; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(14, 16, 26, .12); flex: none; }

/* Kartlag-panelet: rad med forklaring under (vises når laget er på). */
.ds-layerrow__info { display: inline-flex; color: var(--n500); cursor: help; }
.ds-layerrow__info svg { width: 12px; height: 12px; }
.ds-layerrow__count { font-size: var(--fs-label); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-layersub { display: flex; flex-direction: column; gap: 4px; padding: 2px 0 4px 2px; font-size: var(--fs-label); color: var(--n700); }
.ds-layersub[hidden] { display: none; }
.ds-layersub .ds-mapkey { font-size: var(--fs-label); }
.ds-layersub .ds-mapkey__sw { width: 10px; height: 10px; }
.ds-layersub__note { font-size: var(--fs-label); color: var(--n600); line-height: 1.4; }
.ds-mapkey__sw--round { border-radius: 50%; }
.ds-mapkey__sw--dashed { background: transparent !important; box-shadow: none; border: 1.5px dashed var(--map-grense); }
.ds-mapkeys { display: flex; flex-direction: column; gap: 4px; }
/* Kontrollrad oppe til venstre (Totalt/Siden 2020 + Farge-meny). */
.ds-mapbar { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }

/* MapLibre-popupen får ds-mappop-uttrykket (hvit, 7 px, shadow-lg). */
.ds-mapwrap .maplibregl-popup-content { padding: 12px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font: 400 13px/1.45 var(--font-sans); color: var(--n700); }
.ds-mapwrap .maplibregl-popup-close-button { width: 24px; height: 24px; top: 6px; right: 6px; border-radius: var(--radius); font-size: 16px; color: var(--n600); }
.ds-mapwrap .maplibregl-popup-close-button:hover { background: var(--n75); color: var(--n800); }
.ds-mapwrap .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--n0); }
.ds-mapwrap .maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--n0); }
.ds-mappop--popup { width: auto; padding: 0; box-shadow: none; background: transparent; }
.ds-mappop__rows { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.ds-mappop__meta { font-size: var(--fs-label); color: var(--n600); }

/* Nedtrekk: knapp + meny (Farge, filterbrikker, Kolonner, Eksporter). Oppførsel: DSShell.dropdown(). */
.ds-dropdown { position: relative; display: inline-flex; }
.ds-dropdown > .ds-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 90; animation: ds-fade-in var(--dur-fast) var(--ease); max-height: min(70vh, 520px); overflow: auto; }
.ds-dropdown--right > .ds-menu { left: auto; right: 0; }
.ds-dropdown--up > .ds-menu { top: auto; bottom: calc(100% + 4px); }
.ds-menu[hidden] { display: none; }
.ds-menu__item--plain { grid-template-columns: minmax(0, 1fr) auto; }
.ds-menu__count { font-size: var(--fs-label); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-menu--wide { min-width: 300px; }
.ds-menu .ds-checkbox { width: 100%; padding: 6px 8px; border-radius: var(--radius-seg); }
.ds-menu .ds-checkbox:hover { background: var(--n75); }

/* 11 ─ Arbeidsflyt ──────────────────────────────────────────────────────── */
/* Stepper (vedtakspakke): ferdig = fylt N800 m/ hake · nå = blå 400. */
.ds-stepper { display: flex; align-items: center; gap: 10px; font: 500 13px/1.3 var(--font-sans); flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.ds-step { display: inline-flex; align-items: center; gap: 8px; color: var(--n800); text-decoration: none; }
a.ds-step:hover { text-decoration: none; color: var(--blue-400); }
.ds-step__dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--n500); color: var(--n600); font: 600 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.ds-step__dot svg { width: 12px; height: 12px; }
.ds-step.is-done .ds-step__dot { background: var(--n800); border-color: var(--n800); color: var(--n0); }
.ds-step.is-current { color: var(--blue-400); }
.ds-step.is-current .ds-step__dot { border-color: var(--blue-400); color: var(--blue-400); }
.ds-stepper__line { width: 32px; height: 1px; background: var(--n400); flex: none; }
.ds-stepbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--n400); background: var(--n0); }

/* Faseliste (A1 høyrepanel) og tidsplan (D1). */
.ds-phases { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ds-phases__item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding-bottom: 22px; }
.ds-phases__num { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 600 12px/1 var(--font-sans); background: var(--n0); border: 1px solid var(--n500); color: var(--n800); }
.ds-phases__item.is-done .ds-phases__num { background: var(--n800); border-color: var(--n800); color: var(--n0); }
.ds-phases__item.is-current .ds-phases__num { border-color: var(--blue-400); color: var(--blue-400); }
.ds-phases__body { display: flex; flex-direction: column; gap: 4px; }
.ds-phases__title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--n800); }
.ds-phases__desc { font-size: 13px; line-height: 1.5; color: var(--n700); text-wrap: pretty; }
.ds-schedule { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px 10px; align-items: center; font-size: 13px; }
.ds-schedule > :nth-child(3n+2) { color: var(--n800); }
.ds-schedule > :nth-child(3n) { font-size: var(--fs-meta); color: var(--n600); text-align: right; }
/* Prinsippavklaringer (D1): ikon · tekst · status. */
.ds-principle { display: grid; grid-template-columns: 20px minmax(0, 1fr) 220px; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--n200); }
.ds-principle:last-child { border-bottom: 0; }
.ds-principle > svg { width: 16px; height: 16px; color: var(--tone, var(--n600)); }
.ds-principle__value { font-size: var(--fs-meta); font-weight: 500; color: var(--tone, var(--n600)); }

/* RuleBuilder (D2): gruppekort med regelrader «Hvis / og» + feltbrikke + operator + verdibrikke. */
.ds-group { border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-group__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--n200); }
.ds-group__grip { color: var(--n500); cursor: grab; display: inline-flex; }
.ds-group__num { font-size: var(--fs-label); font-weight: 600; color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-group__name { flex: 1 1 0; font-size: 14px; font-weight: 600; color: var(--n800); }
.ds-group__count { font-size: 13px; font-weight: 600; color: var(--n800); font-variant-numeric: tabular-nums; }
.ds-group__rules { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px 40px; }
.ds-rule { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.ds-rule__join { width: 28px; font-size: 12px; color: var(--n600); }
.ds-rule__chip { padding: 3px 8px; border-radius: var(--radius-seg); background: var(--n100); color: var(--n800); border: 0; font: inherit; cursor: pointer; }
.ds-rule__chip--value { font-weight: 500; }
.ds-rule__op { color: var(--n600); }

/* Tavle (B2): fem statuskolonner med kompakte kort. */
.ds-kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--n400); border: 1px solid var(--n400); border-radius: var(--radius-modal); overflow: hidden; }
.ds-kanban__col { display: flex; flex-direction: column; min-height: 0; background: var(--n75); }
.ds-kanban__col.is-blocked { background: repeating-linear-gradient(45deg, var(--n75) 0 6px, var(--n100) 6px 12px); }
.ds-kanban__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--n400); background: var(--n0); }
.ds-kanban__head svg { width: 14px; height: 14px; color: var(--n700); }
.ds-kanban__title { flex: 1 1 0; font-size: 13px; font-weight: 600; color: var(--n800); }
.ds-kanban__count { font-size: var(--fs-meta); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-kanban__items { display: flex; flex-direction: column; gap: 6px; padding: 8px; overflow: auto; }
.ds-kanban__more { font-size: var(--fs-meta); color: var(--n600); padding: 4px 2px; }
.ds-kcard { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: var(--n0); border: 1px solid var(--n400); border-radius: var(--radius); cursor: grab; color: inherit; text-decoration: none; }
.ds-kcard:hover { border-color: var(--n500); text-decoration: none; }
.ds-kcard.is-focused { box-shadow: inset 3px 0 0 var(--blue-400); }
.ds-kcard__title { font-size: 12px; font-weight: 500; color: var(--n800); line-height: 1.35; }
.ds-kcard__meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-label); color: var(--n600); }
.ds-kcard__meta > :first-child { flex: 1 1 0; min-width: 0; }

/* BulkActionBar (B1): mørk flytende linje, 12 px radius, shadow-lg. */
.ds-bulkbar {
  position: fixed; left: 50%; bottom: 20px; z-index: 80; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 16px;
  background: var(--n900); color: var(--n0); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  font-size: 13px; white-space: nowrap; animation: ds-pop-in var(--dur) var(--ease);
}
.ds-bulkbar[hidden] { display: none; }
.ds-bulkbar--static { position: relative; left: auto; bottom: auto; transform: none; display: inline-flex; z-index: auto; }
.ds-bulkbar__count { font-weight: 600; font-variant-numeric: tabular-nums; }
.ds-bulkbar__sep { width: 1px; height: 18px; background: var(--n700); }
.ds-bulkbar__action { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--n0); font: 500 13px/1.3 var(--font-sans); cursor: pointer; }
.ds-bulkbar__action:hover { background: var(--n800); }
.ds-bulkbar__action svg { width: 14px; height: 14px; }
.ds-bulkbar__action--primary { background: var(--blue-400); }
.ds-bulkbar__action--primary:hover { background: var(--blue-500); }
.ds-bulkbar__hint { font-size: var(--fs-label); color: var(--n500); }

/* Dokumentforhåndsvisning (B4) — «papir». */
.ds-paper { background: var(--n0); border: 1px solid var(--n400); box-shadow: var(--shadow-sm); padding: 48px 52px; max-width: 666px; margin: 0 auto; font-size: 13px; color: var(--n800); line-height: 1.55; }
.ds-paper__head { display: flex; justify-content: space-between; font-size: var(--fs-label); color: var(--n600); margin-bottom: 24px; }
/* Prosa (markdown i dokumentpakken, lengre forklaringer). */
.ds-prose { font-size: 13px; line-height: 1.6; color: var(--n700); }
.ds-prose > :first-child { margin-top: 0; }
.ds-prose h1 { font-size: 20px; margin: 4px 0 12px; }
.ds-prose h2 { font-size: 16px; margin: 22px 0 8px; }
.ds-prose h3 { font-size: 14px; margin: 18px 0 6px; }
.ds-prose h4 { font-size: 13px; margin: 14px 0 4px; }
.ds-prose p { margin: 8px 0; max-width: 78ch; }
.ds-prose ul, .ds-prose ol { margin: 8px 0; padding-left: 20px; }
.ds-prose li { margin: 3px 0; }
.ds-prose strong { color: var(--n800); }
.ds-prose hr { border: 0; border-top: 1px solid var(--n400); margin: 18px 0; }
.ds-prose code { font-family: var(--font-mono); font-size: 12px; background: var(--n100); border-radius: var(--radius-sm); padding: 1px 5px; }
.ds-prose blockquote { margin: 12px 0; padding: 8px 12px; border-radius: var(--radius); background: var(--warning-bg); color: var(--n800); font-size: 12px; }
.ds-prose blockquote p { margin: 2px 0; }
.ds-prose .ds-table-wrap { margin: 12px 0; border: 1px solid var(--n400); border-radius: var(--radius); }
.ds-prose table { font-size: 12px; }
.ds-prose th { position: static; }
.ds-prose td { height: auto; padding: 6px 10px; white-space: normal; }
.ds-prose th:first-child, .ds-prose td:first-child { padding-left: 10px; }
.ds-prose th:last-child, .ds-prose td:last-child { padding-right: 10px; }
.ds-watermark { position: relative; overflow: hidden; }
.ds-watermark::after { content: attr(data-watermark); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 64px/1 var(--font-sans); color: rgba(220, 38, 37, .10); transform: rotate(-24deg); pointer-events: none; text-transform: uppercase; }

/* 12 ─ App-skall ────────────────────────────────────────────────────────── */
/* <div class="ds-app"> <nav class="ds-sidebar">… </nav> <div class="ds-main"> <header class="ds-topbar">… </header>
     <div class="ds-split"> <main class="ds-page">… </main> <aside class="ds-rightpanel">… </aside> </div> </div> </div> */
.ds-app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; background: var(--n0); }
.ds-sidebar { display: flex; flex-direction: column; gap: 12px; min-height: 0; height: 100%; overflow-y: auto; padding: 14px 10px; background: var(--n75); border-right: 1px solid var(--n400); }
.ds-sidebar__product { display: flex; align-items: center; gap: 8px; padding-left: 6px; }
.ds-sidebar__logo { width: 22px; height: 22px; flex: none; border-radius: 50%; }
.ds-sidebar__name { flex: 1 1 0; font-size: 14px; font-weight: 600; color: var(--n800); text-decoration: none; }
.ds-sidebar__bell { position: relative; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius); background: transparent; color: var(--n700); cursor: pointer; }
.ds-sidebar__bell:hover { background: var(--n100); }
.ds-sidebar__bell .ds-count-dot { position: absolute; top: 2px; right: 2px; }
/* Kommunevelger: en ekte <select> ligger usynlig over raden. */
.ds-kommune { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); background: var(--n0); border: 1px solid var(--n400); font-size: 13px; color: var(--n800); }
.ds-kommune:hover { border-color: var(--n500); }
.ds-kommune:has(select:focus-visible) { box-shadow: var(--ring-focus); }
.ds-kommune__name { flex: 1 1 0; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-kommune__nr { font-size: var(--fs-label); color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-kommune svg { width: 14px; height: 14px; color: var(--n600); }
.ds-kommune select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
/* Søk med «/»-tips */
.ds-search { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border-radius: var(--radius); background: var(--n100); font-size: 13px; color: var(--n600); border: 1px solid var(--n550); }
.ds-search:hover { background: var(--n200); }
.ds-search:focus-within { background: var(--n0); border-color: var(--focus-border); box-shadow: var(--ring-focus-input); }
.ds-search svg { width: 14px; height: 14px; flex: none; }
.ds-search input { flex: 1 1 0; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; font: inherit; color: var(--n800); }
.ds-search input::placeholder { color: var(--n600); }
.ds-search .ds-kbd { height: 16px; min-width: 16px; padding: 0 5px; }
.ds-searchwrap { position: relative; }
.ds-searchwrap > .ds-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 95; width: 320px; max-height: 60vh; overflow: auto; }
.ds-search__hit .ds-menu__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-search__hit.is-active { background: var(--blue-50); }
/* Navigasjon */
.ds-nav { display: flex; flex-direction: column; gap: 2px; }
.ds-nav__group { padding: 12px 8px 4px; font-size: var(--fs-label); font-weight: 600; color: var(--n600); }
.ds-nav__item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius); color: var(--n700); font-size: 13px; font-weight: 500; text-decoration: none; transition: background-color var(--dur-fast) ease; }
.ds-nav__item:hover { background: var(--n100); text-decoration: none; }
.ds-nav__item svg { width: 16px; height: 16px; color: var(--n600); }
.ds-nav__label { flex: 1 1 0; min-width: 0; }
.ds-nav__count { font-size: var(--fs-label); font-weight: 500; color: var(--n600); font-variant-numeric: tabular-nums; }
.ds-nav__item.is-active, .ds-nav__item[aria-current="page"] { background: var(--blue-100); color: var(--blue-400); }
.ds-nav__item.is-active svg, .ds-nav__item[aria-current="page"] svg,
.ds-nav__item.is-active .ds-nav__count, .ds-nav__item[aria-current="page"] .ds-nav__count { color: var(--blue-400); }
/* Menypunkt for side som ikke er bygd ennå (pending i DSShell.NAV): deaktivert, verktøytips «Kommer». */
.ds-nav__item.is-pending, .ds-tabbar__item.is-pending { opacity: .5; cursor: default; }
.ds-nav__item.is-pending:hover { background: transparent; }
/* Bunn: fase, demo-merke */
.ds-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px 8px 2px; border-top: 1px solid var(--n400); }
.ds-phase { display: flex; flex-direction: column; gap: 6px; }
.ds-phase__head { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-label); font-weight: 600; color: var(--n600); }
.ds-phase__head > :last-child { font-variant-numeric: tabular-nums; }
.ds-phase__head > :first-child { min-width: 0; }   /* «Fase 4 av 4 · Saksbehandling» får brytes, ikke kuttes */
.ds-phase__bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.ds-phase__seg { height: 4px; border-radius: 2px; background: var(--n300); }
.ds-phase__seg.is-done { background: var(--n800); }
.ds-phase__seg.is-current { background: linear-gradient(90deg, var(--blue-400) var(--p, 0%), var(--n300) var(--p, 0%)); }
.ds-phase__seg.is-skipped { background: transparent; box-shadow: inset 0 0 0 1px var(--n500); }
.ds-sidebar__demo { display: flex; align-items: center; gap: 5px; font-size: var(--fs-label); color: var(--warning); }
.ds-sidebar__demo svg { width: 12px; height: 12px; }
.ds-sidebar__note { font-size: var(--fs-label); color: var(--n600); line-height: 1.45; }

/* Hovedflate */
.ds-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.ds-topbar { flex: none; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--n400); background: var(--n0); min-width: 0; }
.ds-topbar__title { font-size: 14px; font-weight: 600; color: var(--n800); margin: 0; white-space: nowrap; }
.ds-topbar__meta { font-size: var(--fs-meta); color: var(--n600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ds-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ds-crumbs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--n600); min-width: 0; }
.ds-crumbs a { color: var(--n600); text-decoration: none; }   /* navigasjon, ikke løpende tekst */
.ds-crumbs a:hover { text-decoration: underline; }
.ds-crumbs svg { width: 12px; height: 12px; color: var(--n500); flex: none; }
.ds-crumbs [aria-current] { color: var(--n800); font-weight: 500; }
.ds-scroll { flex: 1 1 0; min-height: 0; overflow: auto; }
.ds-split { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--rightpanel-w); }
.ds-split > * { min-height: 0; overflow: auto; }
.ds-split--left { grid-template-columns: var(--leftpanel-w, 360px) minmax(0, 1fr); }
.ds-page { display: flex; flex-direction: column; gap: 28px; padding: 28px 32px; min-width: 0; }
.ds-page--narrow { max-width: 1040px; }
.ds-page--tight { gap: 22px; padding: 24px 32px; }
.ds-pagehead { display: flex; flex-direction: column; gap: 12px; padding: 18px 24px 12px; border-bottom: 1px solid var(--n400); }
.ds-pagehead__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ds-pagehead .ds-tabs--views { margin: 0 -24px; padding: 0 24px; }
.ds-rightpanel { display: flex; flex-direction: column; gap: 22px; padding: 24px 22px; background: var(--n50); border-left: 1px solid var(--n400); min-width: 0; }
.ds-rightpanel--plain { background: var(--n0); }
.ds-rightpanel--flush { padding: 0; gap: 0; }
.ds-leftpanel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--n400); background: var(--n0); }
.ds-paneltitle { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ds-paneltitle > :first-child { font-size: 14px; font-weight: 600; color: var(--n800); }
.ds-paneltitle > :last-child:not(:first-child) { font-size: var(--fs-meta); color: var(--n600); }

/* Fanelinje for nettbrett (≤ 1024 px): 64 px, mål ≥ 44 px. */
.ds-tabbar { display: none; }
.ds-only-tablet { display: none !important; }
@media (max-width: 1024px) {
  .ds-app { grid-template-columns: minmax(0, 1fr); }
  .ds-app > .ds-sidebar { display: none; }
  .ds-main { padding-bottom: var(--tabbar-h); }
  .ds-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; height: var(--tabbar-h);
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    background: var(--n0); border-top: 1px solid var(--n400); padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .ds-tabbar__item { min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: 500 11px/1.2 var(--font-sans); color: var(--n700); text-decoration: none; }
  .ds-tabbar__item svg { width: 18px; height: 18px; }
  .ds-tabbar__item:hover { text-decoration: none; color: var(--n800); }
  .ds-tabbar__item.is-active, .ds-tabbar__item[aria-current="page"] { color: var(--blue-400); }
  .ds-only-tablet { display: revert !important; }
  .ds-only-desktop { display: none !important; }
  .ds-split { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow: auto; }
  .ds-split > * { overflow: visible; }
  .ds-rightpanel { border-left: 0; border-top: 1px solid var(--n400); }
  .ds-page { padding: 22px 24px; gap: 24px; }
  .ds-topbar { padding: 0 16px; }
  .ds-btn { min-height: 36px; }
  .ds-btn--sm { min-height: 32px; }
  .ds-stats { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-stats .ds-stat { border-bottom: 1px solid var(--n400); }
  /* To kolonner: ingen dobbel kant mot rammen; en siste celle alene fyller hele raden (A2 har tre tall). */
  .ds-stats .ds-stat:nth-child(2n) { border-right: 0; }
  .ds-stats .ds-stat:last-child, .ds-stats .ds-stat:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .ds-stats .ds-stat:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .ds-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-drawer { --drawer-w: 100%; }
  .ds-bulkbar { bottom: calc(var(--tabbar-h) + 12px); }
}
@media (max-width: 640px) {
  .ds-page { padding: 16px; }
  .ds-stats { grid-template-columns: minmax(0, 1fr); }
  .ds-stat { border-right: 0; }
  .ds-stats .ds-stat:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--n400); }
  .ds-pick { grid-template-columns: minmax(0, 1fr); }
  .ds-overlay { padding: 12px; }
  .ds-bulkbar { left: 12px; right: 12px; transform: none; overflow-x: auto; }
}

/* Utskrift: skjul skall og overlegg */
@media print {
  .ds-sidebar, .ds-tabbar, .ds-bulkbar, .ds-topbar__actions { display: none !important; }
  .ds-app { display: block; height: auto; overflow: visible; }
  .ds-main, .ds-split > * { overflow: visible; height: auto; }
}

/* 13 ─ Flyt (PR 3 steg 2): A4 plan, B6 bunnark, B1 massehandling, B2 tavle, A3 planliste ───────── */
/* Meny inne i en popover/panel (uten egen kant og skygge). */
.ds-menu--static { border: 0; box-shadow: none; padding: 4px 6px; min-width: 0; background: transparent; }
.ds-menu__item[disabled] { opacity: .55; cursor: default; }
.ds-menu__item[disabled]:hover { background: transparent; }
/* Velg vedtakspakke (DSOverlays.batchPicker). */
.ds-batchpick { width: 340px; }
.ds-batchpick .ds-popover__body { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; }
.ds-batchpick__list { border-bottom: 1px solid var(--n200); padding-bottom: 8px; }
.ds-batchpick__empty { margin: 12px 16px 4px; font-size: var(--fs-meta); color: var(--n600); }
.ds-batchpick__new { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 0; align-items: flex-start; }
.ds-batchpick__new .ds-field { width: 100%; }
.ds-batchpick .ds-popover__foot { border-top: 1px solid var(--n200); align-items: flex-start; line-height: 1.45; }
.ds-batchpick .ds-popover__foot svg { flex: none; margin-top: 2px; }

/* A4: beslutningspanelets seksjoner og overstyringsnotat. */
.ds-decide { display: flex; flex-direction: column; gap: 20px; }
.ds-decide__sec { display: flex; flex-direction: column; gap: 8px; }
.ds-decide__head { display: flex; align-items: baseline; gap: 8px; }
.ds-decide__title { flex: 1 1 0; margin: 0; font-size: 13px; font-weight: 600; color: var(--n800); }
.ds-decide__title--lg { font-size: 16px; }
.ds-decide__meta { font-size: var(--fs-label); color: var(--n600); }
.ds-decide__row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-decide__row > svg { color: var(--n700); flex: none; }
.ds-decide__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-rating__opt:disabled { cursor: default; opacity: .5; }

/* B6: beslutningen som fast bunnark på nettbrett (≤ 1024). Skjult på skrivebord. */
.ds-sheet { display: none; }
@media (max-width: 1024px) {
  .ds-sheet {
    position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 60;
    display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px;
    background: var(--n0); border-top: 1px solid var(--n400); box-shadow: 0 -8px 24px rgba(14, 16, 26, .08);
  }
  .ds-sheet__rec { display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); color: var(--n600); }
  .ds-sheet__rec > svg { width: 14px; height: 14px; }
  .ds-sheet__themes { display: flex; align-items: center; gap: 10px; min-height: var(--control-h-touch); padding: 0 12px; border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); font: 600 13px/1.3 var(--font-sans); color: var(--n800); cursor: pointer; text-align: left; }
  .ds-sheet__themes .ds-meta { font-weight: 400; }
  .ds-sheet__themes > svg { margin-left: auto; color: var(--n600); }
  .ds-sheet__foot { display: flex; align-items: center; gap: 10px; }
  .ds-sheet__summary { flex: 1 1 0; min-width: 0; min-height: var(--control-h-touch); display: flex; align-items: center; padding: 0 12px; border-radius: var(--radius); background: var(--n100); font-size: 13px; color: var(--n700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ds-swatchrow > span.is-gronn { background: var(--success); }
  .ds-swatchrow > span.is-gul { background: var(--warning-border); }
  .ds-swatchrow > span.is-rod { background: var(--danger); }
}

/* B2: dra og slipp i tavla. */
.ds-kcard.is-dragging { opacity: .45; }
.ds-kcard:focus-visible { outline: 0; box-shadow: inset 3px 0 0 var(--blue-400), var(--ring-focus); }
.ds-kanban__col.is-drop { background: var(--blue-50); box-shadow: inset 0 0 0 2px var(--blue-300); }
.ds-kanban__col.is-drop.is-blocked { background: var(--danger-bg); box-shadow: inset 0 0 0 2px var(--danger); }
.ds-kanban__more { border: 0; background: transparent; text-align: left; cursor: pointer; font: inherit; }
.ds-kanban__more:hover { color: var(--blue-400); }

/* 14 ─ Flyt (PR 3 steg 3): D3 Kontroll, C5/C4/B4 Vedtakspakker, D4, C7 Varsler ───────── */
/* Toast med handling («Åpne vedtakspakken»). */
.ds-toast__action { color: var(--blue-200, #A9C2FF); font-weight: 600; text-decoration: none; margin-left: 4px; }
.ds-toast__action:hover { text-decoration: underline; color: var(--n0); }
/* Mulige løsninger (D3): kort i rad. */
.ds-solutions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.ds-solution { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--n400); border-radius: var(--radius); background: var(--n0); }
.ds-solution__title { font-size: 13px; font-weight: 500; color: var(--n800); }
.ds-solution__desc { font-size: var(--fs-meta); line-height: 1.4; color: var(--n600); }
/* Kontrolliste (D3): tittel + henvisning, antall til høyre. */
.ds-list__item--check { align-items: start; padding-top: 11px; padding-bottom: 11px; padding-right: 20px; padding-left: 17px; }
.ds-list__item--check .ds-list__value { padding-top: 1px; }
.ds-list__item.is-done .ds-list__title { color: var(--n600); }
/* Papir i et grått lerret (B4, C5-modal). */
.ds-paperwrap { background: var(--n100); padding: 28px 24px 40px; min-height: 100%; }
@media (max-width: 1024px) { .ds-paperwrap { padding: 12px; } .ds-paper { padding: 24px; } }
/* C7 Varsler: popover fra bjella. */
.ds-notifpop { width: var(--popover-w); }
.ds-notifpop .ds-popover__head { border-bottom: 0; padding-bottom: 6px; }
.ds-notifpop .ds-popover__head .ds-link[disabled] { color: var(--n500); cursor: default; text-decoration: none; }
.ds-notifpop__tabs { padding: 0 16px; }
.ds-notifpop .ds-popover__body { max-height: 440px; }
.ds-notifpop .ds-popover__foot { border-top: 1px solid var(--n200); }
.ds-notifpop__empty { margin: 0; padding: 20px 16px; font-size: var(--fs-meta); color: var(--n600); }
a.ds-notif { color: inherit; text-decoration: none; }
a.ds-notif:hover { background: var(--n75); text-decoration: none; }
.ds-notif .ds-feed__icon { color: var(--tone, var(--n700)); background: var(--tone-bg, var(--n100)); }
.ds-notif__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.45; color: var(--n700); }
.ds-notif__text b { color: var(--n800); font-weight: 600; }
.ds-notif__sub { color: var(--n700); font-size: var(--fs-meta); }

/* 15 ─ Tilgjengelighet (WCAG 2.1 AA) og telefonbredde ─────────────────────── */
/* Hoppelenke (DSShell): usynlig til den får fokus. */
.ds-skip { position: fixed; top: 8px; left: 8px; z-index: 200; padding: 8px 14px; border-radius: var(--radius); background: var(--n900); color: var(--n0); font: 600 13px/1.3 var(--font-sans); text-decoration: none; transform: translateY(-200%); }
.ds-skip:focus, .ds-skip:focus-visible { transform: none; outline: 2px solid var(--blue-300); outline-offset: 2px; }
:where([role="main"], main):focus { outline: none; }
/* Innstilling (bryter med etikett): «Hurtigtaster» nederst i sidepanelet og i «Mer». */
.ds-pref { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-meta); color: var(--n700); }
.ds-pref__label { font-weight: 500; }
/* Uten hurtigtaster vises ikke tastetipsene. */
.ds-noshortcuts .ds-kbd, .ds-noshortcuts .ds-btn__kbd, .ds-noshortcuts .ds-pick__key, .ds-noshortcuts [data-shortcut-hint] { display: none !important; }
/* Kartflater (Kart, minikartet på plansiden) får synlig fokus, også der sida har outline: none (A4). */
.ds-app .maplibregl-canvas:focus-visible { outline: 2px solid var(--focus-ring) !important; outline-offset: -2px; }
/* Rullbare områder som får tastaturfokus (fanepanel, lister). */
.ds-modal__body:focus-visible, .ds-popover__body:focus-visible, .ds-drawer__body:focus-visible { outline-offset: -2px; }
/* Fanelinjas «Mer» (A17) og menyen den åpner. */
.ds-tabbar__more { display: flex; min-width: 0; }
.ds-tabbar__more > .ds-tabbar__item { flex: 1 1 0; border: 0; background: transparent; cursor: pointer; }
.ds-tabbar__more > .ds-tabbar__item.is-active { color: var(--blue-400); }
.ds-moremenu { width: min(300px, calc(100vw - 16px)); }
.ds-dropdown--up > .ds-moremenu { bottom: calc(100% + 6px); right: 8px; left: auto; }
.ds-moremenu .ds-menu__item { min-height: 44px; text-decoration: none; }
.ds-moremenu .ds-menu__item[aria-current="page"] { background: var(--blue-100); }
.ds-moremenu .ds-menu__item.is-pending { opacity: .55; cursor: default; }
.ds-moremenu .ds-pref { padding: 4px 8px; min-height: 44px; font-size: 13px; }
.ds-moremenu__note { display: flex; align-items: center; gap: 6px; margin: 4px 8px 2px; font-size: var(--fs-label); color: var(--warning); }
/* Søk i toppfeltet på nettbrett (R13). */
.ds-topsearch { flex: none; padding: 8px 16px; border-bottom: 1px solid var(--n400); background: var(--n0); }
.ds-topsearch .ds-search { height: 44px; font-size: 16px; }
.ds-topsearch .ds-searchwrap > .ds-menu { width: min(420px, calc(100vw - 32px)); }

/* Telefon (≤ 640 px): toppfeltet brytes i stedet for å skjære av kontrollene (A6). */
@media (max-width: 640px) {
  .ds-topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding: 4px 12px; column-gap: 8px; row-gap: 0; }
  .ds-topbar__title { white-space: normal; }
  .ds-topbar__meta { order: 10; flex: 1 1 100%; padding-bottom: 4px; }
  .ds-topbar__actions { flex-wrap: wrap; justify-content: flex-end; gap: 0 6px; min-width: 0; }
  .ds-topbar__demotext { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ds-topbar__demo { padding: 0 6px; }
  .ds-topbar .ds-kommune__nr { display: none; }
  .ds-topbar .ds-kommune { max-width: 46vw; }
  .ds-crumbs { flex-wrap: wrap; gap: 4px 8px; }
  .ds-tabbar__item { font-size: 10px; }
}

/* Nettbrett (≤ 1024 px): trykkflater ≥ 44 × 44 px (A13). Visuell størrelse beholdes der det går; ellers vokser kontrollen. */
@media (max-width: 1024px) {
  .ds-btn, .ds-btn--sm, .ds-btn--lg { min-height: 44px; }
  .ds-btn, .ds-btn--icon, .ds-btn--icon.ds-btn--sm { min-width: 44px; }
  .ds-statusbar__legend .ds-status, a.ds-barlist__row, button.ds-barlist__row, .ds-stat__link { min-height: 44px; }
  .ds-statusbar__legend .ds-status, .ds-stat__link { display: inline-flex; align-items: center; }
  .ds-mapbtn, .ds-kommune, .ds-search, .ds-inputwrap, .ds-input, .ds-select { min-height: 44px; }
  .ds-chip, .ds-chip--sm { height: auto; min-height: 44px; padding: 0 12px; }
  .ds-seg__opt, .ds-seg > button { min-height: 44px; }
  .ds-tab, .ds-tabs--pill .ds-tab { min-height: 44px; }
  .ds-menu__item { min-height: 44px; }
  .ds-mapctl button, .ds-timeline__play { width: 44px; height: 44px; }
  .ds-checkbox, .ds-radio { min-height: 44px; min-width: 44px; }
  .ds-rating { grid-template-columns: repeat(3, 44px); }
  .ds-rating__opt { width: 44px; height: 44px; }
  .ds-ratingtable__row { grid-template-columns: minmax(0, 1fr) 140px; }
  .ds-pick__opt { min-height: 44px; }
  .ds-table th button { min-height: 44px; }
  .ds-acc__head { min-height: 44px; }
  .ds-checkrow__cta, .ds-kanban__more, .ds-statusbar__legend button.ds-status, .ds-topbar__actions .ds-link { min-height: 44px; display: inline-flex; align-items: center; }
  a.ds-tag, button.ds-tag { min-height: 44px; padding: 0 12px; }
  .ds-layerrow__info { min-width: 44px; min-height: 44px; justify-content: center; align-items: center; }
  .ds-mappanel__head { min-height: 44px; }
  .ds-sheet__themes, .ds-sheet__summary { min-height: 44px; }
  /* Bryter: 44 × 44 trykkflate, sporet (30 × 18) tegnes i ::before. */
  .ds-switch, .ds-switch[aria-checked="true"], .ds-switch.is-on { width: 44px; height: 44px; margin: 0 -7px; background: transparent; border-radius: var(--radius); }
  .ds-switch::before { content: ""; position: absolute; left: 7px; top: 13px; width: 30px; height: 18px; border-radius: var(--radius-full); background: var(--n550); transition: background-color 150ms ease; }
  .ds-switch[aria-checked="true"]::before, .ds-switch.is-on::before { background: var(--blue-400); }
  .ds-switch::after { top: 15px; left: 9px; }
  .ds-switch[aria-checked="true"]::after, .ds-switch.is-on::after { left: 21px; }
}

/* Strategi (D1): skjermlesertekst i prinsippknappen må holdes inne i knappen, ellers får sida en ekstra rullefelt (A12). */
.st-prin__btn { position: relative; }
