/* =========================================================
   SGROLLO · Cheap-Hop Planner — design system
   ========================================================= */

:root {
  /* ----- surfaces (cooler "sky" tone) ----- */
  --bg-1: #eef3ff;
  --bg-2: #e9f4ff;
  --bg-3: #fff4ec;
  --ink: #0e0c1a;
  --ink-soft: #2c2b44;   /* darkened for AA secondary text */
  --muted: #5d6480;      /* cooler + darker — fixes muddy tertiary text */
  --line: #e6eaf5;
  --card: #ffffff;

  /* ----- brand spine: violet → indigo → azure → cyan ----- */
  --primary: #5b3df0;
  --primary-2: #6f5bf5;
  --primary-hover: #4a30d8;
  --indigo: #4150e6;
  --azure: #2f8fe6;
  --cyan: #19c3d6;

  /* ----- sky-blue paper-plane two-tone + accent ----- */
  --plane-sky-1: #8fd0fc;
  --plane-sky-2: #3da0f0;
  --plane-blue-1: #2f7fd6;
  --plane-blue-2: #1f5fb0;
  --plane-keel: #194f88;
  --sky-accent: #3da0f0;
  --sky-soft: #e9f3ff;

  /* ----- warm "sunset" accents (kept) ----- */
  --magenta: #e84caa;
  --orange: #ff7a3d;
  --orange-soft: #ffd9bf;
  --green: #1fb56b;
  --yellow: #c98800;
  --blue: #0a6fb6;
  --accent: #3da0f0;     /* re-pointed from orange → sky */
  --danger: #dc2626;
  --border: var(--line);
  --text: var(--ink);

  /* ----- map pins (mirror PIN_COLORS in app.js) ----- */
  --pin-1: #5b3df0;
  --pin-2: #2f8fe6;
  --pin-3: #19c3d6;
  --pin-4: #e84caa;

  --radius-card: 22px;
  --radius-field: 18px;
  --radius-pill: 999px;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ----- shadows: cool indigo tint, a touch deeper ----- */
  --shadow-card: 0 1px 0 rgba(20, 16, 40, .02), 0 10px 28px rgba(40, 60, 140, .07), 0 36px 90px -22px rgba(40, 55, 150, .16);
  --shadow-cta: 0 16px 44px -12px rgba(70, 70, 220, .50), 0 2px 0 rgba(255, 255, 255, .45) inset;
  --shadow-soft: 0 6px 16px rgba(40, 55, 150, .10);

  /* ----- reusable gradient spine ----- */
  --grad-spine: linear-gradient(100deg, #5b3df0 0%, #4150e6 38%, #2f8fe6 72%, #19c3d6 100%);
  --grad-spine-soft: linear-gradient(135deg, #f0ecff 0%, #e6f1ff 60%, #e6fbff 100%);
}

/* hidden master SVG holding the reusable paper-plane symbol + gradients */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.paperplane { display: block; }
.paperplane use { transform-box: fill-box; }

/* ----- base ----- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

.muted { color: var(--muted); font-weight: 500; }
.nowrap { white-space: nowrap; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ----- page background ----- */
.page {
  min-height: 100vh;
  background:
    radial-gradient(1100px 720px at 6% 12%, #e7ddff 0%, transparent 60%),
    radial-gradient(1000px 760px at 94% 8%, #dcefff 0%, transparent 58%),
    radial-gradient(900px 620px at 50% 42%, #e6fbff 0%, transparent 60%),
    radial-gradient(820px 600px at 80% 100%, #ffeede 0%, transparent 55%),
    linear-gradient(180deg, #f7f9ff 0%, #eef5ff 100%);
}

.shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 40px 56px;
  position: relative;
}

/* ----- header ----- */
.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  position: relative;
  width: 80px;
  height: 78px;
}

.logo-text { line-height: 1; padding-top: 2px; }

.logo-name {
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 38px;
  letter-spacing: -.5px;
  color: var(--ink);
}

.logo-tag {
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: 24px;
  margin-top: 2px;
  color: transparent;
  background-image: linear-gradient(90deg, #5b3df0, #2f8fe6 58%, #19c3d6);
  background-clip: text;
  -webkit-background-clip: text;
}

.logo-plane {
  filter: drop-shadow(0 6px 12px rgba(47, 143, 230, .28));
  transition: transform .25s ease;
}
.logo:hover .logo-plane { transform: translateY(-2px) rotate(-3deg); }

.nav {
  display: flex;
  align-items: center;
  gap: 38px;
  margin-top: 22px;
}

.nav-link {
  position: relative;
  padding: 10px 4px;
  font-size: 18px;
  font-weight: 600;
  color: #4a4566;
  transition: color .15s;
}

.nav-link:hover { color: var(--ink); }

.nav-link.active {
  color: var(--ink);
  font-weight: 700;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--grad-spine);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.source-indicator {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.source-indicator.mock { color: #92400e; background: #fef3c7; border-color: #fcd34d; }
.source-indicator.travelpayouts { color: #065f46; background: #d1fae5; border-color: #6ee7b7; }
.source-indicator.offline { color: var(--danger); background: #fee2e2; border-color: #fca5a5; }

.lang-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(60, 40, 140, .06);
  color: var(--ink);
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  background: var(--grad-spine);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 10px 24px -8px rgba(47, 99, 230, .55);
  color: #fff;
  transition: transform .12s, box-shadow .15s, filter .15s;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -8px rgba(47, 99, 230, .6);
  filter: brightness(1.05);
}

.login-btn svg { stroke: #fff; }

/* ----- main grid ----- */
.main-grid {
  display: grid;
  grid-template-columns: 600px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.left-col { position: relative; }

.right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 1200px) {
  .main-grid { grid-template-columns: 1fr; }
  .shell { padding: 20px 22px 40px; }
}

/* ----- doodles ----- */
.doodles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.doodle { position: absolute; pointer-events: none; }

.doodle-plane {
  top: 22px; left: 420px; width: 132px; height: 132px;
  filter: drop-shadow(0 10px 16px rgba(47, 143, 230, .22));
  animation: glide 6s ease-in-out infinite;
}

.doodle-swoop  { top: 140px; left: 460px; width: 90px; height: 160px; }
.doodle-swoop path { stroke: var(--azure); }
.doodle-squiggle { top: 332px; left: 450px; width: 90px; height: 30px; }
.doodle-squiggle path { stroke: var(--cyan); }
.doodle-wash {
  top: 280px; left: 400px; width: 320px; height: 360px;
  z-index: -1; opacity: .8;
  background: conic-gradient(from 200deg at 50% 50%,
    rgba(91, 61, 240, .18), rgba(47, 143, 230, .16), rgba(25, 195, 214, .16), rgba(111, 91, 245, .16), rgba(91, 61, 240, .18));
  filter: blur(38px);
  border-radius: 50%;
  mix-blend-mode: multiply;
  animation: aurora 42s linear infinite;
}

@keyframes plane-drift {
  0%   { transform: translate(0, 0) rotate(-12deg); }
  50%  { transform: translate(6px, -4px) rotate(-10deg); }
  100% { transform: translate(0, 0) rotate(-12deg); }
}

@media (max-width: 1200px) {
  .doodles { display: none; }
}

/* ----- hero ----- */
.hero {
  position: relative;
  z-index: 1;
  margin-top: 14px;
}

.hero-title {
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 78px;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--ink);
  margin: 0 0 22px;
}

@media (max-width: 1200px) {
  .hero-title { font-size: 56px; letter-spacing: -1px; }
}

.hero-sub {
  font-size: 20px;
  color: var(--ink-soft);
  line-height: 1.45;
  font-weight: 500;
  max-width: 430px;
  margin: 0;
}

.accent-underline {
  background-image: linear-gradient(transparent 62%, rgba(47, 143, 230, .32) 62%, rgba(25, 195, 214, .32) 92%, transparent 92%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 0 4px;
}

/* ----- planner card ----- */
.planner-card {
  background: var(--card);
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  border-radius: var(--radius-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, .7);
  padding: 22px;
  margin-top: 30px;
  position: relative;
  z-index: 2;
}

/* 1px gradient ring (masked) so the card edge picks up the brand spine */
.planner-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-spine);
  opacity: .35;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: stretch;
}

.row-2 > .field-shell { flex: 1 1 0; min-width: 0; }
.row-3 > .field-shell { flex: 1 1 0; min-width: 0; }

.field-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: var(--radius-field);
  cursor: text;
  transition: box-shadow .2s, border-color .15s;
  min-width: 0;
}

.field-shell:hover,
.field-shell:focus-within {
  border-color: #bcd6f5;
  box-shadow: 0 6px 18px rgba(47, 143, 230, .16);
}

.field-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.field-icon-violet { background: #f3eeff; color: #5b3df0; }
.field-icon-orange { background: #ffeede; color: #e16a23; }
.field-icon-pink   { background: #ffe2ef; color: #c8197c; }
.field-icon-green  { background: #e0f7eb; color: #128a4d; }
.field-icon-sky    { background: var(--sky-soft); color: var(--sky-accent); }

.field-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.field-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.field-input,
.field-input-bold {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0;
  width: 100%;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-input::placeholder { color: var(--muted); font-weight: 600; }
.field-input:focus { outline: none; }

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .5;
  cursor: pointer;
  filter: invert(20%) sepia(85%) saturate(2400%) hue-rotate(252deg);
}

select.field-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 18px;
  background:
    transparent
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b7691' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>")
    no-repeat right center / 14px 14px;
}

/* loop toggle inside field label */
.loop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  background: #f3eeff;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.loop-toggle input {
  accent-color: var(--primary);
  margin: 0;
  width: 12px;
  height: 12px;
}

/* ----- airport typeahead inside field-shell ----- */
.airport-picker {
  position: relative;
  width: 100%;
}

.airport-picker .airport-input {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0;
  width: 100%;
  outline: none;
}

.airport-picker .airport-input::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.airport-picker .airport-input:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.airport-picker.disabled .airport-input {
  color: var(--muted);
  cursor: not-allowed;
}

.airport-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: -16px;
  right: -16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(60, 40, 140, .18);
  max-height: 320px;
  overflow-y: auto;
  z-index: 30;
  padding: 6px;
}

.airport-item {
  display: grid;
  grid-template-columns: auto 50px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  width: 100%;
}

.airport-item:hover { background: var(--sky-soft); }

.airport-item .iata {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  color: var(--azure);
  font-size: 13px;
  letter-spacing: .03em;
}

.airport-item .name {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.airport-item .country {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
}

.airport-item .hub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  display: inline-block;
}

/* ----- slider shell ----- */
.slider-shell {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: var(--radius-field);
  margin-bottom: 12px;
  transition: box-shadow .2s, border-color .15s;
}

.slider-shell:hover,
.slider-shell:focus-within {
  border-color: #d6cdf0;
  box-shadow: 0 6px 18px rgba(91, 61, 240, .10);
}

.slider-shell .field-icon { align-self: center; }

.slider-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  gap: 12px;
}

.slider-title {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .02em;
}

.slider-value {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  color: var(--ink);
  font-size: 15px;
  font-feature-settings: "tnum";
}

.dual-slider {
  position: relative;
  height: 24px;
  padding: 0 9px;
}

.dual-slider .slider-track,
.dual-slider .slider-fill {
  position: absolute;
  top: 50%;
  height: 6px;
  border-radius: 3px;
  transform: translateY(-50%);
}

.dual-slider .slider-track {
  left: 0;
  right: 0;
  background: #e3e9f6;
}

.dual-slider .slider-fill {
  background: var(--grad-spine);
  pointer-events: none;
}

.dual-slider input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.dual-slider input[type="range"]:focus { outline: none; }

.dual-slider input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
  height: 6px;
  border: none;
}
.dual-slider input[type="range"]::-moz-range-track {
  background: transparent;
  height: 6px;
  border: none;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  cursor: grab;
  box-shadow: 0 2px 8px rgba(91, 61, 240, .25);
}
.dual-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  cursor: grab;
  box-shadow: 0 2px 8px rgba(91, 61, 240, .25);
}
.dual-slider input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.1); box-shadow: 0 2px 8px rgba(47, 143, 230, .3), 0 0 0 6px rgba(47, 143, 230, .16); }
.dual-slider input[type="range"]:active::-moz-range-thumb { cursor: grabbing; transform: scale(1.1); box-shadow: 0 2px 8px rgba(47, 143, 230, .3), 0 0 0 6px rgba(47, 143, 230, .16); }

/* ----- preferences pills ----- */
.section-label {
  margin: 18px 0 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.section-label .muted {
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  margin-left: 6px;
}

.pref-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.pref-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s;
  min-width: 0;
  max-width: 100%;
}

.pref-pill:hover { border-color: #c9bff0; }

.pref-pill > span:first-child { color: var(--ink-soft); }

.pill-select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0 18px 0 0;
  cursor: pointer;
  outline: none;
  background:
    transparent
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b7691' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>")
    no-repeat right center / 12px 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- pax / cabin dropdowns ----- */
.pax-and-class {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Mission dropdown is full-width, occupies the same horizontal space as the
   window_start + window_end row sitting above it. */
.mission-dropdown {
  width: 100%;
  margin-bottom: 12px;
  flex: 1 1 100%;
}

.dropdown {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}

.dropdown-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  cursor: pointer;
  color: var(--ink);
  transition: box-shadow .2s, border-color .15s;
}

.dropdown-btn:hover { border-color: #d6cdf0; }
.dropdown-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
}
.dropdown.open .dropdown-btn {
  border-color: var(--azure);
  box-shadow: 0 6px 18px rgba(47, 143, 230, .18);
}

.dropdown-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #f3eeff;
  color: #5b3df0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dropdown-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
}

.dropdown-value {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-chevron {
  color: var(--muted);
  transition: transform 0.15s ease;
  display: inline-flex;
}

.dropdown.open .dropdown-chevron { transform: rotate(180deg); color: var(--primary); }

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(60, 40, 140, .18);
  padding: 8px 16px;
  margin: 0;
  min-width: 280px;
  border-width: 1px;
}

.dropdown-panel.pax { min-width: 320px; }
.dropdown-panel.cabin { min-width: 280px; }
.dropdown-panel.strategy-panel { min-width: 260px; }
.dropdown-panel.source-panel { min-width: 280px; }

/* The mission button is a standalone full-width control (the picker overlay
   lives in the map area, not in a dropdown panel beneath the button). */
.mission-field {
  width: 100%;
  margin-bottom: 12px;
}

.mission-field .dropdown-btn {
  width: 100%;
}

.mission-btn.active {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(91, 61, 240, .18);
}

.mission-btn.active .dropdown-chevron { transform: rotate(180deg); color: var(--primary); }

/* Mission picker overlays the map area. */
.mission-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--grad-spine-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 20px 20px;
  overflow: hidden;
  animation: missionOverlayIn .18s ease-out;
}

.mission-overlay[hidden] { display: none; }

@keyframes missionOverlayIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mission-overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #ece8f5;
}

.mission-overlay-title {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -.3px;
}

.mission-overlay-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}

