/* ============================================================
   CYRL AIRPORT STATUS BOARD — STYLESHEET
   Dark-first, aviation-inspired design
   ============================================================ */

/* --- DESIGN TOKENS ---------------------------------------- */
:root,
[data-theme='light'] {
  --color-bg:              #f0f2f5;
  --color-surface:         #ffffff;
  --color-surface-2:       #f7f9fc;
  --color-surface-offset:  #eaecf0;
  --color-divider:         #d8dce3;
  --color-border:          #c8ccd4;
  --color-text:            #0e1117;
  --color-text-muted:      #5a6070;
  --color-text-faint:      #9ea5b4;
  --color-text-secondary:  #3d4a5c;
  --color-text-inverse:    #f0f2f5;

  --color-accent:          #0097b2;
  --color-accent-hover:    #007a91;
  --color-accent-dim:      #cdeaf0;

  --color-green:           #0f9960;
  --color-green-dim:       #c3e8d7;
  --color-yellow:          #c87b00;
  --color-yellow-dim:      #fde8b0;
  --color-orange:          #d45000;
  --color-orange-dim:      #fddcc8;
  --color-red:             #c0392b;
  --color-red-dim:         #f4d4d1;
  --color-purple:          #7048a0;
  --color-purple-dim:      #e0d4f0;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-display: 'Cabinet Grotesk', 'Helvetica Neue', sans-serif;
  --font-body:    'Satoshi', 'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm:   clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1.0625rem);
  --text-lg:   clamp(1.0625rem, 0.95rem + 0.6vw, 1.3125rem);
  --text-xl:   clamp(1.3125rem, 1rem + 1.2vw, 1.875rem);

  --transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme='dark'] {
  --color-bg:              #0b0d11;
  --color-surface:         #111318;
  --color-surface-2:       #161921;
  --color-surface-offset:  #1a1d25;
  --color-divider:         #1f2330;
  --color-border:          #252a38;
  --color-text:            #dde2ec;
  --color-text-muted:      #6b7488;
  --color-text-faint:      #3d4358;
  --color-text-secondary:  #8892a8;
  --color-text-inverse:    #0b0d11;

  --color-accent:          #00b8d9;
  --color-accent-hover:    #00d4f7;
  --color-accent-dim:      #0d2d36;

  --color-green:           #1ec97e;
  --color-green-dim:       #0d2e1e;
  --color-yellow:          #f0b429;
  --color-yellow-dim:      #2e2306;
  --color-orange:          #f06518;
  --color-orange-dim:      #2e1506;
  --color-red:             #e74c3c;
  --color-red-dim:         #2e0d0a;
  --color-purple:          #a870e0;
  --color-purple-dim:      #26143a;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:              #0b0d11;
    --color-surface:         #111318;
    --color-surface-2:       #161921;
    --color-surface-offset:  #1a1d25;
    --color-divider:         #1f2330;
    --color-border:          #252a38;
    --color-text:            #dde2ec;
    --color-text-muted:      #6b7488;
    --color-text-faint:      #3d4358;
    --color-text-secondary:  #8892a8;
    --color-text-inverse:    #0b0d11;
    --color-accent:          #00b8d9;
    --color-accent-hover:    #00d4f7;
    --color-accent-dim:      #0d2d36;
    --color-green:           #1ec97e;
    --color-green-dim:       #0d2e1e;
    --color-yellow:          #f0b429;
    --color-yellow-dim:      #2e2306;
    --color-orange:          #f06518;
    --color-orange-dim:      #2e1506;
    --color-red:             #e74c3c;
    --color-red-dim:         #2e0d0a;
    --color-purple:          #a870e0;
    --color-purple-dim:      #26143a;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
  }
}

/* --- BASE -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  line-height: 1.5;
}
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
code { font-family: var(--font-mono); }
img, svg, canvas { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- HEADER ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 800;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.airport-logo {
  width: 36px;
  height: 36px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
/* Real logo image — sits on a white pill so colors stay true in both themes */
.airport-logo-img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  background: #fff;
  border-radius: 6px;
  padding: 2px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-icao {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-accent);
}
.brand-name {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.header-meta {
  flex: 1;
  text-align: center;
}
.header-time {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--color-text);
}
.header-date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}
.header-utc {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.navcan-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: background var(--transition), border-color var(--transition);
}
.navcan-link:hover {
  background: var(--color-divider);
  color: var(--color-text);
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background var(--transition);
}
.theme-toggle:hover { background: var(--color-divider); color: var(--color-text); }

