/* Neste: kart i bakgrunnen, glassark oppå.
   Farger: grønn = i rute, oransje = litt sen, rød = problem, grå = opprinnelig/usikker. Aksent = din reise. */

:root {
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #e9ecf2;
  --glass: rgba(248, 249, 252, 0.8);
  --glass-solid: #f5f6f9;
  --card: rgba(255, 255, 255, 0.74);
  --surface: rgba(24, 30, 56, 0.045);
  --surface-2: rgba(24, 30, 56, 0.08);
  --line: rgba(24, 30, 56, 0.09);
  --fg: #12141b;
  --muted: #687086;
  --accent: #3c55cf;
  --accent-ink: #ffffff;
  --accent-soft: rgba(60, 85, 207, 0.11);
  --ok: #138a44;
  --ok-soft: rgba(19, 138, 68, 0.12);
  --warn: #b55f00;
  --warn-soft: rgba(214, 120, 0, 0.14);
  --bad: #cf2a20;
  --bad-soft: rgba(207, 42, 32, 0.12);
  --marker: #ffffff;
  --marker-dir: #12141b;
  --me: #3c6bff;
  --shadow: 0 10px 40px rgba(20, 25, 50, 0.16);
  --hi: rgba(255, 255, 255, 0.7);
  --map-route: #3c55cf;
  --map-walk: #6b7186;
  --map-casing: #ffffff;

  --vis: 52vh;
  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08090c;
    --glass: rgba(13, 14, 19, 0.82);
    --glass-solid: #121318;
    --card: rgba(255, 255, 255, 0.045);
    --surface: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.09);
    --line: rgba(255, 255, 255, 0.085);
    --fg: #f2f3f7;
    --muted: #8d92a3;
    --accent: #c0cbf6;
    --accent-ink: #10152c;
    --accent-soft: rgba(192, 203, 246, 0.13);
    --ok: #3ad07f;
    --ok-soft: rgba(58, 208, 127, 0.14);
    --warn: #ffa630;
    --warn-soft: rgba(255, 166, 48, 0.15);
    --bad: #ff5b4f;
    --bad-soft: rgba(255, 91, 79, 0.15);
    --marker: #1c1e25;
    --marker-dir: #f2f3f7;
    --me: #7095ff;
    --shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
    --hi: rgba(255, 255, 255, 0.07);
    --map-route: #c0cbf6;
    --map-walk: #a3a8b8;
    --map-casing: #000000;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.ic { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; display: block; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
}

/* ---------- Kart ---------- */

#map { position: fixed; inset: 0; background: var(--bg); }
#map.map-failed::after {
  content: "Kartet kunne ikke lastes";
  position: absolute; inset: 0; display: grid; place-items: start center; padding-top: 30vh;
  color: var(--muted);
}
.mapboxgl-ctrl-top-left, .maplibregl-ctrl-top-left { top: env(safe-area-inset-top, 0px) !important; }
.mapboxgl-ctrl-attrib, .maplibregl-ctrl-attrib { font-size: 10px; }

.fab {
  position: fixed; z-index: 5; right: 16px;
  bottom: calc(var(--vis) + 14px);
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg);
  transition: bottom 0.34s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
}
body[data-sheet="full"] .fab, body.dragging .fab { opacity: 0; pointer-events: none; }

/* Alle busser (unntatt den du følger) tegnes på dette lerretet */
.bus-canvas { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 6; }

/* Rutelinjer: eget lag over bussene (bussen du følger ligger likevel over linja, z-index 8) */
.route-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 7; overflow: visible; }
.route-overlay path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rt-casing { stroke: var(--map-casing); stroke-width: 9; stroke-opacity: 0.35; }
.rt-transit { stroke: var(--map-route); stroke-width: 5; }
.rt-faded { stroke: var(--map-route); stroke-width: 4; stroke-opacity: 0.35; }
.rt-walk { stroke: var(--map-walk); stroke-width: 3.5; stroke-dasharray: 0.1 7; }

