/* Havbruksforvaltning 2.0 – sidestiler bygget på Designsystemet (Digdir).
   Komponentene (knapper, tagger, varsler, tabeller, skjemafelt) kommer fra vendor/designsystemet.
   Denne fila legger bare til layout og visualiseringene, og henter alle farger fra --ds-tokenene,
   slik at lyst og mørkt tema følger data-color-scheme på <html>. */
:root {
  --bg: var(--ds-color-neutral-background-default);
  --bg-tint: var(--ds-color-neutral-background-tinted);
  --surface: var(--ds-color-neutral-surface-default);
  --surface-2: var(--ds-color-neutral-surface-tinted);
  --surface-3: var(--ds-color-neutral-surface-active);
  --ink: var(--ds-color-neutral-text-default);
  --ink-2: var(--ds-color-neutral-text-subtle);
  --ink-3: var(--ds-color-neutral-border-default);
  --rule: var(--ds-color-neutral-border-subtle);
  --rule-strong: var(--ds-color-neutral-border-strong);

  --today: var(--ds-color-danger-base-default);
  --today-text: var(--ds-color-danger-text-subtle);
  --today-on: var(--ds-color-danger-base-contrast-default);
  --today-soft: var(--ds-color-danger-surface-tinted);
  --new: var(--ds-color-accent-base-default);
  --new-text: var(--ds-color-accent-text-subtle);
  --new-on: var(--ds-color-accent-base-contrast-default);
  --new-soft: var(--ds-color-accent-surface-tinted);
  --ok: var(--ds-color-success-text-subtle);
  --warn: var(--ds-color-warning-text-subtle);
  --crit: var(--ds-color-danger-text-subtle);

  --land: var(--ds-color-neutral-surface-tinted);
  --water: var(--ds-color-accent-surface-tinted);
  --seq-1: var(--ds-color-accent-surface-tinted);
  --seq-2: var(--ds-color-accent-surface-active);
  --seq-3: var(--ds-color-accent-border-subtle);
  --seq-4: var(--ds-color-accent-border-default);
  --seq-5: var(--ds-color-accent-base-active);
  --device: #1e2226;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: var(--ds-border-radius-lg);
  --radius-sm: var(--ds-border-radius-md);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));

  --fs-sm: .9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-h3: 1.5rem;
  --fs-h2: clamp(1.75rem, 3.4vw, 2.375rem);
  --fs-h1: clamp(2.25rem, 5.4vw, 3.5rem);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.6;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.2; margin: 0; text-wrap: balance; color: var(--ink); }
h1 { font-size: var(--fs-h1); font-weight: var(--ds-heading-xl-font-weight, 500); letter-spacing: -.02em; line-height: 1.1; }
h2 { font-size: var(--fs-h2); font-weight: var(--ds-heading-lg-font-weight, 500); letter-spacing: -.015em; }
h3 { font-size: var(--fs-h3); font-weight: var(--ds-heading-md-font-weight, 500); letter-spacing: -.01em; }
h4 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; }
p { margin: 0; }
/* Grunnreglene under holdes unna Designsystemet-komponentene (klasser som starter med ds-),
   fordi ulagdelt CSS ellers vinner over @layer ds og overstyrer farger og størrelser. */