/* --- MAIN LAYOUT ------------------------------------------ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* --- SHARED CARD STYLES ----------------------------------- */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
  flex-wrap: wrap;
}
.card-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.card-updated {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}
.card-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --- SECTION: WEATHER SUMMARY ----------------------------- */
.section-weather-summary {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: var(--space-4);
}
.weather-primary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.flight-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}
.flight-cat-badge.vfr  { background: var(--color-green-dim);  color: var(--color-green);  }
.flight-cat-badge.mvfr { background: var(--color-yellow-dim); color: var(--color-yellow); }
.flight-cat-badge.ifr  { background: var(--color-red-dim);    color: var(--color-red);    }
.flight-cat-badge.lifr { background: var(--color-purple-dim); color: var(--color-purple); }
.flight-cat-badge.unknown { background: var(--color-surface-offset); color: var(--color-text-muted); }

.weather-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.stat-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}
.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 2px;
  letter-spacing: 0.03em;
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.metar-raw-wrap {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}
.metar-raw-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  margin-top: 2px;
}
.metar-raw {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  word-break: break-all;
}
.cloud-layers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.cloud-tag {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
}

/* Wind Compass Card */
.wind-compass-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.compass-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compass-val-badge {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  letter-spacing: 0.03em;
  margin-top: -4px;
}
.runway-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.runway-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.xwind-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- SECTION: TAF ----------------------------------------- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}
.section-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
/* TAF styles now live inside the accordion */
.taf-raw {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.7;
  word-break: break-all;
  white-space: pre-wrap;
  display: block;
}

/* --- SECTION: FLIGHTS ------------------------------------- */
.section-flights {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* Unified flights header (replaces tabs) */
.flights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-3);
  background: var(--color-surface-2);
  flex-wrap: wrap;
}
.flights-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.flights-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.flights-data-source {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.data-badge {
  font-size: var(--text-xs);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  font-weight: 500;
}
.data-badge.secondary { opacity: 0.6; }
.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.refresh-btn:hover { background: var(--color-divider); color: var(--color-text); }
.refresh-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.flights-table-wrap { overflow-x: auto; padding: 0; }
.flights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.flights-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}
.flights-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: top;
}
.flights-table tbody tr:last-child td { border-bottom: none; }
.flights-table tbody tr:not(.flights-section-divider):hover { background: var(--color-surface-2); }

/* Section divider rows — ARRIVALS / DEPARTURES label */
.flights-section-divider td {
  padding: var(--space-2) var(--space-3) var(--space-1);
  border-bottom: none;
  background: var(--color-surface-2);
}
.flights-section-divider + tr td {
  border-top: none;
}
.flights-section-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* Row colour tinting — arrivals warm amber, departures cool blue */
.flight-row-arrival {
  background: rgba(251, 146, 60, 0.07);
}
.flight-row-arrival:hover {
  background: rgba(251, 146, 60, 0.14) !important;
}
.flight-row-departure {
  background: rgba(56, 189, 248, 0.07);
}
.flight-row-departure:hover {
  background: rgba(56, 189, 248, 0.14) !important;
}

/* Legend */
.flights-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-swatch.arrival  { background: rgba(251, 146, 60, 0.35); border: 1px solid rgba(251, 146, 60, 0.5); }
.legend-swatch.departure { background: rgba(56, 189, 248, 0.35); border: 1px solid rgba(56, 189, 248, 0.5); }

