:root {
    --bg: #061014;
    --panel: rgba(6, 18, 24, 0.88);
    --panel-strong: rgba(7, 20, 27, 0.96);
    --line: rgba(255, 255, 255, 0.08);
    --line-bright: rgba(55, 245, 210, 0.34);
    --text: #e5f7ff;
    --muted: #8aa4ad;
    --green: #34d399;
    --orange: #f59e0b;
    --red: #fb7185;
    --blue: #38bdf8;
    --cyan: #37f5d2;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
}

button {
    font: inherit;
}

#map {
    position: fixed;
    top: 56px;
    left: 300px;
    right: 300px;
    bottom: 0;
    z-index: 1;
    background: #061014;
}

.leaflet-container {
    width: 100%;
    height: 100%;
    background: #061014;
    font: inherit;
}

.leaflet-container img,
.leaflet-tile {
    max-width: none !important;
    max-height: none !important;
    width: 256px !important;
    height: 256px !important;
    object-fit: initial !important;
}

.top-hud,
.panel,
.toast {
    position: fixed;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.top-hud {
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-width: 0 0 1px;
    border-radius: 0;
    background: rgba(5, 15, 20, 0.92);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #03100f;
    background: linear-gradient(135deg, var(--cyan), #b7ff7a);
    box-shadow: 0 0 24px rgba(55, 245, 210, 0.34);
}

.hud-pill,
.speed-group,
.hud-button,
.primary-button,
.secondary-button {
    min-height: 40px;
    border: 1px solid var(--line);
    color: var(--text);
    background: rgba(9, 25, 32, 0.86);
    border-radius: 10px;
}

.hud-pill {
    display: grid;
    align-content: center;
    gap: 1px;
    min-width: 86px;
    padding: 6px 12px;
    white-space: nowrap;
}

.hud-pill strong {
    font-size: 15px;
    line-height: 1.1;
}

.hud-label {
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
    text-transform: uppercase;
}

.alert-pill strong {
    color: var(--orange);
}

.speed-group {
    display: flex;
    overflow: hidden;
    padding: 3px;
}

.speed-btn,
.hud-button,
.primary-button,
.secondary-button,
.close-button,
.panel-toggle,
.action-button {
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.speed-btn {
    width: 40px;
    border: 0;
    color: var(--muted);
    background: transparent;
    border-radius: 7px;
    font-weight: 800;
}

.speed-btn.is-active {
    color: #03100f;
    background: var(--cyan);
    box-shadow: 0 0 18px rgba(55, 245, 210, 0.28);
}

.view-tabs {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(9, 25, 32, 0.86);
}

.view-tab {
    min-height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 900;
}

.view-tab.is-active {
    color: #03100f;
    background: var(--cyan);
    box-shadow: 0 0 18px rgba(55,245,210,.22);
}

.hud-button,
.primary-button,
.secondary-button {
    padding: 0 14px;
    font-weight: 800;
}

.primary-button {
    margin-left: auto;
    border-color: rgba(55, 245, 210, 0.58);
    color: #03100f;
    background: linear-gradient(135deg, var(--cyan), #70ffba);
    box-shadow: 0 0 26px rgba(55, 245, 210, 0.22);
}

.secondary-button:hover,
.hud-button:hover,
.action-button:hover,
.panel-toggle:hover,
.close-button:hover {
    border-color: var(--line-bright);
    background: rgba(20, 45, 55, 0.94);
}

.panel {
    z-index: 900;
    border-radius: 14px;
    padding: 14px;
}

#left-sidebar,
.left-panel {
    top: 74px;
    left: 10px;
    bottom: 10px;
    width: 300px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    overflow-x: visible;
}

.left-panel.is-collapsed {
    transform: translateX(-274px);
}

.panel-toggle {
    position: absolute;
    top: 14px;
    right: -14px;
    width: 28px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: var(--panel-strong);
    font-size: 18px;
    font-weight: 900;
}

#right-panel,
.right-panel {
    top: 74px;
    right: 10px;
    width: 300px;
    z-index: 1000;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
}

.details-panel {
    right: 320px;
    top: 74px;
    width: 332px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    background: var(--panel-strong);
    z-index: 950;
}

.is-hidden {
    display: none;
}

h2,
h3,
p {
    margin: 0;
}

h2 {
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c8eef3;
}

h3 {
    margin: 14px 0 8px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.metric-grid div,
.list-item,
.flight-row,
.alert-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(12, 31, 39, 0.88), rgba(7, 18, 24, 0.88));
}

.metric-grid div {
    min-height: 62px;
    padding: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.metric-grid span,
.list-item span,
.flight-meta,
.detail-label {
    color: var(--muted);
    font-size: 11px;
}

.metric-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 22px;
    line-height: 1;
}

.stack-list,
.flight-list,
.alert-list {
    display: grid;
    gap: 8px;
}

.list-item,
.flight-row,
.alert-item {
    padding: 9px 10px;
}

.list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
}

.list-item strong {
    color: var(--text);
}

.hub-dot-mini {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.85);
}

.hub-dot-mini.main {
    background: var(--cyan);
    box-shadow: 0 0 16px rgba(55, 245, 210, 0.9);
}

.flight-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px;
    width: 100%;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.flight-row.is-selected {
    border-color: rgba(55, 245, 210, 0.72);
    box-shadow: 0 0 18px rgba(55, 245, 210, 0.12);
}

.flight-title {
    display: block;
    margin-bottom: 2px;
    font-weight: 900;
}

.flight-meta {
    display: block;
    line-height: 1.25;
}

.status-badge {
    align-self: start;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.status-scheduled,
.status-boarding,
.status-arrived {
    color: #03110c;
    background: var(--green);
}

.status-delayed {
    color: #180d00;
    background: var(--orange);
}

.status-cancelled {
    color: #22050c;
    background: var(--red);
}

.status-airborne {
    color: #03111a;
    background: var(--blue);
}

.panel-actions,
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.alert-item {
    width: 100%;
    border-left: 4px solid var(--orange);
    color: var(--text);
    text-align: left;
}

.alert-item.critical {
    border-left-color: var(--red);
}

.alert-item.normal {
    border-left-color: var(--green);
}

.alert-title {
    margin-bottom: 4px;
    font-weight: 900;
}

.alert-message {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: rgba(7, 17, 22, 0.75);
    font-size: 18px;
    font-weight: 900;
}

.detail-header {
    margin: 8px 34px 16px 0;
}

.detail-header strong {
    display: block;
    margin: 3px 0 8px;
    font-size: 26px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.detail-cell {
    min-height: 58px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(7, 17, 22, 0.62);
}

.detail-cell strong {
    display: block;
    margin-top: 4px;
}

.action-button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: rgba(9, 21, 27, 0.82);
    font-weight: 800;
}

.toast {
    z-index: 1100;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 800;
    background: rgba(5, 15, 20, 0.96);
}

.hub-marker {
    position: relative;
    display: grid;
    place-items: center;
    width: 72px;
    height: 38px;
    pointer-events: auto;
}

.hub-dot {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(231, 255, 250, 0.94);
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.95), 0 0 28px rgba(52, 211, 153, 0.42);
}

.hub-marker.main .hub-dot {
    width: 24px;
    height: 24px;
    background: var(--cyan);
    box-shadow: 0 0 16px rgba(55, 245, 210, 1), 0 0 40px rgba(55, 245, 210, 0.58);
}

.hub-code {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: var(--text);
    background: rgba(3, 13, 18, 0.88);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.45);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.hub-deps {
    position: absolute;
    bottom: -2px;
    right: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
}

.aircraft-marker {
    background: transparent !important;
    border: none !important;
}

.aircraft-icon-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
}

.aircraft-icon {
    width: 38px;
    height: 38px;
    color: white;
    font-size: 31px;
    line-height: 38px;
    text-align: center;
    text-shadow: 0 0 10px white, 0 0 20px #37f5d2;
    filter: drop-shadow(0 0 8px rgba(55,245,210,.8));
    transform-origin: center;
}