a:not([class*="ds-"]) { color: var(--ds-color-accent-text-subtle); text-underline-offset: .15em; }
a:not([class*="ds-"]):hover { text-decoration-thickness: 2px; }
:focus-visible:not([class*="ds-"]) { outline: 3px solid var(--ds-color-focus-outer); outline-offset: 2px; }
:is(button, input, select, textarea):not([class*="ds-"]) { font: inherit; }
button:not([class*="ds-"]) { cursor: pointer; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1200px; margin-inline: auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.read { max-width: 44rem; }
.read > * + * { margin-top: 1rem; }
.lede { font-size: var(--fs-lg); color: var(--ink-2); max-width: 44rem; line-height: 1.55; }
.eyebrow { font-size: var(--fs-sm); font-weight: 500; color: var(--ds-color-accent-text-subtle); }
.eyebrow b { font-weight: 600; }
.small { font-size: var(--fs-sm); color: var(--ink-2); }
.today { color: var(--today-text); }
.new { color: var(--new-text); }
strong { font-weight: 600; }
.ds-tag { white-space: nowrap; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.brand { font-weight: 600; font-size: 1.05rem; text-decoration: none; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: .6rem; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand small { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-2); line-height: 1.2; }
.chapters { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; margin-left: auto; align-self: stretch; }
.chapters::-webkit-scrollbar { display: none; }
.chapters a {
  font-size: var(--fs-sm); color: var(--ink); text-decoration: none; padding: 0 .7rem; white-space: nowrap;
  display: flex; align-items: center; border-bottom: 3px solid transparent;
}
.chapters a:hover { color: var(--ds-color-accent-text-subtle); background: var(--ds-color-accent-surface-tinted); }
.chapters a[aria-current="true"] { border-bottom-color: var(--ds-color-accent-base-default); color: var(--ds-color-accent-text-subtle); font-weight: 500; }
.theme-toggle { flex: none; }
.progress { position: absolute; left: 0; bottom: -1px; height: 3px; background: var(--ds-color-accent-base-default); width: 0; }
@media (max-width: 760px) {
  .brand > span { display: none; }
  .topbar .wrap { gap: .75rem; }
}

/* ---------- Hero ---------- */
.hero { background: var(--ds-color-accent-background-tinted); border-bottom: 1px solid var(--rule); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); padding-block: clamp(2.5rem, 6vw, 5rem); align-items: center; }
.hero h1 { margin-top: .75rem; }
.hero h1 em { font-style: normal; color: var(--ds-color-accent-text-subtle); }
.hero .lede { margin-top: 1.25rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; margin-top: 2rem; }
.kbd { font-size: .8em; border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: var(--surface); }
.hero-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.25rem 1.25rem 1rem; min-width: 0; }
.hero-card h2 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: .75rem; }
.hero-card .table-scroll .ds-table { width: 100%; min-width: 0; }
.hero-card .t-new { white-space: nowrap; }
@media (max-width: 420px) { .hero-card { padding-inline: .9rem; } .hero-card td, .hero-card th { padding-inline: .35rem; } .hero-card th:first-child, .hero-card td.spor { display: none; } }
.hero-card td, .hero-card th { padding-inline: .5rem; }
.hero-card .spor { font-weight: 600; color: var(--ds-color-accent-text-subtle); }
.hero-card .t-today { color: var(--today-text); font-weight: 500; }
.hero-card .t-new { color: var(--new-text); font-weight: 600; }
.hero-card p { margin-top: .75rem; }
@media (max-width: 880px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Kapitler ---------- */
.chapter { padding-block: clamp(3rem, 7vw, 5.5rem); border-bottom: 1px solid var(--rule); }
.chapter.tint { background: var(--bg-tint); }
.chapter-head { display: grid; gap: .9rem; margin-bottom: clamp(2rem, 4vw, 2.75rem); }
.sub { margin-top: clamp(3rem, 6vw, 4.5rem); scroll-margin-top: 5rem; }
.sub-head { display: grid; gap: .65rem; margin-bottom: 1.5rem; max-width: 46rem; }
.sub-head p:not(.eyebrow) { color: var(--ink-2); }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: clamp(1rem, 2.5vw, 1.75rem); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; justify-content: space-between; margin-bottom: 1.25rem; }
.panel-head h3 { font-size: var(--fs-lg); font-weight: 600; }
.panel-foot { margin-top: 1.25rem; padding-top: .9rem; border-top: 1px solid var(--rule); font-size: var(--fs-sm); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }

.callout { border-left: 4px solid var(--ds-color-accent-base-default); padding: .25rem 0 .25rem 1rem; font-size: var(--fs-lg); }

.table-scroll { overflow-x: auto; }
.table-scroll .ds-table { min-width: 36rem; width: 100%; }
.panel .ds-details { margin-top: 1.25rem; }

/* ---------- Verktøytips ---------- */
.tip {
  position: fixed; z-index: 100; pointer-events: none; max-width: 18rem;
  background: var(--ds-color-neutral-base-default); color: var(--ds-color-neutral-base-contrast-default);
  font-size: .82rem; line-height: 1.45; padding: .5rem .7rem; border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgb(0 0 0 / .2); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 600; }
.tip .muted { opacity: .75; }