/* Stacked cell styles */
.flight-number {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-accent);
  font-size: var(--text-sm);
  display: block;
  line-height: 1.3;
}
.flight-reg {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: 1px;
}
.flight-airline {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.3;
}
.flight-ac-type {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 1px;
}
.flight-city {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.3;
}
.flight-apt {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: 1px;
}
.sched-time {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  line-height: 1.3;
}
.sched-status {
  display: block;
  margin-top: 3px;
}
/* Delay badges */
.delay-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: var(--radius-full, 9999px);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.delay-late  { background: var(--color-orange-dim); color: var(--color-orange); }
.delay-early { background: var(--color-green-dim);  color: var(--color-green); }
/* Source provenance pips */
.src-pip {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: var(--radius-full, 9999px);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  opacity: 0.7;
}
.src-fa   { background: var(--color-accent-dim); color: var(--color-accent); }
.src-adsb { background: var(--color-surface-offset); color: var(--color-text-faint); border: 1px solid var(--color-border); }
/* FA refresh timestamp */
.fa-refresh-time {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-left: 4px;
}
.flight-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.status-scheduled { background: var(--color-surface-offset); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.status-landed    { background: var(--color-green-dim);  color: var(--color-green);  }
.status-enroute   { background: var(--color-yellow-dim); color: var(--color-yellow); }
.status-delayed   { background: var(--color-orange-dim); color: var(--color-orange); }
.status-overdue   { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.35); animation: overdue-pulse 2.5s ease-in-out infinite; }
@keyframes overdue-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.status-diverted  { background: var(--color-red-dim);    color: var(--color-red);    }
.status-departed  { background: var(--color-accent-dim); color: var(--color-accent); }
.status-unknown   { background: var(--color-surface-offset); color: var(--color-text-faint); }

.loading-row td { padding: var(--space-3); }
.loading-shimmer {
  height: 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-divider) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-flights {
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.fa-link-row {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  margin-top: var(--space-3);
}
.ext-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
}
.ext-link:hover { color: var(--color-accent-hover); }

/* --- SECTION: MAP + NOTAM --------------------------------- */
.section-map-notam {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-4);
  min-height: 400px;
}
.map-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.map-card .card-header {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.map-embed-wrap {
  flex: 1;
  min-height: 300px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.map-embed-wrap iframe { width: 100%; height: 100%; display: block; border: none; }

.ext-link-sm {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}
.ext-link-sm:hover { color: var(--color-accent-hover); }

.pirep-notam-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.pirep-card,
.notam-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pirep-card .card-header,
.notam-card .card-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
}
.pirep-list,
.notam-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 160px;
}
.pirep-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.pirep-meta {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-1);
}
.pirep-alt {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-accent);
}
.pirep-time {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}
.pirep-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  word-break: break-word;
}
.notam-note {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  align-items: flex-start;
}
.notam-note svg { flex-shrink: 0; margin-top: 1px; }
.notam-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-left: 3px solid var(--color-yellow);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.notam-id {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-yellow);
  margin-bottom: var(--space-1);
}
.notam-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}
.empty-state {
  padding: var(--space-4);
  text-align: center;
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

/* --- SECTION: AIRLINES ------------------------------------ */
.section-airlines {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.airlines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2);
}
.airline-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.airline-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}
.airline-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.airline-name-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.airline-name-link:hover .airline-name {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.airline-routes {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  line-height: 1.4;
}
.airline-note {
  font-size: 10px;
  color: var(--color-text-dim, var(--color-text-muted));
  opacity: 0.7;
  margin-bottom: var(--space-2);
  line-height: 1.3;
  font-style: italic;
}
.airline-phone {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-accent);
}

/* --- PERIMETER SCHEDULE SECTION ----------------------------- */
.section-perimeter-schedule {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-2);
}
.perimeter-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.pa-sched-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.pa-sched-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}
.pa-sched-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.pa-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-bottom: var(--space-3);
}
.pa-sched-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-faint);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--color-divider);
}
.pa-sched-table td {
  padding: 4px 6px 4px 0;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}
.pa-sched-table td:nth-child(3),
.pa-sched-table td:nth-child(4) {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.pa-sched-table tr:last-child td { border-bottom: none; }
.pa-sched-connections {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
}
.pa-conn-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: 2px;
}
.pa-conn-item {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* --- PERIMETER NOTE (no YRL legs) -------------------------- */
.pa-no-yrl-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-3);
}
.pa-no-yrl-note svg { flex-shrink: 0; margin-top: 2px; color: var(--color-text-faint); }
.pa-no-yrl-note strong { color: var(--color-text); }

