:root {
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.92);
  --panel-solid: #111827;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --danger: #fb7185;
  --success: #34d399;
  --card: rgba(255, 255, 255, 0.06);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: radial-gradient(circle at top left, #1e3a8a 0, #0f172a 38%, #020617 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 76px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(16px);
  position: relative;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #00111c;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.pill.online {
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--success);
}

.pill.offline {
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--danger);
}

.pill.muted {
  color: var(--muted);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 0;
}

.map-wrap {
  position: relative;
  min-height: calc(100vh - 76px);
}

#map {
  height: 100%;
  min-height: calc(100vh - 76px);
  background: #0b1220;
}

.map-overlay {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 500;
  display: flex;
  gap: 10px;
  background: rgba(2, 6, 23, 0.78);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.map-overlay > div {
  min-width: 96px;
  padding: 4px 8px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.map-overlay strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

.sidebar {
  min-height: calc(100vh - 76px);
  border-left: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search-row {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.search-row input {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 11px 12px;
}

.search-row input:focus {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.aircraft-list {
  overflow-y: auto;
  padding: 10px;
}

.aircraft-card {
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.aircraft-card:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.38);
}

.aircraft-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.callsign {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.hex {
  color: var(--muted);
  font-size: 12px;
}

.aircraft-grid {
  margin-top: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.datum {
  padding: 9px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.36);
}

.datum span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.datum strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  margin: 10px;
}

.aircraft-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #00111c;
  border: 2px solid white;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  font-size: 17px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--line);
}

.leaflet-popup-content {
  margin: 12px 14px;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 76px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .topbar-actions {
    width: 100%;
    overflow-x: auto;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .map-wrap,
  #map {
    min-height: 60vh;
  }

  .sidebar {
    min-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .map-overlay {
    left: 10px;
    right: 10px;
    bottom: 10px;
    overflow-x: auto;
  }
}