.aircraft-label {
    padding: 2px 6px;
    border: 1px solid rgba(55, 245, 210, 0.35);
    border-radius: 999px;
    color: #e5f7ff;
    background: rgba(3, 13, 18, 0.82);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.3;
    text-shadow: 0 0 8px rgba(55,245,210,.65);
    white-space: nowrap;
}

.ops-log-list {
    display: grid;
    gap: 7px;
}

.ops-log-item {
    padding: 8px 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    color: #dffcff;
    background: rgba(7, 18, 24, 0.76);
    font-size: 12px;
    line-height: 1.25;
}

.ops-log-item.is-empty {
    color: var(--muted);
}

@media (max-width: 980px) {
    .top-hud {
        flex-wrap: wrap;
        height: auto;
        min-height: 64px;
    }

    .left-panel,
    .right-panel,
    .details-panel {
        width: calc(100vw - 20px);
    }

    .left-panel {
        top: 84px;
        bottom: auto;
        max-height: 45vh;
    }

    .right-panel {
        display: none;
    }

    .details-panel {
        left: 10px;
        right: auto;
        top: auto;
        bottom: 10px;
    }
}

#map {
  position: fixed !important;
  top: 56px !important;
  left: 300px !important;
  right: 300px !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  z-index: 1 !important;
  background: #061014 !important;
}

.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  background: #061014 !important;
}

.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-layer,
.leaflet-tile-container {
  transform-origin: 0 0 !important;
}

.leaflet-container img,
.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  width: 256px !important;
  height: 256px !important;
  object-fit: initial !important;
}

.leaflet-tile {
  display: block !important;
}

#flight-detail-panel {
  left: 330px;
  right: 330px;
  bottom: 16px;
  top: auto;
  width: auto;
  max-height: min(420px, calc(100vh - 120px));
  overflow-y: auto;
  z-index: 1000;
}

#flight-detail-panel .close-button {
  top: 8px;
  right: 8px;
}

#flight-detail-panel .detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 32px 10px 0;
}

#flight-detail-panel .detail-header strong {
  margin: 2px 0 0;
  font-size: 20px;
}

#flight-detail-panel .detail-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 10px;
}

#flight-detail-panel .detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 0;
}

#flight-detail-panel .detail-cell {
  min-height: 46px;
  padding: 7px 8px;
}

#flight-detail-panel .detail-cell strong {
  margin-top: 2px;
  font-size: 13px;
}

#flight-detail-panel .action-grid {
  grid-template-columns: 1fr;
  gap: 7px;
}

#flight-detail-panel .action-button {
  min-height: 31px;
  padding: 0 8px;
  font-size: 12px;
}

#flight-detail-panel.panel-flash {
  animation: detailFlash 700ms ease;
}

@keyframes detailFlash {
  0% {
    border-color: rgba(55, 245, 210, 1);
    box-shadow: 0 0 0 1px rgba(55, 245, 210, 0.8), 0 0 30px rgba(55, 245, 210, 0.38);
  }
  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
}

.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  z-index: 2000;
  max-height: min(420px, calc(100vh - 120px));
  overflow-y: auto;
  background: rgba(6, 18, 24, 0.94);
  border: 1px solid rgba(55, 245, 210, 0.25);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  padding: 16px;
  color: #e5f7ff;
}

.flight-detail-panel.hidden {
  display: none;
}

.flight-detail-panel,
#flight-detail-panel.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  z-index: 5000 !important;
  max-height: min(420px, calc(100vh - 120px)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: rgba(6,18,24,.96);
  color: white;
  border: 1px solid rgba(55,245,210,.35);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  pointer-events: auto;
}

.flight-detail-panel.hidden,
#flight-detail-panel.flight-detail-panel.hidden {
  display: none !important;
}

.flight-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.flight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  position: sticky;
  bottom: 0;
  background: rgba(6,18,24,.96);
  padding-top: 10px;
}

.flight-detail-panel,
#flight-detail-panel.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  z-index: 5000 !important;
  max-height: min(420px, calc(100vh - 120px)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: rgba(6,18,24,.96);
  color: white;
  border: 1px solid rgba(55,245,210,.35);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  pointer-events: auto;
}

.flight-detail-panel.hidden,
#flight-detail-panel.flight-detail-panel.hidden {
  display: none !important;
}

.flight-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.flight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  position: sticky;
  bottom: 0;
  background: rgba(6,18,24,.96);
  padding-top: 10px;
}

.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  z-index: 5000;
  max-height: min(420px, calc(100vh - 120px));
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(6,18,24,.96);
  color: white;
  border: 1px solid rgba(55,245,210,.35);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  pointer-events: auto;
}

.flight-detail-panel.hidden {
  display: none !important;
}

.main-view {
  position: fixed;
  top: 64px;
  left: 300px;
  right: 300px;
  bottom: 0;
  z-index: 1200;
  overflow: auto;
  color: #e5f7ff;
  background: linear-gradient(180deg, rgba(6,16,20,.98), rgba(3,10,14,.98));
  border-left: 1px solid rgba(255,255,255,.06);
  border-right: 1px solid rgba(255,255,255,.06);
}

.main-view.hidden {
  display: none !important;
}

.planning-view,
.secondary-view {
  padding: 18px;
}

.planning-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
}

.planning-toolbar h1,
.secondary-view h1 {
  margin: 3px 0 0;
  font-size: 28px;
  line-height: 1;
}

.planning-toolbar label {
  display: grid;
  gap: 5px;
  color: #8aa4ad;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.planning-toolbar select {
  min-width: 150px;
  min-height: 36px;
  color: #e5f7ff;
  background: rgba(9,25,32,.96);
  border: 1px solid rgba(55,245,210,.22);
  border-radius: 10px;
}

.planning-help,
.planning-hub-summary,
.planning-decision-panel,
.planning-resources-panel {
  margin-bottom: 12px;
}

.planning-help {
  position: relative;
  padding: 12px 42px 12px 14px;
  color: #c7f7ef;
  background: rgba(55,245,210,.08);
  border: 1px solid rgba(55,245,210,.24);
  border-radius: 14px;
  line-height: 1.45;
}

.planning-help button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  color: #e5f7ff;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  cursor: pointer;
}

.planning-summary-card,
.planning-info-card {
  padding: 12px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.planning-summary-card strong,
.planning-info-card strong {
  display: block;
  color: #f4fdff;
  font-size: 16px;
}

.planning-summary-card span,
.planning-info-card span {
  display: block;
  margin-top: 4px;
  color: #9fb7c0;
  line-height: 1.35;
}

.planning-decision-card,
.planning-resources-card,
.planning-empty-decision {
  padding: 14px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
}

.planning-decision-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 8px;
}

.planning-decision-header strong,
.planning-resources-card strong,
.planning-empty-decision strong {
  display: block;
  color: #f4fdff;
  font-size: 17px;
}

.planning-decision-card p,
.planning-empty-decision span {
  margin: 0;
  color: #9fb7c0;
  line-height: 1.45;
}

.recovery-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.recovery-option {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
}

.recovery-option.best {
  border-color: rgba(55,245,210,.7);
  box-shadow: 0 0 22px rgba(55,245,210,.12);
}

.recovery-option.good {
  border-color: rgba(52,211,153,.42);
}

.recovery-option.risky {
  border-color: rgba(245,158,11,.55);
}

.recovery-option.bad {
  border-color: rgba(251,113,133,.55);
}

.option-band {
  width: max-content;
  padding: 3px 7px;
  color: #061014;
  background: #37f5d2;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 950;
}

.recovery-option.risky .option-band {
  background: #f59e0b;
}

.recovery-option.bad .option-band {
  color: #fff;
  background: #fb7185;
}