/* Markører */
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--me); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }

.stop-pin {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--marker); color: var(--fg); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 0 0 1px var(--line);
}
.stop-pin .ic { width: 16px; height: 16px; }
.stop-pin.active { background: var(--accent); color: var(--accent-ink); width: 34px; height: 34px; }

/* Ingen position her: kartbiblioteket gjør markøren absolutt plassert. */
.bus { --st: var(--line); display: grid; place-items: center; cursor: pointer; }
/* Kanten viser forsinkelsen i glidende farge (grønn → gul → rød → lilla, satt fra JS):
   heltrukken = live GPS, stiplet = beregnet posisjon */
.bus-pill {
  display: inline-flex; align-items: center; gap: 3px;
  height: 28px; padding: 0 8px 0 6px; border-radius: 14px;
  background: var(--marker); color: var(--fg);
  border: 2px solid var(--st);
  font-weight: 700; font-size: 12.5px; letter-spacing: -0.01em;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  white-space: nowrap; position: relative; z-index: 1;
  transition: transform 0.15s ease;
}
.bus.est .bus-pill { border-style: dashed; }
.bus.is-open .bus-pill { transform: scale(1.12); }
.bus-ic .ic { width: 15px; height: 15px; }
.bus-dir { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px; pointer-events: none; transition: transform 0.8s ease; }
.bus-dir i { position: absolute; left: 50%; top: 0; transform: translateX(-50%); border: 5px solid transparent; border-bottom: 7px solid var(--marker-dir); border-top: 0; opacity: 0.85; }

.bus.role-mine .bus-pill { background: var(--accent); color: var(--accent-ink); height: 32px; border-radius: 16px; font-size: 14px; padding: 0 10px 0 8px; border-width: 2.5px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), 0 0 0 4px var(--accent-soft); }
.bus.role-mine .bus-dir i { border-bottom-color: var(--accent); }
.bus.role-target .bus-pill { background: color-mix(in srgb, var(--accent) 26%, var(--marker)); }
.bus.role-other { opacity: 0.7; }
.bus.role-other .bus-pill { transform: scale(0.82); }
body:not([data-view="home"]) .bus.role-other { opacity: 0.32; }
.bus.role-other .bus-dir { display: none; }

/* ---------- Bunnark ---------- */

.sheet {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  height: var(--vis);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-bottom: 0;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: height 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: height;
}
.sheet.dragging { transition: none; }
.handle { flex: none; height: 24px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.handle i { width: 40px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.45; }
.sheet-head { flex: none; padding: 0 16px 10px; display: grid; gap: 12px; touch-action: none; }
.sheet-head > *, .sheet-body > * { min-width: 0; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 16px 28px; display: grid; gap: 12px; align-content: start; -webkit-overflow-scrolling: touch; }

@media (min-width: 820px) {
  :root { --vis: 0px; }
  .sheet { left: 16px; top: 16px; bottom: 16px; right: auto; width: 420px; height: auto; border-radius: var(--r-lg); border-bottom: 1px solid var(--line); padding-bottom: 0; }
  .handle { visibility: hidden; height: 12px; }
  .fab { bottom: 24px; }
  .mapboxgl-ctrl-top-left, .maplibregl-ctrl-top-left { left: 448px; }
}

/* Topplinje i arket */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar-top { align-items: flex-start; }
.bar-title { flex: 1; min-width: 0; margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: balance; }
.bar-line { display: flex; align-items: center; gap: 10px; }
.bar-line span:last-child { overflow: hidden; text-overflow: ellipsis; }
.ibtn {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); color: var(--fg);
}
.ibtn[data-on] { color: var(--accent); }
.od-mini { display: flex; align-items: center; gap: 6px; font-size: 16px; overflow: hidden; }
.od-mini span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.od-mini .ic { width: 16px; height: 16px; color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px 0 11px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 500; font-size: 14px;
}
.chip .ic { width: 18px; height: 18px; color: var(--accent); }
.chip-on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip .chev { width: 18px; height: 18px; margin: 0 -4px 0 -2px; transition: transform 0.2s; }
.chip.is-open .chev { transform: rotate(180deg); }

