:root {
  /* Base palette — flygplatsens egen visuella värld (skyltar, ATC-instrument,
     sektionskartor), inte generisk mörk fintech-terminal. Fast mörkt tema,
     inget ljust läge — se DESIGN_BRIEF.md. */
  --bg: #0b1220;
  --panel: #131b2c;
  --panel2: #0f1729;
  --border: #263349;
  --text: #ede6d6;
  --text-dim: #8b96ac;
  --text-faint: #5a6580;
  --accent: #f2b705;
  --accent-ink: #3b2b00;
  --high: #d4507a;
  --high-bg: #3a1a28;
  --high-ink: #f6c3d4;
  --med: #e8871e;
  --med-bg: #3a2812;
  --med-ink: #f7ce9c;
  --low: #4a5a78;
  --low-bg: #1b2436;
  --low-ink: #aeb9ce;
  --verified: #3fa34d;
  --verified-bg: #123a1e;
  --verified-ink: #a8e8bc;
  /* Extension: "new installation" category needs its own token too — the
     brief's own mockup hardcodes a teal for .cat.new, which would violate
     "never hardcode hex in components" if copied as-is. */
  --new: #6fd9b8;
  --new-bg: #0f3a30;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  margin-bottom: 32px;
}

header.site .wrap {
  padding-top: 20px;
  padding-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 20px;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand a {
  color: var(--text);
}

nav.site a {
  color: var(--text-dim);
  margin-left: 18px;
  font-size: 0.92rem;
  font-weight: 500;
}

nav.site a:first-child {
  margin-left: 0;
}

nav.site a:hover {
  color: var(--text);
  text-decoration: none;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

.subtitle {
  color: var(--text-dim);
  margin: 0 0 28px;
  font-size: 0.98rem;
}

/* Statusremsa (toppbar) — kompakt, max 4-5 tal, de viktigaste. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin-bottom: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat {
  padding: 14px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat:nth-last-child(-n + 1) {
  border-right: none;
}

@media (min-width: 561px) {
  .stat {
    border-bottom: none;
  }
}

.stat .label {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 2px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card .card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
  font-weight: 600;
  font-size: 0.95rem;
}

.card .card-body {
  padding: 18px;
}

/* Personal annotations (scripts/annotate_signal.py) - dashed border marks
   this as an outside note, not something the source itself said. */
/* /ordlista.html: highlight the term a #anchor link landed on. */
.card:target {
  border-color: var(--accent);
}

.card.annotation {
  border-style: dashed;
  border-color: var(--accent);
}

.card.annotation .card-header {
  background: transparent;
  border-bottom-style: dashed;
  border-bottom-color: var(--accent);
}

.card.annotation .eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-top: 2px;
}

.year-estimate {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--panel2);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

td.title {
  white-space: normal;
  min-width: 220px;
}

/* signals_list.html row grouping - see app/static_export/build.py's
   _group_signal_views() and grouping_mockup.html. A group's headline reads
   exactly like a normal signal title (same color/weight) with only the
   muted "+N till" tag revealing it's a group; expanding it reveals a single
   inset panel of "strips", not more table rows. */
.grouprow {
  cursor: pointer;
  user-select: none;
}

.caret {
  display: inline-block;
  transition: transform 0.15s ease;
  margin-right: 6px;
  color: var(--text-faint);
  font-size: 0.68rem;
  width: 10px;
}

.grouprow.open .caret {
  transform: rotate(90deg);
}

.grouptitle {
  color: var(--accent);
}

.more-tag {
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-left: 8px;
}

.detail-row td {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child td {
  border-bottom: none;
}

.detail-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.detail-wrap.open {
  max-height: 480px;
}

.detail-panel {
  margin: 0 14px 14px 34px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 4px 0;
}

.strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.strip:last-child {
  border-bottom: none;
}

.strip:hover {
  background: rgba(255, 255, 255, 0.02);
}

.strip .title {
  flex: 1;
  font-size: 0.92rem;
  white-space: normal;
}

.strip .meta {
  font-size: 0.85rem;
  color: var(--text-faint);
}

.strip .src {
  font-size: 0.85rem;
  color: var(--text-dim);
  width: 130px;
}

.strip .score {
  font-weight: 500;
  width: 36px;
  text-align: right;
}

/* Flygplats-skylt — signaturkomponenten. Överallt en flygplatskod visas. */
.sign {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
  cursor: default;
}

/* Hover affordance when the sign badge is a link's payload (airport-code
   cells in list/table rows) - airport_detail.html's own badge in the page
   <h1> isn't wrapped in <a>, so it's unaffected and keeps cursor:default.
   Rows with no code render the plain "–" fallback span instead (see
   _components.html's sign() macro), which never carries .sign, so it's
   untouched by these rules too. */
a .sign {
  cursor: pointer;
}

a:hover .sign {
  filter: brightness(1.15);
}

/* Kategori-badge — text kommer alltid från den centrala mappningen, aldrig
   ett råt databasvärde. */
.cat {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  white-space: nowrap;
}

.cat.new { background: var(--new-bg); color: var(--new); }
.cat.replace { background: var(--med-bg); color: var(--med-ink); }
.cat.incident { background: var(--high-bg); color: var(--high-ink); }
.cat.study { background: var(--low-bg); color: var(--low-ink); }

/* Confidence som gauge, inte badge-text. */
.gauge {
  display: flex;
  gap: 2px;
  align-items: center;
}

.gauge span:not(.gauge-label) {
  width: 5px;
  height: 12px;
  border-radius: 1px;
  background: var(--border);
}

.gauge.high span:nth-child(-n + 3) { background: var(--high); }
.gauge.med span:nth-child(-n + 2) { background: var(--med); }
.gauge.low span:nth-child(-n + 1) { background: var(--low-ink); }

.gauge-label {
  font-size: 10px;
  color: var(--text-faint);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pill.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* .pill.status doubles as a source-type badge linking to /ordlista.html
   (see _components.html's source_badge macro) - give the linked variant a
   visible hover affordance distinct from the plain (non-clickable) span
   version, without changing its resting look. */
a.pill.status {
  cursor: help;
}

a.pill.status:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

/* Inline glossary link - used for the confidence gauge label and the
   "Bekräftad leverantör" pill's prefix, where a full badge would look out
   of place mid-text. color:inherit so it matches whatever muted/accent ink
   it's embedded in; the dotted underline is the only "this is clickable"
   signal until hover. */
.gloss-link {
  color: inherit;
  cursor: help;
  border-bottom: 1px dotted currentColor;
  text-decoration: none;
}

.gloss-link:hover {
  border-bottom-style: solid;
  text-decoration: none;
}

/* Explicit "we checked and can't confirm this" - dashed/muted so it never
   reads like a normal status pill (e.g. "Bana 24") stating a known fact. */
.pill.unconfirmed {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  background: transparent;
  border: 1px dashed var(--text-faint);
  color: var(--text-faint);
}

/* A signal graduated to a real Installation (scripts/graduate_signal_to_installation.py) -
   same "confirmed fact" green as .pill.vendor, so "done" reads distinctly
   from a still-open status instead of like a broken/unrecognized value. */
.pill.done {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--verified-bg);
  border: 1px solid var(--verified);
  color: var(--verified-ink);
}

/* Confirmed vendor - a fact the source explicitly named, not a guess -
   distinct green so it never reads like the category/confidence pills. */
.pill.vendor {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--verified-bg);
  border: 1px solid var(--verified);
  color: var(--verified-ink);
}

.score {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.mono {
  font-family: var(--font-mono);
}

.src {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.filters input, .filters select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel2);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.filters input {
  flex: 1 1 220px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
}

/* "Bevaka" (watch) star - client-side only, see static/watch.js. Fixed
   rem size so it reads the same whether it's sitting in a table cell or
   next to an <h1> on signal_detail.html. */
.star-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-faint);
  vertical-align: middle;
}

.star-toggle:hover {
  color: var(--accent);
}

.star-toggle.watched {
  color: var(--accent);
}

/* Plain (non-link) hover tooltip via the native title attribute - same
   dotted "help" affordance as .gloss-link, but without implying a
   clickable destination (no glossary entry backs this one). */
.info-hint {
  color: var(--text-faint);
  cursor: help;
  border-bottom: 1px dotted currentColor;
  font-size: 0.8em;
}

.empty-state {
  padding: 40px 18px;
  text-align: center;
  color: var(--text-dim);
}

dl.meta {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 16px;
  margin: 0;
}

dl.meta dt {
  color: var(--text-dim);
  font-size: 0.85rem;
}

dl.meta dd {
  margin: 0;
}

.breadcrumbs {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

/* "← Tillbaka" (history.back()) next to the "← Flygplatser" breadcrumb link -
   a <button>, not an <a>, since it has no real href (see airport_detail.html) -
   styled to read as a plain inline link like its neighbor. */
.link-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 14px;
  color: var(--accent);
  font: inherit;
  font-size: inherit;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 760px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  table, thead, tbody, th, td, tr {
    display: block;
  }
  thead {
    display: none;
  }
  tbody tr {
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
  }
  td {
    border-bottom: none;
    white-space: normal;
    padding: 4px 0;
  }
  td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    margin-bottom: 2px;
  }
}