.mission-overlay-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.mission-overlay-close:hover { color: var(--primary); border-color: #d6cdf0; }

/* Dev menu under the submit CTA — small gear toggle and the panel of
   power-user knobs (strategy, source, mission pool size). Hidden by
   default so the main form stays focused. */
.dev-toggle-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.dev-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}

.dev-toggle:hover {
  color: var(--primary);
  border-color: #d6cdf0;
}

.dev-toggle.open {
  color: var(--primary);
  background: rgba(91, 61, 240, .06);
  border-color: #d6cdf0;
}

.dev-toggle svg { transition: transform .25s ease; }
.dev-toggle.open svg { transform: rotate(60deg); }

.dev-menu {
  margin-top: 12px;
  padding: 14px 16px;
  background: rgba(91, 61, 240, .04);
  border: 1px dashed rgba(91, 61, 240, .25);
  border-radius: var(--radius-field);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dev-menu[hidden] { display: none; }

.dev-field {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-field > legend {
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.dev-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#mission-size-slider {
  flex: 1 1 auto;
  accent-color: var(--primary);
  min-width: 0;
}

.dev-slider-row strong {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
  min-width: 28px;
  text-align: right;
  font-feature-settings: "tnum";
}

.dev-hint {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

.mission-overlay .mission-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 2px;
}

/* keep the legacy class working in case any other panel still uses it */
.dropdown-panel.mission-panel {
  padding: 16px;
  min-width: 100%;
  width: 100%;
  max-height: 540px;
  overflow-y: auto;
}

.mission-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 12px;
  border-bottom: 1px solid #f3eeff;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mission-panel-title {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -.2px;
}

.mission-panel-hint {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.mission-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s;
  font: inherit;
}

.mission-card:hover {
  transform: translateY(-2px);
  border-color: #bcd6f5;
  box-shadow: 0 10px 22px rgba(47, 143, 230, .16);
}

.mission-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f3f0ff 0%, #eaf4ff 100%);
  box-shadow: 0 10px 24px rgba(47, 99, 230, .2);
}

