/* Forsinkometer – stil */

:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --text: #14171c;
  --muted: #5f6672;
  --border: #e4e1d8;

  --board: #101418;
  --board-2: #1a2027;
  --board-text: #f4f2ea;
  --board-muted: #9aa3ae;
  --signal: #ffcf33;

  --ok: #16794a;
  --ok-bg: #e2f3e9;
  --late: #a65300;
  --late-bg: #ffefd6;
  --gone: #b42318;
  --gone-bg: #fde3df;

  --radius: 18px;
  --shadow: 0 1px 2px rgb(16 20 24 / 0.04), 0 4px 16px rgb(16 20 24 / 0.05);
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e11;
    --surface: #151a20;
    --surface-2: #1b2128;
    --text: #eceef1;
    --muted: #98a0ab;
    --border: #252c35;

    --board: #161c22;
    --board-2: #0f1418;

    --ok: #5fd598;
    --ok-bg: #12301f;
    --late: #ffb648;
    --late-bg: #36260f;
    --gone: #ff8577;
    --gone-bg: #3b1714;

    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.hero-inner, main, footer {
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---------- Toppen: «tavla» ---------- */

.hero {
  background:
    radial-gradient(120% 80% at 100% 0%, rgb(255 207 51 / 0.12), transparent 60%),
    var(--board);
  color: var(--board-text);
  padding: max(24px, env(safe-area-inset-top)) 0 28px;
  border-radius: 0 0 28px 28px;
  position: relative;
  overflow: hidden;
}

/* Sviller nederst i tavla */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, rgb(255 255 255 / 0.08) 0 14px, transparent 14px 26px);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }

.logo {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--signal);
  color: var(--board);
  flex: none;
}

h1 {
  margin: 0;
  font: 700 1.9rem/1.05 var(--font-display);
  letter-spacing: -0.03em;
}

.tagline { margin: 3px 0 0; color: var(--board-muted); font-size: 0.95rem; }

/* Strekning: fra ⇄ til */

.route {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  background: var(--board-2);
  border: 1px solid rgb(255 255 255 / 0.06);
  border-radius: 20px;
}

.route button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.route button:focus-visible, .star:focus-visible, .chip:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.station {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 8px 14px 9px;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  transition: background 0.2s;
}

#pick-to { align-items: flex-end; text-align: right; }

.station:hover { background: rgb(255 255 255 / 0.06); }

.station small {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--board-muted);
}

.station span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 1.2rem/1.2 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--board-text);
}

.route .swap {
  align-self: center;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--signal);
  color: var(--board);
  transition: transform 0.25s ease;
}

.route .swap:hover { transform: rotate(180deg); }

/* Mine strekninger */