@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat:nth-child(2n) {
    border-right: none;
  }
}

.money {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* airport_detail.html's "Tidslinje" — a chronological complement to the
   separate Installations/Signals/Incidents tables, not a replacement.
   Reuses the same .cat category coloring (new/replace/incident/study) as
   the Signals table so a category means the same thing everywhere. */
.timeline-item {
  display: grid;
  grid-template-columns: 56px 20px 1fr;
  column-gap: 12px;
  position: relative;
}

.timeline-item.timeline-item-undated {
  grid-template-columns: 20px 1fr;
}

.timeline-item:not(:last-child) {
  padding-bottom: 16px;
}

.timeline-year {
  text-align: right;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding-top: 2px;
}

.timeline-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-item:not(:last-child) .timeline-rail::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: -16px;
  width: 2px;
  background: var(--border);
}

.timeline-undated .timeline-rail::before {
  content: none;
}

.timeline-dot {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-top: 3px;
  position: relative;
  z-index: 1;
  border: 2px solid var(--panel);
}

.timeline-dot.new { background: var(--new); }
.timeline-dot.replace { background: var(--med); }
.timeline-dot.incident { background: var(--high); }
.timeline-dot.study { background: var(--low-ink); }

.timeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-title a {
  color: var(--text);
  font-weight: 500;
}

