/* Fare Engine: the Flight Search page's look (tokens, hero, search card, calendar, result cards), plus the
   engine's own bits at the bottom. */
:root {
  --bg: #f2f5fb; --surface: #ffffff; --surface-2: #f6f8fd; --ink: #0f1b33; --muted: #66738c; --line: #e2e8f2;
  --accent: #2f5bff; --accent-ink: #ffffff; --accent-soft: #e8eeff; --good: #12805a; --good-soft: #dff5ea;
  --bad: #c2382c; --bad-soft: #fde6e3; --warn: #9a6200; --warn-soft: #fff1d6;
  --hero-1: #0b1b4d; --hero-2: #1d3fd8; --hero-3: #4f8bff;
  --shadow: 0 1px 2px rgb(15 27 51 / .04), 0 8px 24px -8px rgb(15 27 51 / .12);
  --shadow-lg: 0 2px 4px rgb(15 27 51 / .04), 0 24px 48px -16px rgb(15 27 51 / .22);
  --r: 20px;
  --display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0a0f1c; --surface: #121a2c; --surface-2: #0f1626; --ink: #e8eefa; --muted: #93a0b8; --line: #23304a;
  --accent: #7f9cff; --accent-ink: #0a0f1c; --accent-soft: #1a2650; --good: #4fd19b; --good-soft: #10301f;
  --bad: #ff8a7d; --bad-soft: #3a1a17; --warn: #f2bd5a; --warn-soft: #362810;
  --hero-1: #050a1c; --hero-2: #14287e; --hero-3: #2f56c9;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -8px rgb(0 0 0 / .5);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 24px 48px -16px rgb(0 0 0 / .6); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0a0f1c; --surface: #121a2c; --surface-2: #0f1626; --ink: #e8eefa; --muted: #93a0b8; --line: #23304a;
  --accent: #7f9cff; --accent-ink: #0a0f1c; --accent-soft: #1a2650; --good: #4fd19b; --good-soft: #10301f;
  --bad: #ff8a7d; --bad-soft: #3a1a17; --warn: #f2bd5a; --warn-soft: #362810;
  --hero-1: #050a1c; --hero-2: #14287e; --hero-3: #2f56c9;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -8px rgb(0 0 0 / .5);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 24px 48px -16px rgb(0 0 0 / .6); color-scheme: dark }

* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); padding-bottom: 56px }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; display: grid; gap: 24px }
h1, h2 { font-family: var(--display); margin: 0; text-wrap: balance }
h1 { font-size: clamp(32px, 6vw, 52px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05 }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em }
.mono { font-family: var(--mono) }
.muted { color: var(--muted) }
.small { font-size: 13px }

/* ---- Hero ---- */
.hero { position: relative; overflow: hidden; color: #fff; padding: 28px 16px 120px;
  background: radial-gradient(120% 90% at 85% 0%, var(--hero-3) 0%, transparent 55%), linear-gradient(160deg, var(--hero-1) 0%, var(--hero-2) 100%) }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(rgb(255 255 255 / .5) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%) }
.hero .arc { position: absolute; right: -40px; top: 10px; width: min(560px, 70vw); height: auto; pointer-events: none; opacity: .55 }
.hero header { position: relative; max-width: 1048px; margin: 0 auto; display: grid; gap: 8px }
.hero .lede { margin: 0; color: rgb(255 255 255 / .75) }

button { font: 700 14px/1 var(--body); color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, filter .15s ease }
button:hover { filter: brightness(1.06) }
button:active { transform: translateY(1px) }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
button[disabled] { opacity: .6; cursor: progress }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.btn-ghost { font: 700 14px/1 var(--body); color: var(--accent); border: 1px solid var(--line); border-radius: 999px; padding: 11px 18px; text-decoration: none; background: var(--surface) }
.btn-ghost:hover { border-color: var(--accent) }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; box-shadow: var(--shadow) }
.panel-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between }