/* --- WASAYA SCHEDULE SECTION -------------------------------- */
.section-wasaya-schedule {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-2);
}
.wasaya-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.wa-sched-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.wa-sched-airline {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 2px;
}
.wa-sched-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}
.wa-sched-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.wa-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-bottom: var(--space-3);
}
.wa-sched-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-faint);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--color-divider);
}
.wa-sched-table td {
  padding: 4px 6px 4px 0;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.wa-sched-table td:nth-child(4),
.wa-sched-table td:nth-child(5) {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.wa-sched-table td:first-child {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-faint);
  white-space: nowrap;
}
.wa-sched-table td strong {
  color: var(--color-text);
  font-weight: 700;
}
/* Arrival rows — subtle left accent */
.wa-arr-row td:first-child::before {
  content: '↓ ';
  color: var(--color-green);
  font-size: 10px;
}
/* Departure rows */
.wa-dep-row td:first-child::before {
  content: '↑ ';
  color: var(--color-accent);
  font-size: 10px;
}
/* Continuation legs — indented, dimmer */
.wa-continuation td {
  opacity: 0.65;
  font-style: italic;
  padding-left: 12px;
}
.wa-continuation td:first-child::before { content: ''; }
.wa-sched-table tr:last-child td { border-bottom: none; }
.wa-sched-note {
  font-size: 10px;
  color: var(--color-text-faint);
  line-height: 1.5;
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}

/* --- RUNWAY CONDITION PANEL --------------------------------- */
.runway-condition-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
}
.runway-condition-panel.hidden { display: none; }

.rwy-status-bar {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid;
}
.rwy-status-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.rwy-status-body {
  flex: 1;
  min-width: 0;
}
.rwy-status-headline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.rwy-surface-pills {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.rwy-surface-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}
.rwy-pill-pct {
  font-weight: 700;
  opacity: 0.85;
}
.rwy-crfi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
}
.rwy-crfi-badge-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  font-weight: 700;
  opacity: 0.75;
  text-transform: uppercase;
}
.rwy-rwy-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  padding: 1px 8px;
  border-radius: var(--radius-full, 9999px);
  flex-shrink: 0;
}
.rwy-status-text {
  font-weight: 600;
  font-size: var(--text-sm);
}
.rwy-friction-line {
  font-size: var(--text-sm);
  font-weight: 500;
  margin-top: 4px;
  opacity: 0.9;
}

.rwy-status-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.rwy-crfi, .rwy-rwycc { display: flex; align-items: center; gap: 4px; }
.rwy-crfi-label {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}
.rwy-crfi-val {
  font-weight: 700;
}
.rwycc-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.rwy-validity {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.rwy-remarks {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}
.rwy-restrictions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.rwy-restriction-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid;
}

/* --- UNSCHEDULED TRAFFIC BANNER ----------------------------- */
.unscheduled-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--color-orange-dim) 0%, var(--color-surface-2) 100%);
  border-bottom: 2px solid var(--color-orange);
  font-size: var(--text-sm);
  animation: banner-slide-in 0.35s ease;
}
.unscheduled-banner.hidden {
  display: none;
}
@keyframes banner-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.banner-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.banner-body {
  flex: 1;
}
.banner-title {
  font-weight: 700;
  color: var(--color-orange);
  margin-bottom: 2px;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}
.banner-flights {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.banner-flight-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-orange);
  border-radius: var(--radius-full, 9999px);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}
.banner-flight-chip .chip-cs {
  color: var(--color-accent);
}
.banner-flight-chip .chip-detail {
  color: var(--color-text-muted);
  font-weight: 400;
}
.banner-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  line-height: 1;
  font-size: 16px;
  transition: color 0.15s;
}
.banner-dismiss:hover { color: var(--color-text); }


.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer-sources {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
}
.footer-sources a { color: var(--color-text-muted); }
.footer-sources a:hover { color: var(--color-accent); }

/* --- AIRPORT INFO BAR ------------------------------------- */
.airport-info-bar {
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 5px var(--space-6);
}
.aib-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.aib-item svg { color: var(--color-accent); flex-shrink: 0; }
.aib-dot {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  user-select: none;
}

/* --- TAF ACCORDION ---------------------------------------- */
.taf-accordion {
  border-top: 1px solid var(--color-divider);
  margin-top: var(--space-2);
}
.taf-accordion-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  user-select: none;
  list-style: none;
  transition: color var(--transition);
}
.taf-accordion-summary::-webkit-details-marker { display: none; }
.taf-accordion-summary::marker { display: none; }
.taf-accordion-summary:hover { color: var(--color-text); }
.taf-accordion[open] .taf-accordion-summary { color: var(--color-text); }
.taf-validity-inline {
  margin-left: auto;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--color-text-faint);
  font-weight: 400;
}
.taf-accordion-body {
  padding: var(--space-2) var(--space-4) var(--space-3);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
}