/* ---------- Frist mot faktisk ---------- */
.dl { display: grid; gap: .25rem; --lw: 15rem; }
.dl-row { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); gap: 1rem; align-items: center; padding-block: .45rem; }
.dl-label b { display: block; font-weight: 600; font-size: .95rem; line-height: 1.3; }
.dl-label span { font-size: .82rem; color: var(--ink-2); }
.dl-track { position: relative; height: 2.25rem; }
.dl-grid { position: absolute; inset: 0; pointer-events: none; }
.dl-grid i { position: absolute; top: -.45rem; bottom: -.45rem; width: 1px; background: var(--rule); }
.dl-grid i.minor { opacity: .55; }
.dl-bar { position: absolute; top: .55rem; height: 1.15rem; border-radius: 0 4px 4px 0; background: var(--today); }
.dl-bar.within { background: var(--ink-3); border-radius: 0; }
.dl-bar.range { background: repeating-linear-gradient(135deg, var(--today) 0 3px, transparent 3px 7px); border: 1px solid var(--today); border-left: 0; }
.dl-bar.fade { background: linear-gradient(90deg, var(--today), color-mix(in srgb, var(--today) 15%, transparent)); }
.dl-frist { position: absolute; top: .1rem; bottom: .1rem; width: 2px; background: var(--ink); border-radius: 1px; }
.dl-val { position: absolute; top: .45rem; font-size: .85rem; white-space: nowrap; padding-left: .5rem; line-height: 1.35rem; font-variant-numeric: tabular-nums; }
.dl-val b { font-weight: 600; }
.dl-val span { color: var(--ink-2); margin-left: .35rem; }
.dl-axis { position: relative; height: 1.6rem; margin-left: calc(var(--lw) + 1rem); font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dl-axis span { position: absolute; transform: translateX(-50%); top: .3rem; white-space: nowrap; }
.dl-axis span:first-child { transform: none; }
.dl-axis span:last-child { transform: translateX(-100%); }
.dl-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .85rem; color: var(--ink-2); margin-bottom: 1rem; }
.dl-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: .35rem; }
.dl-legend i.f { width: 2px; height: 14px; background: var(--ink); vertical-align: -3px; }
@media (max-width: 680px) {
  .dl { --lw: 0rem; }
  .dl-row { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .dl-axis { margin-left: 0; }
}

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin-top: 2rem; }
.fact { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.fact .big { font-size: var(--fs-h3); font-weight: 500; line-height: 1.2; color: var(--ds-color-accent-text-subtle); }
.fact p { font-size: var(--fs-sm); color: var(--ink-2); margin-top: .4rem; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Samme sak, to systemer ---------- */
.tl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1.5rem; }
.tl-controls .play { min-width: 8rem; }
.tl-scrub { flex: 1 1 14rem; display: flex; align-items: center; gap: .75rem; min-width: 0; }
.tl-scrub input { flex: 1; min-width: 0; accent-color: var(--ds-color-accent-base-default); }
.tl-readout { font-size: 1rem; min-width: 5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-panel { --lw: 11.5rem; --p: 0; }
.tl-panel + .tl-panel { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.tl-panel-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-bottom: .75rem; }
.tl-panel-head h4 { font-size: var(--fs-lg); font-weight: 600; }
.tl-panel[data-sys="today"] h4 { color: var(--today-text); }
.tl-panel[data-sys="new"] h4 { color: var(--new-text); }
.g-body { position: relative; }
.g-row { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); align-items: center; min-height: 2.1rem; }
.g-label { font-size: .875rem; line-height: 1.2; padding-right: .75rem; }
.g-label small { display: block; color: var(--ink-2); font-size: .76rem; }
.g-track { position: relative; height: 1.9rem; overflow: hidden; border-left: 1px solid var(--rule-strong); }
.g-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dotted var(--rule); }
.g-bar {
  position: absolute; top: .38rem; height: 1.12rem; border-radius: 3px; font-size: .72rem; line-height: 1.12rem; padding-inline: .35rem;
  overflow: hidden; white-space: nowrap; transition: opacity .2s, left .35s, width .35s; font-weight: 500;
}
.g-bar.neutral { background: var(--surface-3); color: var(--ink); }
.g-bar.late { background: var(--today); color: var(--today-on); }
.g-bar.ok { background: var(--new); color: var(--new-on); }
.g-bar.dashed { background: transparent; border: 1.5px dashed var(--rule-strong); color: var(--ink-2); }
.g-bar.future { opacity: .3; }
.g-bar.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.g-ms { position: absolute; top: 50%; width: .8rem; height: .8rem; background: var(--new); transform: translate(-50%, -50%) rotate(45deg); border: 2px solid var(--surface); transition: left .35s; }
.g-ms.future { opacity: .35; }
.g-mark { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--ink); }
.g-mark.dash { border-left: 1.5px dashed var(--ink-2); }
.g-playhead {
  position: absolute; top: -.35rem; bottom: -.35rem; width: 2px; background: var(--ds-color-accent-base-default); pointer-events: none;
  left: calc(var(--lw) + (100% - var(--lw)) * var(--p)); z-index: 2;
}
.g-axis { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); }
.g-axis .ticks { position: relative; height: 1.5rem; font-size: .74rem; color: var(--ink-2); border-top: 1px solid var(--rule-strong); font-variant-numeric: tabular-nums; }
.g-axis .ticks span { position: absolute; top: .2rem; transform: translateX(-50%); white-space: nowrap; }
.g-axis .ticks span:first-child { transform: none; }
.g-anno { position: absolute; top: 0; font-size: .74rem; color: var(--ink-2); white-space: nowrap; transform: translateX(-50%); }
.tl-status { margin-top: .9rem; }
@media (max-width: 680px) {
  .tl-panel { --lw: 7.25rem; }
  .g-label { font-size: .78rem; }
  .g-label small { display: none; }
  .g-bar { font-size: 0; }
}

