:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: rgba(8, 19, 31, 0.94);
  --panel-solid: #0a1724;
  --line: rgba(255, 255, 255, 0.11);
  --text: #f2f7fb;
  --muted: #91a4b5;
  --accent: #5ec8ff;
  --good: #57d18d;
  --danger: #ff6767;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; }

#app { display: grid; grid-template-rows: auto auto 1fr; position: relative; }

.topbar {
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: #08131f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  z-index: 1000;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark {
  width: 34px; height: 34px; border: 1px solid rgba(94, 200, 255, .55);
  border-radius: 10px; display: grid; place-items: center; color: var(--accent);
  transform: rotate(45deg); font-size: 18px;
}
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand-title { font-size: 14px; letter-spacing: .16em; font-weight: 800; }
.brand-subtitle { color: var(--muted); font-size: 11px; margin-top: 2px; letter-spacing: .06em; }
.top-actions { display: flex; gap: 8px; }
.icon-button, .map-button, .close-button {
  border: 1px solid var(--line); background: rgba(10, 24, 38, .92); color: var(--text);
  cursor: pointer;
}
.icon-button { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; }
.icon-button:active, .map-button:active { transform: scale(.96); }
.icon-button:disabled { opacity: .45; cursor: default; }

.filterbar {
  display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 8px 10px;
  background: rgba(8, 19, 31, .98); border-bottom: 1px solid var(--line); z-index: 950;
}
.filterbar::-webkit-scrollbar { display: none; }
.filter-chip {
  white-space: nowrap; border: 1px solid var(--line); background: #0d1c2a; color: #b8c6d1;
  border-radius: 999px; padding: 7px 10px; font-size: 11px; font-weight: 800; letter-spacing: .04em;
}
.filter-chip span { opacity: .65; margin-left: 3px; }
.filter-chip.active { border-color: rgba(94, 200, 255, .8); background: rgba(94, 200, 255, .14); color: #dff5ff; }

.map-wrap { position: relative; min-height: 0; }
#map { width: 100%; height: 100%; background: #0d1822; }
.leaflet-container { font-family: inherit; }
.leaflet-control-zoom a { background: #0c1a27 !important; color: #eaf5fb !important; border-color: var(--line) !important; }
.leaflet-control-attribution { background: rgba(7, 17, 27, .72) !important; color: #9fb0bd !important; }
.leaflet-control-attribution a { color: #bfe9ff !important; }

.map-overlay { position: absolute; z-index: 700; display: flex; gap: 7px; pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.top-left { top: 10px; left: 10px; }
.bottom-right { position: absolute;
  top: 105px;
  right: 12px;
  bottom: auto;

  display: flex;
  flex-direction: column;
  gap: 6px;

  z-index: 800; }
.status-pill {
  display: flex; gap: 7px; align-items: center; max-width: min(78vw, 360px);
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(7, 17, 27, .88); backdrop-filter: blur(12px); color: #d9e6ef; font-size: 11px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(87, 209, 141, .12); flex: 0 0 auto; }
.status-pill.warn .status-dot { background: #ffbf58; }
.status-pill.error .status-dot { background: var(--danger); }
.map-button { width: 34px; height: 34px; border-radius: 12px; background: rgba(7, 17, 27, .9); backdrop-filter: blur(10px); font-weight: 800; }
.map-button.active { color: var(--accent); border-color: rgba(94, 200, 255, .55); }

.loading-panel {
  position: absolute; z-index: 850; left: 50%; top: 48%; transform: translate(-50%, -50%);
  min-width: 220px; padding: 20px; border-radius: 18px; background: rgba(7,17,27,.92);
  border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(0,0,0,.35); text-align: center;
  font-size: 13px; backdrop-filter: blur(14px);
}
.loading-panel.hidden { display: none; }
.loading-panel small { display: block; color: var(--muted); margin-top: 5px; }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--accent); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bottom-panel {
  position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom)); z-index: 900;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0,0,0,.38); max-height: min(62vh, 560px); overflow: hidden;
  transition: max-height .25s ease;
}
.bottom-panel.open { max-height: min(72vh, 680px); }
.panel-handle { display: block; width: 100%; height: 16px; background: transparent; border: 0; cursor: pointer; }
.panel-handle span { display: block; width: 38px; height: 4px; margin: 6px auto; background: rgba(255,255,255,.22); border-radius: 999px; }
.panel-summary { display: flex; justify-content: space-between; align-items: center; padding: 3px 12px 11px; }
.panel-summary strong { display: block; font-size: 13px; }
.panel-summary span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.list-toggle { background: rgba(94,200,255,.1); color: #d9f4ff; border: 1px solid rgba(94,200,255,.28); border-radius: 10px; padding: 7px 10px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.sigmet-list { display: none; overflow-y: auto; max-height: calc(72vh - 74px); border-top: 1px solid var(--line); }
.bottom-panel.open .sigmet-list { display: block; }
.sigmet-card { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; padding: 11px 12px; cursor: pointer; }
.sigmet-card:last-child { border-bottom: 0; }
.sigmet-card:active { background: rgba(255,255,255,.04); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 800; font-size: 12px; }
.card-meta { color: var(--muted); font-size: 10px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.hazard-badge { border-radius: 7px; padding: 3px 6px; font-size: 9px; font-weight: 900; letter-spacing: .05em; color: white; }
.expiry { font-size: 9px; color: #afc0cc; white-space: nowrap; }
.empty-list { padding: 20px; text-align: center; color: var(--muted); font-size: 12px; }

.sigmet-label { background: transparent; border: 0; }
.sigmet-label-inner {
  transform: translate(-50%, -50%); min-width: 62px; padding: 4px 6px; border-radius: 8px;
  color: white; border: 1px solid rgba(255,255,255,.5); box-shadow: 0 3px 12px rgba(0,0,0,.28);
  text-align: center; font-size: 9px; font-weight: 900; line-height: 1.15; white-space: nowrap; backdrop-filter: blur(3px);
}
.sigmet-label-inner small { display: block; font-size: 8px; font-weight: 700; opacity: .9; margin-top: 2px; }
.move-marker { background: transparent; border: 0; }
.move-inner {
  display: flex; align-items: center; gap: 3px; padding: 3px 5px; border-radius: 999px;
  background: rgba(7,17,27,.88); border: 1px solid rgba(255,255,255,.35); color: white;
  font-size: 8px; font-weight: 900; box-shadow: 0 2px 10px rgba(0,0,0,.28); white-space: nowrap;
}
.move-arrow { display: inline-block; font-size: 26px; line-height: 1; transform-origin: center; color: white; }
.stationary-symbol { font-size: 20px; line-height: 1; }

.details-dialog {
  width: min(94vw, 560px); max-height: min(86vh, 760px); border: 1px solid var(--line); border-radius: 20px;
  padding: 0; background: #0a1724; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.details-dialog::backdrop { background: rgba(0, 5, 10, .72); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 2px 0 0; font-size: 18px; }
.eyebrow { font-size: 9px; color: var(--accent); font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.close-button { width: 34px; height: 34px; border-radius: 10px; font-size: 20px; }
.dialog-body { overflow-y: auto; padding: 15px 16px calc(18px + var(--safe-bottom)); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.detail-cell { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.detail-cell .label { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.detail-cell .value { margin-top: 4px; font-size: 12px; font-weight: 800; }
.raw-block { margin-top: 14px; }
.raw-block h3 { font-size: 10px; letter-spacing: .1em; color: var(--muted); margin: 0 0 7px; }
.raw-block pre { margin: 0; white-space: pre-wrap; word-break: break-word; background: #06101a; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: #d6e1e9; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.disclaimer { margin-top: 14px; padding: 10px 11px; border-radius: 11px; background: rgba(255,191,88,.08); border: 1px solid rgba(255,191,88,.22); color: #dccaa9; font-size: 9px; line-height: 1.45; }

.toast { position: fixed; z-index: 2000; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 9px 12px; border-radius: 999px; background: #101f2d; border: 1px solid var(--line); color: #edf6fb; font-size: 11px; transition: .2s ease; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  #app { grid-template-rows: auto auto 1fr; }
  .topbar { padding-left: 18px; padding-right: 18px; }
  .filterbar { padding-left: 16px; }
  .bottom-panel { left: auto; width: 360px; right: 14px; bottom: 14px; }
  .bottom-right { top: 105px;
  right: 12px;
  bottom: auto; }
}

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

/* v2 route controls */
.filters-wrap { background: rgba(8, 19, 31, .98); border-bottom: 1px solid var(--line); z-index: 950; }
.filter-row { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-bottom: 1px solid rgba(255,255,255,.05); }
.filter-row:last-child { border-bottom: 0; }
.filter-title { flex: 0 0 auto; width: 48px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.filters-wrap .filterbar { flex: 1 1 auto; border-bottom: 0; padding-left: 0; }
.route-controls { display: flex; align-items: center; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 7px 10px 7px 0; }
.route-controls::-webkit-scrollbar { display: none; }
.route-edit-button { white-space: nowrap; border: 1px solid rgba(94,200,255,.35); background: rgba(94,200,255,.08); color: #dff5ff; border-radius: 999px; padding: 7px 10px; font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.route-summary { white-space: nowrap; color: var(--muted); font-size: 10px; font-weight: 700; padding-right: 4px; }
.route-summary.ready { color: #cfefff; }

.route-dialog form { margin: 0; }
.route-input-grid { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 10px; }
.route-input-grid label, .route-text-label { display: block; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.route-input-grid input, .route-text-label textarea {
  width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 11px; background: #06101a; color: var(--text);
  padding: 11px 12px; font: 700 13px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; outline: none;
}
.route-input-grid input:focus, .route-text-label textarea:focus { border-color: rgba(94,200,255,.65); box-shadow: 0 0 0 2px rgba(94,200,255,.08); }
.route-text-label { margin-top: 13px; }
.route-text-label textarea { resize: vertical; min-height: 88px; text-transform: uppercase; }
.route-note { margin-top: 10px; color: #a9bac7; font-size: 9px; line-height: 1.45; }
.route-message { min-height: 18px; margin-top: 9px; color: #ffbf58; font-size: 10px; line-height: 1.4; }
.route-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
.primary-button, .secondary-button { border-radius: 11px; padding: 10px 14px; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.primary-button { border: 1px solid rgba(94,200,255,.6); background: rgba(94,200,255,.18); color: #e7f8ff; }
.secondary-button { border: 1px solid var(--line); background: #0d1c2a; color: #bac8d2; }
.primary-button:disabled { opacity: .45; }

.route-airport-marker, 
.route-via-marker { background: transparent; border: 0; }
.route-airport-inner {
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(4,10,18,.96);
  border: 1px solid rgba(255,255,255,.35);
  color: #5EEBFF;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.15;
  text-shadow: 0 1px 2px #000000, 0 0 3px #000000;
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
}
.route-airport-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.route-airport-symbol {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  box-shadow: 0 1px 5px rgba(0,0,0,.55);
}

.route-airport-wrap.dep .route-airport-symbol {
  background: #39e27d;
  border: 2px solid #07111b;
  border-radius: 50%;
}

.route-airport-wrap.dest .route-airport-symbol {
  background: #ff5a36;
  border: 2px solid #07111b;
  transform: rotate(45deg);
  border-radius: 2px;
}

.route-airport-label {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(4,10,18,.96);
  border: 1px solid rgba(255,255,255,.35);
  color: #5EEBFF;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.15;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
}
.route-via-inner { transform: translate(-50%, -50%); width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid #14293a; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.route-point-label { background: transparent; border: 0; pointer-events: none; }
.route-point-label-inner { white-space: nowrap; padding: 2px 5px; border-radius: 5px; background: rgba(7,17,27,.86); border: 1px solid rgba(255,255,255,.22); color: #00e5ff !important; font-size: 10px; font-weight: 700; letter-spacing: .04em; line-height: 1.15; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
.route-point-label-inner.major {
  color: #67F3FF !important;
  font-size: 12px;
  font-weight: 900;
  }
.route-point-label-inner.minor {
  color: #B2EAF0 !important;
  opacity: 1;
}
.move-arrow { font-size: 26px; }
.stationary-symbol { font-size: 20px; }

@media (max-width: 420px) {
  .filter-title { width: 44px; }
  .route-input-grid { grid-template-columns: 1fr 1fr; }
}
/* === COMPACT TOP CONTROL BAR === */

.filters-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 5px 10px;
  background: rgba(8, 19, 31, .98);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.filters-wrap::-webkit-scrollbar {
  display: none;
}

.filter-row {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 0;
  border-right: 2px solid rgba(94, 235, 255, .45);
}

.filter-row:first-child {
  padding-left: 0;
}

.filter-row:last-child {
  border-right: 0;
  padding-right: 0;
}

.filter-title {
  width: auto;
  flex: 0 0 auto;
  margin-right: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .09em;
}

.filters-wrap .filterbar {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
}

.route-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  overflow: visible;
}

.filters-wrap .filter-chip {
  padding: 5px 9px;
  font-size: 10px;
}

.filters-wrap .route-edit-button {
  padding: 5px 9px;
  font-size: 10px;
}

.filters-wrap .route-summary {
  font-size: 9px;
}

/* Slightly more compact main header */
.topbar {
  padding: calc(6px + var(--safe-top)) 12px 6px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  font-size: 16px;
}

.icon-button {
  width: 34px;
  height: 34px;
}/* === ROUTE LABELS - COMPACT TEST === */

.route-point-label-inner {
  display: inline-block;
  width: auto;

  background: rgba(7, 18, 28, 0.98);
  padding: 1px 4px;

  color: #00e5ff !important;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;

  border: 1px solid rgba(255,255,255,.22);
  border-radius: 4px;
  white-space: nowrap;

  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.route-point-label-inner.major {
  font-size: 10px;
  font-weight: 900;
  padding: 1px 4px;
}

.route-point-label-inner.minor {
  font-size: 9px;
  padding: 1px 3px;
  opacity: 1;
}
/* =========================================================
   RESPONSIVE TOP CONTROLS - TABLET / IPAD
   ========================================================= */

@media (max-width: 1400px) {

  .filters-wrap {
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: visible;
    white-space: normal;
    row-gap: 5px;
  }

  /* SIGMET occupa tutta la prima riga */
  .filter-row:first-child {
    flex: 0 0 100%;
    width: 100%;

    padding: 0 0 5px 0;

    border-right: 0;
    border-bottom: 1px solid rgba(94, 235, 255, .25);
  }

  /* ROUTE e RADAR condividono la seconda riga */
  .filter-row:nth-child(2),
  .filter-row:nth-child(3) {
    flex: 0 0 auto;
  }

  .filter-row:nth-child(2) {
    padding-left: 0;
  }

  .route-controls {
    overflow: visible;
  }
}


/* =========================================================
   IPAD PORTRAIT / TABLET STRETTO
   ========================================================= */

@media (max-width: 900px) {

  .filter-row,
  .filter-row:first-child,
  .filter-row:nth-child(2),
  .filter-row:nth-child(3),
  .filter-row:last-child {
    flex: 0 0 100%;
    width: 100%;

    padding: 4px 0;

    border-right: 0;
    border-bottom: 1px solid rgba(94, 235, 255, .20);
  }

  .filter-row:last-child {
    border-bottom: 0;
  }

  .radar-controls {
    width: 100%;
  }

  .radar-slider {
    flex: 1 1 auto;
    min-width: 100px;
    max-width: 220px;
  }
}

/* === ROUTE SIGMETS ON / OFF === */

#routeSigmetsButton {
  border-color: var(--line);
  background: #0d1c2a;
  color: #b8c6d1;
}

#routeSigmetsButton.active {
  border-color: rgba(94, 200, 255, .85);
  background: rgba(94, 200, 255, .16);
  color: #dff5ff;
}

#routeSigmetsButton:disabled {
  opacity: .4;
  cursor: default;
}

/* === ROUTE ALTERNATES === */

.route-text-label input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #06101a;
  color: var(--text);
  padding: 11px 12px;
  font: 700 13px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  outline: none;
}

.route-text-label input:focus {
  border-color: rgba(94,200,255,.65);
  box-shadow: 0 0 0 2px rgba(94,200,255,.08);
}

/* === ALTERNATE AIRPORTS === */

.route-alternate-marker {
  background: transparent;
  border: 0;
}

.route-alternate-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.route-alternate-symbol {
  width: 18px;
  height: 18px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background: #ffd166;
  color: #07111b;

  border: 2px solid #07111b;

  font-size: 10px;
  font-weight: 900;

  box-shadow: 0 1px 5px rgba(0,0,0,.55);
}

.route-alternate-label {
  padding: 3px 7px;

  border-radius: 6px;

  background: rgba(4,10,18,.96);

  border: 1px solid rgba(255,209,102,.75);

  color: #ffd166;

  font-size: 11px;
  font-weight: 900;

  letter-spacing: .04em;
  line-height: 1.15;

  text-shadow:
    0 1px 2px #000,
    0 0 3px #000;

  box-shadow:
    0 1px 5px rgba(0,0,0,.45);
}

/* =========================================================
   ICAO FPL IMPORT PANEL
   ========================================================= */

.fpl-import-panel {
  /* Se il dialog usa una griglia, occupa tutta la larghezza */
  grid-column: 1 / -1;

  width: 100%;
  box-sizing: border-box;

  margin: 0 0 14px 0;

  border: 1px solid rgba(94, 200, 255, .25);
  border-radius: 11px;

  background: rgba(6, 16, 26, .72);

  overflow: hidden;
}


/* Riga chiusa: PASTE ICAO FPL */
.fpl-import-panel summary {
  padding: 10px 13px;

  cursor: pointer;
  user-select: none;

  color: #dff5ff;

  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;

  list-style-position: inside;
}


/* Evidenzia leggermente il pannello quando è aperto */
.fpl-import-panel[open] {
  border-color: rgba(94, 200, 255, .55);

  background: rgba(6, 16, 26, .94);
}


/* Separatore sotto il titolo quando aperto */
.fpl-import-panel[open] summary {
  border-bottom: 1px solid rgba(255,255,255,.08);

  color: #5ec8ff;
}


/* Contenuto del pannello */
.fpl-import-body {
  padding: 12px;
}


/* Box dove incollare il flight plan */
.fpl-import-body textarea {
  width: 100%;
  min-height: 145px;

  box-sizing: border-box;

  resize: vertical;

  padding: 11px 12px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: #06101a;
  color: var(--text);

  font:
    700 11px/1.45
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;

  outline: none;
}


/* Focus sul testo FPL */
.fpl-import-body textarea:focus {
  border-color: rgba(94, 200, 255, .65);

  box-shadow:
    0 0 0 2px rgba(94, 200, 255, .08);
}


/* Pulsante IMPORT FPL */
.fpl-import-body #importFplButton {
  margin-top: 10px;

  padding: 8px 14px;

  border-color: rgba(94, 200, 255, .55);

  background: rgba(94, 200, 255, .12);

  color: #dff5ff;
}

/* =========================================================
   SIGMET MOVEMENT - HIGH VISIBILITY
   Freccia, velocità e STNR
   ========================================================= */

.move-inner {
  color: #FFE45E;
  font-weight: 900;

  background: rgba(4, 10, 18, .75);

  padding: 2px 5px;
  border-radius: 5px;

  text-shadow:
    0 1px 2px #000,
    0 0 4px rgba(0,0,0,.95);
}


/* Freccia direzione movimento */
.move-arrow {
  color: #FFE45E;
}


/* Simbolo STNR */
.stationary-symbol {
  color: #FFE45E;
}

/* =========================================================
   LIVE GPS CONTROLS
   ========================================================= */

.gps-button {
  font-size: 9px !important;
  font-weight: 900 !important;
  letter-spacing: .03em;
}
.gps-button.active {
  color: #69ffae !important;
  border-color: rgba(105, 255, 174, .85) !important;
  background: rgba(105, 255, 174, .14) !important;
  box-shadow: 0 0 0 1px rgba(105,255,174,.12), 0 0 10px rgba(105,255,174,.24);
}
.gps-follow-button {
  display: none;
  font-size: 8px !important;
  font-weight: 900 !important;
  letter-spacing: .02em;
}
.gps-follow-button.visible { display: block; }
.gps-follow-button.active {
  color: #ffe45e !important;
  border-color: rgba(255, 228, 94, .85) !important;
  background: rgba(255, 228, 94, .14) !important;
}

.gps-aircraft-icon { background: transparent !important; border: 0 !important; }
.gps-aircraft-inner {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
  color: #69ffae;
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 1px 2px #000, 0 0 4px #000, 0 0 8px rgba(0,0,0,.9);
  filter: drop-shadow(0 0 2px rgba(105,255,174,.8));
}
.gps-tooltip {
  background: rgba(4, 12, 20, .94) !important;
  border: 1px solid rgba(105,255,174,.55) !important;
  color: #effff6 !important;
  border-radius: 7px !important;
  box-shadow: 0 3px 12px rgba(0,0,0,.35) !important;
  font: 800 10px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}
.gps-tooltip::before { border-top-color: rgba(105,255,174,.55) !important; }

@media (max-width: 1400px) {
  .filter-row:nth-child(4) { flex: 0 0 auto; }
}

/* =========================================================
   TOP CONTROLS - NO HORIZONTAL SCROLL
   Adatta automaticamente SIGMET / ROUTE / WX RADAR
   ========================================================= */

.filters-wrap {
  display: flex !important;
  flex-wrap: wrap !important;

  width: 100% !important;
  max-width: 100% !important;

  overflow-x: hidden !important;
  overflow-y: visible !important;

  white-space: normal !important;

  row-gap: 5px;
}


/* SIGMET sempre sulla prima riga */
.filters-wrap .filter-row:first-child {
  flex: 1 0 100% !important;
  width: 100% !important;

  padding: 0 0 5px 0 !important;

  border-right: 0 !important;
  border-bottom: 1px solid rgba(94, 235, 255, .25);
}


/* ROUTE / RADAR si dispongono automaticamente
   sulle righe successive in base allo spazio disponibile */
.filters-wrap .filter-row:nth-child(n+2) {
  flex: 0 1 auto;
  min-width: 0;
}


/* Evita che i singoli gruppi provochino overflow */
.filters-wrap .route-controls,
.filters-wrap .filterbar {
  min-width: 0;
}


/* La descrizione della route può accorciarsi
   senza allargare tutta la pagina */
.filters-wrap .route-summary {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* =========================================================
   TABLET / IPAD
   ========================================================= */

@media (max-width: 900px) {

  .filters-wrap .filter-row,
  .filters-wrap .filter-row:first-child,
  .filters-wrap .filter-row:nth-child(n+2) {
    flex: 1 0 100% !important;
    width: 100% !important;

    padding: 4px 0 !important;

    border-right: 0 !important;
    border-bottom: 1px solid rgba(94, 235, 255, .20);
  }

  .filters-wrap .filter-row:last-child {
    border-bottom: 0;
  }

  .filters-wrap .route-summary {
    max-width: none;
  }
}

/* =========================================================
   PUBLIC EDITION - MOBILE / TABLET CONTROLS FIX (TEST 01)
   When the viewport is narrow, keep the control groups
   on their own rows and let each group scroll horizontally.
   This overrides older `overflow: visible` rules without
   changing map, filter, radar or route application logic.
   ========================================================= */
@media (max-width: 900px) {
  .filters-wrap .filter-row,
  .filters-wrap .filter-row:first-child,
  .filters-wrap .filter-row:nth-child(n+2) {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden;
    gap: 7px;
  }

  .filters-wrap .filter-title {
    flex: 0 0 auto;
    margin-right: 0;
  }

  /* Every row scrolls internally, without moving the map or header. */
  .filters-wrap .filterbar,
  .filters-wrap .route-controls {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 4px 1px 7px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 200, 255, .58) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .filters-wrap .filterbar > *,
  .filters-wrap .route-controls > * {
    flex-shrink: 0;
  }

  /* The text at the end of a route must remain reachable by swiping. */
  .filters-wrap .route-summary {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  }

  .filters-wrap .radar-slider {
    flex: 0 0 110px;
    min-width: 110px;
  }
}

/* =========================================================
   PUBLIC EDITION - AIRPORT ICAO SEARCH (TEST 01)
   No modifications to SIGMETs, routes, radar, or map failover.
   ========================================================= */
.airport-search-toggle {
  width: 42px;
  min-width: 42px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  color: #bdefff;
}
.airport-search-dialog { width: min(94vw, 460px); }
.airport-search-form { padding: 17px 16px 18px; }
.airport-search-form label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.airport-search-controls { display: flex; gap: 10px; align-items: stretch; }
.airport-search-controls input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #06101a;
  color: var(--text);
  font: 800 16px/1.2 ui-monospace, Consolas, monospace;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.airport-search-controls input:focus {
  border-color: rgba(94, 200, 255, .8);
  box-shadow: 0 0 0 2px rgba(94, 200, 255, .1);
}
.airport-search-controls .primary-button { flex: 0 0 auto; }
.airport-search-message { min-height: 16px; margin: 9px 0 0; color: #ffcd75; font-size: 11px; }
.airport-search-help { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.searched-airport-icon { background: transparent; border: none; }
.searched-airport-pin { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.searched-airport-pin span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #071a26;
  border: 2px solid #5ec8ff;
  color: #e8fbff;
  font-size: 16px;
  box-shadow: 0 1px 6px #0009;
}
.searched-airport-pin strong {
  background: #071a26;
  color: #bdefff;
  border: 1px solid #5ec8ff;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  box-shadow: 0 1px 6px #0009;
}
@media (max-width: 420px) {
  .topbar .top-actions { gap: 5px; }
  .topbar .airport-search-toggle { width: 39px; min-width: 39px; }
  .airport-search-controls { gap: 7px; }
  .airport-search-controls .primary-button { padding: 10px 9px; }
}

/* PUBLIC EDITION — OURAIRPORTS LAYER, TEST 02 (local data) */
.airports-map-toggle { font-size: 11px; letter-spacing: .02em; }
.airports-map-toggle:not(.active) { color: var(--muted); }

/* PHASE 3 TEST 08 — Visible future-service labels, features still OFF.
   Legacy controls remain in the HTML for maintenance but cannot be used.
   These visible status labels are informational, not buttons. */
.filters-wrap .route-controls-legacy,
.filters-wrap .radar-controls-legacy { display: none !important; pointer-events: none !important; }
.filters-wrap .coming-soon-feature {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 7px 5px 0;
  cursor: default;
}
.filters-wrap .coming-soon-tag {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, .5);
  background: rgba(148, 163, 184, .12);
  color: #cdd9e5;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 9px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: .04em;
  white-space: nowrap;
}
.filters-wrap .coming-soon-note {
  min-width: 0;
  color: #9fb2c3;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .filters-wrap .coming-soon-feature {
    flex: 1 1 auto;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filters-wrap .coming-soon-feature::-webkit-scrollbar { display: none; }
}
@media (max-width: 420px) {
  .filters-wrap .coming-soon-tag { padding: 4px 7px; font-size: 9px; }
  .filters-wrap .coming-soon-note { font-size: 9px; }
}


/* PHASE 3 TEST 02: one accessible INFO link; all map controls unchanged. */
.topbar .site-info-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 39px; min-width: 39px; height: 34px; flex-shrink: 0;
  font: 800 10px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .015em;
  text-decoration: none; color: #d9f4ff; border-radius: 11px;
}
.topbar .site-info-link:focus-visible {outline: 2px solid var(--accent); outline-offset: 2px;}
@media (max-width: 420px) {
  .topbar .site-info-link { width: 35px; min-width: 35px; }
  .topbar .brand { gap: 6px; }
  .topbar .brand-title { font-size: 12px; letter-spacing: .1em; }
  .topbar .top-actions { gap: 4px; }
}

/* PHASE 4 — TEST 12: optional METAR flight category markers; never cover SIGMET controls. */
.flight-categories-toggle { font-size: 11px; }
.flight-categories-toggle:not(.active) { color: var(--muted); }
.flight-categories-legend[hidden] { display: none !important; }
.flight-categories-legend {
  position: absolute;
  z-index: 690;
  left: 9px;
  bottom: 10px;
  max-width: min(470px, calc(100% - 26px));
  padding: 9px 12px;
  color: #e6edf5;
  border: 1px solid rgba(148, 163, 184, .38);
  background: rgba(7, 17, 27, .90);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.24);
  pointer-events: none;
}
.flight-categories-legend-title { font-size: 10px; font-weight: 800; letter-spacing: .035em; }
.flight-categories-legend-title span { font-weight: 500; color: #c3d0df; }
.flight-categories-legend-items { display: flex; flex-wrap: wrap; gap: 8px 13px; margin: 7px 0 5px; }
.flight-categories-legend-items span { display: inline-flex; gap: 5px; align-items: center; font-size: 11px; }
.flight-categories-legend small { display: block; max-width: 440px; font-size: 9px; line-height: 1.3; color: #b6c5d2; }
.flightcat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #06121b; }
.flightcat-vfr { background: #3dc976; }
.flightcat-mvfr { background: #4c9eff; }
.flightcat-ifr { background: #f05757; }
.flightcat-lifr { background: #da59df; }
.flightcat-na { background: #8593a2; }
@media (max-width: 420px) {
  .flight-categories-legend { padding: 7px 8px; bottom: 6px; }
  .flight-categories-legend-items { gap: 5px 8px; margin: 5px 0; }
  .flight-categories-legend-items span { font-size: 10px; }
  .flight-categories-legend small { font-size: 8px; }
}