/* --- AIRCRAFT MAP ICONS ----------------------------------- */
.aircraft-icon {
  background: transparent !important;
  border: none !important;
}
.leaflet-tooltip.ac-tooltip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 11px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-md);
  padding: 4px 8px;
}

/* --- RESPONSIVE ------------------------------------------- */

/* Tablet-landscape: PIREP/NOTAM side-by-side with more breathing room */
@media (min-width: 861px) and (max-width: 1100px) {
  .pirep-notam-col {
    flex-direction: row;
  }
  .pirep-list, .notam-list {
    max-height: 220px;
  }
  .pirep-card,
  .notam-card {
    min-width: 0;
  }
}

@media (max-width: 1100px) {
  .section-map-notam {
    grid-template-columns: 1fr;
  }
  .pirep-notam-col {
    flex-direction: row;
  }
  .pirep-list, .notam-list { max-height: 160px; }
}
@media (max-width: 860px) {
  .section-weather-summary {
    grid-template-columns: 1fr;
  }
  .weather-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pirep-notam-col { flex-direction: column; }
  .pirep-list, .notam-list { max-height: 200px; }
  .header-meta { display: none; }
}
@media (max-width: 640px) {
  .main-content { padding: var(--space-3); gap: var(--space-3); }
  .header-inner { padding: var(--space-3); gap: var(--space-3); }

  /* Issue 2: NavCanada link — icon-only on mobile (font-size:0 approach) */
  .navcan-link {
    font-size: 0;
    gap: 0;
    padding: var(--space-2);
    width: 44px;
    justify-content: center;
  }
  .navcan-link svg {
    width: 16px;
    height: 16px;
  }

  /* Flights header — compact on mobile */
  .flights-header {
    padding: var(--space-2) var(--space-3);
  }
  .data-badge.secondary {
    display: none;
  }

  /* Issue 3: Schedule grids — single column on mobile */
  .perimeter-schedule-grid,
  .wasaya-schedule-grid {
    grid-template-columns: 1fr;
  }
  .pa-sched-card,
  .wa-sched-card {
    overflow-x: auto;
  }

  /* Issue 4: Wind compass card on mobile */
  .wind-compass-card {
    max-width: 240px;
    margin: 0 auto;
  }

  .weather-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .airlines-grid { grid-template-columns: repeat(2, 1fr); }
  .fa-link-row { flex-wrap: wrap; gap: var(--space-3); }
}

/* Very small phones: single-column weather stats */
@media (max-width: 380px) {
  .weather-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* --- PRINT STYLES ----------------------------------------- */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .site-header,
  .airport-info-bar,
  .unscheduled-banner,
  .map-card,
  .theme-toggle,
  .navcan-link,
  .refresh-btn,
  .fa-link-row,
  .flights-data-source,
  .loading-shimmer,
  .site-footer {
    display: none !important;
  }

  .flights-table-wrap {
    overflow: visible;
  }
  .flights-table {
    font-size: 10pt;
  }
  .flights-table th,
  .flights-table td {
    border: 1px solid #ccc;
    padding: 4pt 6pt;
  }

  .taf-accordion-body {
    display: block !important;
  }
  .metar-raw-wrap,
  .taf-accordion-body {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
  }
  .metar-raw, .taf-raw {
    color: black !important;
    white-space: pre-wrap;
  }

  .section-weather-summary {
    page-break-after: avoid;
  }
  .section-flights {
    page-break-inside: avoid;
  }
}

/* --- WALKTHROUGH TOUR ------------------------------------- */
.wt-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: wt-fade-in 0.25s ease;
}

.wt-highlight {
  position: absolute;
  z-index: 9001;
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 4px var(--color-accent),
    0 0 0 9000px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: top 0.35s ease, left 0.35s ease,
              width 0.35s ease, height 0.35s ease,
              opacity 0.25s ease;
}

.wt-tooltip {
  position: absolute;
  z-index: 9100;
  width: min(420px, calc(100vw - 24px));
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  padding: var(--space-5);
  animation: wt-pop-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wt-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes wt-pop-in {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.wt-progress {
  display: flex;
  gap: 5px;
  margin-bottom: var(--space-3);
}
.wt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s;
}
.wt-dot.active {
  background: var(--color-accent);
  width: 18px;
  border-radius: 3px;
}

.wt-step-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.wt-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.25;
}

.wt-body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: var(--space-4);
}

