/* ============================================================================
   Atlas — component stylesheet
   ----------------------------------------------------------------------------
   Flat, editorial award/cash flight UI. No glow, no gradients-as-decoration.
   Consumes design tokens defined elsewhere (e.g. tokens.css / :root):

     Surfaces   --bg --surface --surface-raised
     Ink        --ink --muted-1 --muted-2 --muted-3
     Lines      --border --border-soft
     Brass      --brass --brass-deep --brass-tint-bg --brass-tint-bd
     Seat pill  --seat-bg --seat-fg
     Category   --cat-<name>-line  (swatch / arc color)
                --cat-<name>-bg    (soft fill)
     Radii      --r-card --r-pill --r-input --r-tile
     Shadow     --shadow-card --shadow-float

   Type:
     Newsreader  — headlines, destinations, prices/miles (editorial serif)
     DM Mono     — eyebrows, programs, metadata (monospace)

   Layout philosophy: mobile-first. Base rules target a phone; progressive
   `min-width` media queries layer on the desktop topbar + rail + list grid.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   0. Local component scales
   These are *component* knobs, not global theme tokens. Kept here so the
   stylesheet drops in standalone; override in :root if you want to retune.
   -------------------------------------------------------------------------- */
.atlas {
  --atlas-rail-w: 222px;          /* left filter rail width (212–230 range)   */
  --atlas-topbar-h: 60px;         /* top bar height                            */
  --atlas-gap: 16px;              /* default content gutter                     */
  --atlas-tile: 34px;            /* airline logo tile size                     */
  /* --atlas-eyebrow lives once in atlas.css :root (11px) — do not re-declare here */

  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Shared type primitives ---------------------------------------------------- */
.atlas-serif   { font-family: "Newsreader", Georgia, "Times New Roman", serif; }
.atlas-mono    { font-family: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace; }

/* The eyebrow: small, uppercase, tracked-out mono label that heads a section. */
.atlas-eyebrow {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: var(--atlas-eyebrow);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ============================================================================
   1. TOP BAR  (.atlas-topbar)
   Wordmark · Award/Cash segmented · prominent search · From-selector ·
   day/night toggle · avatar. Single flat row; search flex-grows to fill.
   ========================================================================== */
.atlas-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--atlas-topbar-h);
  padding: 0 var(--atlas-gap);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* Logo — a violet "outlier" mark (a cluster ring + one standout dot) + the editorial-serif wordmark. */
.atlas-topbar .wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Newsreader", Georgia, serif;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--brand);
  line-height: 1;
  flex: 0 0 auto;
  user-select: none;
}
.atlas-topbar .brand-mark { width: 22px; height: 22px; flex: 0 0 auto; display: block; }

/* --- Award / Cash segmented control ------------------------------------- */
.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted-1);
  padding: 6px 16px;
  border-radius: var(--r-pill);
  transition: color 120ms ease, background 120ms ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"],
.segmented button.is-active {
  background: var(--ink);
  color: var(--surface);     /* paper text on ink fill */
}

/* --- Prominent search input ---------------------------------------------- */
.atlas-search {
  position: relative;
  flex: 1 1 auto;             /* the star of the bar — eats remaining width  */
  min-width: 120px;
}
.atlas-search input {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  padding: 0 14px 0 38px;     /* room for the leading search glyph           */
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
/* Editorial italic placeholder — invites a question, not a keyword. */
.atlas-search input::placeholder {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: var(--muted-2);
  opacity: 1;
}
/* Brass focus ring — the only "active" accent in the chrome. */
.atlas-search input:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-tint-bg);
}
.atlas-search .search-glyph {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}

/* --- "From New York" origin selector ------------------------------------ */
.origin-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  height: 40px;
  padding: 0 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
  transition: border-color 120ms ease;
}
.origin-select:hover { border-color: var(--muted-3); }
.origin-select .label { font-size: 12px; color: var(--muted-1); }   /* "From" */
.origin-select .value { font-size: 14px; font-weight: 500; }        /* "New York" */
.origin-select .caret { width: 12px; height: 12px; color: var(--muted-2); }

/* --- Day / night toggle --------------------------------------------------- */
.daynight {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--muted-1);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.daynight:hover { color: var(--ink); border-color: var(--muted-3); }
.daynight svg { width: 17px; height: 17px; }