.recovery-option h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.option-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.option-metrics span {
  padding: 6px;
  color: #c7f7ef;
  background: rgba(255,255,255,.045);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.recovery-option button {
  min-height: 34px;
  color: #061014;
  background: #37f5d2;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 950;
}

.planning-resources-card {
  display: grid;
  gap: 10px;
}

.swap-candidate-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.swap-candidate {
  padding: 9px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}

.swap-candidate.ideal {
  border-color: rgba(52,211,153,.5);
}

.swap-candidate.possible {
  border-color: rgba(245,158,11,.55);
}

.swap-candidate.impossible {
  opacity: .7;
  border-color: rgba(251,113,133,.5);
}

.swap-candidate strong,
.swap-candidate span {
  display: block;
  line-height: 1.3;
}

.swap-candidate span {
  margin-top: 4px;
  color: #9fb7c0;
  font-size: 11px;
}

.planning-timeline {
  position: relative;
  min-width: 980px;
  display: grid;
  gap: 8px;
  padding-bottom: 24px;
}

.timeline-now {
  position: absolute;
  top: 44px;
  bottom: 24px;
  z-index: 6;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 14px rgba(255,255,255,.85), 0 0 26px rgba(55,245,210,.45);
  pointer-events: none;
}

.timeline-now span {
  position: sticky;
  top: 34px;
  display: block;
  width: max-content;
  padding: 3px 6px;
  transform: translateX(-50%);
  color: #061014;
  background: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 950;
}

.timeline-hours {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 30px;
  margin-left: 178px;
  background: rgba(6,16,20,.96);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.timeline-hours span {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  color: #8aa4ad;
  font-size: 11px;
  font-weight: 900;
}

.timeline-row {
  display: grid;
  grid-template-columns: 168px minmax(760px, 1fr);
  gap: 10px;
  min-height: 74px;
}

.timeline-aircraft {
  width: 100%;
  padding: 10px;
  color: #e5f7ff;
  text-align: left;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  cursor: pointer;
}

.timeline-aircraft strong,
.timeline-aircraft span,
.timeline-aircraft em,
.timeline-aircraft b {
  display: block;
}

.timeline-aircraft strong {
  font-size: 15px;
}

.timeline-aircraft span,
.timeline-aircraft em {
  margin-top: 3px;
  color: #9fb7c0;
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.timeline-aircraft b {
  margin-top: 5px;
  color: #fb7185;
  font-size: 11px;
}

.timeline-row.stable .timeline-aircraft {
  border-left: 4px solid #34d399;
}

.timeline-row.delayed .timeline-aircraft {
  border-left: 4px solid #f59e0b;
}

.timeline-row.broken .timeline-aircraft {
  border-left: 4px solid #fb7185;
}

.timeline-row.spare .timeline-aircraft {
  border-left: 4px solid #38bdf8;
}

.timeline-track-row {
  position: relative;
  min-height: 74px;
  overflow: visible;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.065) 0 1px, transparent 1px calc(100% / 16)),
    rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
}

.timeline-track-row.drop-ok {
  border-color: rgba(52,211,153,.85);
  box-shadow: inset 0 0 0 1px rgba(52,211,153,.38), 0 0 22px rgba(52,211,153,.16);
}

.timeline-track-row.drop-warning {
  border-color: rgba(245,158,11,.9);
  box-shadow: inset 0 0 0 1px rgba(245,158,11,.42), 0 0 22px rgba(245,158,11,.18);
}

.timeline-track-row.drop-blocked {
  border-color: rgba(251,113,133,.9);
  box-shadow: inset 0 0 0 1px rgba(251,113,133,.44), 0 0 22px rgba(251,113,133,.2);
}

.timeline-track-row.drop-ok::after,
.timeline-track-row.drop-warning::after,
.timeline-track-row.drop-blocked::after {
  content: attr(data-drop-hint);
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  max-width: 260px;
  padding: 6px 8px;
  color: #061014;
  background: #34d399;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  box-shadow: 0 10px 24px rgba(0,0,0,.3);
}

.timeline-track-row.drop-warning::after {
  background: #f59e0b;
}

.timeline-track-row.drop-blocked::after {
  color: #fff;
  background: #fb7185;
}

.timeline-flight {
  position: absolute;
  top: 9px;
  min-height: 56px;
  padding: 7px 8px;
  overflow: hidden;
  color: #061014;
  text-align: left;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
  cursor: grab;
  box-shadow: 0 10px 22px rgba(0,0,0,.28);
}

.timeline-flight .flight-state-label {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 3px;
  padding: 2px 5px;
  overflow: hidden;
  color: rgba(6,16,20,.92);
  background: rgba(255,255,255,.72);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-flight strong,
.timeline-flight span,
.timeline-flight small,
.timeline-flight em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-flight strong {
  font-size: 12px;
  line-height: 1.1;
}

.timeline-flight span,
.timeline-flight small,
.timeline-flight em {
  margin-top: 2px;
  font-size: 10px;
  font-style: normal;
  line-height: 1.1;
}

.timeline-flight.normal {
  background: linear-gradient(135deg, #18c99b, #9fffd9);
  border: 2px solid #34d399;
}

.timeline-flight.delayed {
  background: rgba(245,158,11,.88);
  border: 2px solid #f59e0b;
  border-left: 7px solid #f97316;
}

.timeline-flight.critical {
  color: #fff7ed;
  background: linear-gradient(135deg, rgba(154,52,18,.96), rgba(251,113,133,.9));
  border: 2px solid #fb7185;
  animation: planningCriticalPulse 1.2s ease-in-out infinite;
}

.timeline-flight.airborne {
  background: linear-gradient(135deg, #38bdf8, #bae6fd);
  border: 2px solid #38bdf8;
}

.timeline-flight.completed {
  color: #d8e3e7;
  background: linear-gradient(135deg, #475569, #1f2937);
  border: 2px solid #64748b;
}

.timeline-flight.cancelled {
  color: #ffe4e6;
  background: repeating-linear-gradient(
    45deg,
    rgba(120,20,30,.95),
    rgba(120,20,30,.95) 8px,
    rgba(60,10,18,.95) 8px,
    rgba(60,10,18,.95) 16px
  );
  border: 2px solid #fb7185;
  opacity: .92;
  text-decoration: line-through;
}

.timeline-flight.cancelled .flight-state-label {
  color: #fff;
  background: #fb7185;
  text-decoration: none;
}

.timeline-flight .slot-label {
  margin-top: 3px;
  color: #fff;
  text-decoration: none;
  white-space: normal;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 178px;
  padding: 8px 0 4px;
  color: #c7f7ef;
  font-size: 11px;
  font-weight: 900;
}

.timeline-legend span {
  padding: 5px 8px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
}

.timeline-flight.propagated {
  outline: 2px solid rgba(245,158,11,.9);
  outline-offset: 2px;
}

.timeline-flight.selected {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.timeline-flight.is-dragging {
  opacity: .55;
  cursor: grabbing;
}

@keyframes planningCriticalPulse {
  0%, 100% { box-shadow: 0 10px 22px rgba(0,0,0,.28), 0 0 0 rgba(251,113,133,0); }
  50% { box-shadow: 0 10px 22px rgba(0,0,0,.28), 0 0 18px rgba(251,113,133,.58); }
}

.planning-action-menu {
  position: fixed;
  z-index: 7000;
  width: 250px;
  display: grid;
  gap: 7px;
  padding: 12px;
  color: #e5f7ff;
  background: rgba(6,18,24,.98);
  border: 1px solid rgba(55,245,210,.35);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(0,0,0,.55);
}

.planning-action-menu.hidden {
  display: none !important;
}

.planning-action-menu strong,
.planning-action-menu span {
  display: block;
}

.planning-action-menu span {
  color: #9fb7c0;
  font-size: 12px;
}

.planning-action-menu button {
  width: 100%;
  padding: 9px;
  color: #e5f7ff;
  text-align: left;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  cursor: pointer;
}

.planning-action-menu small {
  display: block;
  margin-top: 3px;
  color: #8aa4ad;
  line-height: 1.25;
}

.planning-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

/* Definitive right-panel layout. Keep this last so legacy card/debug styles cannot overlap. */
#right-panel {
  position: fixed !important;
  top: 64px !important;
  right: 10px !important;
  bottom: 10px !important;
  width: 300px !important;
  max-height: none !important;
  z-index: 3000 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 12px !important;
  box-sizing: border-box !important;
}

#right-panel *,
#right-panel *::before,
#right-panel *::after {
  box-sizing: border-box !important;
  min-width: 0 !important;
}

#right-panel .right-section {
  position: static !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  padding: 12px !important;
  overflow: visible !important;
  background: rgba(6,18,24,.92) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

#right-panel .right-section.is-hidden {
  display: none !important;
}

#right-panel .right-section-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  cursor: pointer !important;
}

#right-panel .right-section-header h2 {
  margin: 0 !important;
  color: #dffcff !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
}

#right-panel .section-chevron {
  flex: 0 0 auto !important;
  color: #37f5d2 !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

#right-panel .right-section-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-top: 10px !important;
}