.saved-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.saved {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 2px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.saved::-webkit-scrollbar { display: none; }
.saved[hidden] { display: block; visibility: hidden; }

.chip, .star {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  color: var(--board-muted);
  font: 600 0.85rem var(--font-body);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chip:hover, .star:hover { color: var(--board-text); border-color: rgb(255 255 255 / 0.25); }
.chip .arrow { opacity: 0.6; }
.chip.active { background: rgb(255 207 51 / 0.14); border-color: var(--signal); color: var(--board-text); }

.star { flex: none; }
.star svg { fill: none; }
.star[aria-pressed="true"] { color: var(--signal); border-color: rgb(255 207 51 / 0.4); }
.star[aria-pressed="true"] svg { fill: currentColor; }

/* Neste tog */

.next {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: end;
}

.next[hidden] { display: none; }

.next .label {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--signal);
}

.next .count {
  font: 700 clamp(2.6rem, 11vw, 3.6rem)/1 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.next .count small { font-size: 0.45em; letter-spacing: -0.01em; margin-left: 4px; color: var(--board-muted); }

.next .when {
  text-align: right;
  font: 700 1.5rem/1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

.next .when s { display: block; font-size: 0.95rem; color: var(--board-muted); font-weight: 500; margin-bottom: 4px; }
.next.late .when span { color: var(--late); }

.next .sub {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: var(--board-muted);
  font-size: 0.9rem;
}

.next .sub b { color: var(--board-text); font-weight: 600; }

@media (prefers-color-scheme: light) {
  .next.late .when span { color: #ffb648; }
}

/* ---------- Dagsrapport ---------- */

main { padding-top: 20px; }

.report {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.verdict {
  margin: 0 0 12px;
  font: 700 1.1rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
  min-height: 1.3em;
}

.meter {
  display: flex;
  gap: 3px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 14px;
}

.meter .seg { flex: 0 0 auto; width: 0; transition: width 0.5s ease; }
.meter .ok { background: var(--ok); }
.meter .late { background: var(--late); }
.meter .gone { background: var(--gone); }

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

.stat { min-width: 0; }
.stat dt {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat dd {
  margin: 2px 0 0;
  font: 700 1.6rem/1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.stat.ok dd { color: var(--ok); }
.stat.late dd { color: var(--late); }
.stat.gone dd { color: var(--gone); }

/* ---------- Liste ---------- */

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 4px 10px;
}

h2 {
  margin: 0;
  font: 700 1.2rem var(--font-display);
  letter-spacing: -0.02em;
}

.status {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

.status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
  animation: pulse 2s infinite;
}

.status.loading .dot { background: var(--late); }
.status.error { color: var(--gone); }
.status.error .dot { background: var(--gone); animation: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.departures { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.dep {
  position: relative;
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 14px 20px;
  overflow: hidden;
  animation: rise 0.35s ease both;
}

.dep::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--ok);
}

.dep.late::before { background: var(--late); }
.dep.cancelled::before { background: var(--gone); }
.dep.departed { opacity: 0.55; }

.dep.late { background: linear-gradient(90deg, var(--late-bg), var(--surface) 55%); }
.dep.cancelled {
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, color-mix(in srgb, var(--gone-bg) 60%, transparent) 12px 24px),
    var(--surface);
  border-color: color-mix(in srgb, var(--gone) 25%, var(--border));
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; line-height: 1.1; }
.time .aimed, .time .expected { font: 700 1.35rem var(--font-display); letter-spacing: -0.02em; }
.time .struck { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); font-size: 0.95rem; font-weight: 500; }
.dep.cancelled .time .struck { font-size: 1.35rem; font-weight: 700; color: var(--gone); text-decoration-color: currentColor; }
.time .expected { color: var(--late); }

.main { min-width: 0; }
.head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.line {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 7px;
  background: var(--board);
  color: var(--board-text);
  letter-spacing: 0.02em;
}

.dest { font-weight: 600; font-size: 1.02rem; }
.dep.cancelled .dest { text-decoration: line-through; text-decoration-color: var(--gone); }

.meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.meta .track { color: var(--text); font-weight: 600; }

.situation {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 7px 10px 7px 30px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
}
.situation::before { content: "⚠️"; position: absolute; left: 9px; top: 6px; font-size: 0.8rem; }

.badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--ok-bg);
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}
.badge.soon { background: var(--ok); color: var(--surface); }
.late .badge { background: var(--late); color: var(--surface); }
.cancelled .badge { background: var(--gone); color: var(--surface); }

@media (prefers-color-scheme: dark) {
  .badge.soon, .late .badge, .cancelled .badge { color: var(--board); }
}

/* Tom liste og laster */

.empty {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty .art { font-size: 2.6rem; display: block; margin-bottom: 8px; animation: roll 6s linear infinite; }
.empty strong { display: block; color: var(--text); font: 700 1.1rem var(--font-display); margin-bottom: 4px; }

@keyframes roll {
  0% { transform: translateX(-60px) rotate(0); opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { transform: translateX(60px) rotate(360deg); opacity: 0; }
}

.skeleton {
  height: 76px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%) 0 0 / 200% 100%;
  border: 1px solid var(--border);
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Bunn ---------- */

footer { color: var(--muted); font-size: 0.8rem; padding-top: 24px; padding-bottom: max(32px, env(safe-area-inset-bottom)); text-align: center; }
footer a { color: inherit; }

@media (max-width: 420px) {
  .dep { grid-template-columns: 54px 1fr auto; gap: 10px; align-items: start; padding: 12px 12px 12px 16px; }
  .time .aimed, .time .expected { font-size: 1.2rem; }
  .badge { padding: 5px 9px; font-size: 0.78rem; }
  .stat dd { font-size: 1.35rem; }
  .stat dt { font-size: 0.62rem; letter-spacing: 0.03em; }
}

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

/* ---------- Klikkbare avganger ---------- */

.dep[role="button"] { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.dep[role="button"]:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgb(16 20 24 / 0.06), 0 10px 24px rgb(16 20 24 / 0.08); }
.dep[role="button"]:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.dep[role="button"]:active { transform: scale(0.99); }

/* ---------- Detaljark ---------- */

.detail {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  max-width: 560px;
  max-height: 100dvh;
  margin: auto auto 0;
}

@media (min-width: 640px) { .detail { margin: auto; } }

.detail::backdrop { background: rgb(8 10 12 / 0.55); backdrop-filter: blur(3px); }

.detail[open] .sheet { animation: sheet-up 0.28s cubic-bezier(.2,.8,.2,1) both; }

@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet {
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 640px) { .sheet { border-radius: 24px; max-height: 86vh; } }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  background: var(--board);
  color: var(--board-text);
}

.detail-head h2 { display: flex; align-items: center; gap: 4px; font-size: 1.3rem; }
.detail-head .line { background: var(--signal); color: var(--board); font-size: 0.8rem; }
.detail-head p { margin: 4px 0 0; color: var(--board-muted); font-size: 0.9rem; }

.close {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--board-2);
  color: var(--board-text);
  cursor: pointer;
}
.close:hover { background: rgb(255 255 255 / 0.12); }
.close:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.detail-body { overflow-y: auto; padding: 14px 14px 20px; display: grid; gap: 10px; overscroll-behavior: contain; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.card .big { margin: 0; font: 700 1.15rem/1.3 var(--font-display); letter-spacing: -0.01em; }
.card .note { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.card .fine { margin: 8px 0 0; color: var(--muted); font-size: 0.72rem; }

.detail-msg { margin: 8px 4px; }
.detail-msg.error { color: var(--gone); }

/* Kapasitet */

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

.bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; flex: none; }
.bars i { display: block; width: 7px; border-radius: 2px; background: var(--border); }
.bars i:nth-child(1) { height: 30%; }
.bars i:nth-child(2) { height: 45%; }
.bars i:nth-child(3) { height: 60%; }
.bars i:nth-child(4) { height: 80%; }
.bars i:nth-child(5) { height: 100%; }
.bars.l1 i.on, .bars.l2 i.on { background: var(--ok); }
.bars.l3 i.on { background: var(--late); }
.bars.l4 i.on, .bars.l5 i.on { background: var(--gone); }

/* Rute */

.stops { list-style: none; margin: 4px 0 0; padding: 0; }

.stop {
  position: relative;
  display: grid;
  grid-template-columns: 18px 52px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  font-size: 0.92rem;
}

/* Skinnegangen */
.stop::before {
  content: "";
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 4px;
  background: var(--border);
}
.stop:first-child::before { top: 50%; }
.stop:last-child::before { bottom: 50%; }
.stop.passed::before { background: var(--muted); opacity: 0.5; }

.st-dot {
  position: relative;
  z-index: 1;
  width: 14px; height: 14px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--muted);
}

.st-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; display: flex; flex-direction: column; line-height: 1.1; }
.st-time s { font-size: 0.75rem; }
.st-time b { color: var(--late); }

.st-name { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.st-name em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--signal);
  color: var(--board);
}
.st-name em.bad { background: var(--gone); color: var(--surface); }

