body {
  background: #fff;
  margin: 0;
}

.route-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4em 1.2em;
  background: #1f2933;
  padding: 0.4em 0.8em;
}

.route-bar .brand { display: block; padding-bottom: 0.35em; line-height: 0; }
.route-bar .brand-lockup { height: 1.9em; width: auto; }

.route-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  align-items: flex-end;
  color: #eee;
}

.route-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.8em;
}

.route-form input,
.route-form select { color: #111; }
.route-form select { width: 5em; margin: 0; }
.route-form select[name="aircraft"] { width: 14em; }
.route-form input[name="route"] { width: 22em; }
.route-form .route-field { display: flex; flex-wrap: nowrap; align-items: flex-end; }
.route-form input[type="number"] { width: 6em; }
.route-form input[type="submit"] { margin: 0; }

.route-form .route-reverse {
  margin: 0 0 0 0.15em;
  padding: 0.25em 0.5em;
  color: #eee;
  font-size: 1.3em;
  line-height: 1.4;
}

.route-form .route-reverse:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

.profile {
  position: relative;
  padding: 0 0.5em 1em;
}

.profile-status {
  padding: 0.5em;
  color: #555;
}

.profile-status.error { color: #b00000; }

.profile-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8em;
  padding: 0 0.5em 0.3em;
}

.profile-tools label { font-size: 0.85em; }
.profile-tools select { width: auto; margin-left: 0.3em; padding: 0.1em 0.4em; }

.profile-sources {
  font-size: 0.75em;
  color: #777;
}

.profile-chart {
  overflow-x: auto;
}

.profile-chart svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-x;
  user-select: none;
}

/* On phones keep the chart readable and scroll it sideways instead of shrinking it */
@media (max-width: 900px) {
  .profile-chart svg { width: 1100px; max-width: none; }
  .route-form { flex-basis: 100%; }
  .route-form input[name="route"] { width: 100%; }
  .route-form .route-field { flex-basis: 100%; }
  .route-form .route-field label { flex: 1; }
  .departure { margin: 0.5em 0.5em 0; }
  .altitudes { margin: 1em 0.5em 0; }
}