/* ---------- Sakene ---------- */
.cases { --lw: 8.5rem; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
@media (max-width: 900px) { .cases { grid-template-columns: minmax(0, 1fr); } }
.case-list { display: grid; gap: .35rem; }
.case-btn {
  display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); gap: .75rem; align-items: center; text-align: left;
  border: 1px solid transparent; background: transparent; border-radius: var(--radius); padding: .65rem .7rem;
}
.case-btn:hover { background: var(--ds-color-accent-surface-tinted); }
.case-btn[aria-pressed="true"] { background: var(--surface); border-color: var(--ds-color-accent-border-default); box-shadow: inset 4px 0 0 var(--ds-color-accent-base-default); }
.case-btn .nm { font-weight: 600; font-size: 1rem; line-height: 1.25; }
.case-btn .nm small { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-2); }
.case-bars { display: grid; gap: .3rem; }
.cb { position: relative; height: .8rem; }
.cb i { position: absolute; top: 0; height: 100%; border-radius: 0 3px 3px 0; }
.cb i.t { background: var(--today); }
.cb i.t.hold { background: repeating-linear-gradient(135deg, var(--today) 0 3px, var(--today-soft) 3px 6px); }
.cb i.t.range { background: repeating-linear-gradient(135deg, var(--today) 0 3px, transparent 3px 6px); border: 1px solid var(--today); border-left: 0; }
.cb i.t.open { background: linear-gradient(90deg, var(--today) 70%, transparent); }
.cb i.n { background: var(--new); min-width: 3px; }
.cb em { position: absolute; top: -.25rem; font-style: normal; font-size: .76rem; color: var(--ink-2); white-space: nowrap; padding-left: .4rem; line-height: 1.25rem; }
.cb em.newtxt { color: var(--new-text); font-weight: 500; }
.case-axis { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); gap: .75rem; padding-inline: .7rem; }
.case-axis .ticks { position: relative; height: 1.4rem; font-size: .74rem; color: var(--ink-2); border-top: 1px solid var(--rule-strong); }
.case-axis .ticks span { position: absolute; top: .2rem; transform: translateX(-50%); white-space: nowrap; }
.case-axis .ticks span:first-child { transform: none; }
@media (max-width: 560px) {
  .cases { --lw: 0rem; }
  .case-btn { grid-template-columns: minmax(0, 1fr); gap: .45rem; }
  .case-axis { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .case-axis > :first-child { display: none; }
}
.case-detail h3 { font-size: var(--fs-h3); }
.case-detail .story { margin-top: .9rem; }
.case-detail .story + .story { margin-top: .75rem; }
.events { list-style: none; padding: 0; margin: 1.25rem 0 0; border-left: 2px solid var(--rule); }
.events li { position: relative; padding: 0 0 .85rem 1.1rem; font-size: .95rem; line-height: 1.5; }
.events li::before { content: ""; position: absolute; left: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rule-strong); }
.events li.bad::before { border-color: var(--today); background: var(--today); }
.events li.end::before { border-color: var(--ink); background: var(--ink); }
.events time { display: block; font-size: .8rem; color: var(--ink-2); font-weight: 500; }
.newbox { margin-top: 1.25rem; }
.mini-bars { display: grid; gap: .45rem; margin-top: 1rem; }
.mini-bars div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 2.8rem; gap: .6rem; align-items: center; font-size: .85rem; }
.mini-bars .b { height: .7rem; background: var(--surface-2); border-radius: 2px; position: relative; overflow: hidden; }
.mini-bars .b i { position: absolute; inset: 0 auto 0 0; background: var(--ink-3); border-radius: 2px; }
.mini-bars .b i.hl { background: var(--today); }
.mini-bars .v { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Kostnader og årsaker ---------- */
.costs { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.cost { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.15rem; }
.cost h4 { font-size: 1.05rem; margin-bottom: .45rem; }
.cost p { font-size: .92rem; color: var(--ink-2); }
.causes { display: grid; border-top: 1px solid var(--rule); }
.cause { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2.5rem minmax(0, 1fr); gap: .75rem 1rem; padding-block: 1.1rem; border-bottom: 1px solid var(--rule); align-items: start; }
.cause .i { font-weight: 600; color: var(--today-text); font-variant-numeric: tabular-nums; padding-top: .05rem; }
.cause .arrow { color: var(--ink-2); }
.cause .arrow svg { width: 22px; height: 22px; }
.cause h4 { font-size: 1.05rem; }
.cause p { font-size: .92rem; color: var(--ink-2); margin-top: .25rem; }
.cause .fix h4 { color: var(--new-text); }
.causes-head { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2.5rem minmax(0, 1fr); gap: 1rem; padding-bottom: .5rem; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
@media (max-width: 720px) {
  .cause, .causes-head { grid-template-columns: 1.75rem minmax(0, 1fr); }
  .cause .arrow { display: none; }
  .cause .fix { grid-column: 2; padding-left: .9rem; border-left: 3px solid var(--new); }
  .causes-head > :nth-child(3), .causes-head > :nth-child(4) { display: none; }
}
.human-band { margin-top: 1.5rem; }

/* ---------- Arkitektur ---------- */
.arch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 15rem); gap: 1rem 1.25rem; }
.arch-main { display: grid; gap: 1.6rem; min-width: 0; }
.arch-side { display: grid; gap: 1rem; align-content: start; }
.layer { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem 1.2rem; }
.arch-main .layer + .layer::before { content: ""; position: absolute; left: 50%; top: calc(-1.6rem - 1px); height: 1.6rem; border-left: 2px solid var(--rule-strong); }
.arch-main .layer + .layer::after { content: ""; position: absolute; left: calc(50% - 5px); top: -.55rem; border: 5px solid transparent; border-top-color: var(--rule-strong); }
.layer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: baseline; }
.layer h4 { font-size: 1.15rem; margin-top: .15rem; }
.layer .kicker { font-size: .82rem; font-weight: 500; color: var(--ds-color-accent-text-subtle); }
.layer p { font-size: .92rem; color: var(--ink-2); margin-top: .35rem; }
.layer .chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.layer a.go { font-size: .875rem; font-weight: 500; white-space: nowrap; }
.etater { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; margin-top: .85rem; }
.etater span { font-size: .8rem; text-align: center; padding: .5rem .25rem; border-radius: var(--radius-sm); background: var(--ds-color-accent-surface-tinted); color: var(--ds-color-accent-text-default); line-height: 1.25; }
.datalag { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .85rem; }
.datalag > div { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .65rem .75rem; background: var(--bg-tint); min-width: 0; }
.datalag b { font-size: .9rem; display: block; line-height: 1.3; }
.datalag small { font-size: .8rem; color: var(--ink-2); display: block; margin-top: .25rem; line-height: 1.4; }
.layer.side { background: var(--bg-tint); }
@media (max-width: 860px) {
  .arch { grid-template-columns: minmax(0, 1fr); }
  .arch-side { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
}
@media (max-width: 560px) {
  .etater { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .datalag { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Søknad ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
@media (max-width: 900px) { .app { grid-template-columns: minmax(0, 1fr); } }
.form { display: grid; gap: 1.5rem; }
.form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 1rem; min-width: 0; }
.form legend { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: .75rem; padding: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 520px) { .field-row { grid-template-columns: minmax(0, 1fr); } }
.form .ds-field { min-width: 0; }
.form .ds-input:not([type="checkbox"]) { width: 100%; }
.auto { font-size: .8rem; color: var(--ds-color-accent-text-subtle); }
.checks { display: grid; gap: .5rem; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; }
.rules li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .5rem; padding: .65rem 0; border-bottom: 1px solid var(--rule); font-size: .95rem; line-height: 1.4; }
.rules li small { display: block; color: var(--ink-2); font-size: .8rem; margin-top: .15rem; }
.rules .ic { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; }
.rules .ic svg { width: 14px; height: 14px; }
.rules li.pass .ic { background: var(--ds-color-success-surface-tinted); color: var(--ds-color-success-text-subtle); }
.rules li.fail .ic { background: var(--ds-color-danger-surface-tinted); color: var(--ds-color-danger-text-subtle); }
.rules li.na { color: var(--ink-2); }
.rules li.na .ic { background: var(--surface-2); color: var(--ink-2); }
.rule-sum { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .5rem; flex-wrap: wrap; }
.rule-sum h3 { font-size: var(--fs-lg); font-weight: 600; }
.submit-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.25rem; }
.track-badge { margin-top: 1rem; }
.stepper { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; }
.stepper li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; gap: .65rem; align-items: start; padding: .5rem 0; position: relative; font-size: .95rem; line-height: 1.4; }
.stepper li::before { content: ""; position: absolute; left: .82rem; top: 1.9rem; bottom: -.45rem; border-left: 2px solid var(--rule); }
.stepper li:last-child::before { display: none; }
.stepper .dot { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 2px solid var(--rule-strong); background: var(--surface); display: grid; place-items: center; font-size: .75rem; font-weight: 600; color: var(--ink-2); position: relative; z-index: 1; }
.stepper .dot svg { width: 14px; height: 14px; }
.stepper li.done .dot { background: var(--new); border-color: var(--new); color: var(--new-on); }
.stepper li.done::before { border-color: var(--new); }
.stepper li.now .dot { border-color: var(--new); color: var(--new-text); box-shadow: 0 0 0 4px var(--new-soft); }
.stepper li.now .t { font-weight: 600; }
.stepper .when { font-size: .8rem; color: var(--ink-2); white-space: nowrap; padding-top: .2rem; font-variant-numeric: tabular-nums; }
.stepper small { display: block; color: var(--ink-2); font-size: .8rem; }
.status-label { margin-top: 1.75rem; font-weight: 600; font-size: var(--fs-sm); }