#right-panel .right-section.is-collapsed .right-section-body {
  display: none !important;
}

/* Final UI stacking guardrail. */
#map { z-index: 1 !important; }
.main-view { z-index: 10 !important; }
#left-sidebar,
#right-panel,
#top-hud { z-index: 100 !important; }
#flight-detail-panel.flight-detail-panel { z-index: 200 !important; }
.planning-action-menu { z-index: 500 !important; }
.summary-modal,
.setup-modal,
.tutorial-modal,
.tutorial-step-overlay { z-index: 1000 !important; }
.summary-card,
.setup-card,
.tutorial-card,
.tutorial-step-card { z-index: 1100 !important; }
.toast,
.event-banner { z-index: 1200 !important; }

.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.tailtracker-card {
  max-width: 620px;
}

.tailtracker-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tailtracker-step label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #9fb7c0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.tailtracker-step input[type="password"] {
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: #e5f7ff;
  padding: 11px 12px;
  font-size: 14px;
}

.tailtracker-plane-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: min(420px, calc(100vh - 300px));
  overflow-y: auto;
  padding-right: 4px;
}

.tailtracker-plane {
  display: grid;
  grid-template-columns: auto 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(55,245,210,.2);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}

.tailtracker-plane.disabled {
  opacity: .55;
  border-color: rgba(255,255,255,.08);
}

.aircraft-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  overflow: hidden;
}

.aircraft-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aircraft-photo-fallback {
  display: none;
  color: #37f5d2;
  font-size: 18px;
  text-shadow: 0 0 10px rgba(55,245,210,.75);
}

.aircraft-photo.image-failed .aircraft-photo-fallback {
  display: block;
}

.tailtracker-plane > span:not(.aircraft-photo) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.tailtracker-plane strong {
  color: #e5f7ff;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tailtracker-plane small {
  color: #8aa4ad;
  font-size: 11px;
  line-height: 1.35;
}

.aircraft-fleet-card {
  text-align: left;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(55,245,210,.35);
  border-radius: 999px;
  background: rgba(55,245,210,.12);
  color: #37f5d2;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  vertical-align: middle;
}

/* UI state/z-index scale. Keep low and predictable to avoid screen stacking. */
#map {
  z-index: 1 !important;
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: block;
}

.main-view {
  z-index: 10 !important;
}

#left-sidebar,
#right-panel,
#top-hud {
  z-index: 100 !important;
}

#flight-detail-panel.flight-detail-panel {
  z-index: 200 !important;
}

.planning-action-menu {
  z-index: 500 !important;
}

.summary-modal,
.setup-modal,
.tutorial-modal,
.tutorial-step-overlay {
  z-index: 1000 !important;
}

.summary-card,
.setup-card,
.tutorial-card,
.tutorial-step-card {
  z-index: 1100 !important;
}

.toast,
.event-banner {
  z-index: 1200 !important;
}

body[data-active-view="planning"] #flight-detail-panel,
body[data-active-view="fleet"] #flight-detail-panel,
body[data-active-view="stats"] #flight-detail-panel {
  display: none !important;
}

.context-menu.hidden,
.flight-detail-panel.hidden,
.modal.hidden {
  display: none !important;
}

.planning-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.planning-inspector-actions button {
  min-height: 34px;
  padding: 8px 10px;
  color: #e5f7ff;
  background: rgba(55,245,210,.1);
  border: 1px solid rgba(55,245,210,.26);
  border-radius: 9px;
  cursor: pointer;
  font-weight: 900;
}

#right-panel .scenario-card,
#right-panel .scenario-card.is-crisis,
#right-panel .scenario-card.is-empty,
#right-panel .director-card,
#right-panel .recovery-card,
#right-panel .priorities-list,
#right-panel .alert-list,
#right-panel .ops-log-list {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  transform: none !important;
  animation: none !important;
  box-shadow: none !important;
}

#right-panel .scenario-card,
#right-panel .director-card,
#right-panel .recovery-card {
  color: #e5f7ff !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
}

#right-panel .scenario-impact-grid,
#right-panel .recovery-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

#right-panel .scenario-impact-grid div,
#right-panel .recovery-grid div,
#right-panel .director-reco {
  width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  padding: 10px !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.045) !important;
  overflow: visible !important;
}

#right-panel .alert-item,
#right-panel .priority-item,
#right-panel .priority-row,
#right-panel .ops-card,
#right-panel .ops-log-item,
#right-panel .recovery-action,
#right-panel .scenario-choice,
#right-panel .recovery-actions button,
#right-panel .primary-button,
#right-panel .secondary-button {
  position: static !important;
  display: block !important;
  width: 100% !important;
  min-height: 38px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 10px !important;
  border-radius: 10px !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  overflow: visible !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  text-align: left !important;
}

#right-panel button {
  cursor: pointer !important;
}

#right-panel .scenario-choice {
  display: grid !important;
  grid-template-columns: 24px minmax(0, 1fr) !important;
  gap: 4px 8px !important;
}

#right-panel .scenario-choice span {
  grid-row: span 3 !important;
}

#right-panel .alert-title,
#right-panel .priority-title,
#right-panel .ops-card-title,
#right-panel .scenario-choice strong,
#right-panel .director-card strong,
#right-panel .recovery-card h3,
#right-panel .scenario-card h3 {
  display: block !important;
  margin: 0 !important;
  color: #f4fdff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

#right-panel .alert-message,
#right-panel .priority-message,
#right-panel .ops-card-message,
#right-panel .scenario-choice em,
#right-panel .scenario-choice small,
#right-panel .director-card p,
#right-panel .director-card small,
#right-panel .director-reco b,
#right-panel .recovery-card p,
#right-panel .scenario-card p {
  display: block !important;
  margin: 4px 0 0 !important;
  color: #9fb7c0 !important;
  font-size: 11px !important;
  font-style: normal !important;
  font-weight: 650 !important;
  line-height: 1.4 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

#right-panel .command-kicker,
#right-panel .director-reco span,
#right-panel .scenario-impact-grid span,
#right-panel .recovery-grid span {
  display: block !important;
  color: #8aa4ad !important;
  font-size: 10px !important;
  line-height: 1.25 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
}

#right-panel .scenario-impact-grid strong,
#right-panel .recovery-grid strong {
  display: block !important;
  color: #e5f7ff !important;
  font-size: 18px !important;
  line-height: 1.1 !important;
}

#right-panel .recovery-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

/* Final V1 presentation overrides. Keep these after the legacy debug fixes. */
#flight-detail-panel.flight-detail-panel {
  z-index: 6000 !important;
  max-height: min(460px, calc(100vh - 116px)) !important;
  padding: 14px !important;
  background:
    linear-gradient(135deg, rgba(8, 28, 36, .98), rgba(3, 9, 14, .96)),
    rgba(6,18,24,.96) !important;
  border: 1px solid rgba(55,245,210,.32) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.56), 0 0 36px rgba(55,245,210,.12) !important;
}

#flight-detail-panel .flight-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)) !important;
  gap: 9px !important;
}

#flight-detail-panel .flight-detail-card {
  background: rgba(255,255,255,.045) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 12px !important;
  padding: 10px !important;
}

#flight-detail-panel .flight-actions {
  position: sticky !important;
  bottom: -14px !important;
  gap: 8px !important;
  margin-top: 14px !important;
  padding: 12px 0 2px !important;
  background: linear-gradient(180deg, rgba(6,18,24,.75), rgba(6,18,24,.98) 24%) !important;
}

#flight-detail-panel .flight-actions button {
  padding: 9px 12px !important;
  font-weight: 900 !important;
}