.chip { display: inline-block; font: 600 12px/1 var(--body); padding: 5px 9px; border-radius: 999px; white-space: nowrap }
.chip.down { color: var(--good); background: var(--good-soft) }
.chip.up { color: var(--bad); background: var(--bad-soft) }
.chip.flat { color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line) }
.chip.low { color: var(--good); background: var(--good-soft) }
.chip.typical { color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line) }
.chip.high { color: var(--warn); background: var(--warn-soft) }
.chip.best-tag { color: var(--accent); background: var(--accent-soft) }


.notice { border-radius: 12px; padding: 12px 14px; background: var(--warn-soft); color: var(--ink); font-size: 14px }
.empty { text-align: center; padding: 32px 12px; color: var(--muted) }

@media (prefers-reduced-motion: no-preference) { .fade { animation: fade .35s ease both } @keyframes fade { from { opacity: .4 } } }

/* ---- Live search ---- */
.search-panel { gap: 20px; margin-top: -88px; position: relative; padding: 24px; box-shadow: var(--shadow-lg); border-color: transparent }
.seg { display: inline-flex; gap: 4px; border-radius: 999px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); justify-self: start }
.seg label { position: relative; cursor: pointer }
.seg input { position: absolute; opacity: 0; pointer-events: none }
.seg span { display: block; font: 700 13px/1 var(--body); padding: 9px 16px; border-radius: 999px; color: var(--muted); transition: background .15s ease, color .15s ease }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 12px -4px var(--accent) }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px }
.sform { display: grid; gap: 12px }
.sform [hidden] { display: none }
.srow { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: stretch }
.srow.places { grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr); gap: 10px; align-items: center }
.field { display: grid; gap: 2px; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease }
.field:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft) }
.field > span { font: 700 11px/1.2 var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted) }
.field input, .field select { font: 600 15px/1.3 var(--body); color: var(--ink); background: transparent; border: 0; padding: 2px 0; width: 100%; min-width: 0 }
.field input:focus, .field select:focus { outline: none }
.field input::placeholder { color: var(--muted); font-weight: 500; opacity: .8 }
.field:has(input:disabled) { opacity: .5 }
.srow.places .field { padding: 14px 18px }
.srow.places .field input { font-size: 18px; font-weight: 700 }
.swap { position: relative; z-index: 1; justify-self: center; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; font-size: 18px;
  background: var(--surface); color: var(--accent); border: 1px solid var(--line); box-shadow: var(--shadow) }