/* Tidsvelger: avreise/ankomst, dato og klokkeslett */
.when { display: grid; gap: 10px; padding: 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button { height: 38px; border-radius: 10px; text-align: center; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.when-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.when-field { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.when-field .ic { color: var(--accent); width: 19px; height: 19px; }
.when-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; font-weight: 500; color: var(--fg); }
.when-field input::-webkit-calendar-picker-indicator { opacity: 0.6; }
.when-actions { display: flex; gap: 8px; }
.when-actions .btn { flex: 1; height: 44px; }

.label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.label .ic { width: 15px; height: 15px; }
.label-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; padding: 4px 2px; }
.label-btn .ic { width: 17px; height: 17px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--hi);
}

/* Holdeplasser nær deg: nedtrekksliste */
.stops { padding: 0 14px; }
.stop + .stop { border-top: 1px solid var(--line); }
.stop-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 10px 0; }
.stop-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.stop-ic .ic { width: 18px; height: 18px; }
.stop-name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-walk { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; }
.stop-walk .ic { width: 16px; height: 16px; }
.chev { color: var(--muted); width: 20px; height: 20px; }
.stop-head .chev { transition: transform 0.25s ease; }
.stop.open .stop-head .chev { transform: rotate(180deg); }
.stop-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.stop.open .stop-body { grid-template-rows: 1fr; }
.stop-inner { overflow: hidden; min-height: 0; }
.stop:not(.open) .stop-inner { visibility: hidden; transition: visibility 0s 0.28s; }
.stop-all { display: flex; align-items: center; justify-content: flex-end; gap: 4px; width: 100%; padding: 8px 2px 12px; color: var(--accent); font-weight: 600; font-size: 14px; border-top: 1px solid var(--line); }
.stop-all .ic { width: 17px; height: 17px; }