/* --- Avatar --------------------------------------------------------------- */
.atlas-topbar .avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted-1);
  cursor: pointer;
}
.atlas-topbar .avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================================
   2. LEFT FILTER RAIL  (.atlas-rail)
   Sections headed by mono eyebrows: trip-length legend, cabin 2x2 grid,
   transfer-from program chips. Hidden on mobile (filters live in the sheet).
   ========================================================================== */
.atlas-rail {
  display: none;                          /* mobile: rail collapses           */
  flex: 0 0 var(--atlas-rail-w);
  width: var(--atlas-rail-w);
  box-sizing: border-box;
  padding: 18px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.rail-section { margin-bottom: 22px; }
.rail-section:last-child { margin-bottom: 0; }
.rail-section > .atlas-eyebrow { display: block; margin-bottom: 10px; }

/* --- Trip-length LEGEND rows --------------------------------------------- */
/* Each row: a thin color line-swatch (category) + label + count pushed right. */
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  transition: background 110ms ease, box-shadow 110ms ease;
}
.legend-row:hover { background: var(--bg); }

/* The swatch is the editorial signature: a 16x3 hairline, not a dot. */
.legend-row .swatch {
  flex: 0 0 auto;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--muted-3);             /* fallback; overridden per category */
}
.legend-row .label { font-size: 13.5px; line-height: 1; }
/* Count floats to the right edge of the row. */
.legend-row .count {
  margin-left: auto;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* Selected row = faint inset hairline (ink for default, brass for emphasis). */
.legend-row[aria-pressed="true"],
.legend-row.is-selected {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
}
.legend-row.is-selected .count { color: var(--ink); }

/* Per-category swatch colors. Class per trip-length bucket; the swatch inherits
   the matching --cat-*-line token. Bucket names MIRROR THE REAL DATA
   (routes.json primary_bucket): all / weekend / one_week / two_weeks, plus the
   purple-flare "outlier" standout. (Tokens defined in atlas.css.) */
.legend-row.cat-all       .swatch { background: var(--cat-all-line); }
.legend-row.cat-weekend   .swatch { background: var(--cat-weekend-line); }
.legend-row.cat-one_week  .swatch { background: var(--cat-one_week-line); }
.legend-row.cat-two_weeks .swatch { background: var(--cat-two_weeks-line); }
.legend-row.cat-outlier .swatch { background: var(--cat-outlier-line); }
/* Selected category rows pick up the soft category fill for a quiet wash. */
.legend-row.cat-all.is-selected        { background: var(--cat-all-bg); }
.legend-row.cat-weekend.is-selected    { background: var(--cat-weekend-bg); }
.legend-row.cat-one_week.is-selected   { background: var(--cat-one_week-bg); }
.legend-row.cat-two_weeks.is-selected  { background: var(--cat-two_weeks-bg); }
.legend-row.cat-outlier.is-selected{ background: var(--cat-outlier-bg); }

/* --- Cabin 2x2 grid ------------------------------------------------------- */
.cabin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.cabin-grid button {
  appearance: none;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 9px 8px;
  text-align: center;
  transition: background 110ms ease, color 110ms ease, border-color 110ms ease;
}
.cabin-grid button:hover { border-color: var(--muted-3); }
/* Selected = ink fill, paper text (matches the segmented control). */
.cabin-grid button[aria-pressed="true"],
.cabin-grid button.is-selected {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

/* --- Transfer-from program chips ----------------------------------------- */
.program-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* These chips are INFORMATIONAL only (non-interactive <span>s in a role="group" labelled
   "Transfer from"). They must not advertise interactivity: no pointer cursor, no hover/selected
   state — those affordances are leftovers from when they were buttons with a handler. */
.program-chips .chip {
  cursor: default;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted-1);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 5px 11px;
}

/* ============================================================================
   3. TICKET CARD  (.ticket)
   Logo tile · airline + program · miles + cash · flight timeline · footer.
   The .outlier variant tints purple (the "flare") and adds a tag + context line.
   ========================================================================== */
.ticket {
  position: relative;
  display: block;
  box-sizing: border-box;
  --card-bg: var(--surface);   /* itinerary layover label sits over this to break the hairline cleanly */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 14px 16px 12px;
  text-align: left;
  width: 100%;
}

/* Clickable ticket (chat results) -> draws the flight's routing on the globe. */
.ticket.tp-clickable { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.ticket.tp-clickable:hover { border-color: var(--brass, #b08a3e); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.ticket.tp-clickable:active { transform: translateY(1px); }
.ticket.tp-clickable:focus-visible { outline: 2px solid var(--brass, #b08a3e); outline-offset: 2px; }

/* Discovery shortlist (Jake "where can my points go?") — tappable city rows */
.disco { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
/* nowrap + city-truncates: a long city name (e.g. "Buenos Aires Argentina") ellipsizes rather than
   shoving the cost onto a second line on a ~320px phone — matches the proven classic.html behavior. */
.disco-row { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: baseline; gap: 10px;
  width: 100%; text-align: left; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease; }
.disco-row:hover { border-color: var(--brass, #b08a3e); box-shadow: 0 3px 12px rgba(0,0,0,.10); }
.disco-row:active { transform: translateY(1px); }
.disco-row:focus-visible { outline: 2px solid var(--brass, #b08a3e); outline-offset: 2px; }
.disco-city { font-weight: 600; font-size: 14px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disco-cc { color: var(--muted-1); font-weight: 400; font-size: 12px; margin-left: 5px; }
.disco-cost { color: var(--muted-1); font-size: 12.5px; text-align: right; flex: 0 0 auto; white-space: nowrap; }
.disco-cost b { color: var(--ink); }
.disco-more { color: var(--muted-1); font-size: 12px; margin: 4px 2px 0; }

/* H6: per-award bookability badge (shows when the user's balances were sent + a transfer path exists) */
.ticket-book { margin-top: 9px; font-size: 12.5px; font-weight: 600; padding: 7px 10px; border-radius: 8px; line-height: 1.4; }
.ticket-book.ok { color: var(--seat-fg); background: var(--seat-bg); }
.ticket-book.no { color: var(--muted-1); background: var(--surface-raised); }

/* --- Header: logo tile + airline name + program -------------------------- */
.ticket-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}
/* Airline logo tile: light square, rounded 8, hairline border, contained img. The backing must stay
   LIGHT because avs.io logos are colored/dark artwork meant for white — a dark tile makes many vanish
   (verified). In dark mode we drop pure-#fff (a harsh blown-out square on near-black) to the brand's
   warm paper so it reads as an intentional logo card, not a glare. */
.ticket .logo-tile {
  flex: 0 0 auto;
  width: var(--atlas-tile);
  height: var(--atlas-tile);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
[data-theme="dark"] .ticket .logo-tile { background: #efe9dd; }
.ticket .logo-tile img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.ticket .airline { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ticket .airline-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Award program label — mono, muted, ONLY shown in award mode. */
.ticket .program {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  line-height: 1;
}
/* Cash mode hides the program line entirely (toggle this class on the root). */
.atlas[data-mode="cash"] .ticket .program { display: none; }

/* --- Price block: miles (big serif) + "+ $cash" right-aligned ------------ */
.ticket-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}
.ticket .miles {
  font-family: "Newsreader", Georgia, serif;
  font-size: 27px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ticket .miles .unit {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-left: 5px;
}
.ticket .cash {
  font-family: "Newsreader", Georgia, serif;
  font-size: 15px;
  color: var(--muted-1);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ticket .cash::before { content: "+ "; color: var(--muted-2); }

/* --- Itinerary: per-leg date + endpoints (code + time) + layover (airport · length). Shows the
   departure date, departure/arrival times, and layover location & length the chat now carries; each
   field renders only when known and gracefully omits otherwise. --- */
.itin { display: flex; flex-direction: column; gap: 9px; margin: 2px 0 1px; }
.itin .il-leg { display: flex; flex-direction: column; gap: 3px; }
.itin .il-date { font: 500 10px/1 "DM Mono", ui-monospace, monospace; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-2); }
.itin .il-row { display: flex; align-items: center; gap: 8px; }
.itin .il-ep { flex: 0 0 auto; display: flex; flex-direction: column; }
.itin .il-ep:last-child { align-items: flex-end; text-align: right; }
.itin .il-ep b { font-family: "Newsreader", Georgia, serif; font-size: 16px; font-weight: 600;
  line-height: 1.05; color: var(--ink); letter-spacing: 0.01em; }
.itin .il-ep .il-t, .itin .il-ep .il-c { font: 500 10.5px/1 "DM Mono", ui-monospace, monospace;
  font-style: normal; letter-spacing: 0.04em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.itin .il-ep .il-t { color: var(--ink); }
.itin .il-ep .il-c { color: var(--muted-2); }
.itin .il-mid { flex: 1 1 auto; min-width: 0; text-align: center; position: relative; }
.itin .il-mid::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.itin .il-via { position: relative; padding: 0 7px; background: var(--card-bg, var(--surface));
  font: 500 10px/1.3 "DM Mono", ui-monospace, monospace; letter-spacing: 0.02em; color: var(--muted-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: inline-block; }
.itin .il-mid.ns .il-via { color: var(--muted-2); }

/* --- Footer: seat pill + cabin + nights ---------------------------------- */
.ticket-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--border-soft);
}
/* Seat-availability pill — uses dedicated seat tokens. */
.ticket .seat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--seat-fg);
  background: var(--seat-bg);
  border-radius: var(--r-pill);
  padding: 3px 9px;
}
.ticket .foot-meta {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted-2);
}
/* dot separator between cabin and nights metadata. */
/* --muted-2 == --muted-3 by design (both tuned to clear AA), so the dot separator needs its own
   step-down to read one notch quieter than the meta text it sits between. */
.ticket .foot-meta .sep { margin: 0 6px; color: var(--muted-3); opacity: .7; }
.ticket .foot-meta .nights { color: var(--muted-1); }

/* --- OUTLIER variant -------------------------------------------------- */
/* Purple "flare": tint surface + a soft outer glow + tag + context line ("21% below median"). */
.ticket.outlier {
  --card-bg: var(--flare-tint-bg);
  background: var(--flare-tint-bg);
  border-color: var(--flare-tint-bd);
  box-shadow: 0 0 0 1px var(--flare-tint-bd), 0 6px 22px var(--flare-glow);
}
.ticket.outlier .ticket-foot { border-top-color: var(--flare-tint-bd); }
/* The OUTLIER tag — top-right corner, mono, purple flare. */
.ticket.outlier .outlier-tag {
  position: absolute;
  top: 12px;
  right: 14px;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;   /* match the spec's eyebrow tracking (§2) */
  text-transform: uppercase;
  color: var(--flare-deep);
  background: var(--surface);
  border: 1px solid var(--flare-tint-bd);
  border-radius: var(--r-pill);
  padding: 3px 8px;
}
/* (The outlier "context line" is rendered as .outlier-note and styled inline in index.html; the
   former .outlier-context rules here were dead — the markup never used that class — so they're removed.) */

/* ============================================================================
   4. LIST VIEW table  (.atlas-list)
   Columns: Destination · Route · Airline · Schedule · Seats · +Cash · Miles.
   Outlier rows tint brass with a 3px brass inset left bar. Sort control.
   ========================================================================== */
.atlas-list { width: 100%; }

/* --- Sort control (Best value / Miles / Cash) ---------------------------- */
.list-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.list-sort .label {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.list-sort .options { display: inline-flex; gap: 4px; }
.list-sort button {
  appearance: none;
  cursor: pointer;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--muted-1);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 4px 11px;
  transition: color 110ms ease, background 110ms ease, border-color 110ms ease;
}
.list-sort button:hover { color: var(--ink); }
.list-sort button[aria-pressed="true"],
.list-sort button.is-active {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--border);
}

/* --- The table ----------------------------------------------------------- */
.atlas-list table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;            /* clip the rounded corners over rows         */
}
.atlas-list thead th {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
/* Numeric columns right-align. */
.atlas-list th.num,
.atlas-list td.num { text-align: right; font-variant-numeric: tabular-nums; }

.atlas-list tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--ink);
  vertical-align: middle;
}
.atlas-list tbody tr:last-child td { border-bottom: 0; }
.atlas-list tbody tr { transition: background 100ms ease; }
.atlas-list tbody tr:hover { background: var(--bg); }

/* Destination cell — editorial serif, the column you read first. */
.atlas-list td.destination {
  font-family: "Newsreader", Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.atlas-list td.route,
.atlas-list td.schedule {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--muted-1);
  letter-spacing: 0.02em;
}
.atlas-list td.miles {
  font-family: "Newsreader", Georgia, serif;
  font-size: 16px;
  font-weight: 600;
}
.atlas-list td.cash { color: var(--muted-1); }
/* Airline cell — carrier LOGO + full name, with the loyalty program as an eyebrow beneath (award). */
.atlas-list .al { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; }
.atlas-list .al-logo { width: 18px; height: 18px; border-radius: 4px; flex: 0 0 auto;
  object-fit: contain; background: var(--surface-raised); }
.atlas-list .al-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atlas-list .al-prog { display: block; margin-top: 3px; }
/* Seats cell hosts a compact seat pill. */
.atlas-list td.seats .seat-pill {
  display: inline-flex;
  align-items: center;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--seat-fg);
  background: var(--seat-bg);
  border-radius: var(--r-pill);
  padding: 2px 7px;
}

/* Outlier row: purple-flare tint + a 3px purple inset left bar. */
.atlas-list tr.outlier td { background: var(--flare-tint-bg); }
.atlas-list tr.outlier:hover td { background: var(--flare-tint-bg); }
.atlas-list tr.outlier td:first-child {
  box-shadow: inset 3px 0 0 0 var(--flare-line);
}
.atlas-list tr.outlier td.miles { color: var(--flare-deep); }

/* ============================================================================
   5. MOBILE
   Phone-frame helper · draggable bottom sheet · bottom tab bar ·
   route-detail screen (fare, itinerary, transfer paths, sticky book bar).
   ========================================================================== */

/* --- Phone-frame layout helper ------------------------------------------- */
/* Wraps a mobile mock; on large screens it renders a device chrome, on a real
   phone it just fills the viewport. Purely a presentation helper. */
.phone-frame {
  position: relative;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 760px) {
  /* Show an actual device shell when there's room to frame it. */
  .phone-frame {
    min-height: auto;
    height: 780px;
    border: 10px solid var(--ink);
    border-radius: 44px;
    box-shadow: var(--shadow-float);
  }
}

/* --- Draggable bottom sheet  (.sheet) ------------------------------------ */
/* Holds the deal stack; slides up over the globe. JS drives the drag and the
   .is-peek / .is-open / .is-full state classes; CSS owns the look + motion. */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  max-height: 92%;
  background: var(--surface);
  border-top-left-radius: var(--r-card);
  border-top-right-radius: var(--r-card);
  box-shadow: var(--shadow-float);
  transform: translateY(calc(100% - 132px));   /* default peek height        */
  transition: transform 240ms cubic-bezier(.32, .72, 0, 1);
  touch-action: none;          /* let JS own the drag gesture                 */
}
.sheet.is-peek { transform: translateY(calc(100% - 132px)); }
.sheet.is-open { transform: translateY(25%); }
.sheet.is-full { transform: translateY(0); }
/* While the user is actively dragging, kill the transition for 1:1 tracking. */
.sheet.is-dragging { transition: none; }

/* Grab handle. */
.sheet .grabber {
  flex: 0 0 auto;
  align-self: center;
  width: 38px;
  height: 4px;
  margin: 9px 0 6px;
  border-radius: 2px;
  background: var(--muted-3);
  cursor: grab;
}
.sheet.is-dragging .grabber { cursor: grabbing; }
.sheet .sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 16px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.sheet .sheet-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.sheet .sheet-count {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted-2);
}
/* Scrollable body; momentum scroll only takes over once the sheet is open. */
.sheet .sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* --- Bottom tab bar  (.tabbar): Globe / List / Watched / You ------------- */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;          /* one row, N equal columns — adapts to 4 OR 5 tabs (Filters added on mobile) */
  grid-auto-columns: 1fr;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 7px;
  color: var(--muted-2);
  transition: color 110ms ease;
}
.tabbar .tab svg { width: 21px; height: 21px; }
.tabbar .tab .tab-label {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10.5px;     /* >= ~11px so labels stay legible on low-DPI phones */
  letter-spacing: 0.03em;
}
.tabbar .tab:hover { color: var(--muted-1); }
.tabbar .tab[aria-current="page"],
.tabbar .tab.is-active { color: var(--ink); }       /* active tab = full ink (icon + label) */
/* (brass is reserved for outlier fares — the active tab uses ink, not a brass icon accent) */

/* --- Outlier-fares entry points (topbar pill · rail call-to-action · list header) ---------
   Brass is the app's outlier-fare accent, so these standouts wear it. They were buried in the
   filter rail; these surface them "up top". */
.outlier-star { color: var(--flare-line); }
.outlier-link {
  appearance: none; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'DM Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .03em;
  color: var(--flare-deep); background: var(--flare-tint-bg);
  border: 1px solid var(--flare-tint-bd); border-radius: var(--r-pill);
  padding: 7px 13px; transition: background .15s, border-color .15s;
}
.outlier-link:hover { background: var(--flare-tint-bd); }
.outlier-rail {
  appearance: none; cursor: pointer; width: 100%; text-align: left;
  display: flex; align-items: center; gap: 10px;
  background: var(--flare-tint-bg); border: 1px solid var(--flare-tint-bd);
  border-radius: var(--r-card); padding: 11px 13px; margin: 0 0 14px;
  color: var(--flare-deep); transition: background .15s, border-color .15s;
}
.outlier-rail:hover { background: var(--flare-tint-bd); }
.outlier-rail .outlier-star { font-size: 17px; flex: 0 0 auto; }
.outlier-rail-txt { display: flex; flex-direction: column; flex: 1; min-width: 0;
  font-family: 'DM Mono', ui-monospace, monospace; font-size: 12.5px; }
.outlier-rail-txt small { font-family: -apple-system, system-ui, sans-serif; font-size: 11px;
  color: var(--muted-1); margin-top: 2px; letter-spacing: 0; }
.outlier-go { color: var(--flare-line); flex: 0 0 auto; font-size: 15px; }
.outlier-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--flare-tint-bg); border: 1px solid var(--flare-tint-bd);
  border-radius: var(--r-card); padding: 12px 14px; margin: 0 0 12px;
}
.outlier-head-txt { display: flex; flex-direction: column; min-width: 0;
  font-family: 'Newsreader', Georgia, serif; font-size: 17px; color: var(--ink); }
.outlier-head-txt small { font-family: 'DM Mono', ui-monospace, monospace; font-size: 11px;
  color: var(--muted-1); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.outlier-clear {
  appearance: none; cursor: pointer; white-space: nowrap;
  font-family: 'DM Mono', ui-monospace, monospace; font-size: 11.5px;
  color: var(--flare-deep); background: transparent;
  border: 1px solid var(--flare-tint-bd); border-radius: var(--r-pill); padding: 8px 12px;
}
.outlier-clear:hover { background: var(--flare-tint-bg); }
.outlier-ledger-link { color: var(--flare-deep); text-decoration: none; }
.outlier-ledger-link:hover, .outlier-ledger-link:focus-visible { text-decoration: underline; text-underline-offset: 2px; }

/* --- Route-detail screen ------------------------------------------------- */
/* Full-bleed mobile screen: fare header, itinerary timeline, transfer-path
   rows, then a sticky book bar pinned to the bottom. */
.route-detail {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--bg);
}
.route-detail .rd-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 16px 96px;     /* leave room for the sticky book bar         */
}

/* Fare header. */
.route-detail .rd-fare {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.route-detail .rd-fare .miles {
  font-family: "Newsreader", Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.route-detail .rd-fare .miles .unit {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted-2);
  margin-left: 5px;
}
.route-detail .rd-fare .cash {
  font-family: "Newsreader", Georgia, serif;
  font-size: 16px;
  color: var(--muted-1);
}

/* Section eyebrow inside the detail screen. */
.route-detail .rd-section { margin-top: 22px; }
.route-detail .rd-section > .atlas-eyebrow { display: block; margin-bottom: 12px; }

/* Itinerary timeline — vertical leg list (dep/arr stacked with a spine). */
.itinerary { display: flex; flex-direction: column; }
.itinerary .leg {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding-left: 4px;
}
/* Vertical spine connecting legs. */
.itinerary .leg::before {
  content: "";
  position: absolute;
  left: 60px;                  /* aligns with the node column                 */
  top: 18px;
  bottom: -4px;
  width: 1px;
  background: var(--border);
}
.itinerary .leg:last-child::before { display: none; }
.itinerary .leg-time {
  font-family: "Newsreader", Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.itinerary .leg-body { padding-bottom: 18px; position: relative; }
/* The node dot sits on the spine. */
.itinerary .leg-body::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--muted-2);
}
.itinerary .leg-airport {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.itinerary .leg-sub {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 2px;
}
/* Layover row between legs. */
.itinerary .layover {
  grid-column: 2;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--muted-2);
  padding: 4px 0 14px;
}

/* Transfer-path rows — "Amex MR -> Air France/KLM · 1:1 · instant". */
.transfer-path { display: flex; flex-direction: column; gap: 8px; }
.transfer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-tile);
}
.transfer-row .from,
.transfer-row .to { font-size: 13px; color: var(--ink); font-weight: 500; }
.transfer-row .arrow { color: var(--muted-3); flex: 0 0 auto; }
.transfer-row .meta {
  margin-left: auto;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--muted-2);
  text-align: right;
  white-space: nowrap;
}
.transfer-row .meta .ratio { color: var(--ink); }
.transfer-row .meta .speed.instant { color: var(--brass-deep); }