/* Final right-panel flow override: prevents later card styles from reintroducing overlap. */
#right-panel .scenario-card.is-crisis,
#right-panel .scenario-card,
#right-panel .director-card,
#right-panel .recovery-card,
#right-panel .priorities-list,
#right-panel .alert-list,
#right-panel .ops-log-list {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  transform: none !important;
}

#right-panel .right-section-body,
#right-panel .recovery-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

#right-panel .right-section.is-collapsed .right-section-body {
  display: none !important;
}

/* Absolute final right-panel guardrail. This must remain at the end of the file. */
#right-panel .scenario-card.is-crisis,
#right-panel .scenario-card,
#right-panel .director-card,
#right-panel .recovery-card,
#right-panel .priorities-list,
#right-panel .alert-list,
#right-panel .ops-log-list {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  transform: none !important;
}

#right-panel .right-section-body,
#right-panel .recovery-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

#right-panel .right-section.is-collapsed .right-section-body {
  display: none !important;
}

/* Absolute final right-panel guardrail. This must remain at the end of the file. */
#right-panel .scenario-card.is-crisis,
#right-panel .scenario-card,
#right-panel .director-card,
#right-panel .recovery-card,
#right-panel .priorities-list,
#right-panel .alert-list,
#right-panel .ops-log-list {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  transform: none !important;
}

#right-panel .right-section-body,
#right-panel .recovery-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

#right-panel .right-section.is-collapsed .right-section-body {
  display: none !important;
}

.scenario-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  color: #fff;
  background: linear-gradient(145deg, rgba(245,158,11,.16), rgba(55,245,210,.08));
  border: 1px solid rgba(245,158,11,.36);
  border-radius: 15px;
  box-shadow: 0 0 32px rgba(245,158,11,.12);
}

.scenario-card.is-crisis {
  position: fixed;
  left: 50%;
  top: 86px;
  z-index: 6500;
  width: min(560px, calc(100vw - 700px));
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  transform: translateX(-50%);
  animation: scenarioArrival .28s ease-out;
}

@keyframes scenarioArrival {
  from { opacity: 0; transform: translate(-50%, -12px) scale(.98); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@media (max-width: 1100px) {
  .scenario-card.is-crisis {
    width: min(560px, calc(100vw - 32px));
  }
}

.scenario-card.is-empty {
  background: rgba(52,211,153,.07);
  border-color: rgba(52,211,153,.2);
}

.scenario-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.scenario-card p {
  margin: 0;
  color: #d9f9ff;
  line-height: 1.4;
}

.scenario-urgency {
  padding: 8px 10px;
  color: #fbbf24;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.22);
  border-radius: 10px;
  font-weight: 800;
}

.scenario-choices {
  display: grid;
  gap: 8px;
}

.scenario-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
  padding: 10px;
  color: #e5f7ff;
  text-align: left;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  cursor: pointer;
}

.scenario-choice:hover {
  border-color: rgba(55,245,210,.58);
  background: rgba(55,245,210,.1);
  transform: translateY(-1px);
}

.scenario-choice span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #061014;
  background: #37f5d2;
  border-radius: 50%;
  font-weight: 950;
  grid-row: span 3;
}

.scenario-choice strong,
.scenario-choice em,
.scenario-choice small {
  display: block;
}

.scenario-choice em {
  color: #c7f7ef;
  font-style: normal;
  line-height: 1.3;
}

.scenario-choice small,
.scenario-hint-text {
  color: #8aa4ad;
  font-weight: 800;
}

.scenario-hint {
  width: max-content;
}

.scenario-impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scenario-impact-grid div {
  padding: 8px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}

.scenario-impact-grid strong,
.scenario-impact-grid span {
  display: block;
}

.scenario-impact-grid strong {
  color: #37f5d2;
  font-size: 20px;
}

.scenario-impact-grid span {
  color: #8aa4ad;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.objectives-list {
  display: grid;
  gap: 8px;
}

.objective-row {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.objective-row strong {
  color: #e5f7ff;
  font-size: 12px;
}

.objective-row span {
  color: #8aa4ad;
  font-size: 11px;
  font-weight: 900;
}

.objective-row.success {
  border-color: rgba(52,211,153,.28);
  box-shadow: inset 3px 0 0 #34d399;
}

.objective-row.risk {
  border-color: rgba(245,158,11,.24);
  box-shadow: inset 3px 0 0 #f59e0b;
}

.summary-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
}

.summary-modal.hidden {
  display: none !important;
}

.summary-card {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 24px;
  color: #e5f7ff;
  background: linear-gradient(145deg, rgba(8,28,36,.98), rgba(3,9,14,.98));
  border: 1px solid rgba(55,245,210,.3);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 42px rgba(55,245,210,.15);
}

.summary-card h1 {
  margin: 0;
  font-size: 36px;
}

.summary-grade {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: rgba(55,245,210,.1);
  border: 1px solid rgba(55,245,210,.22);
  border-radius: 14px;
}

.summary-grade strong {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #061014;
  background: #37f5d2;
  border-radius: 50%;
  font-size: 30px;
}

.summary-grade span {
  color: #c7f7ef;
  font-weight: 900;
}

.story-strip {
  display: grid;
  gap: 7px;
  padding: 12px;
  color: #d9f9ff;
  background: rgba(55,245,210,.07);
  border: 1px solid rgba(55,245,210,.18);
  border-radius: 14px;
}

.story-strip p {
  margin: 0;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.shop-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  color: #e5f7ff;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
}

.shop-card strong {
  color: #37f5d2;
  font-size: 18px;
}

.shop-card span,
.shop-card em,
.shop-card label {
  color: #8aa4ad;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.shop-card select {
  width: 100%;
  margin-top: 6px;
  color: #e5f7ff;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 8px;
}

.shop-card button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.setup-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(10px);
}

.setup-modal.hidden {
  display: none !important;
}

.setup-card {
  width: min(460px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 24px;
  color: #e5f7ff;
  background: linear-gradient(145deg, rgba(8, 28, 36, .98), rgba(3, 9, 14, .98));
  border: 1px solid rgba(55,245,210,.28);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 42px rgba(55,245,210,.14);
}

.setup-card h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
}