.profile-readout {
  position: absolute;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #999;
  border-radius: 4px;
  padding: 0.4em 0.6em;
  font-size: 0.8em;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.profile-readout b { color: #1f2933; }

.departure {
  margin: 0.5em 2em 0;
}

.departure-label {
  text-align: center;
  font-weight: bold;
}

.departure-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.3em;
}

.departure-bar span { flex: 1; }
.departure-bar span.outlook { background: repeating-linear-gradient(45deg, #bbb 0 3px, #e4e4e4 3px 6px); }

.departure-ranges { display: flex; font-size: 0.75em; color: #555; margin-top: 0.2em; }
.departure-ranges span { text-align: center; white-space: nowrap; overflow: hidden; }
.departure-ranges .outlook-label { border-left: 2px solid #888; color: #444; font-weight: bold; }
.outlook-tag { color: #b00000; letter-spacing: 0.04em; }

.outlook-banner {
  margin: 0.3em 0.5em 0.5em;
  padding: 0.5em 0.8em;
  background: #fff4d6;
  border-left: 4px solid #d99a00;
  font-size: 0.9em;
}

.departure input[type="range"] {
  width: 100%;
  margin: 0;
}

.altitudes {
  margin: 1em 2em 0;
  overflow-x: auto;
}

.altitudes table {
  width: 100%;
  font-size: 0.85em;
}

.altitudes th,
.altitudes td {
  padding: 0.25em 0.6em;
  text-align: right;
}

.altitudes tr.unsafe td { color: #999; }
.altitudes tr.current td { font-weight: bold; }
.altitudes tr.recommended td { background: #dff3df; }
.altitudes td.bad { color: #b00000; }
.altitudes td.warn { color: #7a2fb5; }
.altitudes td.turb { color: #d97a00; }

.destination {
  margin: 1em 2em 0;
  overflow-x: auto;
}

.destination table { width: 100%; font-size: 0.85em; }
.destination td, .destination th { padding: 0.25em 0.6em; text-align: left; }
.destination .cat { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; margin-right: 0.3em; }
.alt-required { color: #b00000; border-left: 4px solid #b00000; padding: 0.3em 0.6em; }

@media (max-width: 900px) {
  .destination { margin: 1em 0.5em 0; }
}

.route-map {
  height: 420px;
  margin: 1em 2em 0;
  border: 1px solid #ccc;
}

@media (max-width: 900px) {
  .route-map { margin: 1em 0.5em 0; height: 320px; }
}

/* Picnic hides bare radios/checkboxes (it expects its own markup); restore Leaflet's layer switcher */
.leaflet-control-layers input[type="radio"],
.leaflet-control-layers input[type="checkbox"] {
  opacity: 1;
  position: static;
  width: auto;
  margin: 0 0.3em 0 0;
}

.leaflet-control-layers label { margin: 0.2em 0; cursor: pointer; }

.no-fiki {
  color: #b00000;
  border-left: 4px solid #b00000;
  padding: 0.3em 0.6em;
}

.altitude-plan {
  background: #dff3df;
  padding: 0.4em 0.6em;
  border-left: 4px solid #0a7a0a;
}

/* Leaflet's panes and controls use z-indexes up to ~1000, so overlays sit above that */
.skewt {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
}

.skewt[hidden] { display: none; }

.loading {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(31, 41, 51, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading[hidden] { display: none; }

.loading-panel {
  background: #fff;
  border-radius: 10px;
  padding: 1.5em 2.5em;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.loading-logo {
  border-radius: 20px;
  animation: loading-pulse 1.6s ease-in-out infinite;
}

.loading-title { font-weight: bold; margin-top: 0.6em; }
.loading-step { color: #555; font-size: 0.9em; margin-top: 0.3em; min-height: 1.4em; }

@keyframes loading-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.92); opacity: 0.8; }
}

.skewt-panel {
  background: #fff;
  border-radius: 6px;
  padding: 0.5em 0.8em 0.8em;
  max-width: 720px;
  width: 100%;
  max-height: 100%;
  overflow: auto;
}

.skewt-panel header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
}

.skewt-panel header > span {
  display: flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}

.skewt-panel svg {
  width: 100%;
  height: auto;
  display: block;
}

.disclaimer-backdrop {
  min-height: 100vh;
  background: #1f2933;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
}

.disclaimer {
  background: #fff;
  border-radius: 8px;
  max-width: 720px;
  padding: 1.2em 1.5em;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.disclaimer li { margin-bottom: 0.4em; }
.disclaimer-agree { display: block; margin: 1em 0; }
.disclaimer-alert { color: #b00000; font-weight: bold; }
.disclaimer-note { font-size: 0.8em; color: #666; margin-top: 0.8em; }

/* Outlined so the AI buttons read as buttons before hover */
.ai-button,
.ai-button:focus {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.25em 0.7em;
  font-size: 0.85em;
  color: #1856bd;
  background: #fff;
  border: 1px solid #1856bd;
  border-radius: 0.3em;
  box-shadow: none;
}

.ai-button:hover {
  color: #fff;
  background: #1856bd;
  box-shadow: none;
}

/* also beats .skewt-panel svg, which sizes the diagram to the panel width */
.ai-button .ai-icon,
.skewt-panel .ai-button .ai-icon {
  flex: none;
  width: 16px;
  height: 16px;
  display: inline-block;
}
.ai-briefing { position: relative; margin: 0.5em 2em; padding: 0.6em 2.5em 0.6em 0.9em; background: #f4f7fb; border-left: 4px solid #1856bd; }
.ai-close { position: absolute; top: 0.2em; right: 0.3em; padding: 0.1em 0.5em; font-size: 1.2em; line-height: 1; }
.ai-output { margin-top: 0.6em; padding: 0.5em 0.8em; background: #f4f7fb; border-left: 4px solid #1856bd; }
.ai-text { line-height: 1.45; }
.ai-note, .ai-pending { font-size: 0.8em; color: #666; margin: 0.4em 0 0; }

@media (max-width: 900px) {
  .ai-briefing { margin: 0.5em; }
}

.profile-empty { padding: 2em; }

/* Surface forecast and decoded TAF for the station in the Skew-T popup */
.station-wx table, .station-taf table { width: 100%; font-size: 0.85em; margin: 0.4em 0; }
.station-wx th, .station-wx td, .station-taf th, .station-taf td { padding: 0.15em 0.5em; text-align: left; vertical-align: top; }
.station-wx th { width: 8em; white-space: nowrap; color: #555; font-weight: normal; background: none; }
.station-wx code { white-space: normal; font-size: 0.95em; }
.station-taf { margin-top: 0.6em; }
.station-taf h4 { margin: 0.2em 0; padding: 0; font-size: 1em; }
.station-taf th { background: #f0f2f5; color: #333; }
.station-taf tr.active td { background: #fff4c2; font-weight: bold; }
.station-taf pre { white-space: pre-wrap; font-size: 0.8em; background: #f7f7f7; padding: 0.4em 0.6em; margin: 0.3em 0 0; }
.station-wx .cat, .station-taf .cat { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; margin-right: 0.3em; vertical-align: -0.05em; }
.skewt-legend { display: flex; flex-wrap: wrap; gap: 0.3em 1em; font-size: 0.8em; color: #444; margin: 0.4em 0 0.2em; }
.skewt-legend span { display: inline-flex; align-items: center; gap: 0.35em; }
/* beats .skewt-panel svg, which sizes the diagram to the panel width */
.skewt-panel .skewt-legend svg { width: 24px; height: 10px; display: inline-block; flex: none; }

/* Sign out, at the end of the app's route bar */
.route-bar .sign-out { margin: 0 0 0.2em; padding: 0.3em 0.6em; color: #ccd; font-size: 0.85em; }
.route-bar .sign-out:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

/* Sign in with Apple / Google */
.sign-in-buttons { display: flex; flex-wrap: wrap; gap: 0.6em; }
.sign-in-buttons form { margin: 0; }
.sign-in-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin: 0;
  padding: 0.6em 1.2em;
  border-radius: 0.4em;
  font-weight: 600;
}
.sign-in-apple { background: #000; color: #fff; }
.sign-in-google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
.sign-in-apple:hover, .sign-in-google:hover { box-shadow: inset 0 0 0 99em rgba(128, 128, 128, 0.15); }

.sign-in-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1856bb;
  padding: 1em;
}
.sign-in-card {
  background: #fff;
  border-radius: 0.6em;
  padding: 1.6em 2em 2em;
  max-width: 26em;
  box-shadow: 0 0.5em 2em rgba(0, 0, 0, 0.25);
}
.sign-in-card h2 { margin: 0.6em 0 0.2em; padding: 0; }
.sign-in-logo { display: inline-block; background: #1856bb; border-radius: 0.4em; padding: 0.5em 0.8em; line-height: 0; }
.sign-in-logo img { height: 2em; }
.flash-alert { color: #b42318; }
.flash-notice { margin: 0; padding: 0.5em 1.5em; background: #e8f0fe; color: #1f2933; }

/* Welcome page */
.home { background: #f5f7fb; color: #1f2933; min-height: 100vh; }
.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8em 1.5em;
  background: #1856bb;
}
.home-nav .brand-lockup { height: 2.2em; display: block; }
.home-nav .button { margin: 0; }
.home-nav .home-sign-in { color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); }
.home-hero {
  display: grid;
  grid-template-columns: minmax(18em, 1fr) minmax(0, 1.6fr);
  gap: 2.5em;
  align-items: center;
  padding: 3em 1.5em 4em;
  background: linear-gradient(#1856bb, #1856bb 70%, #f5f7fb 70%);
  color: #fff;
}
.home-hero h1 { font-size: 2.4em; line-height: 1.15; margin: 0 0 0.4em; padding: 0; }
.home-hero p { font-size: 1.15em; color: #dce7fb; margin: 0 0 1.4em; }
.home-cta { font-size: 1.1em; background: #fa951f; color: #1f2933; }
.home-shot {
  width: 100%;
  height: auto;
  border-radius: 0.6em;
  box-shadow: 0 1em 3em rgba(15, 30, 60, 0.35);
  background: #fff;
}
.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
  gap: 1.5em 2em;
  max-width: 72em;
  margin: 0 auto;
  padding: 1em 1.5em 3em;
}
.home-features h3 { margin: 0 0 0.3em; padding: 0; color: #1856bb; }
.home-features p { margin: 0; }
.home-close { text-align: center; padding: 2.5em 1.5em; background: #1f2933; color: #fff; }
.home-close h2 { margin: 0 0 0.8em; padding: 0; }
.home-close .sign-in-buttons { justify-content: center; }
.home-footer { padding: 1.2em 1.5em; font-size: 0.85em; color: #5b6573; text-align: center; }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; padding-top: 2em; background: linear-gradient(#1856bb, #1856bb 60%, #f5f7fb 60%); }
  .home-hero h1 { font-size: 1.9em; }
}

/* Saved routes (also the offline fallback page) */
.route-bar .account-links { display: flex; align-items: flex-end; gap: 0.4em; margin-left: auto; }
.route-bar .saved-link { margin: 0 0 0.45em; color: #ccd; font-size: 0.85em; }
.route-bar .saved-link:hover { color: #fff; }
.saved-page { background: #f5f7fb; min-height: 100vh; color: #1f2933; }
.saved { max-width: 44em; margin: 0 auto; padding: 1.5em 1em 3em; }
.saved h2 { padding: 0; margin: 0 0 0.4em; }
.saved-offline { background: #fff4e5; border-left: 4px solid #fa951f; padding: 0.6em 0.8em; }
.saved-list { list-style: none; margin: 1em 0; padding: 0; }
.saved-list li { margin: 0 0 0.6em; }
.saved-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15em 1em;
  padding: 0.7em 0.9em;
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 0.5em;
  color: inherit;
}
.saved-list a:hover { border-color: #1856bb; }
.saved-route { font-weight: 700; font-size: 1.1em; color: #1856bb; }
.saved-depart { text-align: right; font-weight: 600; }
.saved-details, .saved-age { font-size: 0.85em; color: #5b6573; }
.saved-age { text-align: right; }
.saved-empty { color: #5b6573; }

/* Admin dashboard */
.admin { background: #f5f7fb; min-height: 100vh; color: #1f2933; }
.admin-nav .admin-nav-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.2em 1.2em; }
.admin-nav .admin-nav-links a { color: #fff; white-space: nowrap; }
.admin-main { max-width: 76em; margin: 0 auto; padding: 1.2em 1em 3em; }
.admin-main h2 { padding: 0; margin: 0 0 0.2em; }
.admin-note, .admin-muted { color: #5b6573; font-size: 0.85em; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10em, 1fr)); gap: 0.8em; margin: 1em 0; }
@media (max-width: 600px) {
  .admin-tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 1.5em; }
  .admin-nav .brand-lockup { height: 1.7em; }
}
.admin-tile { display: flex; flex-direction: column; background: #fff; border: 1px solid #dde3ec; border-radius: 0.5em; padding: 0.8em 1em; }
.tile-value { font-size: 1.9em; font-weight: 700; line-height: 1.1; }
.tile-label { font-weight: 600; }
.tile-sub { color: #5b6573; font-size: 0.8em; margin-top: 0.2em; }
.admin-card { background: #fff; border: 1px solid #dde3ec; border-radius: 0.5em; padding: 0.8em 1em; margin: 0 0 1em; }
.admin-card h3 { padding: 0; margin: 0 0 0.5em; font-size: 1.05em; }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(22em, 1fr)); gap: 1em; align-items: start; }
.admin-scroll { overflow-x: auto; }
.admin-table { width: 100%; font-size: 0.85em; }
.admin-table th { background: #eef2f8; color: #1f2933; text-align: left; }
.admin-table td, .admin-table th { padding: 0.35em 0.6em; vertical-align: top; }
.admin-badge { background: #fa951f; color: #1f2933; border-radius: 0.3em; padding: 0 0.4em; font-size: 0.75em; font-weight: 700; margin-left: 0.3em; }
.admin-failed { color: #b42318; font-weight: 600; }
.admin-chart { width: 100%; height: auto; display: block; }
.admin-chart .chart-axis { font-size: 11px; fill: #5b6573; }
.admin-chart .chart-day:hover path { fill: #0f3f8f; }
.admin-user-facts p { margin: 0.2em 0; }
.admin-user-facts form { margin-top: 0.6em; }
.flash-notice.flash-alert { background: #fdecea; color: #b42318; }