/* Sticky book bar — pinned to the bottom of the detail screen. */
.book-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.book-bar .bb-fare { display: flex; flex-direction: column; line-height: 1.2; }
.book-bar .bb-miles {
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.book-bar .bb-cash {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted-2);
}
/* Primary action — brass fill, the one solid-accent button in the system. */
.book-bar .bb-cta {
  appearance: none;
  margin-left: auto;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--seat-fg);
  background: var(--brass);
  border: 1px solid var(--brass-deep);
  border-radius: var(--r-pill);
  padding: 11px 22px;
  transition: background 120ms ease;
}
.book-bar .bb-cta:hover { background: var(--brass-deep); }

/* ============================================================================
   6. RESPONSIVE LAYOUT
   Mobile-first: base is the phone. Layer the desktop topbar + rail + list
   grid at progressively wider breakpoints. The app shell composes pieces;
   this just decides when the rail appears and how dense the chrome gets.
   ========================================================================== */

/* App shell: rail beside content once there's room. */
.atlas-shell { display: flex; min-height: 0; }

/* --- Small tablets / large phones (>= 640px) ----------------------------- */
@media (min-width: 640px) {
  /* Topbar can breathe; show all controls inline (already inline by default). */
  .atlas-topbar { gap: 16px; }
}

/* --- Tablet / small desktop (>= 880px): rail appears ---------------------- */
@media (min-width: 880px) {
  .atlas-rail { display: block; }     /* the left filter rail comes in        */
  /* Bottom sheet + tab bar are mobile-only affordances — hide on desktop. */
  .sheet,
  .tabbar { display: none; }
  /* On desktop the deal stack flows as cards in a grid instead of a sheet. */
  .ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    padding: var(--atlas-gap);
  }
}