/* Avgangsrader */
.deps { display: grid; }
.dep {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 2px; min-height: 52px; width: 100%;
  border-top: 1px solid var(--line);
}
.deps-board .dep:first-child { border-top: 0; }
.dep-dest { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dep-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dep .sit { width: 16px; height: 16px; color: var(--warn); }
.dep.is-mine { background: var(--accent-soft); border-radius: 14px; border-top-color: transparent; padding-inline: 10px; margin-inline: -8px; width: calc(100% + 16px); }
.dep.is-mine + .dep { border-top-color: transparent; }
.dep.is-after { opacity: 0.5; }
.reach { color: var(--accent); display: inline-flex; }
.reach .ic { width: 15px; height: 15px; }

/* Linjemerke */
.lp {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  height: 28px; min-width: 52px; padding: 0 9px 0 7px; border-radius: 9px;
  background: var(--surface-2); color: var(--fg);
  font-weight: 700; font-size: 14px; letter-spacing: -0.01em;
}
.lp .ic { width: 16px; height: 16px; }
.lp-mine { background: var(--accent); color: var(--accent-ink); }
.lp-x { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }

/* Tider: 16:50 stort, grå 16:45 under, +5 i farge */
.tb { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; }
.tb-row { display: inline-flex; align-items: center; gap: 6px; }
.tb-time { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.tb-aimed { font-size: 12.5px; color: var(--muted); text-decoration-thickness: 1px; }
.dchip { font-style: normal; font-weight: 700; font-size: 12.5px; line-height: 1; padding: 4px 6px; border-radius: 7px; display: inline-flex; align-items: center; }
.dchip .ic { width: 14px; height: 14px; }
.dchip.st-warn { background: var(--warn-soft); color: var(--warn); }
.dchip.st-bad { background: var(--bad-soft); color: var(--bad); }
.dchip.st-ok { background: var(--ok-soft); color: var(--ok); }
/* Forsinkelse i glidende farge, satt fra JS som --c */
.dchip[style], .pop-delay[style] { color: var(--c); background: color-mix(in srgb, var(--c) 17%, transparent); }
.tb.is-cancelled .tb-time { color: var(--bad); text-decoration: line-through; }
.tb-big .tb-time { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.tb-big { align-items: flex-start; }
.tb-big .tb-row { flex-direction: row-reverse; gap: 10px; }
.tb-big .dchip { font-size: 15px; padding: 5px 8px; }
.tb-big .tb-aimed { font-size: 14px; margin-top: 4px; }


.occ { display: inline-flex; color: var(--muted); }
.occ .ic { width: 13px; height: 13px; opacity: 0.35; margin-right: -3px; }
.occ .ic.on { opacity: 1; }
.occ-3 { color: var(--bad); }

/* Mål og "din buss" */
.target-row { display: flex; align-items: center; gap: 8px; }
.target-row .ibtn { width: 36px; height: 36px; }
.target-row .ibtn .ic { width: 18px; height: 18px; }
.hero {
  border-radius: 24px; padding: 16px 16px 18px; display: grid; gap: 16px;
  background:
    radial-gradient(120% 140% at 0% 0%, var(--accent-soft), transparent 60%),
    var(--card);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--hi);
}
.hero-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hero-dest { flex: 1; min-width: 0; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-before { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px 0 9px; border-radius: 15px; background: var(--surface-2); font-weight: 700; }
.hero-before .ic { width: 17px; height: 17px; color: var(--muted); }
.hero-time { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero-cd { height: 34px; padding: 0 14px; border-radius: 17px; display: inline-flex; align-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; white-space: nowrap; }

.none { margin: 0; padding: 14px 4px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.none .ic { width: 18px; height: 18px; }

/* Søk */
.od { flex: 1; min-width: 0; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 4px 0; }
.od-fields { flex: 1; min-width: 0; display: grid; padding-left: 16px; }
.od-row { display: flex; align-items: center; gap: 12px; height: 56px; width: 100%; min-width: 0; text-align: left; padding-right: 2px; }
.od-hit { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 12px; }
.od-x { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.od-x .ic { width: 17px; height: 17px; }
.od-row + .od-row { border-top: 1px solid var(--line); }
.od-label { width: 34px; flex: none; font-weight: 600; font-size: 16px; }
.od-val { min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.od-val.is-me, .od-row input.is-me { color: var(--accent); font-weight: 500; }
.od-val.is-empty { color: var(--muted); }
.me-ic { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.me-ic .ic { width: 17px; height: 17px; }
.od-row input, .field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; height: 100%; }
.od-row input::placeholder, .field input::placeholder { color: var(--muted); }
.swap { flex: none; width: 52px; height: 52px; margin: 0 12px 0 10px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.swap .ic { width: 24px; height: 24px; }
.field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 16px; background: var(--surface-2); }
.field .ic { color: var(--accent); }

.sug { display: grid; }
.sug-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; width: 100%; border-top: 1px solid var(--line); }
.sug-row:first-child { border-top: 0; }
.sug-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.sug-ic.accent { background: var(--accent-soft); color: var(--accent); }
.sug-text { display: grid; min-width: 0; }
.sug-text span { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-text small { color: var(--muted); font-size: 13px; }

/* Reiseforslag */
.trips { display: grid; gap: 10px; }
.trip { display: grid; gap: 12px; padding: 14px 16px; width: 100%; }
.trip.is-x { opacity: 0.6; }
.trip-top { display: flex; align-items: flex-start; gap: 8px; }
.tb-trip { align-items: flex-start; }
.tb-trip .tb-time { font-size: 21px; }
.tb-trip .tb-row { flex-direction: row-reverse; }
.trip-arrow { color: var(--muted); padding-top: 3px; }
.trip-arrow .ic { width: 18px; height: 18px; }
.trip-end { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.trip-dur { margin-left: auto; color: var(--muted); font-weight: 500; padding-top: 3px; }
.trip-legs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.trip-legs .sep { width: 16px; height: 16px; color: var(--muted); opacity: 0.6; }
.leg-walk { display: inline-flex; align-items: center; color: var(--muted); }
.leg-walk small { font-size: 12px; font-weight: 600; }
.leg-walk .ic { width: 18px; height: 18px; }
.trip-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trip-meta:empty { display: none; }
.trip-cd { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; }
.trip-cd .ic { width: 16px; height: 16px; }
.xchip { font-style: normal; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 7px; border-radius: 13px; font-weight: 700; font-size: 13px; }
.xchip .ic { width: 15px; height: 15px; }
.xchip.st-ok { background: var(--ok-soft); color: var(--ok); }
.xchip.st-warn { background: var(--warn-soft); color: var(--warn); }
.xchip.st-bad { background: var(--bad-soft); color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 24px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-ghost { background: var(--surface-2); color: var(--fg); }
.more { justify-self: center; }

/* Handlinger (Lagre / Del) */
.actions { display: flex; gap: 8px; }
.act { flex: 1; display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; }
.act .ic { width: 22px; height: 22px; }
.act.on { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* Tidslinje for en reise */
.tl { display: grid; gap: 6px; }
.tl-leg { position: relative; padding-left: 40px; display: grid; gap: 4px; }
.tl-leg::before { content: ""; position: absolute; left: 14px; top: 44px; bottom: 14px; width: 6px; border-radius: 3px; background: var(--accent); }
.tl-badge { margin-left: -40px; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.away { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 8px; border-radius: 13px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.away .ic { width: 15px; height: 15px; color: var(--muted); }
.away.on { background: var(--accent-soft); color: var(--accent); }
.away.on .ic { color: var(--accent); }
.tl-stop { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 2px 0; }
.tl-stop::before { content: ""; position: absolute; left: -31px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--glass-solid); border: 3px solid var(--accent); }
.tl-name { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.quay { font-size: 11.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tl-sub { grid-column: 1; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.tl-sub .ic { width: 14px; height: 14px; }
.tl-mid { color: var(--muted); }
.tl-mid summary, .tl-mid-plain { list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer; font-weight: 500; color: var(--fg); }
.tl-mid summary::-webkit-details-marker { display: none; }
.tl-mid summary .ic:first-child, .tl-mid-plain .ic { width: 18px; height: 18px; color: var(--muted); }
.tl-mid summary small, .tl-mid-plain small { color: var(--muted); font-size: 13px; }
.tl-mid summary .chev { margin-left: auto; transition: transform 0.2s; }
.tl-mid[open] summary .chev { transform: rotate(180deg); }
.tl-mid ul { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.tl-mid li { position: relative; display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 5px 0; }
.tl-mid li::before { content: ""; position: absolute; left: -28px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-ink); opacity: 0.7; }
.tl-mid time { color: var(--muted); }
.tl-walk { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 8px 0 8px 8px; font-weight: 500; }
.tl-walk small { font-size: 13px; opacity: 0.8; }
.tl-walk .ic { width: 20px; height: 20px; }
.tl-xfer { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 4px; color: var(--muted); font-size: 13px; }

.sumbar { position: sticky; bottom: -28px; display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 0 16px; background: linear-gradient(to top, var(--glass-solid) 60%, transparent); margin: 0 -2px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px 0 10px; border-radius: 17px; background: var(--surface-2); font-weight: 600; font-size: 14px; }
.pill .ic { width: 17px; height: 17px; color: var(--muted); }
.pill-soft { background: var(--accent-soft); color: var(--accent); }
.pill-soft .ic { color: var(--accent); }
.pill.st-ok .ic { color: var(--ok); }
.pill .dchip { padding: 3px 5px; }
.chips-info { flex-wrap: wrap; margin: 0; padding: 0; }

/* Tidslinje for én tur */
.jlist { list-style: none; margin: 0; padding: 0; position: relative; display: grid; }
.jlist::before { content: ""; position: absolute; left: 13px; top: 18px; bottom: 18px; width: 4px; border-radius: 2px; background: var(--accent); opacity: 0.85; }
.js > button, .js-bus { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 0; }
.js-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--glass-solid); border: 3px solid var(--accent); justify-self: center; position: relative; z-index: 1; }
.js-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.js .tb-time { font-size: 15px; }
.js.is-past { opacity: 0.45; }
.js.is-past .js-dot { border-color: var(--muted); }
.js.is-here .js-name { font-weight: 700; }
.js.is-here .js-dot { width: 16px; height: 16px; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.js.is-now .js-dot { background: var(--accent); }
.js.is-x { opacity: 0.6; }
.js-bus { color: var(--accent); }
.js-busic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); position: relative; z-index: 1; box-shadow: 0 0 0 5px var(--accent-soft); }
.js-busic .ic { width: 17px; height: 17px; }
.js-bus .js-name { font-weight: 600; }
.js-past { margin-bottom: 4px; }
.js-past summary { list-style: none; display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 8px 4px; cursor: pointer; font-weight: 500; }
.js-past summary::-webkit-details-marker { display: none; }
.js-past summary .ic { width: 18px; height: 18px; }
.js-past summary .chev { margin-left: auto; transition: transform 0.2s; }
.js-past[open] summary .chev { transform: rotate(180deg); }
.js-past .jlist::before { background: var(--muted); opacity: 0.4; }

/* Tom / feil / laster */
.empty { display: grid; justify-items: center; gap: 10px; padding: 32px 16px; color: var(--muted); text-align: center; }
.empty .ic { width: 32px; height: 32px; }
.empty p { margin: 0; }
.skel { display: grid; gap: 10px; }
.skel-row { display: grid; grid-template-columns: 52px 1fr 48px; gap: 12px; align-items: center; height: 44px; }
.skel-row > * { display: block; height: 14px; border-radius: 7px; background: var(--surface-2); animation: shimmer 1.4s ease-in-out infinite; }
.skel-row i { height: 28px; border-radius: 9px; }
.skel-row b { width: 70%; }

.toast {
  position: fixed; z-index: 20; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px);
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 16px; font-weight: 600; font-size: 14px;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Infoboble når du trykker på en buss */
.bus-pop { z-index: 10; }
.bus-pop .mapboxgl-popup-content, .bus-pop .maplibregl-popup-content {
  padding: 0; background: var(--glass); color: var(--fg); font: 15px/1.35 var(--font);
  -webkit-backdrop-filter: blur(26px) saturate(1.6); backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
}
.bus-pop .mapboxgl-popup-tip, .bus-pop .maplibregl-popup-tip { display: none; }
.pop { display: grid; gap: 10px; padding: 12px; width: 272px; max-width: calc(100vw - 48px); font-variant-numeric: tabular-nums; }
.pop-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pop-dest { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-delay { font-style: normal; font-weight: 700; font-size: 13.5px; padding: 5px 9px; border-radius: 9px; white-space: nowrap; }
.pop-rows { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 6px; }
.pop-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 36px; }
.pop-row .ic { width: 18px; height: 18px; color: var(--muted); }
.pop-row .tb-time { font-size: 15px; }
.pop-stop { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-wait { color: var(--muted); }
.pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pop-src { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; }
.pop-src .ic { width: 15px; height: 15px; }
.pop-go { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px 0 14px; border-radius: 17px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; }
.pop-go .ic { width: 17px; height: 17px; }
.pop-go .ic:first-child { display: none; }

@keyframes shimmer { 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