/* ---------- Sakmappe ---------- */
.folder-bar { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.folder-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .92rem; color: var(--ink-2); }
.folder-meta b { color: var(--ink); font-weight: 600; }
.conflict { margin-bottom: 1rem; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 1180px) { .cols { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 760px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.col { border: 1px solid var(--rule); border-radius: var(--radius); padding: .85rem; background: var(--bg-tint); display: grid; gap: .65rem; align-content: start; min-width: 0; overflow-wrap: anywhere; }
.col.flag { border-color: var(--ds-color-warning-border-default); }
.col > * { min-width: 0; }
.col h4 { font-size: 1rem; }
.col .law { font-size: .76rem; color: var(--ink-2); line-height: 1.35; }
.count { display: grid; gap: .3rem; }
.count .lbl { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.count .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.count .bar i { display: block; height: 100%; background: var(--new); transition: width .4s; }
.count.over .bar i { background: var(--ink-3); }
.draft { border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--rule); padding: .65rem .7rem; font-size: .86rem; line-height: 1.5; }
.draft.lapsed { opacity: .6; }
.draft .who { font-size: .74rem; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: .3rem; margin-bottom: .35rem; }
.draft .who svg { width: 13px; height: 13px; }
.draft .txt[contenteditable="true"] { outline: 2px solid var(--ds-color-accent-border-default); outline-offset: 2px; border-radius: 2px; background: var(--new-soft); }
.draft .srcs { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .5rem; }
.draft .srcs .ds-tag { max-width: 100%; white-space: normal; text-align: left; min-height: 0; padding-block: .15rem; line-height: 1.3; }
.col .acts { display: flex; flex-wrap: wrap; gap: .4rem; }
.signed { font-size: .82rem; color: var(--ok); display: flex; gap: .3rem; align-items: center; font-weight: 500; }
.signed svg { width: 14px; height: 14px; flex: none; }

/* ---------- Resipientregnskap ---------- */
.recip { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
@media (max-width: 920px) { .recip { grid-template-columns: minmax(0, 1fr); } }
.map { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--land); }
.map .wb { stroke: var(--surface); stroke-width: 2; cursor: pointer; transition: fill .3s; outline: none; }
.map .wb:hover { stroke: var(--ink-2); }
.map .wb.sel { stroke: var(--ink); stroke-width: 3; }
.map .wb:focus-visible { stroke: var(--ds-color-focus-outer); stroke-width: 3; }
.map .isle { fill: var(--land); stroke: var(--rule-strong); stroke-width: 1; }
.map .lbl { font-family: var(--font); font-size: 12.5px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.map .lbl.pct { font-weight: 500; font-size: 11.5px; }
.map .site { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; pointer-events: none; }
.map .site.app { fill: var(--today); stroke: var(--surface); stroke-width: 2; }
.map .sitelbl { font-family: var(--font); font-size: 11px; font-weight: 500; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; }
.map .compass { fill: none; stroke: var(--rule-strong); }
.map .compass-t { font-family: var(--font); font-size: 10.5px; fill: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .75rem; font-size: .8rem; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 1.4rem; height: .7rem; border-radius: 2px; vertical-align: -1px; margin-right: .3rem; border: 1px solid var(--rule); }
.legend i.over { background: repeating-linear-gradient(135deg, var(--today) 0 2px, var(--seq-5) 2px 5px); }
.ctrl { display: grid; gap: 1.1rem; }
.ctrl .ds-input { width: 100%; }
.ctrl input[type="range"] { width: 100%; accent-color: var(--ds-color-accent-base-default); }
.range-label { display: flex; justify-content: space-between; gap: .5rem; }
.range-label output { font-weight: 600; font-variant-numeric: tabular-nums; }
.wb-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.wb-head h4 { font-size: 1.3rem; }
.loads { display: grid; gap: .9rem; }
.load .top { display: flex; justify-content: space-between; font-size: .88rem; gap: .5rem; flex-wrap: wrap; }
.load .top b { font-weight: 600; }
.load .top .num { color: var(--ink-2); }
.load .bar { position: relative; height: 1.1rem; background: var(--surface-2); border-radius: 3px; margin-top: .3rem; }
.load .bar i { position: absolute; top: 0; bottom: 0; transition: left .3s, width .3s; }
.load .bar i.base { left: 0; background: var(--ink-3); border-radius: 3px 0 0 3px; }
.load .bar i.add { background: var(--today); }
.load .bar i.cut { background: repeating-linear-gradient(135deg, var(--new) 0 2px, transparent 2px 5px); border: 1px solid var(--new); }
.load .bar .cap { position: absolute; top: -.3rem; bottom: -.3rem; width: 2px; background: var(--ink); }
.load-key { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .8rem; color: var(--ink-2); }
.load-key i { display: inline-block; width: .9rem; height: .6rem; border-radius: 2px; margin-right: .3rem; }
.load-key i.cap { width: 2px; height: .85rem; background: var(--ink); vertical-align: -2px; }

/* ---------- Høring ---------- */
.hearing { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: clamp(1.25rem, 4vw, 3rem); align-items: start; }
@media (max-width: 820px) { .hearing { grid-template-columns: minmax(0, 1fr); justify-items: center; } .hearing > .panel { width: 100%; } }
.phone { width: 100%; max-width: 20rem; border-radius: 2.2rem; padding: .7rem; background: var(--device); border: 1px solid var(--rule); }
.screen { background: var(--bg); border-radius: 1.65rem; overflow: hidden; min-height: 36rem; display: flex; flex-direction: column; }
.statusbar { display: flex; justify-content: space-between; padding: .55rem 1.1rem .25rem; font-size: .72rem; font-weight: 600; color: var(--ink-2); }
.notif { margin: .4rem .6rem; padding: .6rem .7rem; border-radius: .8rem; background: var(--surface); border: 1px solid var(--rule); font-size: .78rem; line-height: 1.35; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: .5rem; }
.notif .ico { width: 1.6rem; height: 1.6rem; border-radius: .4rem; background: var(--new); display: grid; place-items: center; color: var(--new-on); }
.notif .ico svg { width: 14px; height: 14px; }
.notif b { display: block; font-size: .82rem; }
.app-body { padding: .6rem .9rem 1rem; display: grid; gap: .75rem; font-size: .85rem; line-height: 1.45; }
.app-body h5 { font-size: 1.05rem; font-weight: 600; margin: 0; line-height: 1.25; }
.mini-map { width: 100%; height: auto; border-radius: .5rem; border: 1px solid var(--rule); display: block; background: var(--land); }
.mini-map .w { fill: var(--water); }
.mini-map .pen { fill: none; stroke: var(--today); stroke-width: 2; }
.mini-map .pen.old { stroke: var(--ink-2); stroke-dasharray: 3 3; }
.mini-map .home { fill: var(--ink); }
.mini-map .rng { fill: none; stroke: var(--ink-2); stroke-dasharray: 2 3; }
.mini-map text { font-family: var(--font); font-size: 9.5px; font-weight: 500; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 2.5px; }
.cons { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.cons li { display: grid; grid-template-columns: 1rem minmax(0, 1fr); gap: .4rem; }
.cons li::before { content: "–"; color: var(--ink-2); }
.phone .ds-input { width: 100%; font-size: .85rem; }
.phone .ds-button { width: 100%; }
.groups { display: grid; gap: .5rem; }
.group { border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); }
.group > button { width: 100%; display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) 2rem 1rem; gap: .75rem; align-items: center; padding: .7rem .85rem; background: transparent; border: 0; text-align: left; border-radius: var(--radius-sm); }
.group > button:hover { background: var(--ds-color-accent-surface-tinted); }
.group .gname { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.group .gbar { height: .55rem; border-radius: 0 3px 3px 0; background: var(--new); transition: width .4s; }
.group .gcount { font-size: .92rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.group .chev { width: 16px; height: 16px; color: var(--ink-2); transition: transform .2s; }
.group > button[aria-expanded="true"] .chev { transform: rotate(90deg); }
.group .quotes { padding: 0 .85rem .85rem; display: grid; gap: .5rem; }
.group blockquote { margin: 0; padding: .5rem .75rem; border-left: 3px solid var(--rule-strong); font-size: .92rem; background: var(--bg-tint); border-radius: 0 4px 4px 0; }
.group blockquote.fresh { border-color: var(--new); background: var(--new-soft); }
.group blockquote cite { display: block; font-style: normal; font-size: .76rem; color: var(--ink-2); margin-top: .2rem; }
.group.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--ds-color-accent-border-default); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .group.flash { animation: none; } }
@media (max-width: 520px) { .group > button { grid-template-columns: minmax(0, 1fr) 4rem 1.8rem 1rem; } }

/* ---------- Spor A/B/C ---------- */
.spor3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 820px) { .spor3 { grid-template-columns: minmax(0, 1fr); } }
.spor-card { padding: 1.25rem; border: 1px solid var(--rule); border-top: 4px solid var(--new); border-radius: var(--radius); background: var(--surface); display: grid; gap: .55rem; align-content: start; }
.spor-card .letter { font-size: .9rem; font-weight: 600; color: var(--new-text); }
.spor-card .time { font-weight: 500; font-size: 1.75rem; line-height: 1.15; }
.spor-card .today-was { font-size: .88rem; color: var(--today-text); }
.spor-card p { font-size: .95rem; color: var(--ink-2); }
.spor-card .floor { border-top: 1px solid var(--rule); padding-top: .6rem; font-size: .88rem; }
.spor-card .floor span { font-size: .8rem; font-weight: 600; color: var(--ink-2); display: block; }

/* ---------- AI ---------- */
.ai-table td:nth-child(2) { white-space: nowrap; }
.meter { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: .5rem; }
.meter i { width: 9px; height: 9px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--rule-strong); }
.meter i.on { background: var(--new); border-color: var(--new); }
@media (max-width: 720px) { .ai-table td:nth-child(2) { white-space: normal; } }
.legal { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem 2rem; margin-top: 2rem; }
.legal div { font-size: .92rem; color: var(--ink-2); }
.legal b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: .2rem; }