.mission-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mission-card-label {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -.1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-card-size {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.mission-card-desc {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
}

.mission-card-map {
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #eef4ff 0%, #e6fbff 100%);
  aspect-ratio: 2 / 1;
}

.mission-card-map svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Mission visual: full list of cities in the mission, as compact chips.
   Temporary review surface so the curation can be improved before we move
   back to a graphic representation. */
.mission-card-cities {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  overflow: hidden;
}

/* Tighten spacing when the mission has lots of cities so they still fit. */
.mission-card-cities[data-count="14"],
.mission-card-cities[data-count="15"],
.mission-card-cities[data-count="16"],
.mission-card-cities[data-count="17"],
.mission-card-cities[data-count="18"],
.mission-card-cities[data-count="19"],
.mission-card-cities[data-count="20"] {
  gap: 3px;
  padding: 6px;
}

.mission-city-chip {
  background: rgba(47, 143, 230, .10);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid rgba(47, 143, 230, .2);
}

.mission-card-cities-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mission-card.selected .mission-card-map {
  outline: 2px solid rgba(91, 61, 240, .35);
  outline-offset: -1px;
}

.mission-card.selected .mission-city-chip {
  background: rgba(91, 61, 240, .18);
  border-color: rgba(91, 61, 240, .35);
}

/* On click the selected mission card expands to span 2 grid columns and
   drops the 2:1 aspect lock so every destination chip is fully visible.
   Sibling cards reflow naturally because CSS grid auto-row pushes them. */
.mission-card.selected {
  grid-column: span 2;
  background: linear-gradient(180deg, #f3f0ff 0%, #e6f4ff 100%);
}

.mission-card.selected .mission-card-map {
  aspect-ratio: auto;
  min-height: 180px;
}

.mission-card.selected .mission-card-cities {
  overflow: visible;
  gap: 6px;
  padding: 12px;
}

.mission-card.selected .mission-city-chip {
  font-size: 12.5px;
  padding: 4px 10px;
  border-width: 1px;
}

@media (max-width: 720px) {
  .mission-card.selected { grid-column: span 1; }
}

.mission-card-auto .mission-card-map-auto svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 720px) {
  .mission-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

.pax-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3eeff;
}
.pax-row:last-child { border-bottom: none; }

.pax-label strong { display: block; font-size: 14px; font-weight: 700; color: var(--ink); }
.pax-label small { color: var(--muted); font-size: 12px; font-weight: 500; }

.counter {
  display: flex;
  align-items: center;
  gap: 14px;
}

.counter-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 6px rgba(91, 61, 240, .3);
  transition: transform .12s;
}
.counter-btn:hover:not(:disabled) { transform: translateY(-1px); }
.counter-btn:disabled {
  background: #ece8f5;
  color: #c9c2dc;
  cursor: not-allowed;
  box-shadow: none;
}

.counter-value {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 18px;
  min-width: 20px;
  text-align: center;
  color: var(--ink);
  font-feature-settings: "tnum";
}

.cabin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3eeff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.cabin-row:last-child { border-bottom: none; }

.cabin-row input[type="radio"],
.cabin-row input[type="checkbox"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  margin: 0;
}

.baggage-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

/* ----- CTA + status ----- */
.actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta-gradient {
  position: relative;
  overflow: hidden;
  width: 100%;
  background:
    radial-gradient(120% 200% at 0% 50%, var(--primary) 0%, transparent 55%),
    radial-gradient(120% 180% at 100% 50%, var(--cyan) 0%, transparent 60%),
    linear-gradient(100deg, var(--primary), var(--indigo) 40%, var(--azure) 78%, var(--cyan));
  color: #fff;
  padding: 20px 24px;
  border-radius: var(--radius-field);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .01em;
  box-shadow: var(--shadow-cta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: transform .12s, box-shadow .15s;
}

.cta-gradient:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px -12px rgba(47, 99, 230, .6), 0 2px 0 rgba(255, 255, 255, .45) inset;
}

.cta-gradient:disabled {
  opacity: .7;
  cursor: progress;
}

/* moving specular sheen across the CTA */
.cta-gradient::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 55%;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, .3) 50%, transparent 100%);
  transform: translateX(-160%) skewX(-12deg);
  animation: sheen 5s ease-in-out infinite;
  pointer-events: none;
}