.swap:hover { transform: rotate(180deg); filter: none }
.checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px }
.checks > label, .checks .checks > label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600 }
.checks > label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft) }
.checks > label:has(input:disabled) { opacity: .55; cursor: not-allowed }
.checks input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0 }
.sfoot { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding-top: 4px }
#s-go { padding: 15px 34px; font-size: 15px; box-shadow: 0 10px 24px -10px var(--accent) }
.ac { position: absolute; z-index: 50; list-style: none; margin: 0; padding: 6px; max-height: min(340px, 50vh); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg) }
.ac[hidden] { display: none }
.ac li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; min-height: 44px; border-radius: 10px; cursor: pointer; font-size: 15px }
.ac li[aria-selected="true"] { background: var(--accent-soft) }
.ac li:hover { background: var(--surface-2) } .ac li[aria-selected="true"]:hover { background: var(--accent-soft) }
.ac .ac-code { font: 500 12px/1 var(--mono); color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 5px 8px; flex: none; letter-spacing: .04em }
.ac li[aria-selected="true"] .ac-code { background: var(--surface) }
.ac .ac-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink) }
.ac .ac-name b { font-weight: 700; color: var(--accent) }
.dpick { font: 600 15px/1.3 var(--body); color: var(--ink); background: none; border: 0; border-radius: 0; padding: 2px 0; text-align: left; width: 100%; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.dpick:hover { filter: none } .dpick:focus-visible { outline: none } .dpick[disabled] { cursor: not-allowed; opacity: 1 }
.dpick .ph { color: var(--muted); font-weight: 500 }
.field:has(.dpick) { cursor: pointer }
.dp { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 14px 16px 16px; color: var(--ink) }
.dp[hidden], .dp-back[hidden] { display: none }
.dp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px }
.dp-head > b { flex: 1; font: 700 11px/1.2 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted) }
.dp-head button, .dp-nav { width: 36px; height: 36px; padding: 0; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; flex: none }
.dp-head button svg, .dp-nav svg { display: block }
.dp-head button:hover:not([disabled]), .dp-nav:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); filter: none }
.dp-nav[disabled] { opacity: .35; cursor: default }
.dp-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-width: 0; margin-bottom: 12px }
.dp-tab:hover { border-color: var(--accent); filter: none }
.dp-tab { color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: start; gap: 3px; text-align: left; padding: 8px 12px; border-radius: 12px; font: 700 14px/1.2 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0 }
.dp-tab small { font: 700 10px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted) }
.dp-tab .ph { color: var(--muted); font-weight: 500 }
.dp-tab[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset }
.dp-tab[aria-pressed="true"] small { color: var(--accent) }
.dp-months { position: relative }
.dp-nav { position: absolute; top: 0; z-index: 1 } .dp-nav.prev { left: 0 } .dp-nav.next { right: 0 }
.dp-months { display: flex; gap: 28px }
.dp-month { width: 280px }
.dp-title { font: 700 15px/36px var(--display); text-align: center; margin: 0 0 8px }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px }
.dp-wk span { font: 700 11px/1 var(--body); color: var(--muted); text-align: center; padding: 6px 0 8px }
.dp-grid button { aspect-ratio: 1; width: 100%; padding: 0; border-radius: 999px; font: 600 14px/1 var(--body); color: var(--ink); background: none; font-variant-numeric: tabular-nums; position: relative }
.dp-grid button:hover:not([disabled]) { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); filter: none }
.dp-grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px }
.dp-grid button[disabled] { color: var(--muted); opacity: .4; cursor: default }
.dp-grid button.in, .dp-grid button.hov { background: var(--accent-soft); border-radius: 0 }
.dp.hovering .dp-grid button.in.act:not(.hov) { background: none }
.dp-grid button.hov:hover { background: var(--accent); color: var(--accent-ink); border-radius: 999px; box-shadow: none }
.dp.hovering:not(.flex) .dp-grid button.sel:not(.hov) { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent) }
.dp-grid button.today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent) }
.dp-grid button.sel, .dp-grid button.sel:hover, .dp-grid button.end, .dp-grid button.end:hover { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -6px var(--accent) }
.dp-grid button.end { background: color-mix(in srgb, var(--accent) 55%, var(--surface)) }
.dp-grid button.sel.today::after, .dp-grid button.end.today::after { background: var(--accent-ink) }
.dp-back { position: fixed; inset: 0; z-index: 59; background: rgb(10 15 28 / .45) }
@media (max-width: 640px) {
  .dp { position: fixed; left: 0; right: 0; bottom: 0; top: auto; border-radius: 22px 22px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); border-width: 1px 0 0 }
  .dp-months, .dp-month { width: 100% }
  .dp-grid button { font-size: 16px }
  .dpick .flexmark { display: none }
}
.srow.dates { grid-template-columns: repeat(2, minmax(0, 1fr)) }
.dpick .flexmark { font: 700 10px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 6px; vertical-align: 2px; margin-left: 4px }
.dp-head .dp-mode { display: flex; width: max-content; max-width: 100% }
.dp-head .dp-mode + .dp-close { margin-left: auto }
.dp-mode span { padding: 8px 14px }
.dp-hint { margin: -4px 0 12px; font-size: 13px; color: var(--muted) }
.progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--hero-3), var(--accent)); transition: width .3s ease }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none }
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px) }
.card.top { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.card .air { font-weight: 700; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center }
.leg-line { display: grid; grid-template-columns: 4.6em auto minmax(60px, 1fr) auto; gap: 12px; align-items: center; font-size: 14px }
.leg-line .t { font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums }
.leg-line .t sup { font-size: 10px; color: var(--warn); margin-left: 2px }
.leg-line .mid { display: grid; gap: 4px; text-align: center; font-size: 12px; color: var(--muted) }
.leg-line .mid i { display: block; height: 0; border-top: 2px dashed var(--line); position: relative; margin-inline: 6px }
.leg-line .mid i::before, .leg-line .mid i::after { content: ""; position: absolute; top: -5px; width: 8px; height: 8px; border-radius: 50% }
.leg-line .mid i::before { left: -6px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent) }
.leg-line .mid i::after { right: -6px; background: var(--accent) }
.leg-line .mid > span:first-child::after { content: " ✈"; color: var(--accent) }
.leg-line .lbl { font: 700 11px/1.2 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px }
.side { display: grid; gap: 8px; justify-items: end; align-content: center; text-align: right; padding-left: 24px; border-left: 2px dashed var(--line) }
.side .price { font-size: 26px; line-height: 1; color: var(--accent) }
.side a.book { font: 700 13px/1 var(--body); color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 11px 18px; text-decoration: none; white-space: nowrap; box-shadow: 0 8px 18px -8px var(--accent) }
.side a.book:hover { filter: brightness(1.06) }
.card .note { grid-column: 1 / -1; font-size: 12px; color: var(--muted) }
.card .note.warn { color: var(--warn) }
@media (max-width: 640px) {
  .hero { padding-bottom: 104px }
  .search-panel { padding: 18px; margin-top: -76px }
  .srow.places { grid-template-columns: 1fr; gap: 0 }
  .srow.places .field:first-child { margin-bottom: -22px } .srow.places .field:last-child { margin-top: -22px }
  #go { width: 100% }
  .swap { justify-self: end; margin-right: 18px; transform: rotate(90deg) }
  .swap:hover { transform: rotate(270deg) }
  .card { grid-template-columns: minmax(0, 1fr); padding: 16px }
  .side { display: flex; flex-wrap: wrap; text-align: left; align-items: center; gap: 6px 12px; padding: 12px 0 0; border-left: 0; border-top: 2px dashed var(--line) }
  .side a.book { margin-left: auto }
  .leg-line { grid-template-columns: 3.6em auto minmax(24px, 1fr) auto; gap: 6px }
  .leg-line .t { font-size: 17px }
}

