/*
 * Lykkelig tur – stilark.
 * Mobil først. Alle farger er variabler slik at lys og mørk modus deler ett sett regler.
 */

:root {
  color-scheme: light dark;

  --paper: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --surface-3: #e7e3d9;
  --ink: #1b1c1a;
  --ink-2: #55574f;
  --ink-3: #83857c;
  --line: #dcd8ce;
  --line-strong: #c3bdaf;

  --green: #2f6b46;
  --green-soft: #e3efe6;
  --route: #e2483d;
  --sky: #2f6fd0;
  --sky-soft: #e6eefb;
  --warn: #a9690b;
  --warn-soft: #fbf0dc;
  --alert: #c2352a;
  --alert-soft: #fbe6e3;
  --ok-soft: #e4f0e6;
  --gold: #c99a22;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(27 28 26 / 8%), 0 8px 24px rgb(27 28 26 / 10%);
  --shadow-sm: 0 1px 3px rgb(27 28 26 / 12%);
  --topbar-h: 54px;
  --sheet-peek: 196px;
  /*
   * Hvor mye av skjermens underkant bunnarket dekker akkurat nå. Settes av
   * sheet.js mens man drar, slik at knapper i kartet alltid ligger like over
   * arket i stedet for å forsvinne bak det.
   */
  --sheet-cover: var(--sheet-peek);
  /* Høyden på dragflaten øverst i arket – håndtak, turlinje og faner. */
  --sheet-head: 120px;
  --tap: 44px;

  /*
   * Trygge soner. Lagt til hjemskjerm har appen ingen nettleserlinje, og da
   * ligger innholdet ellers under hakket og under hjemindikatoren.
   */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161a;
    --surface: #1c1f24;
    --surface-2: #23272e;
    --surface-3: #2c313a;
    --ink: #eef0ee;
    --ink-2: #b3b8b4;
    --ink-3: #868b88;
    --line: #303640;
    --line-strong: #414954;

    --green: #63b083;
    --green-soft: #1e2f26;
    --route: #ff6b5e;
    --sky: #6aa4f0;
    --sky-soft: #1b2739;
    --warn: #e5a54a;
    --warn-soft: #33291a;
    --alert: #f0776a;
    --alert-soft: #331e1c;
    --ok-soft: #1d2c22;
    --gold: #e0b954;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 45%);
    --shadow-sm: 0 1px 3px rgb(0 0 0 / 40%);
  }
}

* {
  box-sizing: border-box;
}

/*
 * Flere av klassene her setter display, og da vinner de over nettleserens
 * regel for [hidden]. Denne linja gjør at hidden faktisk skjuler.
 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

a {
  color: var(--green);
}

button {
  font: inherit;
  color: inherit;
}

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 8px;
  z-index: 3000;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: top 0.15s;
}

.skip-link:focus {
  top: 8px;
}

.noscript {
  position: fixed;
  inset: auto 0 0;
  z-index: 3000;
  padding: 16px;
  margin: 0;
  text-align: center;
  background: var(--alert-soft);
}

/* ---------- Topplinje ---------- */

.topbar {
  position: relative;
  z-index: 900;
  display: flex;
  gap: 10px;
  align-items: center;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 17px;
  white-space: nowrap;
}

.brand__mark {
  color: var(--green);
  font-size: 15px;
}

@media (max-width: 400px) {
  .brand__name {
    display: none;
  }
}

/* ---------- Søk ---------- */

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 520px;
}

.search__input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.search__input::placeholder {
  color: var(--ink-3);
}