/* ---------- Veien dit ---------- */
.road { --lw: 16rem; display: grid; gap: .2rem; }
.road-row { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); gap: 1rem; align-items: center; padding-block: .5rem; }
.road-row .nm { font-size: .95rem; font-weight: 600; line-height: 1.3; }
.road-row .nm small { display: block; font-weight: 400; color: var(--ink-2); font-size: .8rem; }
.road-row .nm .ds-tag { margin-left: .25rem; vertical-align: 1px; }
.road-track { position: relative; height: 1.6rem; background: linear-gradient(90deg, var(--rule) 1px, transparent 1px) 0 0 / 20% 100%; }
.road-track i { position: absolute; top: .3rem; height: 1rem; }
.road-track i.solid { left: 0; background: var(--new); border-radius: 3px 0 0 3px; }
.road-track i.maybe { background: repeating-linear-gradient(135deg, var(--new) 0 2px, transparent 2px 5px); border: 1px solid var(--new); border-left: 0; border-radius: 0 3px 3px 0; }
.road-track em { position: absolute; top: .1rem; font-style: normal; font-size: .8rem; font-weight: 500; padding-left: .45rem; white-space: nowrap; line-height: 1.4rem; }
.road-axis { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); gap: 1rem; }
.road-axis .ticks { position: relative; height: 1.5rem; border-top: 1px solid var(--rule-strong); font-size: .76rem; color: var(--ink-2); }
.road-axis .ticks span { position: absolute; top: .25rem; transform: translateX(-50%); white-space: nowrap; }
.road-axis .ticks span:first-child { transform: none; }
.road-axis .ticks span:last-child { transform: translateX(-100%); }
@media (max-width: 680px) {
  .road { --lw: 0rem; }
  .road-row { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
  .road-axis { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .road-axis > :first-child { display: none; }
}
.laws { list-style: none; counter-reset: law; margin: 0; padding: 0; display: grid; gap: .75rem; }
.laws li { counter-increment: law; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: .4rem 1rem; padding: 1rem 1.15rem; align-items: start; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.laws li::before { content: counter(law); width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .95rem; background: var(--new); color: var(--new-on); }
.laws h4 { font-size: 1.05rem; padding-top: .2rem; }
.laws p { font-size: .92rem; color: var(--ink-2); margin-top: .25rem; }
.laws .meta { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; max-width: 15rem; }
@media (max-width: 680px) { .laws li { grid-template-columns: 2.5rem minmax(0, 1fr); } .laws .meta { grid-column: 2; justify-content: flex-start; max-width: none; } }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.limits > div { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.15rem; }
.limits b { display: block; font-size: 1.05rem; font-weight: 600; }
.limits p { font-size: .92rem; color: var(--ink-2); margin-top: .3rem; }

/* ---------- Bunntekst ---------- */
.foot { padding-block: clamp(2.5rem, 5vw, 4rem) 2.5rem; background: var(--ds-color-neutral-base-default); color: var(--ds-color-neutral-base-contrast-default); }
.foot h2 { font-size: var(--fs-h3); color: inherit; }
.foot a { color: inherit; }
.foot .small { color: inherit; opacity: .85; }
.src-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem 3rem; margin-top: 1.5rem; }
.src-groups h3 { font-size: 1rem; font-weight: 600; margin-bottom: .6rem; color: inherit; }
.src-groups ul { margin: 0; padding: 0 0 0 1.1rem; display: grid; gap: .45rem; font-size: .92rem; line-height: 1.45; }
.colophon { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid color-mix(in srgb, currentColor 30%, transparent); font-size: .85rem; opacity: .85; display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; }
.verdict b, .verdict span { display: block; }
.verdict b { font-weight: 600; margin-bottom: .2rem; }
.verdict .small { color: inherit; opacity: .85; }