/* ---- Fare Engine ---- */
.ac-wrap { position: relative }
.sfoot .hint { max-width: 60ch }
#go { padding: 15px 34px; font-size: 15px; box-shadow: 0 10px 24px -10px var(--accent) }
.summary { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) }
.stat { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; background: var(--surface-2) }
.stat .k { font: 700 11px/1.2 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted) }
.stat .price { font-size: 26px; line-height: 1.1 }
.stat.win { border-color: var(--good); background: var(--good-soft) }
.stat.win .price { color: var(--good) }
.bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between }
.kind { font: 700 11px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; padding: 5px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line) }
.kind.split { background: var(--accent-soft); color: var(--accent); box-shadow: none }
.kind.nearby { background: var(--warn-soft); color: var(--warn); box-shadow: none }
.legrow { display: grid; gap: 6px }
.legrow .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); align-items: center }
.legrow .meta b { color: var(--ink); font-weight: 700 }
.legrow .meta a { color: var(--accent); font-weight: 600; text-decoration: none; margin-left: auto }
.legrow .meta a:hover { text-decoration: underline }
.conn { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--warn); padding: 8px 12px; border-radius: 12px; background: var(--warn-soft) }
.notes { grid-column: 1 / -1; list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 12px; color: var(--muted) }
.notes .warn { color: var(--warn) }
.saving { font: 700 12px/1 var(--body); color: var(--good); background: var(--good-soft); border-radius: 999px; padding: 5px 9px }
.dirs { justify-self: start }
[hidden] { display: none !important }
.bar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none }
.bar .seg span { white-space: nowrap }