.cta-gradient.is-searching::after,
.cta-gradient.is-no-routes::after { animation: none; opacity: 0; }

/* Mid-search: dim gradient slightly + show cancel affordance on the cursor. */
.cta-gradient.is-searching {
  filter: saturate(.75) brightness(.95);
  cursor: pointer;
}

/* No-routes flash: solid red so the failure registers immediately. */
.cta-gradient.is-no-routes {
  background: linear-gradient(90deg, #d33b4d, #ff6680);
  filter: none;
  cursor: not-allowed;
}

.cta-icon-spin svg {
  animation: cta-spin 0.9s linear infinite;
}

@keyframes cta-spin {
  to { transform: rotate(360deg); }
}

.cta-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}

.status.error { color: var(--danger); }
.status.warning { color: var(--orange); }

/* ----- map ----- */
.map-wrap {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: linear-gradient(160deg, #dceffb 0%, #e7ecfb 55%, #ffe8d2 100%);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(20, 16, 40, .04);
  height: 520px;
}

.map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 4;
  pointer-events: none;
  color: var(--ink-soft);
  font-weight: 600;
  text-align: center;
  padding: 20px;
}

.map-empty-hint[hidden] { display: none; }

.map-empty-hint .hint-title {
  font-family: "Sora", sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.5px;
}

