body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

header {
  background: #111827;
  padding: 16px 20px;
}

h1 {
  margin: 0;
  font-size: 24px;
}

.sub {
  display: inline-block;
  margin-top: 4px;
  color: #9ca3af;
  text-decoration: none;
}

.sub:hover {
  text-decoration: underline;
}

#map {
  height: 60vh;
}

main {
  padding: 20px;
}

.ok {
  color: #86efac;
}

.missing {
  color: #fca5a5;
}

#aircraftFilters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: #111827;
}

#aircraftFilters label {
  cursor: pointer;
  color: #e5e7eb;
}

.aircraft-icon {
  font-size: 24px;
  line-height: 24px;
  text-align: center;
}

.homebase-icon {
  font-size: 26px;
  line-height: 26px;
  text-align: center;
}

/* ==========================================
   FILTER BAR
   ========================================== */

#filtersBar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px;
  padding: 16px 20px;
  background: #111827;
  border-top: 1px solid #374151;
  align-items: end;
}

.rangeControl {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rangeControl label {
  color: #9ca3af;
  font-size: 13px;
}

.rangeAction {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rangeControlWide .rangeAction {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

#historyDays,
.rangeAction input,
.rangeAction button {
  min-width: 0;
  height: 46px;
  box-sizing: border-box;
  background: #0f172a;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 15px;
}

.rangeAction input {
  color-scheme: dark;
}

.rangeAction button {
  cursor: pointer;
  background: #2563eb;
  border-color: #2563eb;
  font-weight: 700;
  white-space: nowrap;
}

.rangeAction button:hover {
  background: #1d4ed8;
}

#historyDays:focus,
.rangeAction input:focus,
.rangeAction button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ==========================================
   AIRCRAFT CARDS
   ========================================== */

#aircraftCards {
  display: grid;
  gap: 12px;
}

.aircraftCard {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 14px;
  overflow: hidden;
}

.aircraftCard summary {
  display: grid;
  grid-template-columns: 28px 140px 1fr 140px 110px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.aircraftCard summary::-webkit-details-marker {
  display: none;
}

.aircraftCard summary::before {
  content: "▶";
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.aircraftCard[open] summary::before {
  transform: rotate(90deg);
}

.aircraftCard summary:hover {
  background: #1f2937;
}

.aircraftCardBody {
  display: grid;
  grid-template-columns: 260px 260px 1fr;
  gap: 24px;
  padding: 16px;
  border-top: 1px solid #374151;
  background: #0f172a;
}

.flightsBlock {
  min-width: 0;
}

.muted {
  color: #9ca3af;
}

/* ==========================================
   FLIGHTS
   ========================================== */

.flightButton {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 12px;
  text-align: left;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 10px;
  cursor: pointer;
}

.flightButton:hover {
  background: #1f2937;
}

.flightButton.selectedFlight {
  border-color: #3b82f6;
  background: #1e3a8a;
}

.flightButton {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 8px 0;
  padding: 14px;
  text-align: left;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 12px;
  cursor: pointer;
}

.flightTime {
  font-weight: 700;
}

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

.flightStats span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 8px;
}

.flightStats strong {
  font-size: 14px;
}

.flightStats small {
  color: #9ca3af;
  font-size: 12px;
}

/* ==========================================
   MOBILE
   ========================================== */

@media (max-width: 900px) {
  #filtersBar {
    grid-template-columns: 1fr;
  }

  .rangeAction,
  .rangeControlWide .rangeAction {
    grid-template-columns: 1fr;
  }

  .rangeAction button {
    width: 100%;
  }

  .aircraftCard summary,
  .aircraftCardBody {
    grid-template-columns: 1fr;
  }

  .aircraftCard summary::before {
    display: none;
  }

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