.setup-card label {
  display: grid;
  gap: 7px;
  color: #8aa4ad;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.setup-card input,
.setup-card select {
  width: 100%;
  box-sizing: border-box;
  color: #e5f7ff;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  font-weight: 800;
  outline: none;
}

.setup-card input:focus,
.setup-card select:focus {
  border-color: rgba(55,245,210,.8);
  box-shadow: 0 0 0 3px rgba(55,245,210,.12);
}

.setup-error {
  min-height: 18px;
  margin: 0;
  color: #fb7185;
  font-weight: 800;
}

.aircraft-row strong span {
  display: block;
  margin-top: 2px;
  color: #8aa4ad;
  font-size: 10px;
  font-weight: 800;
}

.rotation-timeline {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.rotation-leg {
  display: grid;
  grid-template-columns: 28px 70px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  color: #e5f7ff;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.rotation-leg span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #061014;
  background: #37f5d2;
  border-radius: 50%;
  font-weight: 950;
}

.rotation-leg strong {
  color: #37f5d2;
}

.rotation-leg em {
  overflow: hidden;
  color: #c7f7ef;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-leg small {
  color: #8aa4ad;
  font-weight: 900;
}

.rotation-leg.delayed,
.rotation-leg.boarding {
  border-color: rgba(245,158,11,.35);
}

.rotation-leg.cancelled {
  border-color: rgba(251,113,133,.5);
}

.director-card {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 13px;
  color: #e5f7ff;
  background: linear-gradient(145deg, rgba(55,245,210,.12), rgba(255,255,255,.045));
  border: 1px solid rgba(55,245,210,.24);
  border-radius: 14px;
  box-shadow: 0 0 26px rgba(55,245,210,.09);
}

.director-card strong {
  font-size: 16px;
  line-height: 1.18;
}

.director-card p,
.director-card small {
  margin: 0;
  color: #8aa4ad;
  line-height: 1.35;
}

.director-reco {
  display: grid;
  gap: 3px;
  padding: 9px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}

.director-reco span {
  color: #8aa4ad;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.director-card button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.recovery-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 20%, rgba(251,113,133,.28), transparent 36%),
    linear-gradient(145deg, rgba(127,29,29,.74), rgba(8,28,36,.96));
  border: 1px solid rgba(251,113,133,.58);
  border-radius: 16px;
  box-shadow: 0 0 38px rgba(251,113,133,.22), 0 18px 60px rgba(0,0,0,.45);
  animation: recoveryPulse 1.8s ease-in-out infinite;
}

.recovery-card h3 {
  margin: 0;
  font-size: 19px;
}

.recovery-card p {
  color: #ffe4e6;
  line-height: 1.38;
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.recovery-grid div,
.priority-row {
  padding: 9px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px;
}

.recovery-grid strong {
  display: block;
  color: #fff;
  font-size: 20px;
}

.recovery-grid span {
  color: #fecdd3;
  font-size: 11px;
  font-weight: 800;
}

.recovery-actions {
  display: grid;
  gap: 8px;
}

.recovery-actions button {
  min-height: 38px;
  color: #fff;
  font-weight: 900;
  text-align: left;
  background: rgba(251,113,133,.14);
  border: 1px solid rgba(251,113,133,.34);
  border-radius: 10px;
  cursor: pointer;
}

.recovery-actions button:hover {
  background: rgba(251,113,133,.26);
  box-shadow: 0 0 18px rgba(251,113,133,.2);
}

.priority-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 7px;
}

.priority-row strong {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #061014;
  background: #37f5d2;
  border-radius: 50%;
  font-size: 12px;
}

.priority-row span {
  color: #d9f9ff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.network-health-text.stable {
  color: #34d399;
}

.network-health-text.pressured {
  color: #f59e0b;
}

.network-health-text.critical,
.network-health-text.meltdown {
  color: #fb7185;
  text-shadow: 0 0 12px rgba(251,113,133,.55);
}

body[data-network-health="critical"] .hub-tooltip.warning,
body[data-network-health="meltdown"] .hub-tooltip {
  border-color: rgba(251,113,133,.8);
  box-shadow: 0 0 24px rgba(251,113,133,.45);
}

body[data-network-health="meltdown"] .route-problem,
body[data-network-health="meltdown"] .route-critical {
  animation-duration: .75s;
}

.management-card {
  border-color: rgba(55,245,210,.24);
  background: linear-gradient(145deg, rgba(55,245,210,.08), rgba(255,255,255,.045));
}

@keyframes recoveryPulse {
  0%, 100% { border-color: rgba(251,113,133,.5); }
  50% { border-color: rgba(251,113,133,.95); box-shadow: 0 0 46px rgba(251,113,133,.32), 0 18px 60px rgba(0,0,0,.45); }
}

.tutorial-modal,
.tutorial-step-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.tutorial-modal.hidden,
.tutorial-step-overlay.hidden {
  display: none !important;
}

.tutorial-modal {
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
}

.tutorial-card {
  pointer-events: auto;
}

.tutorial-modal button,
.tutorial-step-card button,
[data-tutorial-action] {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.tutorial-card,
.tutorial-step-card {
  color: #e5f7ff;
  background: linear-gradient(145deg, rgba(8,28,36,.98), rgba(3,9,14,.98));
  border: 1px solid rgba(55,245,210,.3);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 42px rgba(55,245,210,.15);
}

.tutorial-card {
  width: min(620px, calc(100vw - 32px));
  display: grid;
  gap: 15px;
  padding: 24px;
}

.tutorial-card h1 {
  margin: 0;
  font-size: 36px;
}

.tutorial-card p,
.tutorial-step-card p {
  margin: 0;
  color: #c7f7ef;
  line-height: 1.5;
}

.tutorial-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 9px;
}

.tutorial-metrics div {
  padding: 10px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.tutorial-metrics strong,
.tutorial-metrics span {
  display: block;
}

.tutorial-metrics span {
  margin-top: 3px;
  color: #8aa4ad;
  font-size: 12px;
}

.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.tutorial-step-card {
  position: fixed;
  width: min(360px, calc(100vw - 48px));
  padding: 16px;
  pointer-events: auto;
}

.tutorial-highlight {
  z-index: 9600 !important;
  outline: 2px solid rgba(55,245,210,.95) !important;
  box-shadow: 0 0 0 6px rgba(55,245,210,.14), 0 0 34px rgba(55,245,210,.55) !important;
}

.panel-help,
.flight-detail-card small,
.flight-actions button span {
  display: block;
  margin-top: 4px;
  color: #8aa4ad;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.flight-actions button b {
  display: block;
  color: #e5f7ff;
}

.hub-bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.hub-bank-grid h4 {
  margin: 0 0 8px;
  color: #e5f7ff;
}

.mini-flight-row {
  width: 100%;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  padding: 8px;
  color: #e5f7ff;
  text-align: left;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  cursor: pointer;
}

.mini-flight-row span {
  overflow: hidden;
  color: #c7f7ef;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-flight-row em {
  color: #8aa4ad;
  font-style: normal;
  font-weight: 900;
}

.mini-flight-row.critical {
  border-color: rgba(251,113,133,.45);
  box-shadow: inset 3px 0 0 #fb7185;
}

.hub-pressure-meter {
  height: 12px;
  overflow: hidden;
  margin: 10px 0 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
}

.hub-pressure-meter div {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #f59e0b 65%, #fb7185);
  box-shadow: 0 0 18px rgba(245,158,11,.45);
}

.pressure-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pressure-list span {
  padding: 7px 9px;
  border-radius: 999px;
  font-weight: 900;
}

.pressure-list .safe {
  color: #34d399;
  background: rgba(52,211,153,.09);
}

.pressure-list .tight {
  color: #fbbf24;
  background: rgba(245,158,11,.12);
}

.pressure-list .missed {
  color: #fb7185;
  background: rgba(251,113,133,.12);
}

.route-focus-dim {
  stroke-opacity: .2 !important;
}

.route-rotation-prev {
  stroke: #60a5fa !important;
  stroke-width: 5 !important;
}

.route-rotation-next,
.route-hub-outbound {
  stroke: #37f5d2 !important;
  stroke-width: 5 !important;
}

.route-connection-focus,
.route-hub-inbound {
  stroke: #60a5fa !important;
  stroke-width: 4 !important;
}

.route-hub-tight {
  stroke: #f59e0b !important;
  stroke-width: 6 !important;
  animation: routePulse 1.4s ease-in-out infinite;
}

.route-hub-missed {
  stroke: #fb7185 !important;
  stroke-width: 7 !important;
  animation: routeCriticalPulse 1.1s ease-in-out infinite;
}

/* V1 game-feel pass: command card, live map objects, and event feedback. */
.event-banner {
  position: fixed;
  top: 82px;
  left: 50%;
  z-index: 7000;
  min-width: min(560px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  padding: 14px 20px;
  transform: translate(-50%, -18px) scale(.98);
  opacity: 0;
  pointer-events: none;
  color: #fff7ed;
  font-weight: 900;
  letter-spacing: .01em;
  text-align: center;
  background: linear-gradient(135deg, rgba(245, 158, 11, .96), rgba(127, 29, 29, .94));
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .52), 0 0 40px rgba(245, 158, 11, .34);
  transition: opacity .22s ease, transform .22s ease;
}

.event-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

#flight-detail-panel.flight-detail-panel {
  z-index: 6000 !important;
  max-height: min(460px, calc(100vh - 116px)) !important;
  padding: 14px !important;
  background:
    linear-gradient(135deg, rgba(8, 28, 36, .98), rgba(3, 9, 14, .96)),
    rgba(6,18,24,.96) !important;
  border: 1px solid rgba(55,245,210,.32) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.56), 0 0 36px rgba(55,245,210,.12) !important;
}

.command-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.command-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.command-kicker,
.detail-label {
  color: #8aa4ad;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.command-main strong {
  color: #e5f7ff;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  text-shadow: 0 0 22px rgba(55,245,210,.22);
}

.command-main span:last-child {
  color: #37f5d2;
  font-size: 15px;
  font-weight: 800;
}

.flight-timeline {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 6px 0 14px;
  color: #c7f7ef;
  font-size: 12px;
  font-weight: 900;
}

.timeline-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
}