.timeline-title a:hover {
  color: var(--accent);
}

.timeline-meta {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2px;
}

@media (max-width: 480px) {
  .timeline-item {
    grid-template-columns: 40px 16px 1fr;
    column-gap: 8px;
  }
  .timeline-year {
    font-size: 0.76rem;
  }
}

/* Landing spot for a Tidslinje click into the Installationer/Incidenter
   tables below - .card:target (above) already covers /ordlista.html
   anchors, but these two targets aren't .card elements. */
[id^="installation-"]:target {
  background: rgba(242, 183, 5, 0.1);
  border-radius: var(--radius-sm);
}

tbody tr:target td {
  background: rgba(242, 183, 5, 0.1);
}

/* index.html's install-trend chart - pure SVG, no chart library. Two
   stacked panels (per-year bars, cumulative line) share the same x mapping
   (see build.py's _trend_view) so their gridlines line up vertically. */
.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.trend-legend-item {
  display: inline-flex;
  align-items: center;
}

.trend-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  margin-right: 6px;
}

.trend-swatch-install {
  background: var(--accent);
}

.trend-swatch-signal {
  background-image: repeating-linear-gradient(45deg, var(--low-ink), var(--low-ink) 1.5px, transparent 1.5px, transparent 4px);
  border: 1px dashed var(--low-ink);
}

/* SVG text scales with the viewBox like everything else in it - on a
   narrow phone that shrinks the 9-unit tick labels into illegible dust.
   Rather than hide labels to compensate, give the chart a min-width and
   let it scroll horizontally (same idea as the table->card breakpoint
   elsewhere, applied to a chart instead: adapt, don't render illegibly). */
.trend-scroll {
  overflow-x: auto;
}

.trend-chart {
  display: block;
  width: 100%;
  min-width: 700px;
  height: auto;
}

.trend-chart-cumulative {
  margin-top: 2px;
}

.trend-gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.trend-baseline {
  stroke: var(--border);
  stroke-width: 1;
}

.trend-bar-install {
  fill: var(--accent);
}

.trend-bar-install:hover {
  opacity: 0.82;
}

/* Forecast/planned - deliberately muted + hatched + dashed, never solid
   gold, so it never reads as confirmed fact next to the installation bars. */
.trend-bar-signal {
  fill: url(#trend-hatch);
  stroke: var(--low-ink);
  stroke-width: 1;
  stroke-dasharray: 2 1;
}

.trend-bar-signal:hover {
  opacity: 0.82;
}

.trend-area {
  fill: var(--accent);
  opacity: 0.12;
  stroke: none;
}

.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.trend-point {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.trend-point:hover {
  fill: var(--accent);
}

.trend-tick-label {
  fill: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.trend-caption {
  color: var(--text-faint);
  font-size: 0.8rem;
  margin: 10px 0 0;
}

footer.site {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 40px;
}