.map-empty-hint .hint-sub {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  max-width: 320px;
}

/* Compact score badge — a pill in the top-left corner of the map. */
.score-card.score-card-compact {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  background: #fff;
  border-radius: var(--radius-pill);
  padding: 6px 12px 6px 8px;
  box-shadow: 0 6px 18px rgba(60, 40, 140, .14), 0 1px 0 rgba(20, 16, 40, .04);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(20, 16, 40, .04);
}

.score-card.score-card-compact .score-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--sky-soft);
  color: var(--sky-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.score-value-compact {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: "Sora", sans-serif;
  letter-spacing: -.5px;
}

.score-value-compact #score-num {
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  line-height: 1;
}

.score-value-compact .score-out {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ----- Custom map controls (bottom-right column) ----- */
.map-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
  border-radius: 18px;
  padding: 4px;
  box-shadow: 0 8px 22px rgba(60, 40, 140, .18);
  border: 1px solid rgba(20, 16, 40, .04);
}

.map-controls[hidden] { display: none; }

.map-ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s, transform .12s;
}

.map-ctrl-btn:hover {
  background: var(--sky-soft);
  color: var(--azure);
}

.map-ctrl-btn:active { transform: scale(.95); }

.map-ctrl-play.playing {
  background: var(--grad-spine);
  color: #fff;
}

.map-ctrl-play.playing:hover { background: var(--grad-spine); color: #fff; }

/* ----- Tour card: shown during the auto-tour ----- */
/* Tour cards row: a horizontally-scrollable strip overlaid on the bottom of
   the map, with one card per destination. The play button highlights one
   card at a time. */
.tour-cards-row {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 64px 4px 4px;   /* right padding reserves space for the map controls */
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 61, 240, .3) transparent;
}

.tour-cards-row[hidden] { display: none; }

.tour-cards-row::-webkit-scrollbar { height: 6px; }
.tour-cards-row::-webkit-scrollbar-thumb { background: rgba(91, 61, 240, .3); border-radius: 3px; }

.tour-mini {
  flex: 0 0 auto;
  width: 192px;
  background: #fff;
  border: 1.5px solid rgba(20, 16, 40, .06);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 8px 22px -8px rgba(60, 40, 140, .25);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  font: inherit;
}

.tour-mini:hover {
  transform: translateY(-2px);
  border-color: #d6cdf0;
  box-shadow: 0 12px 28px -8px rgba(91, 61, 240, .3);
}

.tour-mini.active {
  border-color: var(--magenta);
  box-shadow: 0 14px 32px -8px rgba(232, 76, 170, .4);
  transform: translateY(-3px);
}

.tour-mini-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tour-stop-num {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 13px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85);
  flex-shrink: 0;
}

.tour-mini.active .tour-stop-num {
  background: linear-gradient(135deg, var(--magenta), var(--orange));
}

.tour-mini-city {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.tour-mini-iata {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
}

.tour-mini-dates {
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.35;
}

.tour-mini-dates strong {
  color: var(--ink);
  font-weight: 700;
}

.tour-mini-days {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--orange);
  letter-spacing: -.3px;
}

.tour-mini-days small {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--orange);
  margin-left: 3px;
  letter-spacing: 0;
}

/* Total trip days on the terminal (return / final) card — green so it reads
   as a positive summary number, distinct from the orange per-stop days. */
.tour-mini-total {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #1f9d55;
  letter-spacing: -.3px;
}

.tour-mini-total small {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #1f9d55;
  margin-left: 3px;
  letter-spacing: 0;
}

/* When the mission picker overlay is active the map-wrap grows to show
   the full catalog of missions without scrolling the cramped initial view.
   Tall enough to fit every mission card at the typical 4-column width. */
.map-wrap.mission-active {
  height: auto;
  min-height: 1400px;
}

.mission-overlay .mission-grid {
  max-height: none;
  overflow: visible;
}

/* Pin pulse — emphasises the city currently being toured. */
.pin-marker-inner.active {
  animation: pinPulse 1.4s ease-in-out infinite;
  transform: scale(1.18);
  z-index: 600;
}

