:root {
  /* palette taken from the logo: deep navy ground, sky-blue accent, white ink */
  --bg: #0a1a2b;
  --panel: #0d2034;        /* matches the logo artwork background */
  --ink: #eef4fa;
  --muted: #90a6bd;
  --accent: #29c5f9;       /* logo sky blue */
  --border: #274a67;
  --bright: #5ad4fb;
  --pop: #ffd15a;
  --detail-bg: #10283f;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 80px;
  padding: 0 68px 0 20px;   /* right room for the fixed hamburger */
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.site-header .tag { color: var(--muted); font-size: 13px; flex: none; white-space: nowrap; }
.site-header .hd-search { margin-left: auto; }

/* logo art already carries the navy ground, so it sits straight on the header */
.brand { display: inline-flex; align-items: center; flex: none; }
.brand picture { display: inline-flex; align-items: center; }
.brand img { display: block; width: auto; height: 60px; }

.layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  height: calc(100vh - 81px);
}
.layout.solo { grid-template-columns: 1fr; }
.layout.compact { height: calc(100vh - 81px); }  /* detail-bar header */

.panel {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 16px 18px;
}

/* airport page: destinations on top, hovered-route detail on the bottom half */
.panel.split { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.panel.split .panel-top { flex: 1 1 35%; overflow-y: auto; padding: 0 18px 16px; }
.panel.split .panel-top h2 { margin-top: 16px; }
.panel.split .panel-detail {
  position: relative;
  flex: 1 1 65%;
  overflow-y: auto;
  padding: 14px 18px 18px;
  background: var(--detail-bg);
  border-top: 2px solid var(--bright);
}
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.panel .totals { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.map { width: 100%; height: 100%; }

/* map column + floating filter bar (airport page) */
.map-wrap { position: relative; height: 100%; min-width: 0; }
.map-filters {
  position: absolute; z-index: 5; top: 10px; left: 10px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
  padding: 8px 10px;
  background: rgba(13, 32, 52, .93);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  max-width: calc(100% - 78px);
}
.map-filters label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.map-filters select {
  font-family: inherit; font-size: 12px;
  max-width: 190px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 6px; cursor: pointer;
}
.map-filters select:focus { outline: none; border-color: var(--accent); }
.map-filters #f-clear {
  font-family: inherit; font-size: 11px; cursor: pointer;
  background: transparent; color: var(--accent);
  border: 1px solid var(--border); border-radius: 5px; padding: 5px 9px;
}
.map-filters #f-clear:hover { border-color: var(--accent); }
.map-filters .f-count {
  font-size: 11px; color: var(--muted); padding-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

/* site nav — hamburger fixed top-right, dropdown to About / Contact */
.sitenav { position: fixed; top: 19px; right: 16px; z-index: 200; }
.sitenav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 0 9px;
  background: rgba(13, 32, 52, .93); cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.sitenav-toggle span {
  display: block; height: 2px; width: 100%; border-radius: 2px;
  background: var(--ink); transition: transform .15s, opacity .15s;
}
.sitenav-toggle:hover span { background: var(--accent); }
.sitenav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sitenav-toggle.is-open span:nth-child(2) { opacity: 0; }
.sitenav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.sitenav-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  margin: 0; padding: 5px; list-style: none; min-width: 140px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.sitenav-menu li { display: block; }
.sitenav-menu a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--ink); font-size: 14px; text-decoration: none;
}
.sitenav-menu a:hover { background: rgba(41, 197, 249, .14); color: var(--bright); }

/* plain text pages (About, Contact) */
.page {
  max-width: 640px; margin: 0 auto; padding: 52px 24px 72px; line-height: 1.65;
}
.page h1 { font-size: 26px; color: var(--bright); margin: 0 0 18px; letter-spacing: .3px; }
.page p { color: var(--ink); margin: 0 0 14px; }
.page a { color: var(--accent); }
.page .contact-email {
  font-family: var(--mono); font-size: 18px; font-weight: 700;
  color: var(--bright); user-select: all; margin: 6px 0 22px;
}
.page .muted { color: var(--muted); }