.wt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.wt-nav {
  display: flex;
  gap: var(--space-2);
}

.wt-skip {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}
.wt-skip:hover { color: var(--color-text-muted); }

.wt-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.wt-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.wt-btn.wt-primary {
  background: var(--color-accent);
  color: #000;
  border-color: var(--color-accent);
}
.wt-btn.wt-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* Replay button in footer */
.wt-replay-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}
.wt-replay-btn:hover { color: var(--color-accent); }

@media (max-width: 480px) {
  .wt-tooltip { padding: var(--space-4); }
  .wt-title   { font-size: var(--text-base); }
  .wt-body    { font-size: var(--text-xs); }
}

/* ── Settings Button ─────────────────────────────────────────────────── */
.settings-btn {
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 5px 7px;
  transition: background 0.15s, color 0.15s;
  margin-left: 4px;
}
.settings-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ── Settings Overlay & Modal ────────────────────────────────────────── */
.settings-overlay {
  display: none;  /* JS sets display:flex when open — never visible by default */
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.settings-overlay.open {
  display: flex;
  opacity: 1;
}
.settings-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  width: min(520px, 94vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform 0.15s;
}
.settings-overlay.open .settings-modal { transform: translateY(0); }

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.settings-header h2 {
  font-size: 1rem; font-weight: 600;
  color: var(--color-text); margin: 0;
}
.settings-close {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-size: 1.4rem; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: background 0.15s;
}
.settings-close:hover { background: var(--color-surface-2); color: var(--color-text); }

.settings-body {
  overflow-y: auto; padding: 4px 0;
  flex: 1;
}

.settings-section {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--color-divider);
}
.settings-section:last-child { border-bottom: none; }

.settings-section-title {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
}

.settings-label {
  font-size: 0.82rem; color: var(--color-text);
  line-height: 1.3;
}
.settings-label em { font-style: normal; font-weight: 600; }

.settings-control {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
}
.settings-control input[type="number"] {
  width: 72px; text-align: right;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.85rem;
  padding: 4px 8px;
  -moz-appearance: textfield;
}
.settings-control input[type="number"]::-webkit-inner-spin-button,
.settings-control input[type="number"]::-webkit-outer-spin-button { opacity: 1; }
.settings-control input[type="number"]:focus {
  outline: none; border-color: var(--color-accent);
}
.settings-control input[type="text"] {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.78rem;
  padding: 4px 8px;
  width: 100%;
}
.settings-control input[type="text"]:focus {
  outline: none; border-color: var(--color-accent);
}
.settings-default {
  font-size: 0.68rem; color: var(--color-text-muted);
  white-space: nowrap;
}

.settings-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
.settings-btn-reset {
  background: transparent; border: 1px solid var(--color-border);
  border-radius: 6px; color: var(--color-text-secondary);
  font-size: 0.82rem; padding: 6px 14px; cursor: pointer;
  transition: background 0.15s;
}
.settings-btn-reset:hover { background: var(--color-surface-2); }
.settings-btn-apply {
  background: var(--color-accent); border: none;
  border-radius: 6px; color: #fff;
  font-size: 0.82rem; font-weight: 600; padding: 6px 18px; cursor: pointer;
  transition: filter 0.15s;
}
.settings-btn-apply:hover { filter: brightness(1.1); }

