:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0b1220;
  color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b 0%, #0b1220 55%);
}

header {
  padding: 1.5rem 2rem 1rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.2vw, 2.3rem);
}

header p {
  margin: 0.35rem 0;
  color: #93c5fd;
}

#updatedAt {
  font-size: 0.85rem;
  color: #94a3b8;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(260px, auto));
  gap: 1rem;
  padding: 1rem 2rem 2rem;
}

.card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
  min-height: 0;
}

#airspace-card {
  grid-column: span 4;
  grid-row: span 1;
  display: flex;
  flex-direction: column;
}

#airports-card {
  grid-column: span 8;
  grid-row: span 1;
}

#ai-summary-card {
  grid-column: span 8;
  grid-row: span 1;
}

#alerts-card {
  grid-column: span 4;
  grid-row: span 1;
}

#airspace-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.55rem;
  width: clamp(320px, 62vw, 760px);
  max-width: 100%;
}

#map {
  width: 100%;
  height: 220px;
  min-height: 220px;
  border-radius: 10px;
}

.airspace-table-wrap {
  border: 1px solid #334155;
  border-radius: 10px;
  background: #101a2e;
  max-height: 150px;
}

#regional-airspace-table {
  width: 100%;
  border-collapse: collapse;
}

#regional-airspace-table th,
#regional-airspace-table td {
  border-bottom: 1px dashed #334155;
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
}

#regional-airspace-table th {
  color: #93c5fd;
  font-size: 0.78rem;
  position: sticky;
  top: 0;
  background: #101a2e;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.status-open {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

.status-limited {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}

.status-restricted {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.stats-row div {
  background: #172033;
  border-radius: 10px;
  padding: 0.8rem;
}

.stats-row strong {
  display: block;
  font-size: 1.1rem;
  color: #67e8f9;
}

.stats-row span {
  color: #94a3b8;
  font-size: 0.82rem;
}

.metric-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.metric-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #334155;
  padding: 0.35rem 0;
  gap: 1rem;
}

.scrollable {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

#airport-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.airport-table {
  width: 100%;
  border-collapse: collapse;
}

.airport-table th,
.airport-table td {
  border-bottom: 1px dashed #334155;
  text-align: left;
  padding: 0.45rem;
  vertical-align: top;
}

.airport-table th {
  color: #93c5fd;
  font-size: 0.84rem;
}

.airport-table small,
#ai-summary-updated {
  color: #94a3b8;
}

.airport-table .country-row td {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  background: rgba(30, 41, 59, 0.5);
}

.airport-table .airport-row.airport-active td:nth-child(2),
.airport-table .airport-row.airport-active td:nth-child(3) {
  background: rgba(134, 239, 172, 0.2);
}

.airport-table .airport-row.airport-inactive td:nth-child(2),
.airport-table .airport-row.airport-inactive td:nth-child(3) {
  background: rgba(248, 113, 113, 0.2);
}

#ai-summary-text {
  white-space: pre-wrap;
  line-height: 1.5;
  background: #101a2e;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 1rem;
  min-height: 180px;
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  #airspace-card,
  #airports-card,
  #alerts-card,
  #ai-summary-card {
    grid-column: span 1;
    grid-row: span 1;
  }

  #airspace-content {
    grid-template-columns: 1fr;
  }

  #map {
    width: 100%;
    min-height: 260px;
  }

  #airport-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  header,
  .grid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

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

  #airport-columns {
    grid-template-columns: 1fr;
  }
}

.small-note {
  color: #94a3b8;
  font-size: 0.8rem;
  margin: 0.4rem 0;
}


.daily-bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  min-height: 140px;
  align-items: end;
  margin: 0.65rem 0 0.9rem;
  padding: 0.55rem;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #101a2e;
}

.daily-bar-chart .bar {
  background: linear-gradient(180deg, #22d3ee, #2563eb);
  border-radius: 8px 8px 4px 4px;
  min-height: 3%;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1.3rem;
}

.daily-bar-chart .value {
  position: absolute;
  top: -1.2rem;
  font-size: 0.72rem;
  color: #bae6fd;
}

.daily-bar-chart .date {
  position: absolute;
  bottom: 0.25rem;
  font-size: 0.68rem;
  color: #e2e8f0;
}

.chart-empty {
  color: #94a3b8;
  font-size: 0.82rem;
  margin: 0;
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
}

.aircraft-marker {
  color: #fde047;
  font-size: 14px;
  text-shadow: 0 0 4px rgba(15, 23, 42, 0.9);
}
