:root {
  --bg: #eef3f7;
  --card: #fff;
  --ink: #122033;
  --muted: #5b6b7c;
  --line: #d5dee6;
  --accent: #1f4e79;
  --accent-2: #c45c26;
  --ok: #1b7a4a;
  --danger: #b42318;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
}

.top {
  background: #0f2744;
  color: #fff;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.top nav { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; }
.top a { color: #dbe8f4; text-decoration: none; font-size: 0.95rem; }
.top a:hover, .top a.nav-active { color: #fff; }
.top a.nav-active { font-weight: 700; }

.wrap { padding: 1rem; max-width: 720px; margin: 0 auto 3rem; }
.wrap.wide { max-width: 920px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat { background: #0f2744; color: #fff; border-radius: var(--radius); padding: 0.9rem 1rem; }
.stat b { display: block; font-size: 1.4rem; }

form { display: grid; gap: 0.7rem; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; color: var(--muted); }
input, select, textarea {
  font: inherit;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }

.btn, button, input[type=submit] {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.btn.secondary { background: #5b6b7c; }
.btn.danger { background: var(--danger); }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.search { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.search input { flex: 1; }
.range, .muted { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding-top: 0.75rem; }
.pager a { text-decoration: none; }

.flight {
  display: block;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0;
}
.flight:last-child { border-bottom: 0; }
.flight .when { color: var(--muted); font-size: 0.86rem; }
.flight .route { font-weight: 700; font-size: 1.05rem; }
.flight .meta { color: var(--muted); font-size: 0.9rem; }

.flash { background: #e8f6ee; color: var(--ok); padding: 0.7rem 0.8rem; border-radius: 10px; }
.error { background: #fdecec; color: var(--danger); padding: 0.7rem 0.8rem; border-radius: 10px; }

.hint { margin: 0; font-size: 0.86rem; color: var(--muted); }
.ext { color: var(--accent); }
.airport-panel {
  display: grid;
  gap: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: #f7fafc;
}
.airport-panel h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}
.lookup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}
.lookup-row button { height: 2.7rem; }

.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; background: #f7fafc; border-radius: 10px; }
.chart-tip {
  position: absolute;
  min-width: 11.75rem;
  background: #0f2744;
  color: #fff;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(15, 39, 68, 0.25);
  pointer-events: none;
  z-index: 3;
}
.chart-tip[hidden] { display: none; }
.chart-tip-date { margin: 0 0 0.4rem; font-weight: 700; }
.chart-tip p { margin: 0; display: flex; justify-content: space-between; gap: 0.85rem; }
.chart-tip p span { color: #dbe8f4; }
.chart-tip p b { font-variant-numeric: tabular-nums; font-weight: 700; }
.metric-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.metric-tabs a {
  text-decoration: none;
  background: #e8eef4;
  color: var(--ink);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
}
.metric-tabs a.active { background: var(--accent); color: #fff; }
.bar-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
  max-height: min(70vh, 42rem);
  overflow-y: auto;
  padding-right: 0.2rem;
}
.bar-row { display: grid; gap: 0.28rem; }
.bar-head {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: baseline;
}
.bar-code { font-weight: 700; }
.bar-place {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.bar-track { background: #e8eef4; border-radius: 6px; height: 0.7rem; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; }
table.data th a { color: inherit; text-decoration: none; }
table.data th.active, table.data th.active a { color: var(--accent); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.card h1 { margin: 0 0 0.5rem; font-size: 1.35rem; }
.card h2 { margin: 1rem 0 0; font-size: 1rem; }

.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); }

@media (max-width: 520px) {
  .row2, .stats, .lookup-row { grid-template-columns: 1fr; }
}