/* ── Overflight banner sections ──────────────────────────────────────── */
.banner-body--multi {
  display: flex; flex-direction: column; gap: 8px; flex: 1;
}
.banner-section {
  display: flex; flex-direction: column; gap: 4px;
}
.banner-section--overflights {
  border-top: 1px solid var(--color-divider);
  padding-top: 8px;
  opacity: 0.85;
}
.banner-title--dim {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Admin panel override indicator — small amber dot next to status badge */
.admin-override-dot {
  display: inline-block;
  color: var(--color-warn, #d29922);
  font-size: 7px;
  vertical-align: super;
  margin-left: 3px;
  cursor: help;
  opacity: 0.8;
}

/* Now Boarding status badge */
.status-boarding {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.35);
  animation: boarding-pulse 1.5s ease-in-out infinite;
}
@keyframes boarding-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Live countdown next to boarding badge */
.boarding-countdown {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

/* Staff-logged manual entry source pip */
.src-manual {
  background: rgba(210, 153, 34, 0.15);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

/* Taxiing status badge — amber/yellow, faster pulse */
.status-taxiing {
  background: rgba(210, 153, 34, 0.15);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.35);
  animation: taxiing-pulse 0.9s ease-in-out infinite;
}
@keyframes taxiing-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Taxiing countdown pill — amber toned */
.taxiing-countdown {
  color: #d29922 !important;
  background: rgba(210, 153, 34, 0.12) !important;
  border-color: rgba(210, 153, 34, 0.3) !important;
}

/* On Final status badge — green, medium pulse */
.status-onfinal {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.35);
  animation: onfinal-pulse 1.2s ease-in-out infinite;
}
@keyframes onfinal-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* On Final countdown pill */
.onfinal-countdown {
  color: #3fb950 !important;
  background: rgba(63, 185, 80, 0.12) !important;
  border-color: rgba(63, 185, 80, 0.3) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TV / KIOSK MODE
   Applied via <body class="kiosk-mode">
   Goal: single 16:9 viewport, no scroll, large readable text, clean layout.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Settings panel — kiosk section */
.btn-kiosk-toggle {
  background: var(--color-accent) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  margin-bottom: 6px;
  display: inline-block;
  width: auto;
}
.btn-kiosk-toggle:hover { opacity: .85; }
[data-theme='light'] .btn-kiosk-toggle {
  color: #fff !important;
  background: #0097b2 !important;
}
.kiosk-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kiosk-check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.kiosk-check-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* Exit button — floats top-right, only shown in kiosk mode */
.kiosk-exit-btn {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30,34,42,.85);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: opacity .2s, color .2s;
}
.kiosk-exit-btn:hover { color: #fff; opacity: 1; }
.kiosk-exit-btn.hidden { display: none !important; }

/* ── Kiosk body ── */
body.kiosk-mode {
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Hide header chrome in kiosk mode */
body.kiosk-mode .header-actions,
body.kiosk-mode .walkthrough-btn {
  display: none !important;
}

/* Compact header in kiosk mode */
body.kiosk-mode .app-header {
  padding: 6px 20px;
  min-height: unset;
}
body.kiosk-mode .header-logo-mark { width: 28px; height: 28px; }
body.kiosk-mode .header-title { font-size: 1rem; }
body.kiosk-mode .header-time  { font-size: 1.6rem; }
body.kiosk-mode .header-date,
body.kiosk-mode .header-utc   { font-size: 0.72rem; }

/* Main content fills remaining height, no scroll */
body.kiosk-mode .main-content {
  height: calc(100vh - 52px); /* subtract compact header height */
  overflow: hidden;
  display: grid;
  gap: 10px;
  padding: 10px 14px 10px 14px;
  box-sizing: border-box;
  /* default: flights col + weather col */
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto 1fr;
  align-items: start;
}

/* Weather section — right column, compact */
body.kiosk-mode .section-weather-summary {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

body.kiosk-mode .weather-primary-card {
  padding: 12px 14px;
}

body.kiosk-mode .metar-raw {
  font-size: 0.65rem;
  max-height: 48px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Flights section — left column, full height */
body.kiosk-mode .section-flights {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* Scale up table text for readability from a distance */
body.kiosk-mode .flights-table {
  font-size: 1.05rem;
}
body.kiosk-mode .flights-table th {
  font-size: 0.72rem;
  padding: 6px 10px;
}
body.kiosk-mode .flights-table td {
  padding: 10px 10px;
}
body.kiosk-mode .callsign-cell .callsign {
  font-size: 1.2rem;
  font-weight: 700;
}
body.kiosk-mode .airline-cell {
  font-size: 0.9rem;
}
body.kiosk-mode .status-badge {
  font-size: 0.85rem;
  padding: 4px 10px;
}
body.kiosk-mode .sched-time {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Section header (Arrivals / Departures) */
body.kiosk-mode .flights-section-header {
  font-size: 0.8rem;
  padding: 6px 10px;
}

/* Runway condition — below weather, right col */
body.kiosk-mode .runway-condition-panel {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.78rem;
  overflow: hidden;
  max-height: 180px;
}

/* Unscheduled banner — full width, above the grid */
body.kiosk-mode .unscheduled-banner:not(.hidden) {
  font-size: 0.9rem;
  padding: 8px 16px;
}

/* Hide map, PIREPs, NOTAMs, TAF accordion in kiosk mode */
body.kiosk-mode .section-map-notam {
  display: none !important;
}

/* When weather is hidden */
body.kiosk-mode.kiosk-hide-weather .section-weather-summary {
  display: none !important;
}
body.kiosk-mode.kiosk-hide-weather .main-content {
  grid-template-columns: 1fr;
}
body.kiosk-mode.kiosk-hide-weather .section-flights {
  grid-column: 1;
}

/* When runway is hidden */
body.kiosk-mode.kiosk-hide-runway .runway-condition-panel {
  display: none !important;
}

/* When banner is hidden */
body.kiosk-mode.kiosk-hide-banner .unscheduled-banner {
  display: none !important;
}

/* When flights are hidden */
body.kiosk-mode.kiosk-hide-flights .section-flights {
  display: none !important;
}

/* In canvas kiosk mode, section-map-notam stays display:none in its original
   DOM position — the live node is moved into the widget by JS when enabled.
   No override rules needed here; the blanket hide above handles it. */


/* ═══════════════════════════════════════════════════════════════════════════
   KIOSK DRAG-AND-RESIZE WIDGET CANVAS
   When kiosk-mode is active, panels become absolutely-positioned cards
   that the user can freely move and resize within a full-viewport canvas.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The canvas that holds all draggable widgets */
#kiosk-canvas {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0; /* overridden in kiosk-mode to sit below header */
  z-index: 100;
  background: var(--color-bg);
  overflow: hidden;
}
body.kiosk-mode #kiosk-canvas {
  display: block;
  /* top is set dynamically in JS to match actual header height */
}

/* Edit-mode overlay hint */
#kiosk-edit-hint {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,184,217,.15);
  border: 1px solid rgba(0,184,217,.4);
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .3s;
}
body.kiosk-mode.kiosk-edit #kiosk-edit-hint { opacity: 1; }

/* Each draggable widget card */
.kiosk-widget {
  position: absolute;
  box-sizing: border-box;
  background: var(--color-surface-1, #13161d);
  border: 1px solid var(--color-border, #222733);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
  min-width: 160px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
}

/* Drag handle bar — shown only in edit mode */
.kiosk-widget-handle {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: rgba(0,184,217,.12);
  border-bottom: 1px solid rgba(0,184,217,.25);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  gap: 8px;
}
.kiosk-widget-handle:active { cursor: grabbing; }
body.kiosk-mode.kiosk-edit .kiosk-widget-handle { display: flex; }

.kiosk-widget-handle-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-accent);
  pointer-events: none;
}
.kiosk-widget-handle-dots {
  font-size: 14px;
  color: var(--color-accent);
  opacity: .6;
  pointer-events: none;
}

/* Widget content fills remaining space */
.kiosk-widget-body {
  flex: 1;
  overflow: auto;
  height: 0; /* forces flex child to scroll rather than overflow */
}

/* Map widget: force section and map container to fill the widget body */
.kiosk-widget-body .section-map-notam {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  grid-template-columns: unset !important;
}
.kiosk-widget-body .map-card {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
}
.kiosk-widget-body .map-embed-wrap {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
}
.kiosk-widget-body #live-map {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}
/* Hide the NOTAM/PIREP column in TV mode — map fills the full widget */
.kiosk-widget-body .pirep-notam-col {
  display: none !important;
}

/* Resize handle — bottom-right corner grip */
.kiosk-resize-handle {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: se-resize;
  z-index: 10;
}
body.kiosk-mode.kiosk-edit .kiosk-resize-handle { display: block; }
.kiosk-resize-handle::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  opacity: .7;
  border-radius: 1px;
}

/* Edit toggle button (shown in kiosk mode, top-left) */
#kiosk-edit-btn {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(30,34,42,.85);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color .2s, border-color .2s;
}
body.kiosk-mode #kiosk-edit-btn { display: flex; }
#kiosk-edit-btn:hover { color: #fff; }
body.kiosk-mode.kiosk-edit #kiosk-edit-btn {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Reset layout button (shown only in edit mode) */
#kiosk-reset-btn {
  position: fixed;
  top: 10px;
  left: 130px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 5px;
  background: rgba(30,34,42,.85);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color .2s;
}
body.kiosk-mode.kiosk-edit #kiosk-reset-btn { display: flex; }
#kiosk-reset-btn:hover { color: #fff; }

/* Move exit button to right side */
#kiosk-exit-btn {
  top: 10px;
  right: 12px;
}