.stop.outside { opacity: 0.45; }
.stop.passed .st-name { color: var(--muted); }
.stop.passed .st-dot { background: var(--muted); border-color: var(--muted); }
.stop.board .st-dot, .stop.alight .st-dot { border-color: var(--text); width: 16px; height: 16px; margin-left: 1px; }
.stop.board .st-name, .stop.alight .st-name { font-weight: 700; }
.stop.cancelled .st-name { text-decoration: line-through; color: var(--gone); }

.stop.here .st-dot { background: var(--signal); border-color: var(--board); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 40%, transparent); }

.train { font-size: 1.1rem; animation: chug 1.2s ease-in-out infinite; }
@keyframes chug { 50% { transform: translateY(-2px); } }

.stop.moving { min-height: 30px; }
.stop.moving .st-dot { visibility: hidden; }
.stop.moving .st-name { color: var(--muted); font-style: italic; font-size: 0.85rem; }
.stop.moving::after {
  content: "";
  position: absolute;
  left: 1px;
  top: calc(var(--frac, 0.5) * 100% - 6px);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--signal);
  border: 2px solid var(--board);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 40%, transparent);
  z-index: 2;
}

/* ---------- Stasjonsvelger ---------- */

.picker .sheet { height: 88dvh; }
@media (min-width: 640px) { .picker .sheet { height: min(640px, 86vh); } }

.picker-search { padding: 12px 14px 0; background: var(--bg); }

.picker-search input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: 500 1rem var(--font-body);
}