/* dashboard */
.page-wide { max-width: 880px; }
.dash-nav { display: flex; gap: 6px; margin: 0 0 18px; }
.dash-nav a {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); font-size: 13px;
}
.dash-nav a.on { color: #0b1118; background: var(--bright); border-color: var(--bright); }
table.dash { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dash th, table.dash td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.dash th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
table.dash td.rt { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
table.dash td.num { font-variant-numeric: tabular-nums; }
table.dash .muted { color: var(--muted); }
.dash-actions form { display: flex; gap: 6px; justify-content: flex-end; }
.dash-actions button {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); border-radius: 5px; padding: 4px 10px;
}
.btn-ok { color: #0b1118; background: var(--bright); border-color: var(--bright); }
.btn-del { color: #ff9f4a; background: transparent; border-color: #ff9f4a; }
.btn-plain { color: var(--muted); background: transparent; }
.page .page-signoff { margin-top: 28px; }
.page .page-signoff .contact-email { display: inline-block; font-size: 15px; margin: 4px 0 0; }

/* trip-dates: cog + Book cluster in the detail pane, panel overlays it */
.d-actions {
  position: absolute; top: 12px; right: 16px; z-index: 2;
  display: flex; align-items: center; gap: 6px;
}
.d-cog {
  width: 26px; height: 26px; padding: 5px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; cursor: pointer;
}
.d-cog:hover { color: var(--accent); border-color: var(--accent); }
.d-cog svg { width: 100%; height: 100%; }
.trip-panel {
  position: absolute; z-index: 6; top: 8px; right: 8px;
  width: 220px; max-width: calc(100% - 16px);
  padding: 12px 14px 14px;
  background: rgba(13, 32, 52, .98);
  border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.trip-panel.flash { animation: trip-flash .9s ease-out 2; }
@keyframes trip-flash {
  0%, 100% { border-color: var(--border); }
  50% { border-color: var(--pop); box-shadow: 0 0 0 3px rgba(255, 209, 90, .25), 0 12px 32px rgba(0, 0, 0, .5); }
}
.trip-panel-h { display: flex; align-items: center; justify-content: space-between; }
.trip-panel-h strong { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--bright); }
.trip-panel-h button {
  background: none; border: none; color: var(--muted); font-size: 18px;
  line-height: 1; cursor: pointer; padding: 0 2px;
}
.trip-panel-h button:hover { color: var(--ink); }
.trip-hint { margin: 4px 0 10px; font-size: 11px; color: var(--muted); }
.trip-panel label {
  display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.trip-panel input[type="date"], .trip-panel select {
  font-family: inherit; font-size: 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 5px; padding: 5px 6px;
  color-scheme: dark;
}
.trip-panel select { cursor: pointer; }
.trip-panel input[type="date"]:focus,
.trip-panel select:focus { outline: none; border-color: var(--accent); }
.trip-panel .trip-ow {
  flex-direction: row; align-items: center; gap: 6px; margin: 2px 0 0;
  text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 11px;
  cursor: pointer;
}
.trip-panel .trip-ow input { cursor: pointer; }

/* Book button in the route-detail pane (sits right of the cog) */
.d-book {
  font-family: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  color: #0b1118; background: var(--pop);
  border: none; border-radius: 5px; padding: 5px 11px;
}
.d-book:hover { background: #ffdd80; }

/* "Error?" button + the report panel it toggles */
.d-err-btn {
  font-family: inherit; font-size: 10px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 5px; padding: 4px 8px;
}
.d-err-btn:hover { color: #ff9f4a; border-color: #ff9f4a; }
.d-report {
  margin-top: 16px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255, 159, 74, .07);
}
.d-report-q { font-size: 12px; color: var(--ink); margin-bottom: 9px; }
.d-report-airline {
  display: block; margin-bottom: 9px; max-width: 100%;
  font-family: inherit; font-size: 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 5px; padding: 5px 6px;
}
.d-report-send {
  font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  color: #0b1118; background: #ff9f4a;
  border: none; border-radius: 5px; padding: 6px 12px;
}
.d-report-send:hover { background: #ffb066; }
.d-report-send:disabled { opacity: .6; cursor: default; }
.d-report-done { font-size: 12px; color: var(--bright); margin-top: 4px; }

/* dimmed (filtered-out) destination rows */
table.routes tbody tr.is-dim { opacity: .3; }
table.routes tbody tr.is-dim:hover { opacity: .65; }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.rank .code { font-weight: 600; }
.rank .city { color: var(--muted); font-size: 13px; }
.rank .num { color: var(--muted); font-variant-numeric: tabular-nums; }

/* compact one-line header on the airport page */
.detail-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 80px; box-sizing: border-box;
  padding: 0 68px 0 18px;   /* right room for the fixed hamburger */
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.hd-id { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 auto; }

/* split-flap / Vestaboard-style airport code */
.split-flap { display: inline-flex; gap: 3px; flex: none; }
.flap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 42px;
  font-family: var(--mono);
  font-size: 25px; font-weight: 700; line-height: 1;
  color: #f2ecdc;                     /* warm vintage off-white */
  text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
  background: linear-gradient(#2b2f34 0%, #202429 49%,
                              #0b0d10 51%, #1c2025 100%);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05),
              0 1px 3px rgba(0, 0, 0, .5);
  position: relative;
}
.flap::after {                        /* the seam where the two flaps meet */
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; transform: translateY(-1px);
  background: rgba(0, 0, 0, .55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04);
}
.hd-ap {
  color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* header airport search (sits where the airport name used to) */
.hd-search { position: relative; min-width: 0; flex: 1 1 560px; max-width: 760px; }
.hd-search-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.hd-search input {
  width: 100%; box-sizing: border-box;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--ink); font-size: 13px; padding: 8px 36px 8px 12px;
  text-overflow: ellipsis;
  outline: none;
}
.hd-search input::placeholder { color: var(--muted); opacity: 1; }
.hd-search input:focus { border-color: var(--accent); background: rgba(41, 197, 249, .06); }
.hd-search:focus-within .hd-search-icon { color: var(--accent); }
.hd-search-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); max-height: 60vh; overflow-y: auto;
}
.hd-search-menu li {
  display: grid; grid-template-columns: 3.4em 1fr auto; gap: 8px; align-items: baseline;
  padding: 6px 8px; border-radius: 5px; cursor: pointer;
}
.hd-search-menu li:hover, .hd-search-menu li.is-active { background: rgba(41, 197, 249, .14); }
.hd-search-menu .c { font-family: var(--mono); font-weight: 700; color: var(--bright); }
.hd-search-menu .nm { color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-search-menu .dp { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.hd-title { text-align: right; line-height: 1.3; white-space: nowrap; flex: none; }
.hd-title strong { display: block; font-size: 13px; color: var(--ink); }
.hd-title .sub { font-size: 11px; color: var(--muted); }
.hd-title .sub a { color: var(--accent); }
.hd-title .note { color: #ff9f4a; }

table.routes { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.routes th, table.routes td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.routes th:first-child, table.routes td:first-child,
table.routes th:nth-child(2), table.routes td:nth-child(2) { text-align: left; }
table.routes td.city { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
table.routes td:first-child a { font-family: var(--mono); font-weight: 700; letter-spacing: .5px; }
table.routes th {
  position: sticky; top: 0; z-index: 3;
  background: var(--panel); color: var(--muted); font-weight: 600;
  border-bottom: none; box-shadow: inset 0 -1px 0 var(--border);
}
table.routes tbody tr:hover { background: rgba(41,197,249,.10); }
table.routes tbody tr.is-active {
  background: rgba(41,197,249,.16);
  box-shadow: inset 3px 0 0 var(--bright);
}
.badge { font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }

.panel .hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

/* --- small map popup: route + city + miles only --- */
.maplibregl-popup-content {
  background: #08192a;
  color: var(--ink);
  border: 1px solid var(--bright);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
}
.maplibregl-popup-content b { color: #fff; }
.maplibregl-popup-tip { border-top-color: var(--bright) !important; border-bottom-color: var(--bright) !important; }
.pp-h { font-size: 13px; margin-bottom: 1px; }
.pp-h b { color: var(--bright); }
.pp-sub { color: var(--muted); }
.pp-tag { font-size: 10px; border: 1px solid #ff9f4a; border-radius: 9px;
  padding: 0 5px; color: #ff9f4a; }

/* --- route detail in the sidebar bottom half --- */
.panel-detail .d-empty { color: var(--muted); font-size: 12px; font-style: italic; padding-right: 40px; }
.d-h {
  font-size: 17px; font-weight: 700; color: var(--bright);
  letter-spacing: .3px; margin-bottom: 2px; padding-right: 150px;
}
.d-sub { color: var(--ink); font-size: 12px; margin-bottom: 2px; padding-right: 150px; }
.d-line { color: var(--pop); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.d-lbl {
  color: var(--bright); text-transform: uppercase; letter-spacing: .08em;
  font-size: 10px; font-weight: 700; margin: 10px 0 5px;
}
.d-car-list { display: flex; flex-direction: column; gap: 8px; }
.d-car-row { padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; }
.d-car-row:first-child { padding-top: 0; border-top: none; }
.d-car-row--dim { opacity: .34; }
.d-car-row--dim:hover { opacity: .7; }
.d-car-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.d-car-logo {
  flex: none; width: 34px; height: 20px; object-fit: contain;
  background: #fff; border-radius: 3px; padding: 1px;
}
.d-car-logo--none { background: transparent; }
.d-car-name { color: #fff; font-weight: 600; }
.d-car-for {
  font-size: 10px; color: var(--accent); white-space: nowrap;
  border: 1px solid var(--border); border-radius: 9px; padding: 0 6px;
}
.d-car-top-badge {
  font-size: 10px; color: #0b1118; white-space: nowrap; font-weight: 700;
  background: var(--pop); border-radius: 9px; padding: 0 6px;
}
.d-car-op { color: var(--muted); font-size: 11px; margin-top: 2px; }
.d-car-freq { color: var(--pop); font-size: 11px; margin-top: 2px; }
.d-car-times { color: var(--muted); font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.d-car-planes { color: var(--muted); font-size: 11px; margin-top: 2px; }
.d-plain { color: var(--ink); font-size: 12px; }

/* ======================================================================
   MOBILE  (phones + small tablets, portrait)
   ====================================================================== */
@media (max-width: 820px) {
  html, body { height: auto; }

  /* --- header: shorter, drop secondary bits --- */
  .site-header, .detail-bar {
    height: 52px; gap: 10px; padding: 0 50px 0 12px;
  }
  .brand img { height: 34px; }
  .site-header .tag { display: none; }
  .detail-bar .hd-title { display: none; }
  .hd-id { gap: 9px; }
  .split-flap { display: none; }   /* hide the vestaboard code to save space */
  .hd-search { flex: 1 1 auto; min-width: 0; max-width: none; }
  .hd-search input { font-size: 16px; }        /* 16px = no iOS zoom-on-focus */

  /* --- hamburger sits in the shorter header --- */
  .sitenav { top: 8px; right: 10px; }
  .sitenav-toggle { width: 36px; height: 36px; }

  /* --- layout: map on top, panel below, page scrolls --- */
  .layout, .layout.compact, .layout.solo {
    display: flex; flex-direction: column; height: auto; min-height: 0;
  }
  .map-wrap, .layout > #map { order: -1; height: 56vh; flex: none; }
  .panel {
    border-right: none; border-top: 1px solid var(--border);
    padding: 14px 14px 40px;
  }

  /* airport page: table then detail, both flowing (no fixed split) */
  .panel.split { display: block; overflow: visible; }
  .panel.split .panel-top {
    flex: none; padding: 0 14px 14px; max-height: 46vh; overflow-y: auto;
  }
  .panel.split .panel-detail {
    flex: none; overflow: visible;
    padding: 14px 14px 40px;
    border-top: 2px solid var(--bright);
  }

  /* --- filter bar: full width, compact, one row of selects --- */
  .map-filters {
    top: 8px; left: 8px; right: 8px; max-width: none;
    gap: 6px 5px; padding: 6px 8px;
  }
  .map-filters label { flex: 1 1 28%; min-width: 0; font-size: 8px; gap: 2px; }
  .map-filters select { max-width: none; width: 100%; font-size: 11px; padding: 4px; }
  .map-filters #f-clear { flex: 0 0 auto; padding: 4px 8px; }
  .map-filters .f-count { flex: 1 1 100%; padding: 0; }

  /* --- detail pane: action buttons flow at the top, full-width panels --- */
  .d-actions { position: static; margin-bottom: 10px; }
  .d-h, .d-sub { padding-right: 0; }
  .d-h { font-size: 16px; }
  .panel-detail .d-empty { padding-right: 0; }
  .trip-panel { left: 8px; right: 8px; width: auto; top: 6px; }

  /* --- static pages --- */
  .page { padding: 28px 16px 44px; }
  .page h1 { font-size: 22px; }

  /* landing list a touch tighter */
  .rank li { padding: 8px 0; }
}