.timeline-track div {
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, #37f5d2, #34d399);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(55,245,210,.72);
}

#flight-detail-panel .flight-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 9px;
}

#flight-detail-panel .flight-detail-card {
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px;
}

#flight-detail-panel .flight-detail-card strong {
  display: block;
  margin-top: 4px;
  color: #e5f7ff;
  font-size: 16px;
}

#flight-detail-panel .flight-actions {
  position: sticky;
  bottom: -14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 0 2px;
  background: linear-gradient(180deg, rgba(6,18,24,.75), rgba(6,18,24,.98) 24%);
}

#flight-detail-panel .flight-actions button {
  border: 1px solid rgba(55,245,210,.28);
  background: rgba(55,245,210,.1);
  color: #e5f7ff;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 900;
}

#flight-detail-panel .flight-actions button:hover {
  border-color: rgba(55,245,210,.68);
  background: rgba(55,245,210,.22);
  box-shadow: 0 0 18px rgba(55,245,210,.16);
}

.panel-flash {
  animation: panelFlash .9s ease;
}

@keyframes panelFlash {
  0% { border-color: rgba(55,245,210,1); box-shadow: 0 0 0 1px rgba(55,245,210,.75), 0 0 40px rgba(55,245,210,.35); }
  100% { border-color: rgba(55,245,210,.32); }
}

.aircraft-icon-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 34px auto;
  align-items: center;
  gap: 4px;
  min-width: 88px;
  transform-origin: 17px 17px;
}

.aircraft-icon-wrap .aircraft-icon {
  width: 34px;
  height: 34px;
  color: #fff;
  font-size: 30px;
  line-height: 34px;
  text-align: center;
  text-shadow: 0 0 10px #fff, 0 0 22px rgba(55,245,210,.95);
  filter: drop-shadow(0 0 9px rgba(55,245,210,.85));
}

.aircraft-label {
  display: inline-block;
  max-width: 62px;
  padding: 3px 6px;
  overflow: hidden;
  color: #37f5d2;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(4,12,16,.86);
  border: 1px solid rgba(55,245,210,.54);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(55,245,210,.15);
}

.aircraft-icon-wrap.problem .aircraft-icon,
.aircraft-icon-wrap.problem .aircraft-label {
  color: #fbbf24;
  border-color: rgba(245,158,11,.8);
  text-shadow: 0 0 10px #fff, 0 0 22px rgba(245,158,11,.92);
  filter: drop-shadow(0 0 9px rgba(245,158,11,.86));
}

.aircraft-icon-wrap.critical .aircraft-icon,
.aircraft-icon-wrap.critical .aircraft-label {
  color: #fb7185;
  border-color: rgba(251,113,133,.88);
  text-shadow: 0 0 10px #fff, 0 0 22px rgba(251,113,133,.94);
  filter: drop-shadow(0 0 10px rgba(251,113,133,.9));
}

.aircraft-icon-wrap.selected .aircraft-icon {
  font-size: 38px;
  transform-origin: center;
}

.aircraft-icon-wrap.selected .aircraft-label {
  color: #e5f7ff;
  border-color: rgba(255,255,255,.86);
  box-shadow: 0 0 22px rgba(55,245,210,.46);
}

.aircraft-icon-wrap.has-issue::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 17px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(245,158,11,.65);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: aircraftPulse 1.4s ease-out infinite;
}

.action-flash .aircraft-icon-wrap {
  animation: actionFlash .85s ease;
}

@keyframes aircraftPulse {
  0% { opacity: .9; transform: translate(-50%, -50%) scale(.7); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
}

@keyframes actionFlash {
  0%, 100% { filter: none; }
  35% { filter: drop-shadow(0 0 20px rgba(55,245,210,1)) brightness(1.7); }
}

.route-problem {
  animation: routePulse 1.6s ease-in-out infinite;
}

.route-critical {
  animation: routeCriticalPulse 1.15s ease-in-out infinite;
}

.route-selected {
  filter: drop-shadow(0 0 8px rgba(55,245,210,.85));
}

@keyframes routePulse {
  0%, 100% { stroke-opacity: .62; }
  50% { stroke-opacity: 1; }
}

@keyframes routeCriticalPulse {
  0%, 100% { stroke-opacity: .7; }
  50% { stroke-opacity: 1; stroke-width: 7; }
}

.hub-status-tooltip {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.hub-status-tooltip::before {
  display: none !important;
}

.hub-tooltip {
  position: relative;
  display: grid;
  gap: 1px;
  padding: 5px 8px;
  color: #e5f7ff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 0 8px rgba(0,0,0,.8);
  background: rgba(4,12,16,.78);
  border: 1px solid rgba(55,245,210,.28);
  border-radius: 10px;
}

.hub-tooltip span {
  color: #8aa4ad;
  font-size: 9px;
}

.hub-tooltip i {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  background: #f59e0b;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(245,158,11,.95);
}

.hub-tooltip.warning,
.hub-pressure-warning .hub-tooltip {
  border-color: rgba(245,158,11,.75);
  box-shadow: 0 0 18px rgba(245,158,11,.32);
  animation: hubPulseWarning 1.6s ease-in-out infinite;
}

.hub-tooltip.critical,
.hub-pressure-critical .hub-tooltip {
  border-color: rgba(251,113,133,.85);
  box-shadow: 0 0 24px rgba(251,113,133,.45);
  animation: hubPulseCritical 1s ease-in-out infinite;
}

@keyframes hubPulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes hubPulseCritical {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.1); filter: brightness(1.35); }
}

.ops-log-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 10px;
  margin-bottom: 7px;
  color: #d9f9ff;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.ops-log-item.is-empty {
  color: #34d399;
  border-color: rgba(52,211,153,.2);
  background: rgba(52,211,153,.07);
}

.flight-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.flight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  position: sticky;
  bottom: 0;
  background: rgba(6,18,24,.96);
  padding-top: 10px;
}

#flight-detail-panel.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  top: auto;
  width: auto;
  z-index: 5000 !important;
  max-height: min(420px, calc(100vh - 120px)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: rgba(6,18,24,.96);
  color: white;
  border: 1px solid rgba(55,245,210,.35);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  pointer-events: auto !important;
}

#flight-detail-panel.flight-detail-panel.hidden {
  display: none !important;
}

.leaflet-marker-icon,
.aircraft-marker,
.aircraft-icon,
.aircraft-icon-wrap {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.aircraft-marker {
  z-index: 9999 !important;
}

#left-sidebar {
  position: fixed !important;
  z-index: 5000 !important;
  pointer-events: auto !important;
}

#map {
  z-index: 1 !important;
}

.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 20px;
  z-index: 9999 !important;
  background: #061218;
  color: white;
  border: 2px solid #37f5d2;
  border-radius: 16px;
  padding: 16px;
  pointer-events: auto !important;
}

#left-sidebar {
  position: fixed !important;
  z-index: 5000 !important;
  pointer-events: auto !important;
}

.flight-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.flight-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.flight-detail-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px;
}

.flight-detail-card strong {
  display: block;
  margin-top: 4px;
}

.flight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.flight-actions button {
  border: 1px solid rgba(55,245,210,.25);
  background: rgba(55,245,210,.1);
  color: #e5f7ff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.flight-actions button:hover {
  background: rgba(55,245,210,.22);
}

#flight-detail-panel.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  top: auto;
  width: auto;
  z-index: 2000;
  max-height: min(420px, calc(100vh - 120px));
  overflow-y: auto;
}

/* Right panel readability pass: keep OCC cards calm, readable, and non-overlapping. */
#right-panel,
.right-panel {
  box-sizing: border-box !important;
  width: 300px !important;
  max-height: calc(100vh - 84px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 14px !important;
}

#right-panel *,
.right-panel * {
  box-sizing: border-box;
  min-width: 0;
}

#right-panel section,
.right-panel section,
.alert-columns,
.alert-list,
.ops-log-list {
  display: grid;
  gap: 10px;
}

#right-panel h2 {
  margin: 4px 0 2px;
  color: #dffcff;
  font-size: 12px;
  line-height: 1.2;
}