.picker-search input:focus { outline: 2px solid var(--signal); outline-offset: 1px; }

.picker .detail-body { align-content: start; gap: 6px; }

.picker-hint { margin: 2px 4px; color: var(--muted); font-size: 0.8rem; }
.picker-hint:empty { display: none; }

.picker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.pick {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pick:hover { border-color: var(--muted); }
.pick:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.pick-name { font-weight: 600; }
.pick-place { color: var(--muted); font-size: 0.85rem; }

/* ---------- Signalfeil-teller ---------- */

.signal-tally {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.signal-tally p { margin: 0; grid-column: 2; }
.signal-icon { grid-row: span 3; font-size: 1.6rem; line-height: 1; filter: grayscale(0.6); }
.signal-tally.hot .signal-icon { filter: none; animation: blink 1.4s steps(2, start) infinite; }
.signal-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.signal-tally b { font: 700 1.25rem/1 var(--font-display); font-variant-numeric: tabular-nums; margin-left: 4px; }
.signal-tally.hot b { color: var(--late); }
.signal-note { font-size: 0.9rem; }
.signal-tally .fine { color: var(--muted); font-size: 0.72rem; margin-top: 4px; }

@keyframes blink { to { opacity: 0.35; } }

/* ---------- Driftsmeldinger ---------- */

.alerts { margin-top: 14px; }

.alerts-fold {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.alerts-fold.signal { border-color: var(--signal); }

.alerts-summary {
  display: grid;
  gap: 2px;
  padding: 12px 44px 12px 16px;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.alerts-summary::-webkit-details-marker { display: none; }
.alerts-summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.alerts-fold[open] .alerts-summary::after { transform: rotate(-135deg); margin-top: -2px; }
.alerts-summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: var(--radius); }

.alerts-title { display: flex; align-items: center; gap: 8px; }
.alerts-title h2 { font-size: 1rem; }
.alerts-count {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 1.5em;
  padding: 1px 7px;
  border-radius: 999px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.alerts-count.signal { background: var(--signal); border-color: var(--signal); color: #14171c; }
.alerts-peek {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alerts-fold[open] .alerts-peek { display: none; }
.alerts-fold .alerts-list { padding: 0 10px 10px; }
.alerts-fold .alert { box-shadow: none; }

.alerts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.alert {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}
.alert.incident { border-left-color: var(--late); }
.alert.signal { border-left-color: var(--signal); background: linear-gradient(90deg, rgb(255 207 51 / 0.12), transparent 60%), var(--surface); }
.alert.upcoming { opacity: 0.85; }
.alert.none { border-left-color: var(--ok); color: var(--muted); }

.alert-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.alert-head strong { font-weight: 600; line-height: 1.35; flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.alert-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 0.78rem; }

.alert .tag {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--signal);
  color: #14171c;
}
.alert .tag.soft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.alert details summary { cursor: pointer; list-style: none; position: relative; padding-right: 22px; }
.alert details summary::-webkit-details-marker { display: none; }
.alert details summary::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.alert details[open] summary::after { transform: rotate(-135deg); top: 9px; }
.alert details summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; border-radius: 6px; }
.alert-body { margin-top: 8px; color: var(--text); overflow-wrap: anywhere; }
.alert-body p { margin: 6px 0 0; }
.alert-body .advice { color: var(--muted); font-style: italic; }
.alert-body a { color: inherit; font-weight: 600; }

.card.sits .alert { box-shadow: none; }

.situation.signal { border-color: var(--signal); background: rgb(255 207 51 / 0.12); }
.situation.signal::before { content: "🚦"; }

@media (prefers-reduced-motion: reduce) {
  .signal-tally.hot .signal-icon { animation: none; }
}

/* ---------- Ventepils ved innstilte tog ---------- */

.pils-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(255 207 51 / 0.18);
  border: 1px solid rgb(255 207 51 / 0.55);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.pils-link:hover { background: rgb(255 207 51 / 0.3); }
.pils-link:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.card.pils { border-color: rgb(255 207 51 / 0.55); background: linear-gradient(180deg, rgb(255 207 51 / 0.12), transparent 70%), var(--surface); }
.pubs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.pubs a {
  display: grid;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.pubs a:hover { border-color: rgb(255 207 51 / 0.8); }
.pubs a:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.pubs .pub-meta { color: var(--muted); font-size: 0.82rem; }
.pils-more { display: inline-block; margin-top: 8px; color: var(--text); font-weight: 600; font-size: 0.88rem; }