@keyframes pinPulse {
  0%, 100% {
    box-shadow: 0 6px 18px rgba(60, 40, 140, .35), inset 0 0 0 3px rgba(255, 255, 255, .9), 0 0 0 0 rgba(232, 76, 170, .55);
  }
  50% {
    box-shadow: 0 6px 18px rgba(60, 40, 140, .35), inset 0 0 0 3px rgba(255, 255, 255, .9), 0 0 0 16px rgba(232, 76, 170, 0);
  }
}

/* Active leg highlight when the tour is on the corresponding stop. */
.leg.tour-active {
  border-color: var(--magenta);
  box-shadow: 0 8px 22px -6px rgba(232, 76, 170, .35);
  background: linear-gradient(90deg, #fff 0%, #ffe7f1 100%);
}

/* ----- Leaflet restyling ----- */
.leaflet-container {
  background: transparent !important;
  font-family: "Plus Jakarta Sans", sans-serif !important;
}

.leaflet-tile-pane {
  opacity: .9;
  filter: saturate(.9);
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, .85) !important;
  border-radius: 999px !important;
  padding: 2px 10px !important;
  margin: 8px !important;
  font-size: 10px !important;
  color: var(--muted) !important;
  font-weight: 600 !important;
}

.leaflet-control-attribution a { color: var(--ink-soft) !important; }

.leaflet-control-zoom {
  border: none !important;
  box-shadow: none !important;
}

.leaflet-control-zoom a {
  background: #fff !important;
  color: var(--ink) !important;
  border: 0 !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 16px rgba(60, 40, 140, .12) !important;
  margin-bottom: 6px !important;
  transition: transform .12s;
}

.leaflet-control-zoom a:hover { transform: translateY(-1px); }

/* Custom DivIcon pin */
.pin-marker { background: transparent; border: 0; }

.pin-marker-inner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  font-family: "Sora", sans-serif;
  box-shadow: 0 6px 18px rgba(60, 40, 140, .35), inset 0 0 0 3px rgba(255, 255, 255, .9);
}

/* One-way trip: the origin is a departure point, not a visited destination.
   We render it as a small unlabeled dot so the route line has a clear start
   without claiming a step number. */
.pin-marker-start {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(60, 40, 140, .35), inset 0 0 0 2px rgba(255, 255, 255, .9);
}

/* Permanent labels attached to each city marker on the map. */
.leaflet-tooltip.map-tooltip {
  background: #fff;
  border: 0;
  border-radius: 12px;
  padding: 7px 12px;
  box-shadow: 0 6px 18px rgba(60, 40, 140, .18);
  font: inherit;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
}

.leaflet-tooltip.map-tooltip::before { display: none; }