/* --- Desktop (>= 1100px): roomier rail + multi-col cards ------------------ */
@media (min-width: 1100px) {
  .atlas { --atlas-rail-w: 230px; }
  .ticket-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

/* On true mobile, the list view collapses to stacked cards instead of a wide
   table (the table would overflow horizontally). Below 880px, prefer cards. */
@media (max-width: 879.98px) {
  .atlas-list table { display: none; }       /* hide the wide table          */
  .atlas-list.cards .ticket { margin-bottom: 11px; }
}

/* ----------------------------------------------------------------------------
   7. Motion & accessibility
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sheet,
  .segmented button,
  .cabin-grid button,
  .legend-row,
  .list-sort button,
  .tabbar .tab,
  .book-bar .bb-cta {
    transition: none;
  }
}

/* Visible keyboard focus for every interactive control — brass, flat. */
.atlas-topbar button:focus-visible,
.segmented button:focus-visible,
.atlas-search input:focus-visible,
.origin-select:focus-visible,
.daynight:focus-visible,
.legend-row:focus-visible,
.cabin-grid button:focus-visible,
.ticket:focus-visible,
.list-sort button:focus-visible,
.tabbar .tab:focus-visible,
.transfer-row:focus-visible,
.book-bar .bb-cta:focus-visible {
  outline: 2px solid var(--brass-deep);   /* brass-deep clears the 3:1 non-text focus-ring minimum on light (brass was 2.65:1) */
  outline-offset: 2px;
}
