:root {
  --page: #edf0f3;
  --surface: #ffffff;
  --ink: #1c2331;
  --muted: #626b78;
  --line: #d5dae1;
  --action: #174ea6;
  --action-ink: #ffffff;
  --ok: #14713d;
  --ok-bg: #e8f5ec;
  --deduct: #9a5b00;
  --deduct-bg: #fff4e0;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--action); }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 .35rem; }
h2 { font-size: 1.1rem; font-weight: 650; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.lede { color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: .25rem; }
.crumb { margin-bottom: .5rem; }

/* ---- chrome ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.25rem;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.nav { display: flex; gap: 1.1rem; align-items: center; font-size: .95rem; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav a.primary { color: var(--action); font-weight: 600; }
.nav .who { color: var(--muted); }
.page { max-width: 1040px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.narrow { max-width: 480px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* ---- flash / notices ---- */
.flash { padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.notice { background: var(--deduct-bg); color: var(--deduct); padding: .6rem .8rem; border-radius: var(--radius); }
.warn { color: var(--deduct); }
.note { font-style: italic; color: var(--muted); }
.empty { background: var(--surface); border: 1px dashed var(--line); padding: 1.5rem; border-radius: var(--radius); color: var(--muted); }

/* ---- forms ---- */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
label { display: block; font-weight: 600; font-size: .92rem; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: .3rem; }
input, select, textarea {
  font: inherit; font-weight: 400;
  padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
input[name="origin"], input[name="destination"] { text-transform: uppercase; letter-spacing: .06em; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--action); outline-offset: 2px;
}
.btn {
  display: inline-block; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: .5rem .9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
  align-self: flex-start;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--action); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); padding-left: 0; }

/* ---- results header ---- */
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.baseline {
  display: flex; flex-direction: column; align-items: flex-end;
  background: var(--ok-bg); color: var(--ok);
  padding: .5rem .9rem; border-radius: var(--radius); font-size: .85rem;
}
.baseline b { font-size: 1.25rem; }
.filters { display: flex; gap: .4rem; margin: 1rem 0; flex-wrap: wrap; }
.filters a {
  text-decoration: none; color: var(--ink); font-size: .9rem;
  padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.filters a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- offer rows: the fare ledger ---- */
.offers { display: flex; flex-direction: column; gap: .6rem; }
.offer {
  display: grid;
  grid-template-columns: 1fr 190px auto;
  gap: 1rem; align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--ok);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.offer-out { border-left-color: var(--deduct); }
.offer-airline { margin-bottom: .35rem; }
.offer-airline .muted { font-size: .88rem; margin-left: .35rem; }
.itin { display: flex; flex-direction: column; gap: .25rem; }
.leg { display: grid; grid-template-columns: 92px 1fr; column-gap: .75rem; font-size: .95rem; }
.leg-day { color: var(--muted); white-space: nowrap; }
.leg-times b { font-weight: 650; }
.leg-times .arrow { color: var(--muted); margin: 0 .2rem; }
.leg-meta { grid-column: 2; color: var(--muted); font-size: .85rem; }

.settle { padding: .5rem .75rem; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok); font-size: .85rem; }
.settle-deduct { background: var(--deduct-bg); color: var(--deduct); }
.settle-total { font-size: 1.35rem; font-weight: 700; color: var(--ink); line-height: 1.2; margin-bottom: .2rem; }
.settle-line { display: flex; justify-content: space-between; gap: .5rem; }
.settle-line b { font-weight: 650; white-space: nowrap; }
.settle-you { font-weight: 600; }

.offer-pick { justify-self: end; }
.offer-pick summary { list-style: none; white-space: nowrap; }
.offer-pick summary::-webkit-details-marker { display: none; }
.offer-pick[open] { grid-column: 1 / -1; justify-self: stretch; border-top: 1px solid var(--line); padding-top: .9rem; }
.offer-pick[open] summary { display: none; }
.offer-pick form { max-width: 560px; }

/* ---- panels, tables, pills ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: 1rem; }
.facts { display: grid; grid-template-columns: 160px 1fr; gap: .3rem .75rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: .93rem; margin-top: .5rem; }
.list th, .list td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-weight: 600; color: var(--muted); font-size: .85rem; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tfoot th { color: var(--ink); border-top: 2px solid var(--line); border-bottom: 0; }
.num { text-align: right !important; white-space: nowrap; }
.deduct { color: var(--deduct); font-weight: 600; }

.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill-pending { background: #e6ecf7; color: var(--action); }
.pill-approved { background: var(--ok-bg); color: var(--ok); }
.pill-booked { background: var(--ink); color: #fff; }
.pill-rejected { background: var(--danger-bg); color: var(--danger); }
.pill-cancelled { background: var(--page); color: var(--muted); }

@media (max-width: 760px) {
  .offer { grid-template-columns: 1fr; }
  .offer-pick { justify-self: start; }
  .settle { width: 100%; }
  .leg { grid-template-columns: 1fr; }
  .leg-meta { grid-column: 1; }
  .list { display: block; overflow-x: auto; }
  .nav { gap: .7rem; font-size: .88rem; }
  .nav .who { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: filter .12s, border-color .12s; }
}

/* ---- events ---- */
.cards { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }
.card { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--action); border-radius: var(--radius); padding: .9rem 1rem; }
.card-action { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; white-space: nowrap; }
.facts-tight { grid-template-columns: 110px 1fr; margin-top: .4rem; font-size: .93rem; }
.window { background: #e6ecf7; color: var(--action); padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; }
.window .muted { color: var(--action); opacity: .8; font-size: .88rem; }
.window-line { margin-top: .25rem; }
.offer-misfit { opacity: .75; border-left-color: var(--line); }
.offer-misfit .settle { background: var(--page); color: var(--muted); }
.offer-misfit .settle-total { color: var(--muted); }
@media (max-width: 760px) { .card { flex-direction: column; } .card-action { align-items: flex-start; } }

/* ---- grouped flights: one itinerary, many fares ---- */
.small { font-size: .88rem; }
.flight { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.flight-head { padding: .9rem 1rem .7rem; }
.fares { border-top: 1px solid var(--line); }
.fare { border-top: 1px solid var(--line); border-left: 5px solid var(--ok); }
.fare:first-child { border-top: 0; }
.fare-out { border-left-color: var(--deduct); }
.fare-row { display: grid; grid-template-columns: 1fr 110px minmax(200px, 1.1fr) auto; gap: 1rem; align-items: center; padding: .55rem 1rem .55rem .9rem; font-size: .92rem; cursor: pointer; list-style: none; }
.fare-row::-webkit-details-marker { display: none; }
.fare-row:hover { background: #f6f8fa; }
.fare-name { color: var(--ink); }
.fare-price { font-weight: 700; font-size: 1.05rem; text-align: right; white-space: nowrap; }
.fare-settle { font-size: .86rem; color: var(--ok); }
.fare-out .fare-settle { color: var(--deduct); }
.fare-settle em { font-style: normal; color: var(--muted); }
.fare-btn { padding: .35rem .8rem; font-size: .88rem; }
.fare[open] .fare-btn { visibility: hidden; }
.fare-form { padding: .5rem 1rem 1rem; max-width: 620px; border-top: 1px dashed var(--line); }
.reason { color: var(--ink); }
.offer-misfit .fare { border-left-color: var(--line); }
@media (max-width: 760px) {
  .fare-row { grid-template-columns: 1fr auto; }
  .fare-settle { grid-column: 1 / -1; }
  .fare-btn { grid-column: 2; grid-row: 1; }
}

/* ---- class grid ---- */
.airports-line { margin-top: .25rem; }
.alt-tag { display: inline-block; margin-left: .4rem; font-size: .8rem; font-weight: 600; color: var(--deduct); background: var(--deduct-bg); padding: .05rem .45rem; border-radius: 999px; }
.grid-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid th { text-align: left; font-size: .78rem; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .6rem .75rem; border-bottom: 2px solid var(--line); background: #f6f8fa; }
.grid th.grid-flight { min-width: 300px; }
.grid td { vertical-align: top; padding: .7rem .75rem; border-bottom: 1px solid var(--line); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .cell { min-width: 150px; }
.grid-misfit td { opacity: .7; }
.fare-chip { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: .4rem .55rem; margin-bottom: .4rem; font: inherit; color: var(--ink); cursor: pointer; }
.fare-chip:last-child { margin-bottom: 0; }
.fare-chip:hover { border-color: var(--ink); border-left-color: var(--ok); }
.chip-out { border-left-color: var(--deduct); }
.chip-out:hover { border-left-color: var(--deduct); }
.chip-active { outline: 2px solid var(--action); outline-offset: 1px; }
.fare-dead { border-left-color: var(--line); cursor: default; color: var(--muted); }
.chip-price { display: block; font-weight: 700; font-size: 1.02rem; }
.chip-name { display: block; font-size: .85rem; }
.chip-meta { display: block; font-size: .78rem; color: var(--muted); }
.chip-settle { display: block; font-size: .78rem; font-weight: 600; color: var(--ok); }
.chip-out .chip-settle { color: var(--deduct); }
.grid-panel-row td { background: #f6f8fa; padding: 0; }
.pick-panel { margin: 0; border: 0; border-radius: 0; border-top: 3px solid var(--action); }
.pick-panel form { max-width: 620px; }
label.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; font-size: .92rem; }
label.check input { width: auto; margin-top: .25rem; }
label.check em { font-style: normal; font-weight: 600; }
.w-code { flex: 0 1 140px !important; }
fieldset.status { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem .9rem; }
fieldset.status legend { font-weight: 600; font-size: .92rem; padding: 0 .3rem; }
.status-row { margin-top: .4rem; }
.self-tag { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--action); background: #e6ecf7; padding: .1rem .5rem; border-radius: 999px; }

.decline summary { list-style: none; }
.decline summary::-webkit-details-marker { display: none; }
.decline[open] { background: var(--page); padding: .6rem .8rem; border-radius: var(--radius); }
.decline[open] summary { display: none; }
.decline form { min-width: 240px; }
.alt-soft { color: var(--muted); background: var(--page); }

/* ---- rental car, people ---- */
.car { font-size: .9rem; line-height: 1.5; }
.car-wrap { margin-top: .5rem; padding: .5rem .7rem; background: var(--page); border-radius: var(--radius); }
.car-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .15rem; }
.car-cell { min-width: 180px; }
.car-edit summary { list-style: none; padding-left: 0; }
.car-edit summary::-webkit-details-marker { display: none; }
.car-edit[open] summary { display: none; }
.car-edit form { min-width: 320px; margin-top: .3rem; }
.status-head { font-size: .8rem; color: var(--muted); font-weight: 600; margin-top: .5rem; }
.status-head span { flex: 1 1 160px; }
.status-row label { margin: 0; }
.status-row label > input { margin-top: 0; }

/* ---- legs ---- */
.leg-tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; padding: .1rem .45rem; border-radius: 3px; vertical-align: middle; margin-right: .2rem; }
.leg-outbound { background: #e6ecf7; color: var(--action); }
.leg-return { background: #efe9f7; color: #5b3d99; }
.leg-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem; }
.leg-name { font-size: .85rem; color: var(--muted); min-width: 92px; }
.card-action { align-items: stretch; }
.card-action .leg-line { justify-content: flex-end; }
h1 .leg-tag { font-size: .8rem; vertical-align: middle; position: relative; top: -3px; }

.decline[open] { width: 100%; }
.decline summary.btn-primary { display: inline-block; }
.card-action .leg-line { flex-wrap: wrap; }

/* ---- suggestions, hubs ---- */
.suggest { background: #fffbea; border: 1px solid #f2e4a0; border-radius: var(--radius); padding: .8rem 1.1rem; margin: .75rem 0 1rem; }
.suggest h2 { font-size: .95rem; margin-bottom: .35rem; }
.suggest ul { margin: 0; padding-left: 1.2rem; }
.suggest li { margin: .2rem 0; font-size: .93rem; }
.suggest .jump { margin-left: .3rem; }
.hub-tag { display: inline-block; margin-left: .4rem; font-size: .78rem; font-weight: 600; color: var(--action); background: #e6ecf7; padding: .05rem .45rem; border-radius: 999px; }
.chip-flash { outline: 3px solid #e0b400; outline-offset: 2px; }
.st-bags { align-self: end; padding-bottom: .55rem; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.st-remove { align-self: end; padding-bottom: .4rem; }
#st-add { margin-top: .5rem; }
.status-row { align-items: flex-end; }
.medium { max-width: 720px; }
.status-row { flex-wrap: nowrap; }
.status-row label.w-code { flex: 0 0 200px !important; }
.status-row label { flex: 1 1 140px; }
@media (max-width: 760px) { .status-row { flex-wrap: wrap; } }

/* ---- tickets, forwarding ---- */
.ticket { border-left: 5px solid var(--ok); }
.pnr { font-weight: 700; font-size: 1.15rem; letter-spacing: .1em; }
.fwd-tag { display: inline-block; margin-right: .4rem; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--page); color: var(--muted); }
.fwd-me { background: #e0b400; color: #3d3000; }
.forward { margin-top: .75rem; }
.forward summary { list-style: none; }
.forward summary::-webkit-details-marker { display: none; }
.forward[open] summary { display: none; }
.forward form { max-width: 420px; margin-top: .5rem; }
.cls { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* ---- seat map ---- */
.cabin { display: inline-block; background: var(--page); border-radius: 12px; padding: .8rem 1rem; max-height: 420px; overflow-y: auto; }
.seat-row { display: flex; align-items: center; gap: .25rem; margin-bottom: .25rem; }
.row-label { width: 24px; text-align: right; margin-right: .4rem; color: var(--muted); font-size: .8rem; }
.aisle-gap { width: 22px; }
.seat { width: 30px; height: 30px; border-radius: 6px 6px 3px 3px; font-size: .75rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
button.seat { cursor: pointer; font: inherit; font-size: .75rem; font-weight: 600; }
.seat-open { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cc; }
.seat-fee { background: var(--deduct-bg); color: var(--deduct); border-color: #ecd6a8; }
.seat-taken { background: #e3e6ea; color: #a6adb6; }
.seat-sel { outline: 3px solid var(--action); outline-offset: 1px; background: var(--action); color: #fff; }
.seat-choice { margin-left: .6rem; }

/* ---- quick find ---- */
.findbar { flex: 1 1 auto; max-width: 340px; margin: 0 1.2rem; }
.findbar input { width: 100%; padding: .4rem .7rem; border-radius: 999px; font-size: .9rem; }
.findbar-page { display: flex; gap: .5rem; max-width: 560px; margin: 0 0 1.25rem; }
.findbar-page input { border-radius: var(--radius); padding: .55rem .7rem; }
@media (max-width: 900px) { .topbar .findbar { display: none; } }

/* ---- result filters ---- */
.filterbar { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin: .25rem 0 .5rem; }
.fgroup { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.flabel { font-size: .8rem; color: var(--muted); font-weight: 600; margin-right: .1rem; }
.fpill { text-decoration: none; color: var(--ink); font-size: .85rem; padding: .25rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); white-space: nowrap; }
.fpill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.fclear { color: var(--danger); border-color: var(--danger-bg); background: var(--danger-bg); }

fieldset.variant { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .9rem .7rem; }
fieldset.variant legend { font-weight: 600; font-size: .92rem; padding: 0 .3rem; }
fieldset.variant .check { margin: .25rem 0; }
#pick-flex-wrap { background: var(--page); padding: .5rem .7rem; border-radius: var(--radius); }

/* ---- loading overlay & seats-left ---- */
.loading-overlay { position: fixed; inset: 0; background: rgba(247,248,250,.88); display: flex; align-items: center; justify-content: center; z-index: 50; }
.loading-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 2rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; box-shadow: 0 10px 30px rgba(15,23,42,.12); max-width: 320px; text-align: center; }
.loading-box span { color: var(--muted); font-size: .88rem; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--action); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seats-left { color: var(--deduct); font-weight: 600; }

/* ---- connection breakdown ---- */
.conn { margin: .35rem 0 .1rem; padding-left: .85rem; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: .15rem; }
.conn-seg { display: flex; flex-wrap: wrap; gap: .15rem .75rem; align-items: baseline; }
.conn-times { font-size: .88rem; }
.conn-meta { font-size: .8rem; color: var(--muted); }
.conn-stop { font-size: .8rem; color: var(--deduct); font-weight: 600; margin: .1rem 0; display: flex; align-items: center; gap: .4rem; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--deduct); display: inline-block; }
.conn-stop .warn { color: var(--danger); }
[hidden] { display: none !important; }
.grid td:first-child { min-width: 265px; }
.conn-times { white-space: nowrap; }
.conn-stop { flex-wrap: wrap; }
.conn { min-width: 250px; }
.conn-meta, .conn-stop { white-space: nowrap; }
.grid td:first-child { min-width: 300px; }

/* seat-picker Clear as a real button */
.seat-clear { background: var(--page); border: 1px solid var(--line); color: var(--ink); padding: .25rem .8rem; border-radius: 6px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.seat-clear:hover { background: #e8ebef; border-color: #c7cdd6; }

/* ---- airport autocomplete + seat clear ---- */
.ac-wrap { position: relative; display: block; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 10px 24px rgba(15,23,42,.14); z-index: 30; max-height: 300px; overflow-y: auto; }
.ac-row { padding: .5rem .7rem; cursor: pointer; font-size: .92rem; display: flex; gap: .45rem; align-items: baseline; flex-wrap: wrap; }
.ac-row:hover { background: var(--page); }
.ac-row b { min-width: 2.6em; }
.ac-name { color: var(--ink); }
.ac-hub { font-size: .75rem; color: var(--action); background: #e6ecf7; border-radius: 999px; padding: .05rem .45rem; }
.seat-clear { background: var(--page); border: 1px solid var(--line); padding: .25rem .7rem; font-size: .8rem; }
.seat-clear:hover { background: #e8ebef; }
.conf { letter-spacing: .06em; }