.leaflet-tooltip.map-tooltip.origin {
  background: linear-gradient(90deg, #fff 0%, #f3eeff 100%);
  border: 1px solid #d6cdf0;
}

.leaflet-tooltip.map-tooltip.final {
  background: linear-gradient(90deg, #fff 0%, #ffe2ef 100%);
  border: 1px solid #f8c6dc;
}

.map-tip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.map-tip .map-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.map-tip .map-iata {
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.map-tip .map-date {
  font-size: 10.5px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-weight: 600;
}

/* ----- results strip ----- */
.results-strip {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.results-strip[hidden] { display: none; }

.alternatives-card,
.best-card,
.empty-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(20, 16, 40, .04);
}

.alternatives-card {
  padding: 16px 20px 4px;
  box-shadow: var(--shadow-soft);
}

/* the winning loop — lifted above the alternatives list with a spine ring */
.best-card {
  position: relative;
  padding: 18px 22px;
  background: linear-gradient(180deg, #f3f8ff 0%, #fff 130px);
  box-shadow: 0 1px 0 rgba(20, 16, 40, .02), 0 14px 34px rgba(40, 60, 140, .1), 0 40px 100px -26px rgba(40, 55, 150, .22);
}

.best-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: var(--grad-spine);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.alternatives-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.trophy-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff7e0;
  color: #c98800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.alternatives-title {
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
}

.alternatives-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* alternatives list */
.alternatives {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.alt-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 6px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 10px;
  margin: 0 -6px;
  padding-left: 12px;
  padding-right: 12px;
  /* Soft fade-in so each row that lands from the streaming /search/stream
     endpoint visibly arrives instead of all appearing at the same instant.
     The animation is harmless on rows present from the initial render too. */
  animation: alt-row-fade-in 0.28s ease-out both;
}

@keyframes alt-row-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.alt-row:first-child { border-top: none; }
.alt-row:hover { background: #f0f6ff; }

.alt-row.selected {
  background: linear-gradient(90deg, #eaf3ff 0%, #fdeef5 100%);
}

.alt-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: border-color .12s;
}

.alt-row.selected .alt-mark { border-color: var(--primary); }

.alt-mark::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transition: background .12s;
}

.alt-row.selected .alt-mark::after {
  background: var(--grad-spine);
}

.alt-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.alt-route {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alt-route-codes {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alt-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.alt-price {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  white-space: nowrap;
  font-feature-settings: "tnum";
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  letter-spacing: -.3px;
}

.alt-price-pp {
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  font-family: "Plus Jakarta Sans", sans-serif;
}

/* best card head */
.best-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.best-title {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.badge-green {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: #e6f7ec;
  color: #1f8a4d;
  font-weight: 700;
  font-size: 12.5px;
}

.best-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.price-amount {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 34px;
  color: var(--ink);
  letter-spacing: -.5px;
}

.price-unit {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.bag-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 6px;
  font-feature-settings: "tnum";
}

.book-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 22px -6px rgba(132, 40, 200, .45);
  transition: transform .12s;
}
.book-btn-primary:hover { transform: translateY(-1px); }

/* Save + Share + Booking — grouped in best-head */
.best-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-action {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
  transition: transform .12s, color .15s, border-color .15s, background .15s;
}

.icon-action:hover {
  transform: translateY(-1px);
  color: var(--primary);
  border-color: #d6cdf0;
}

.icon-action[aria-pressed="true"] {
  color: var(--magenta);
  border-color: #f8c6dc;
  background: #ffe7f1;
}

.icon-action[aria-pressed="true"] svg {
  fill: var(--magenta);
  stroke: var(--magenta);
}

/* Tiny toast for save/share feedback */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: #171530;
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 16px 40px -10px rgba(40, 55, 150, .5);
  border-top: 1px solid rgba(47, 143, 230, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast[hidden] { display: none; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Flight-details panel under the booking row — full per-leg breakdown for
   the selected itinerary. */
.flight-details-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.flight-details-panel[hidden] { display: none; }

.flight-details-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* legs list (expandable) */
.legs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leg {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.12s, box-shadow .12s;
}

.leg.open {
  border-color: #bcd6f5;
  box-shadow: 0 6px 18px rgba(47, 143, 230, .14);
}

.leg-summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  padding: 12px 14px;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.leg-summary:hover { background: #f5f9ff; }
.leg-summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.leg-summary .chevron {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transition: transform 0.15s ease;
  font-weight: 600;
}

.leg.open .leg-summary .chevron { transform: rotate(90deg); color: var(--primary); }

.leg .marker {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  font-family: "Sora", sans-serif;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85);
  flex-shrink: 0;
}

.leg .route {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.leg .route .leg-names {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leg .route .leg-codes {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Times row: HH:MM ─── duration ─── HH:MM */
.leg .route .leg-times {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Sora", sans-serif;
  font-size: 13px;
  color: var(--ink);
  margin: 2px 0;
}

.leg .route .leg-time {
  font-weight: 700;
  font-feature-settings: "tnum";
}

.leg .route .leg-time-arrow {
  flex: 1;
  position: relative;
  height: 1px;
  background: var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.leg .route .leg-time-arrow::after {
  content: "›";
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

.leg .route .leg-time-dur {
  background: var(--card);
  padding: 0 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--mono);
}

.leg .price {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  white-space: nowrap;
  font-feature-settings: "tnum";
}

.leg-details {
  padding: 14px 16px 16px 60px;
  border-top: 1px solid var(--line);
  background: #fafaff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leg-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.leg-fields > div { display: flex; flex-direction: column; gap: 2px; }
.leg-fields dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
  font-weight: 700;
}
.leg-fields dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: "tnum";
}

.stay {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 16px 6px 60px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.stay::before {
  content: "";
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, #c9c2dc, transparent);
  border-radius: 2px;
}

/* stat cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-field);
  padding: 14px 16px 14px 18px;
  border: 1px solid rgba(20, 16, 40, .04);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.stat-green  { background: linear-gradient(135deg, #e7f8ee 0%, #fff 80%); }
.stat-yellow { background: linear-gradient(135deg, #fff6dc 0%, #fff 80%); }
.stat-blue   { background: linear-gradient(135deg, #e9f3ff 0%, #fff 80%); }
.stat-pink   { background: linear-gradient(135deg, #ffe7f1 0%, #fff 80%); }

.stat-green::before  { background: #1fb56b; }
.stat-yellow::before { background: #e0a400; }
.stat-blue::before   { background: var(--azure); }
.stat-pink::before   { background: var(--magenta); }

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-green  .stat-icon { background: #cdeed8; color: #1f8a4d; }
.stat-yellow .stat-icon { background: #fbe7a3; color: #9a7300; }
.stat-blue   .stat-icon { background: #e4f1ff; color: #2f8fe6; }
.stat-pink   .stat-icon { background: #fbcadd; color: #c4187a; }

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.stat-value {
  font-family: "Sora", sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value .unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-left: 2px;
}

/* notes */
.notes {
  margin-top: 14px;
  background: #f7f4ff;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  border: 1px solid #ece5fb;
  font-weight: 500;
}

.notes:empty { display: none; }

.notes ul { margin: 0; padding-left: 18px; }
.notes ul li { margin: 2px 0; }

/* empty state */
.empty-card {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 24px 28px;
}

.empty-card[hidden] { display: none; }

/* sky panel hosting the paper-plane + contrail */
.empty-illustration {
  position: relative;
  flex-shrink: 0;
  width: 172px;
  height: 132px;
  border-radius: 18px;
  background:
    radial-gradient(120px 90px at 68% 26%, rgba(47, 143, 230, .18), transparent 70%),
    var(--grad-spine-soft);
  overflow: hidden;
}

.empty-illustration::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: conic-gradient(from 180deg at 50% 50%, rgba(91, 61, 240, .16), rgba(47, 143, 230, .16), rgba(25, 195, 214, .16), rgba(91, 61, 240, .16));
  filter: blur(22px);
  opacity: .85;
  animation: aurora 30s linear infinite;
}

.empty-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.empty-plane {
  position: absolute;
  z-index: 2;
  width: 76px;
  height: 76px;
  top: 20px;
  left: 56px;
  filter: drop-shadow(0 8px 14px rgba(31, 95, 176, .3));
  animation: glide 5s ease-in-out infinite;
}

/* no-results variant: plane noses gently down */
.empty-illustration-sad .empty-plane { transform: rotate(10deg); animation: none; }

.empty-copy { min-width: 0; }

.empty-title {
  font-family: "Sora", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 6px;
}

.empty-text {
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-weight: 500;
}

.empty-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* footer */
.footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.footer a {
  color: var(--primary);
  font-weight: 700;
}

.footer a:hover { text-decoration: underline; }

/* responsive */
@media (max-width: 720px) {
  .shell { padding: 16px 16px 32px; }
  .top-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .nav { margin-top: 0; gap: 20px; flex-wrap: wrap; }
  .header-actions { margin-top: 0; flex-wrap: wrap; }
  .hero-title { font-size: 44px; letter-spacing: -.5px; }
  .row { flex-direction: column; }
  .planner-card { padding: 18px; }
  .map-wrap { height: 400px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .alt-route { white-space: normal; }
  .alt-row { grid-template-columns: auto 1fr; }
  .alt-price { grid-column: 2; align-items: flex-start; }
  .empty-card { flex-direction: column; align-items: flex-start; }
  .empty-illustration { width: 100%; }
}

/* =========================================================
   Motion — tasteful keyframes added for the refresh
   ========================================================= */
@keyframes glide {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-7px) rotate(-1deg); }
}

@keyframes sheen {
  0%   { transform: translateX(-160%) skewX(-12deg); }
  55%  { transform: translateX(280%) skewX(-12deg); }
  100% { transform: translateX(280%) skewX(-12deg); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes aurora {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

/* staggered reveal of result surfaces (re-plays on every search) */
.alt-row, .stat-card, .best-card, .leg { animation: rise .4s ease-out both; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .10s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.alt-row:nth-child(2) { animation-delay: .04s; }
.alt-row:nth-child(3) { animation-delay: .08s; }
.alt-row:nth-child(4) { animation-delay: .12s; }
.alt-row:nth-child(5) { animation-delay: .16s; }

@media (prefers-reduced-motion: reduce) {
  .doodle-plane, .empty-plane, .empty-illustration::before, .doodle-wash,
  .cta-gradient::after, .logo-plane,
  .alt-row, .stat-card, .best-card, .leg {
    animation: none !important;
    transition: none !important;
  }
  .alt-row, .stat-card, .best-card, .leg { opacity: 1 !important; transform: none !important; }
}

/* =========================================================
   Dark mode — token flip + a few surface overrides.
   Map stays "light tiles in a dark frame" (accepted compromise).
   ========================================================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #161a3a; --bg-2: #141832; --bg-3: #2a1f33;
    --ink: #f3f1ff; --ink-soft: #ced3ee; --muted: #9aa2c4;
    --line: rgba(255, 255, 255, .10); --card: #181633;
    --sky-soft: rgba(47, 143, 230, .16);
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 28px rgba(0, 0, 0, .35), 0 36px 90px -22px rgba(0, 0, 0, .6);
    --shadow-soft: 0 6px 16px rgba(0, 0, 0, .4);
    --grad-spine-soft: linear-gradient(135deg, #241d4d 0%, #1b2a52 60%, #14323f 100%);
  }

  html, body { background: #0c0a1e; }
  .page {
    background:
      radial-gradient(1100px 720px at 6% 12%, #241a4d 0%, transparent 60%),
      radial-gradient(1000px 760px at 94% 8%, #122744 0%, transparent 58%),
      radial-gradient(900px 620px at 50% 42%, #0f2a35 0%, transparent 60%),
      linear-gradient(180deg, #0c0a1e 0%, #0e1430 100%);
  }

  .planner-card { background: rgba(28, 26, 58, .78); border-color: rgba(255, 255, 255, .08); }

  .field-shell, .slider-shell, .dropdown-btn, .pref-pill,
  .airport-dropdown, .dropdown-panel, .mission-overlay-close,
  .map-controls, .score-card.score-card-compact,
  .source-indicator, .lang-select, .icon-action {
    background: #1f1d40;
    border-color: var(--line);
    color: var(--ink);
  }

  .field-input, .field-input-bold, .airport-picker .airport-input,
  .dropdown-value, .counter-value, .slider-value, .pill-select { color: var(--ink); }

  .map-wrap { background: linear-gradient(160deg, #1a2348 0%, #1b2150 55%, #2a1f33 100%); }
  .leaflet-container { background: #10162e !important; }
  .leaflet-tile-pane { opacity: .85; filter: saturate(.85) brightness(.82); }
  .leaflet-control-zoom a { background: #21204a !important; color: var(--ink) !important; }

  .mission-overlay { background: var(--grad-spine-soft); }
  .mission-card, .leg-summary, .stat-card { background: #1c1a3d; }
  .alternatives-card, .best-card, .empty-card, .leg { background: var(--card); }
  .best-card { background: linear-gradient(180deg, #1d1b40 0%, var(--card) 130px); }
  .alt-row:hover { background: rgba(47, 143, 230, .12); }
  .leg-summary:hover { background: rgba(47, 143, 230, .08); }
  .leg-details, .notes { background: #141228; }
  .toast { background: #060512; }
}