#right-panel h3 {
  margin: 8px 0 0;
  color: #8aa4ad;
  font-size: 10px;
  line-height: 1.25;
  letter-spacing: .08em;
}

#right-panel p,
#right-panel small,
#right-panel span,
#right-panel strong,
#right-panel b,
#right-panel em,
.alert-title,
.alert-message,
.ops-log-item,
.priority-row span,
.director-card p,
.director-card small,
.director-reco b,
.scenario-card p,
.scenario-choice strong,
.scenario-choice em,
.scenario-choice small,
.recovery-card p,
.recovery-actions button {
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.alert-list {
  align-items: stretch;
}

.alert-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 11px 12px !important;
  border: 1px solid rgba(255,255,255,.08);
  border-left: 4px solid var(--orange);
  border-radius: 12px;
  color: #e5f7ff;
  text-align: left;
  line-height: 1.35;
  background: linear-gradient(180deg, rgba(13,34,42,.9), rgba(6,18,24,.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

.alert-item:hover {
  border-color: rgba(55,245,210,.28);
  border-left-color: var(--orange);
  background: linear-gradient(180deg, rgba(15,42,50,.94), rgba(7,22,29,.96));
}

.alert-item.critical {
  border-left-color: var(--red);
  background: linear-gradient(180deg, rgba(54,20,29,.9), rgba(16,18,24,.94));
}

.alert-item.normal {
  border-left-color: var(--green);
  color: #c9fce9;
  background: rgba(52,211,153,.075);
}

.alert-title {
  display: block;
  margin: 0;
  color: #f4fdff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.alert-message {
  display: block;
  color: #9fb8c0;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.ops-log-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-height: 0;
  margin: 0 !important;
  padding: 10px 11px !important;
  color: #d9f9ff;
  font-size: 12px;
  line-height: 1.42;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.director-card,
.scenario-card,
.recovery-card {
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 14px !important;
  gap: 10px !important;
  overflow: visible;
  line-height: 1.4;
}

.director-card strong,
.scenario-card h3,
.recovery-card h3 {
  display: block;
  margin: 0;
  color: #f4fdff;
  font-size: 16px;
  line-height: 1.22;
}

.director-card p,
.scenario-card p,
.recovery-card p {
  color: #b8d1d8;
  font-size: 12px;
  line-height: 1.5;
}

.director-reco {
  gap: 5px !important;
  padding: 10px !important;
  overflow: hidden;
}

.director-reco b {
  display: block;
  color: #e5f7ff;
  font-size: 12px;
  line-height: 1.4;
}

.scenario-impact-grid,
.recovery-grid {
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}

.scenario-impact-grid div,
.recovery-grid div {
  min-height: 58px;
  padding: 9px !important;
  overflow: hidden;
}

.scenario-impact-grid strong,
.recovery-grid strong {
  display: block;
  font-size: 18px !important;
  line-height: 1.1;
}

.scenario-impact-grid span,
.recovery-grid span {
  display: block;
  margin-top: 3px;
  font-size: 10px !important;
  line-height: 1.25;
}

.scenario-choice {
  grid-template-columns: 24px minmax(0, 1fr) !important;
  row-gap: 4px;
  min-height: 0;
  padding: 10px !important;
  line-height: 1.35;
}

.scenario-choice strong {
  font-size: 13px;
  line-height: 1.25;
}

.scenario-choice em,
.scenario-choice small {
  font-size: 11px;
  line-height: 1.35;
}

.recovery-card {
  animation-duration: 2.4s;
}

.recovery-actions {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 8px !important;
}

.recovery-actions button {
  width: 100%;
  min-height: 42px;
  height: auto;
  padding: 10px 12px;
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
}

.priority-row {
  grid-template-columns: 24px minmax(0, 1fr) !important;
  align-items: start;
  margin-top: 0 !important;
}

.sidebar-row {
  cursor: pointer;
}

.sidebar-row:hover {
  border-color: rgba(55,245,210,.45);
  background: rgba(55,245,210,.08);
}

.sidebar-row.selected {
  border-color: rgba(55,245,210,.9);
  background: rgba(55,245,210,.14);
  box-shadow: inset 3px 0 0 #37f5d2;
}

body.sidebar-collapsed #left-sidebar {
  transform: translateX(-285px);
}

body.sidebar-collapsed #map {
  left: 40px !important;
}

.aircraft-marker.fleet-highlight .aircraft-icon-wrap {
  filter: drop-shadow(0 0 12px rgba(251, 113, 133, 0.95));
}

.aircraft-marker.fleet-highlight .aircraft-label {
  border-color: rgba(251, 113, 133, 0.8);
  color: #ffe4e9;
}

#left-sidebar {
  z-index: 3000 !important;
  pointer-events: auto !important;
}

#right-panel {
  z-index: 3000 !important;
  pointer-events: auto !important;
}

#top-hud {
  z-index: 4000 !important;
  pointer-events: auto !important;
}

#map {
  z-index: 1 !important;
}

.decorative-overlay,
.map-overlay,
.glow-overlay,
.background-gradient {
  pointer-events: none !important;
}

.aircraft-marker,
.aircraft-icon {
  pointer-events: auto !important;
}

.flight-detail-panel {
  position: fixed;
  left: 330px;
  right: 330px;
  bottom: 16px;
  z-index: 5000 !important;
  background: rgba(6,18,24,.96);
  color: white;
  border: 1px solid rgba(55,245,210,.4);
  border-radius: 16px;
  padding: 16px;
  pointer-events: auto !important;
  max-height: min(420px, calc(100vh - 120px)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box;
}

.flight-detail-panel.hidden {
  display: none !important;
}
/* Final V1 presentation overrides. Keep these after the legacy debug fixes. */
#flight-detail-panel.flight-detail-panel {
  z-index: 6000 !important;
  max-height: min(460px, calc(100vh - 116px)) !important;
  padding: 14px !important;
  background:
    linear-gradient(135deg, rgba(8, 28, 36, .98), rgba(3, 9, 14, .96)),
    rgba(6,18,24,.96) !important;
  border: 1px solid rgba(55,245,210,.32) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.56), 0 0 36px rgba(55,245,210,.12) !important;
}

#flight-detail-panel .flight-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)) !important;
  gap: 9px !important;
}

#flight-detail-panel .flight-detail-card {
  background: rgba(255,255,255,.045) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 12px !important;
  padding: 10px !important;
}

#flight-detail-panel .flight-actions {
  position: sticky !important;
  bottom: -14px !important;
  gap: 8px !important;
  margin-top: 14px !important;
  padding: 12px 0 2px !important;
  background: linear-gradient(180deg, rgba(6,18,24,.75), rgba(6,18,24,.98) 24%) !important;
}

#flight-detail-panel .flight-actions button {
  padding: 9px 12px !important;
  font-weight: 900 !important;
}
/* End of file right-panel safety override. */
#right-panel .scenario-card.is-crisis,
#right-panel .scenario-card,
#right-panel .director-card,
#right-panel .recovery-card,
#right-panel .priorities-list,
#right-panel .alert-list,
#right-panel .ops-log-list {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  transform: none !important;
}

#right-panel .right-section-body,
#right-panel .recovery-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

#right-panel .right-section.is-collapsed .right-section-body {
  display: none !important;
}
/* Final UI stacking guardrail. */
#map { z-index: 1 !important; }
.main-view { z-index: 10 !important; }
#left-sidebar,
#right-panel,
#top-hud { z-index: 100 !important; }
#flight-detail-panel.flight-detail-panel { z-index: 200 !important; }
.planning-action-menu { z-index: 500 !important; }
.summary-modal,
.setup-modal,
.tutorial-modal,
.tutorial-step-overlay { z-index: 1000 !important; }
.summary-card,
.setup-card,
.tutorial-card,
.tutorial-step-card { z-index: 1100 !important; }
.toast,
.event-banner { z-index: 1200 !important; }
