:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: #101820;
  --panel-2: #0b1118;
  --line: rgba(137, 220, 255, .22);
  --text: #e9f7ff;
  --muted: #7f98a8;
  --cyan: #40d9ff;
  --green: #55f39a;
  --amber: #ffca5f;
  --red: #ff5a6d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(rgba(64, 217, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 217, 255, .035) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, #12212d 0, #05070a 42rem);
  background-size: 40px 40px, 40px 40px, auto;
  color: var(--text);
}

.flightdeck { width: min(1480px, calc(100vw - 32px)); margin: 0 auto; padding: 24px 0; }
.topbar, footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 6px; color: var(--cyan); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 72px); line-height: .9; letter-spacing: 0; }
h2, .instrument-title { margin: 0 0 14px; font-size: 14px; color: #bdefff; text-transform: uppercase; letter-spacing: 0; }

.status-pill {
  min-width: 190px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 14, 19, .86);
  box-shadow: inset 0 0 30px rgba(64, 217, 255, .06);
  font-weight: 800;
}
.beacon { width: 12px; height: 12px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 18px var(--amber); }
.ok .beacon { background: var(--green); box-shadow: 0 0 20px var(--green); }
.warn .beacon { background: var(--amber); box-shadow: 0 0 20px var(--amber); }
.bad .beacon { background: var(--red); box-shadow: 0 0 20px var(--red); }
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.quick-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(137,220,255,.24);
  border-radius: 6px;
  background: rgba(8,14,19,.86);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 0 28px rgba(64,217,255,.05);
}
.quick-links a:hover { border-color: rgba(64,217,255,.6); color: #fff; }
.reboot-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(137,220,255,.24);
  border-radius: 6px;
  background: rgba(8,14,19,.86);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 28px rgba(64,217,255,.05);
}
.reboot-button:hover,
.secondary-button:hover { border-color: rgba(64,217,255,.6); color: #fff; }
.danger-button {
  border-color: rgba(255,90,109,.5);
  background: rgba(42, 8, 14, .92);
  color: #ffeef1;
  box-shadow: inset 0 0 28px rgba(255,90,109,.09), 0 0 18px rgba(255,90,109,.1);
}
.danger-button:hover { border-color: rgba(255,90,109,.95); box-shadow: inset 0 0 30px rgba(255,90,109,.16), 0 0 24px rgba(255,90,109,.24); }

.hero-grid { display: grid; grid-template-columns: 1.25fr .85fr .9fr; gap: 16px; margin: 26px 0 16px; }
.panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.instrument, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 28, 38, .94), rgba(7, 12, 17, .94));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 18px 50px rgba(0,0,0,.36);
  padding: 18px;
  overflow: hidden;
}