.search__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 1000;
  max-height: 60vh;
  padding: 4px;
  margin: 0;
  overflow-y: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search__option {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.search__option.is-active,
.search__option:hover {
  background: var(--green-soft);
}

.search__name {
  font-weight: 600;
}

.search__meta {
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ---------- Oppsett ---------- */

.app {
  position: relative;
  display: grid;
  height: calc(100dvh - var(--topbar-h) - var(--safe-top));
  overflow: hidden;
  grid-template-columns: 1fr;
  /* minmax(0, …) hindrer at raden vokser med innholdet i panelet – uten den
     strekker kartet seg like langt som turlista er lang. */
  grid-template-rows: minmax(0, 1fr);
}

.map-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.map {
  width: 100%;
  height: 100%;
  background: var(--surface-2);
}

.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Liggende telefon: knappene på rad, ellers spiser stabelen hele kartet. */
@media (max-height: 520px) and (max-width: 899px) {
  .map-tools {
    flex-direction: row;
  }
}

.map-btn {
  display: grid;
  width: var(--tap);
  height: var(--tap);
  font-size: 18px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  place-items: center;
}

.map-btn:hover {
  border-color: var(--line-strong);
}

.map-btn.is-on {
  color: #fff;
  background: var(--sky);
  border-color: var(--sky);
}

/*
 * På telefon er dette et eget ark nederst, ikke en liten boks i hjørnet.
 * Boksen ble klippet av bunnarket, og valgene under kanten var uråd å nå.
 */
.popover {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2500;
  max-height: min(72dvh, 620px);
  padding: 14px 16px calc(16px + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
}

/* Bakgrunnen dempes, så det er tydelig at menyen er øverst. */
.has-overlay::before {
  position: fixed;
  z-index: 2400;
  content: '';
  inset: 0;
  background: rgb(20 22 26 / 32%);
}

@media (min-width: 900px) {
  .popover {
    position: absolute;
    top: 12px;
    right: 68px;
    bottom: auto;
    left: auto;
    width: min(300px, calc(100vw - 96px));
    max-height: 70vh;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .has-overlay::before {
    content: none;
  }
}

.popover__head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.popover__heading {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.popover__title {
  margin: 12px 0 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.popover__title:first-child {
  margin-top: 0;
}

/* Sier fra når nettet er borte, så et tomt kart ikke ser ødelagt ut. */
.offline-note {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 760;
  max-width: calc(100% - 140px);
  padding: 7px 13px;
  margin: 0;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  background: var(--warn-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transform: translateX(-50%);
}

@media (prefers-color-scheme: dark) {
  .offline-note {
    color: var(--ink);
  }
}

/* Navnet på stien under pekeren. */
.trail-label {
  position: absolute;
  bottom: calc(var(--sheet-cover) + 12px);
  left: 50%;
  z-index: 700;
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  margin: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  transition: bottom 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 900px) {
  .trail-label {
    bottom: 16px;
  }
}

/* ---------- Forhåndsvisning over kartet ---------- */

.preview {
  position: absolute;
  right: 12px;
  bottom: calc(var(--sheet-cover) + 12px);
  left: 12px;
  z-index: 720;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: 420px;
  padding: 13px 14px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: bottom 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 900px) {
  .preview {
    right: auto;
    bottom: 16px;
    left: 16px;
    margin: 0;
  }
}

.preview__head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.preview__name {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
}

.preview__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.preview__pick {
  width: 100%;
}

/* ---------- Kom deg til start ---------- */

.journeys {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journey {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  grid-template-columns: auto 1fr auto;
}

.journey__when {
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}

.journey__when span {
  font-size: 11.5px;
  color: var(--ink-2);
}

.journey__legs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.leg {
  padding: 2px 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.leg--bus,
.leg--tram,
.leg--metro {
  color: var(--sky);
  border-color: var(--sky);
}

.leg--rail,
.leg--water {
  color: var(--green);
  border-color: var(--green);
}

.journey__walk {
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.btn--link {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  text-decoration: none;
  color: var(--ink);
}

/* Kartet får pekefinger når en sti kan velges. */
.map.is-pointing {
  cursor: pointer;
}

/* I tegnemodus er trådkorset et signal om at trykk setter punkter. */
.map.is-drawing {
  cursor: crosshair;
}

.map.is-drawing::after {
  position: absolute;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  content: '';
  box-shadow: inset 0 0 0 3px var(--green);
}

.pill.is-on {
  color: #fff;
  background: var(--green);
  border-color: transparent;
}

.map-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100% - 80px);
}

.draw-tools {
  display: flex;
  gap: 8px;
}

.pill {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.pill:hover {
  border-color: var(--line-strong);
}

.pill--action {
  color: #fff;
  background: var(--green);
  border-color: transparent;
}

/* ---------- Første gang ---------- */

.intro {
  position: absolute;
  right: 12px;
  bottom: calc(var(--sheet-cover) + 12px);
  left: 12px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  padding: 16px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.intro__title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.intro__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  list-style: none;
}

.intro__line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.intro__icon {
  font-size: 17px;
  line-height: 1.2;
}

@media (min-width: 900px) {
  .intro {
    right: auto;
    bottom: 16px;
    left: 16px;
    margin: 0;
  }
}

/* «Start turen» ligger i kartet, der man ser hvor man skal. */
.pill--start {
  position: absolute;
  bottom: calc(var(--sheet-cover) + 12px);
  left: 50%;
  z-index: 710;
  min-height: 46px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 620;
  color: #fff;
  background: var(--green);
  border-color: transparent;
  transform: translateX(-50%);
  transition: bottom 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 900px) {
  .pill--start {
    bottom: 16px;
  }
}

/*
 * Er arket dratt helt opp er det ingen kart igjen å legge knappene over.
 * «Start turen» ligger uansett også nederst i panelet.
 */
@media (max-width: 899px) {
  body[data-sheet='full'] .pill--start,
  body[data-sheet='full'] .trail-label,
  body[data-sheet='full'] .preview,
  body[data-sheet='full'] .map-tools {
    display: none;
  }

  /*
   * Meldinger må fram uansett – de flytter seg opp i stedet, men under
   * fanene og turlinja. Legger de seg oppå, dekker de nettopp det man
   * trenger å lese mens man går.
   */
  body[data-sheet='full'] .toasts {
    /* Arkets egen overkant er «100dvh minus det arket dekker». */
    top: calc(100dvh - var(--sheet-cover) + var(--sheet-head) + 10px);
    bottom: auto;
  }
}

/* Leaflet-oppretting */
.leaflet-container {
  font: inherit;
  background: var(--surface-2);
}

.leaflet-control-attribution {
  font-size: 10.5px;
  background: rgb(255 255 255 / 78%) !important;
}

.leaflet-control-zoom {
  display: none;
}

@media (min-width: 900px) {
  .leaflet-control-zoom {
    display: block;
  }
}

@media (max-width: 899px) {
  .leaflet-bottom {
    margin-bottom: calc(var(--sheet-cover) - 12px);
  }
}

@media (prefers-color-scheme: dark) {
  .leaflet-control-attribution {
    color: #ddd;
    background: rgb(20 22 26 / 80%) !important;
  }

  .leaflet-control-attribution a {
    color: #9fd6b4;
  }

  /* Kartverkets fliser er lyse; en lett demping gjør ruta lesbar i mørk modus. */
  .leaflet-tile-pane {
    filter: brightness(0.86) contrast(1.04);
  }
}

.leaflet-bar a {
  color: var(--ink);
  background: var(--surface);
  border-bottom-color: var(--line);
}

/* Markører */
.wp {
  display: grid;
  width: 26px;
  height: 26px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--route);
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
  place-items: center;
}

.wp--start {
  background: var(--green);
}

.wp--slutt {
  background: #1b1c1a;
}

.wp--mellom {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.tip {
  display: block;
  width: 14px;
  height: 14px;
  background: #1c6fd4;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
}

.tip--slutt {
  background: #0d3f7f;
}

.poi {
  display: grid;
  width: 26px;
  height: 26px;
  font-size: 14px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  place-items: center;
}

.me {
  display: block;
  width: 16px;
  height: 16px;
  background: var(--sky);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 25%);
}

/* ---------- Panel ---------- */

.panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  /* Over Leaflets egne kontroller, som ligger på 1000. */
  z-index: 1100;
  display: flex;
  height: min(88dvh, 760px);
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
  /* Startstilling; JavaScript overtar når arket kan dras. */
  transform: translateY(calc(100% - var(--sheet-peek)));
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

/*
 * Hele toppen av arket er dragflate – fanene og turlinja følger med. Det er
 * mye lettere å treffe enn en tynn strek.
 */
.sheet-grab {
  flex: none;
  touch-action: none;
  cursor: grab;
}

.sheet-grab:active {
  cursor: grabbing;
}

.sheet-handle {
  display: block;
  width: 100%;
  height: 26px;
  padding: 0;
  cursor: inherit;
  background: none;
  border: 0;
}

.sheet-handle__grip {
  display: block;
  width: 48px;
  height: 5px;
  margin: 10px auto;
  background: var(--line-strong);
  border-radius: 3px;
  transition: background 0.15s;
}

.panel[data-sheet='peek'] .sheet-handle__grip {
  background: var(--green);
}

@media (min-width: 900px) {
  .app {
    grid-template-columns: 1fr min(440px, 40vw);
  }

  .panel {
    position: relative;
    height: 100%;
    min-height: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding-bottom: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none !important;
  }

  .sheet-grab {
    touch-action: auto;
    cursor: default;
  }

  .sheet-handle {
    display: none;
  }

  .popover {
    right: 68px;
  }
}

/* ---------- Faner ---------- */

.tabs {
  display: flex;
  flex: none;
  gap: 3px;
  padding: 3px;
  margin: 0 12px 8px;
  background: var(--surface-2);
  border-radius: 11px;
}

.tab {
  flex: 1;
  /* Fanene er hovednavigasjonen; de skal treffes med tommelen i fart. */
  min-height: var(--tap);
  padding: 7px 6px;
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 9px;
}

.tab.is-active {
  font-weight: 640;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panes {
  flex: 1 1 auto;
  /* Uten dette spiser innholdet plassen til fanene i en flex-kolonne. */
  min-height: 0;
  padding: 8px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Turmodus ---------- */

/*
 * Turlinja leses i fart, ofte i sollys og med kalde hender. Tallene er derfor
 * store, tabulære og alltid på samme plass.
 */
.navbar {
  flex: none;
  padding: 2px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.navbar__numbers {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.navbar__stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.navbar__value {
  font-size: clamp(16px, 4.6vw, 21px);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.navbar__label {
  font-size: 10.5px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bar--nav {
  margin: 10px 0 8px;
}

.navbar__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.navbar__ok,
.navbar__warn {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar__ok {
  color: var(--green);
}

.navbar__warn {
  font-weight: 640;
  color: var(--alert);
}

.navbar__waiting {
  margin: 0;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--ink-2);
}

.navbar__done {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.pill--tiny {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12.5px;
  box-shadow: none;
  flex: none;
}

.next-up {
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 14px;
  background: var(--green-soft);
  border-radius: var(--radius-sm);
}

.position {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.position__value {
  font-size: 19px;
  font-weight: 680;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.position .hint {
  margin: 0;
}

.position .btn {
  margin-top: 6px;
  align-self: flex-start;
}

/*
 * Under turen trengs mer av arket synlig når det er skjøvet ned. Variabelen
 * settes på body, slik at meldinger og kartkontroller flytter seg like mye.
 */
body.is-navigating {
  --sheet-peek: 252px;
}

/* ---------- Nøkkeltall og profil ---------- */

/* Ligger nå øverst i rulleflaten, ikke som et eget fast felt. */
.route-header {
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.stats {
  padding: 4px 0 10px;
}

.stats__grid {
  display: grid;
  gap: 8px 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat__value {
  /* Skalerer med skjermen så «1 t 31 min» får plass også på små telefoner. */
  font-size: clamp(14px, 3.9vw, 18px);
  font-weight: 680;
  white-space: nowrap;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-size: 11px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat__hint {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.stats__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.profile {
  position: relative;
}

.profile__box {
  position: relative;
  height: 108px;
}

@media (min-width: 900px) {
  .profile__box {
    height: 136px;
  }
}


.profile__svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.profile__grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.profile__gridv {
  stroke-dasharray: 2 4;
}

.profile__label {
  font-size: 10.5px;
  fill: var(--ink-3);
}

.profile__area {
  fill: var(--green-soft);
}

.profile__seg {
  stroke-width: 2.4;
  stroke-linecap: round;
}

.profile__seg--flat {
  stroke: var(--green);
}

.profile__seg--opp {
  stroke: #c98a1b;
}

.profile__seg--bratt-opp {
  stroke: var(--alert);
}

.profile__seg--ned {
  stroke: var(--sky);
}

.profile__seg--bratt-ned {
  stroke: #7a5ad6;
}

.profile__cursor {
  stroke: var(--ink);
  stroke-dasharray: 3 3;
  stroke-width: 1;
}

.profile__dot {
  fill: var(--ink);
  stroke: var(--surface);
  stroke-width: 2;
}

.profile__tip {
  position: absolute;
  top: 6px;
  display: flex;
  flex-direction: column;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

/* ---------- Brikker og filtre ---------- */

.chip {
  padding: 4px 10px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.chip--grade {
  font-weight: 620;
  color: #fff;
  background: var(--chip-color);
  border-color: transparent;
}

.chip--warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: transparent;
}

.chip--busy {
  color: var(--ink-3);
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-group__title {
  margin: 0;
  font-size: 11.5px;
  font-weight: 640;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filters__foot {
  display: flex;
  gap: 8px;
}

.filters__foot .btn {
  flex: 1;
}

/*
 * Brikkene brytes over flere linjer. Sidelengs rullende rader gjemte to
 * tredeler av valgene bak skjermkanten, i rader man måtte gjette at kunne dras.
 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* Aktive filtre når lista er slått sammen. */
.chips--active {
  margin-bottom: 10px;
}

.chip__x {
  margin-left: 2px;
  font-size: 11px;
  opacity: 0.75;
}

.chip--clear {
  color: var(--ink-3);
}

.chip--toggle {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 40px;
  padding: 6px 13px;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
}

.chip--toggle:hover {
  border-color: var(--line-strong);
}

.chip--toggle.is-on {
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green);
}

/*
 * Ringen gjør at prikken leses mot både lys og mørk bakgrunn. Uten den
 * forsvant den svarte ekspertprikken helt i mørk modus.
 */
.chip--dot::before,
.card__grade::before {
  box-shadow: 0 0 0 1px rgb(127 127 127 / 55%);
}

.chip--dot::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  content: '';
  background: var(--dot);
  border-radius: 50%;
}

/* ---------- Turkort ---------- */

.result-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 0 10px;
}

.result-bar .chip--toggle {
  flex: none;
}

.result-bar__count {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn--dice {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.card:hover,
.card:focus-visible {
  background: var(--surface);
  border-color: var(--green);
  transform: translateY(-1px);
}

.card:active {
  transform: translateY(0);
}

.card__top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.card__name {
  font-size: 15.5px;
  font-weight: 640;
  line-height: 1.25;
}

.card__grade {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  flex: none;
}

.card__grade::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  content: '';
  background: var(--dot);
  border-radius: 50%;
}

.card__facts {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.card__pending {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  padding: 2px 8px;
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-3);
  border-radius: 999px;
}

.tag--feature {
  color: var(--green);
  background: var(--green-soft);
}

.tag--hc {
  color: var(--sky);
  background: var(--sky-soft);
}

.tag--more {
  font-weight: 600;
  color: var(--ink-2);
  cursor: help;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.feature-row .tag {
  padding: 5px 11px;
  font-size: 12.5px;
}

.access {
  font-size: 11.5px;
  color: var(--ink-2);
}

.access--ja {
  font-weight: 600;
  color: var(--sky);
}

.access--nei {
  color: var(--ink-3);
}

.card__by {
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ---------- Bilder ---------- */

.card__photo {
  position: relative;
  display: block;
  margin: -13px -14px 4px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}

.card__photo img {
  display: block;
  width: 100%;
  height: 112px;
  object-fit: cover;
  background: var(--surface-3);
}

.card__photo .photo__credit {
  position: absolute;
  right: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 2px 7px;
  overflow: hidden;
  font-size: 10.5px;
  color: #fff;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgb(0 0 0 / 55%);
  border-radius: 999px;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.photo {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.photo img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: var(--surface-3);
}

.photo figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 18px 10px 7px;
  background: linear-gradient(to top, rgb(0 0 0 / 62%), transparent);
}

.photo__credit {
  font-size: 11px;
  color: #fff;
  text-decoration: none;
}

.photo__credit:hover {
  text-decoration: underline;
}

.gallery__strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.gallery__strip::-webkit-scrollbar {
  display: none;
}

.gallery__thumb {
  flex: none;
  width: 82px;
  height: 62px;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-3);
  transition: transform 0.15s;
}

.gallery__thumb:hover img {
  transform: scale(1.06);
}

.gallery__note {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.skeleton--photo {
  height: 190px;
}

.article__text {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
}

.spark {
  width: 100%;
  height: 26px;
  margin-top: 2px;
}

.spark__line {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.spark__fill {
  fill: var(--green-soft);
  stroke: none;
}

.skeletons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.skeleton {
  height: 84px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 150% 0;
  }

  to {
    background-position: -150% 0;
  }
}

/* ---------- Tomme tilstander ---------- */

.empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 28px 12px;
  color: var(--ink-2);
  text-align: center;
}

.empty p {
  margin: 0;
}

.empty__big {
  font-size: 40px;
  line-height: 1;
}

.empty__title {
  font-size: 17px;
  font-weight: 640;
  color: var(--ink);
}

.empty .btn {
  margin-top: 8px;
}

/* ---------- Skjemaelementer ---------- */

.quick {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field__hint,
.hint {
  font-size: 12.5px;
  color: var(--ink-3);
}

.hint {
  margin: 8px 0 0;
}

.input {
  width: 100%;
  height: var(--tap);
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.segmented {
  display: flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented__item {
  flex: 1;
  min-height: 38px;
  padding: 6px 4px;
  font-size: 13.5px;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 7px;
}

.segmented__item[aria-checked='true'] {
  font-weight: 620;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.range-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.range {
  flex: 1;
  accent-color: var(--green);
}

.range-row output {
  min-width: 52px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  margin-top: 10px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.toggle input,
.check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--green);
  flex: none;
}

.toggle__body {
  display: flex;
  flex-direction: column;
}

.toggle__label {
  font-weight: 600;
}

.toggle__hint {
  font-size: 12.5px;
  color: var(--ink-2);
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 36px;
  padding: 6px 0;
  cursor: pointer;
}

.radio-list,
.check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 40px;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.radio:hover {
  background: var(--surface-2);
}

.radio input {
  margin-top: 3px;
  accent-color: var(--green);
}

.radio span {
  display: flex;
  flex-direction: column;
}

.radio__hint {
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ---------- Knapper ---------- */

.btn {
  min-height: var(--tap);
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: 0.55;
}

.btn--primary {
  color: #fff;
  background: var(--green);
  border-color: transparent;
}

.btn--primary:hover:not(:disabled) {
  color: #fff;
  background: color-mix(in srgb, var(--green) 88%, black);
  border-color: transparent;
}

.btn--file {
  display: inline-grid;
  place-items: center;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.linkish {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--green);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
}

.linkish:hover {
  text-decoration: underline;
}

.linkish--small {
  flex: none;
  font-size: 12.5px;
  font-weight: 500;
  align-self: flex-start;
}

/* ---------- Blokker ---------- */

.block {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.block__title {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.block--fold > .block__title {
  min-height: 32px;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

.block--fold > .block__title::-webkit-details-marker {
  display: none;
}

.block--fold > .block__title::after {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  content: '▾';
  transition: transform 0.15s;
}

.block--fold[open] > .block__title::after {
  transform: rotate(180deg);
}

.block__body {
  padding-top: 10px;
}

.block__badge {
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
  background: var(--surface-3);
  border-radius: 999px;
}

/* ---------- Lister ---------- */

.waypoints,
.pois,
.trips,
.weather,
.checklist,
.highlights,
.badges {
  padding: 0;
  margin: 0;
  list-style: none;
}

.waypoint,
.poi-row,
.trip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.waypoint:last-child,
.poi-row:last-child,
.trip:last-child {
  border-bottom: 0;
}

.waypoint__body,
.poi-row__body,
.trip__body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.waypoint__meta,
.poi-row__meta,
.trip__body span {
  font-size: 12px;
  color: var(--ink-2);
}

.poi-row__icon {
  display: grid;
  width: 30px;
  height: 30px;
  font-size: 15px;
  background: var(--surface-2);
  border-radius: 50%;
  place-items: center;
  flex: none;
  align-self: flex-start;
  margin-top: 2px;
}

/* Raden har fått mer å fortelle, så den stables i stedet for å midtstilles. */
.poi-row {
  align-items: flex-start;
}

.poi-row__name {
  font-weight: 600;
  text-align: left;
}

.poi-row__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.poi-row__facts .tag {
  font-size: 11.5px;
}

.tag--dnt {
  color: #6b4b12;
  background: var(--warn-soft);
}

.tag--warn {
  color: var(--alert);
  background: var(--alert-soft);
}

.poi-row__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.trip__open {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 40px;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
}

.trip__open span {
  font-size: 12px;
  color: var(--ink-2);
}

.icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  font-size: 16px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  place-items: center;
}

.icon-btn--tiny {
  width: 34px;
  height: 34px;
  font-size: 13px;
  background: transparent;
  border-color: transparent;
  flex: none;
}

.icon-btn--tiny:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

/* ---------- Vær ---------- */

.sun {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13.5px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.weather__row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 1fr auto auto;
}

.weather__row:last-child {
  border-bottom: 0;
}

.weather__where {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.weather__time {
  font-size: 12px;
  color: var(--ink-2);
}

.weather__icon {
  font-size: 22px;
}

.weather__values {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.temp {
  font-size: 16px;
}

.temp--cold,
.rain {
  color: var(--sky);
}

.weather__none {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------- Varsler ---------- */

.notice {
  padding: 11px 13px;
  margin: 10px 0 0;
  font-size: 13.5px;
  background: var(--surface-2);
  border-left: 3px solid var(--line-strong);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.notice--ok {
  background: var(--ok-soft);
  border-left-color: var(--green);
}

.notice--warn {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}

.notice--alert {
  background: var(--alert-soft);
  border-left-color: var(--alert);
}

.danger {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  margin: 12px 0;
  background: var(--surface-2);
  border-left: 4px solid var(--danger-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.danger__level {
  display: grid;
  width: 34px;
  height: 34px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: var(--danger-color);
  border-radius: 50%;
  place-items: center;
  flex: none;
}

.danger__region {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
}

.danger p {
  margin: 6px 0 0;
  font-size: 13.5px;
}

/* ---------- Dagbok ---------- */

.totals {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--green-soft) 0%, var(--surface-2) 100%);
  border-radius: var(--radius);
  grid-template-columns: repeat(3, 1fr);
}

.totals .stat__value {
  font-size: clamp(20px, 6vw, 26px);
}

.highlights {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.highlights li {
  padding: 9px 12px;
  font-size: 13.5px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.highlights li::before {
  margin-right: 7px;
  content: '✨';
}

.goal {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
}

.goal__icon {
  font-size: 24px;
}

.goal__body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.goal__hint {
  font-size: 12.5px;
  color: var(--ink-2);
}

.bar {
  display: block;
  height: 7px;
  margin-top: 3px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.bar__fill {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.badges {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.badge {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 11px 6px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  opacity: 0.45;
  filter: grayscale(1);
}

.badge.is-earned {
  background: var(--surface);
  border-color: var(--gold);
  opacity: 1;
  filter: none;
}

.badge__icon {
  font-size: 22px;
}

.badge__label {
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink-2);
}

.badge.is-earned .badge__label {
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Bunnfelt ---------- */

.panel__footer {
  flex: none;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line);
}

.panel__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel__buttons .btn {
  flex: 1 1 auto;
}

/* Hovedhandlingen tar hele bredden, de andre deler linja under. */
.panel__buttons .btn--primary {
  flex: 1 0 100%;
}

.panel__buttons::-webkit-scrollbar {
  display: none;
}

.panel__buttons > * {
  flex: none;
}

@media (min-width: 900px) {
  .panel__buttons {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* ---------- Framdrift ---------- */

.progress {
  height: 8px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 999px;
}

.progress__bar {
  width: var(--andel, 0%);
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.ok-line {
  padding: 10px 12px;
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--ok-soft);
  border-radius: var(--radius-sm);
}

.credits {
  margin: 18px 0 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* ---------- Meldinger ---------- */

.toasts {
  position: fixed;
  /* Over bunnarket, så meldingene aldri dekker knappene i turlinja. */
  bottom: calc(var(--sheet-cover) + 14px + var(--safe-bottom));
  left: 50%;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

/* På skrivebord ligger panelet ved siden av, så meldingene kan stå nederst. */
@media (min-width: 900px) {
  .toasts {
    bottom: calc(16px + var(--safe-bottom));
  }
}

.toast {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 13.5px;
  pointer-events: auto;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toast__text {
  flex: 1;
}

.toast__action {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 620;
  color: var(--green);
  cursor: pointer;
  background: var(--green-soft);
  border: 0;
  border-radius: 999px;
  flex: none;
}

.toast--ok {
  border-left-color: var(--green);
}

.toast--advarsel {
  border-left-color: var(--warn);
}

.toast--feil {
  border-left-color: var(--alert);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