.round-map { position: relative; width: min(100%, 310px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; border: 2px solid #284253; overflow: hidden; background: #071016; box-shadow: inset 0 0 0 10px #070b0f, inset 0 0 60px rgba(0,0,0,.8); }
.round-map:after { content: ""; pointer-events: none; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 8px rgba(5,7,10,.72), inset 0 0 44px rgba(64,217,255,.2); z-index: 500; }
#trafficMap { width: 100%; height: 100%; background: #0b151c; filter: saturate(.86) contrast(1.04); }
.leaflet-container { font-family: inherit; background: #0b151c; }
.leaflet-control-container { display: none; }
.receiver-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--cyan); border: 2px solid #fff; box-shadow: 0 0 18px var(--cyan); }
.plane-marker { width: 28px; height: 28px; object-fit: contain; transform-origin: 50% 50%; filter: drop-shadow(0 0 1px #020407) drop-shadow(0 0 7px rgba(64,137,255,.72)); }
.plane-label { margin-top: 1px; color: #e9f7ff; font-size: 11px; font-weight: 800; text-shadow: 0 1px 6px #000; white-space: nowrap; transform: translateX(-30%); }
.plane-tooltip { line-height: 1.25; }
.plane-tooltip strong { display: block; color: #061019; font-size: 12px; text-align: center; margin-bottom: 4px; }
.plane-tooltip span { display: block; color: #24313a; font-size: 11px; margin-top: 2px; text-align: center; }
.readout-row { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px 12px; margin-top: 14px; align-items: center; }
.readout-row span, .metric-grid span, .note-line span { color: var(--muted); }
.readout-row strong, .metric-grid strong, .note-line strong { text-align: right; color: #fff; }

.gauge { position: relative; height: 250px; display: grid; place-items: center; }
.gauge-arc {
  width: 230px; height: 230px; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--green) 0deg, var(--green) 140deg, var(--amber) 225deg, var(--red) 300deg, transparent 301deg 360deg);
  -webkit-mask: radial-gradient(circle, transparent 0 74%, #000 75% 86%, transparent 87%);
  mask: radial-gradient(circle, transparent 0 74%, #000 75% 86%, transparent 87%);
}
.needle { position: absolute; width: 4px; height: 102px; bottom: 50%; left: calc(50% - 2px); background: #f7fbff; transform-origin: 50% 100%; transform: rotate(calc(-140deg + (var(--value) * 2.8deg))); box-shadow: 0 0 18px #fff; }
.gauge-center { position: absolute; width: 124px; height: 124px; border-radius: 50%; display: grid; place-items: center; align-content: center; border: 1px solid var(--line); background: #071016; }
.gauge-center strong { font-size: 42px; line-height: 1; }
.gauge-center span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.scale { display: flex; justify-content: space-around; color: var(--muted); font-size: 12px; }
.temp-panel { display: flex; flex-direction: column; }
.mini-gauge-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}
.mini-gauge {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(137,220,255,.12);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 54%, rgba(64,217,255,.08), rgba(0,0,0,.2) 62%);
  overflow: hidden;
}
.mini-gauge:before {
  content: "";
  position: absolute;
  width: min(75%, 102px);
  height: min(75%, 102px);
  border-radius: 50%;
  background:
    linear-gradient(140deg, transparent 0 47%, rgba(233,247,255,.64) 48% 52%, transparent 53%) 50% 50% / 100% 100% no-repeat,
    linear-gradient(0deg, transparent 0 47%, rgba(233,247,255,.46) 48% 52%, transparent 53%) 50% 50% / 100% 100% no-repeat,
    linear-gradient(220deg, transparent 0 47%, rgba(233,247,255,.64) 48% 52%, transparent 53%) 50% 50% / 100% 100% no-repeat;
  -webkit-mask: radial-gradient(circle, transparent 0 64%, #000 65% 68%, transparent 69%);
  mask: radial-gradient(circle, transparent 0 64%, #000 65% 68%, transparent 69%);
  pointer-events: none;
}
.mini-gauge .gauge-arc {
  width: min(96%, 138px);
  height: min(96%, 138px);
}
.gauge-svg {
  position: absolute;
  width: min(96%, 138px);
  height: min(96%, 138px);
  overflow: visible;
}
.gauge-svg path {
  fill: none;
  stroke-linecap: round;
  stroke-width: 7;
}
.gauge-track { stroke: rgba(137,220,255,.12); }
.gauge-green { stroke: var(--green); filter: drop-shadow(0 0 7px rgba(85,243,154,.42)); }
.gauge-amber { stroke: var(--amber); filter: drop-shadow(0 0 7px rgba(255,202,95,.35)); }
.gauge-red { stroke: var(--red); filter: drop-shadow(0 0 7px rgba(255,90,109,.35)); }
.mini-gauge.temp-hot .gauge-red {
  animation: hotPulse .85s ease-in-out infinite;
}
@keyframes hotPulse {
  0%, 100% {
    filter: drop-shadow(0 0 7px rgba(255,90,109,.42));
    stroke-width: 7;
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(255,90,109,.95))
      drop-shadow(0 0 22px rgba(255,90,109,.82))
      drop-shadow(0 0 34px rgba(255,90,109,.52));
    stroke-width: 11;
  }
}
.mini-gauge .needle {
  width: 3px;
  height: min(39%, 60px);
  left: calc(50% - 1.5px);
  box-shadow: 0 0 12px #fff;
  transition: transform .22s linear;
}
.mini-gauge .gauge-center {
  width: min(52%, 72px);
  height: min(52%, 72px);
}
.mini-gauge .gauge-center strong { font-size: clamp(18px, 2vw, 26px); }
.mini-gauge .gauge-center span {
  max-width: 68px;
  padding: 0 4px;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
}
.gauge-scale span {
  position: absolute;
  color: rgba(233,247,255,.72);
  font-size: 10px;
  font-weight: 900;
  text-shadow: 0 1px 6px #000;
}
.scale-min { left: 10px; bottom: 20px; }
.scale-mid { left: 50%; top: 14px; transform: translateX(-50%); }
.scale-max { right: 8px; bottom: 20px; }

.radar { position: relative; height: 230px; border-radius: 50%; margin: 4px auto 12px; aspect-ratio: 1; max-width: 230px; border: 1px solid rgba(85,243,154,.55); background: radial-gradient(circle, transparent 0 24%, rgba(85,243,154,.08) 25% 26%, transparent 27% 49%, rgba(85,243,154,.08) 50% 51%, transparent 52%), #06100b; overflow: hidden; }
.radar:before, .radar:after { content: ""; position: absolute; background: rgba(85,243,154,.18); }
.radar:before { width: 1px; inset: 0 auto 0 50%; }
.radar:after { height: 1px; inset: 50% 0 auto; }
.sweep { position: absolute; inset: 50% 50% 0 50%; width: 50%; height: 50%; transform-origin: 0 0; background: linear-gradient(45deg, rgba(85,243,154,.45), transparent 70%); animation: sweep 3s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.blip { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.b1 { left: 28%; top: 35%; } .b2 { left: 68%; top: 48%; } .b3 { left: 43%; top: 72%; } .b4 { left: 57%; top: 25%; }
.traffic-number { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.traffic-number strong { font-size: 48px; }
.traffic-number span { color: var(--muted); text-transform: uppercase; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric-grid div, .service, .check, .note-line {
  border: 1px solid rgba(137,220,255,.16);
  border-radius: 6px;
  background: rgba(0,0,0,.18);
  padding: 12px;
}
.metric-grid span, .metric-grid strong { display: block; }
.metric-grid strong { font-size: 25px; margin-top: 4px; }

.check, .service, .note-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.check, .service { display: grid; grid-template-columns: 18px minmax(130px, 1fr) minmax(170px, auto); }
.lamp { width: 14px; height: 14px; border-radius: 50%; justify-self: center; border: 1px solid rgba(255,255,255,.42); }
.lamp.ok { background: radial-gradient(circle at 35% 30%, #ffffff 0 8%, var(--green) 28% 100%); box-shadow: 0 0 12px var(--green), inset 0 0 6px rgba(255,255,255,.32); }
.lamp.warn { background: radial-gradient(circle at 35% 30%, #ffffff 0 8%, var(--amber) 28% 100%); box-shadow: 0 0 12px var(--amber), inset 0 0 6px rgba(255,255,255,.28); }
.lamp.bad { background: radial-gradient(circle at 35% 30%, #ffffff 0 8%, var(--red) 28% 100%); box-shadow: 0 0 12px var(--red), inset 0 0 6px rgba(255,255,255,.26); }
.check .label, .service .label { min-width: 0; overflow-wrap: normal; }
.check strong, .service strong { min-width: 0; font-size: 12px; text-align: right; text-transform: uppercase; overflow-wrap: normal; word-break: normal; white-space: normal; }

.bars { display: grid; gap: 18px; }
.bar-line { display: grid; grid-template-columns: 92px 1fr 58px; gap: 12px; align-items: center; }
.bar-line span, .bar-line strong { font-size: 13px; color: var(--muted); }
.bar-line div { height: 12px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: rgba(0,0,0,.28); }
.bar-line i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--cyan)); box-shadow: 0 0 16px rgba(64,217,255,.65); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); text-align: left; font-weight: 600; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
td { padding: 8px 0; border-bottom: 1px solid rgba(137,220,255,.1); }

footer { margin-top: 18px; color: var(--muted); font-size: 13px; }

.map-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  grid-template-rows: auto 1fr;
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
  padding: clamp(10px, 1.4vw, 18px);
  background: rgba(3, 6, 9, .96);
  color: var(--text);
}
.map-modal.open { display: grid; }
.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(2, 5, 8, .74);
  backdrop-filter: blur(8px);
  z-index: 1200;
}
.confirm-modal.open { display: grid; }
.confirm-dialog {
  width: min(460px, 100%);
  border: 1px solid rgba(137,220,255,.28);
  border-radius: 8px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(16,28,38,.98), rgba(6,10,15,.98));
  box-shadow: 0 24px 70px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
}
.confirm-dialog h2 { margin: 0 0 10px; color: var(--text); font-size: 26px; text-transform: none; }
.confirm-copy { margin: 0 0 20px; color: var(--muted); line-height: 1.45; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
}
.modal-topbar h2 { margin: 0; font-size: clamp(28px, 4vw, 56px); color: var(--text); text-transform: none; }
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #101820;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
.modal-body {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 24vw);
  gap: clamp(10px, 1.2vw, 16px);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
#fullTrafficMap {
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #0b151c;
}
.map-modal .leaflet-control-container { display: block; }
.aircraft-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 28, 38, .96), rgba(7, 12, 17, .96));
  padding: 18px;
  overflow: auto;
}
.empty-state { color: var(--muted); }
.detail-call { font-size: 34px; margin: 0 0 4px; line-height: 1; }
.detail-sub { color: var(--muted); margin: 0 0 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.detail-box, .route-box {
  border: 1px solid rgba(137,220,255,.16);
  border-radius: 6px;
  background: rgba(0,0,0,.18);
  padding: 10px;
}
.detail-box span, .route-box span { display: block; color: var(--muted); font-size: 12px; }
.detail-box strong, .route-box strong { display: block; margin-top: 4px; font-size: 16px; }
.route-box { margin-top: 8px; }
.route-box span, .route-box strong, .route-box p { text-align: center; }
.route-trip {
  border: 1px solid rgba(137,220,255,.16);
  border-radius: 6px;
  background: rgba(0,0,0,.18);
  padding: 14px;
  text-align: center;
}
.route-trip strong, .route-trip span { display: block; }
.route-trip strong { font-size: 18px; overflow-wrap: anywhere; }
.route-trip span { color: var(--muted); font-weight: 900; margin: 8px 0; text-transform: lowercase; }
.route-trip p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.route-point + span { margin-top: 10px; }
.route-airline { color: var(--cyan); font-weight: 800; margin: 8px 0; }
.route-source { color: var(--muted); font-size: 12px; margin-top: 12px; }

@media (max-width: 1050px) {
  .hero-grid, .panel-grid { grid-template-columns: 1fr; }
  .round-map { width: min(100%, 280px); }
  .modal-body { grid-template-columns: 1fr; grid-template-rows: minmax(420px, 1fr) auto; overflow: auto; }
  .aircraft-detail { max-height: 36vh; }
}

@media (max-width: 620px) {
  .flightdeck { width: min(100vw - 20px, 1480px); padding: 14px 0; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .bar-line { grid-template-columns: 76px 1fr 48px; }
  .map-modal { padding: 10px; }
  .modal-body { grid-template-rows: minmax(360px, 1fr) auto; }
}
