/* ===============================================================
   AirTicketMania — styles
   =============================================================== */
:root {
  --bg: #eef2f7; --panel: #fff; --panel2: #f5f7fb; --ink: #0f1b2d; --muted: #5b6b82; --line: #dde4ee;
  --accent: #0a6ebd; --accent-soft: rgba(10,110,189,.1); --good: #15803d; --good-soft: #dcfce7; --bad: #dc2626; --bad-soft: #fee2e2; --warn: #b45309; --warn-soft: #fef3c7;
  --navy: #0b1f3a; --navy2: #13305a; --board: #0a0d12; --amber: #ffb81c; --map-land: #c3d0e0;
  --shadow: 0 1px 2px rgba(15,27,45,.06), 0 6px 20px rgba(15,27,45,.07);
  --r: 14px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111e; --panel: #121b2c; --panel2: #18233a; --ink: #e8eef7; --muted: #95a5bd; --line: #26344d;
    --good: #4ade80; --good-soft: rgba(74,222,128,.13); --bad: #f87171; --bad-soft: rgba(248,113,113,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.13);
    --map-land: #2a3a55; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a111e; --panel: #121b2c; --panel2: #18233a; --ink: #e8eef7; --muted: #95a5bd; --line: #26344d;
  --good: #4ade80; --good-soft: rgba(74,222,128,.13); --bad: #f87171; --bad-soft: rgba(248,113,113,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.13);
  --map-land: #2a3a55; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 600 14px/1.45 var(--font); color: var(--ink); background: var(--bg); overflow: hidden; }
.screen { position: fixed; inset: 0; display: none; }
/* size screens to the visible area so iPhone Safari's toolbar never covers the bottom */
@supports (height: 100dvh) { .screen { bottom: auto; height: 100dvh; } }
.screen.active { display: flex; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
kbd { font: 700 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--panel2); }
a { color: var(--accent); }

/* ---------- buttons & inputs ---------- */
.btn {
  font: 800 14px var(--font); border: 1px solid var(--line); border-radius: 11px; padding: 9px 15px; cursor: pointer; background: var(--panel); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: transform .1s, filter .15s, background .15s; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .fare:focus-visible, .navbtn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.good { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.big { font-size: 17px; padding: 13px 24px; border-radius: 14px; }
.btn.sm { font-size: 12.5px; padding: 6px 11px; border-radius: 9px; }
.btn.xs { font-size: 11.5px; padding: 3px 8px; border-radius: 7px; }
input[type=text], input[type=number], select { font: 700 14px var(--font); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); max-width: 100%; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=range] { accent-color: var(--accent); width: 160px; }
input[type=color] { width: 40px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); }
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #b8c2cf; border-radius: 25px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 19px; height: 19px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(19px); }
.switch input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; border-radius: 999px; font: 800 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 800 12.5px var(--font); padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.tog > div { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.bar { height: 8px; border-radius: 8px; background: var(--panel2); overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 8px; transition: width .4s; }
.al-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; color: #fff; font: 800 11px var(--mono); letter-spacing: .02em; }

/* ---------- title ---------- */
#screen-title { align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #173a6b, #0b1f3a 55%, #050c18); color: #fff; overflow: auto; }
#title-map { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.title-wrap { position: relative; text-align: center; padding: 32px 16px; max-width: 640px; }
.title-badge { font-size: 42px; letter-spacing: 6px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.title-name { font-size: clamp(42px, 9vw, 78px); line-height: 1; margin: 10px 0 6px; letter-spacing: -.03em; }
.title-name span { color: var(--amber); }
.title-sub { margin: 0 0 18px; font-size: 18px; opacity: .85; }
.title-board { margin: 0 auto 22px; max-width: 560px; }
.title-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.title-btns .btn:not(.primary) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.title-back { display: inline-block; margin-top: 22px; color: rgba(255,255,255,.7); font-weight: 800; text-decoration: none; }
.title-back:hover { color: #fff; }

/* ---------- departure board (split-flap) ---------- */
.board { background: var(--board); color: var(--amber); font: 700 13px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 34px; overflow: hidden; border-bottom: 1px solid #000; flex: none; cursor: pointer; }
.board .lbl { color: #9aa6b6; font-size: 11px; flex: none; }
.board .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flap { display: inline-block; min-width: .62em; text-align: center; }
.flap.f { animation: flap .07s linear; }
@keyframes flap { 50% { transform: scaleY(.2); opacity: .5; } }
.title-board.board, .title-board .board { border-radius: 8px; border: 1px solid #222; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }

/* ---------- setup ---------- */
#screen-setup { overflow: auto; background: var(--bg); }
.setup { width: 100%; max-width: 980px; margin: 0 auto; padding: 16px 16px 0; padding-top: max(16px, env(safe-area-inset-top)); }
.setup-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.setup-head h2 { font-size: 24px; }
.setup-body { display: grid; gap: 14px; }
.setup-sec h3 { font-size: 15px; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.setup-sec h3 small { color: var(--muted); font-weight: 700; font-size: 12px; }
.hq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.hq { border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 9px 10px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.hq b { display: block; font-size: 14px; }
.hq small { color: var(--muted); font-weight: 700; }
.hq.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.diff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.setup-foot { position: sticky; bottom: 0; z-index: 2; margin: 6px -16px 0; padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); display: flex; justify-content: center; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 22px; }
.opt { display: flex; flex-direction: column; gap: 5px; }
.opt > span { font-weight: 800; font-size: 13px; }
.prog-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.prog-pick button { text-align: left; }

/* ---------- game shell ---------- */
#screen-game { flex-direction: column; }
.topbar { height: 56px; flex: none; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 12px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.brand { background: none; border: 0; color: #fff; font: 800 17px var(--font); cursor: pointer; padding: 4px; white-space: nowrap; }
.brand b { color: var(--amber); }
.tb-date { display: flex; flex-direction: column; min-width: 120px; }
.tb-date b { font-size: 15px; }
.tb-date .bar { height: 5px; background: rgba(255,255,255,.12); border: 0; width: 120px; margin-top: 3px; }
.tb-date .bar i { background: var(--amber); }
.tb-date small { font-size: 11px; opacity: .7; }
.tb-kpis { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tb-kpis::-webkit-scrollbar { display: none; }
.kpi { background: rgba(255,255,255,.08); border-radius: 10px; padding: 4px 10px; display: flex; flex-direction: column; min-width: 92px; cursor: pointer; border: 0; color: #fff; text-align: left; font: inherit; }
.kpi small { font-size: 10.5px; opacity: .7; font-weight: 700; white-space: nowrap; }
.kpi b { font-size: 14px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.kpi b.good { color: #4ade80; } .kpi b.bad { color: #fca5a5; }
.tb-actions { display: flex; gap: 6px; }
.tb-actions .btn { color: #fff; border-color: rgba(255,255,255,.25); }
.tb-next { background: var(--amber) !important; color: #1b1300 !important; border-color: var(--amber) !important; }
.layout { flex: 1; display: grid; grid-template-columns: 200px 1fr 300px; min-height: 0; }
.sidenav { border-right: 1px solid var(--line); background: var(--panel); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.navbtn { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; border: 0; background: none; color: var(--ink); font: 800 14px var(--font); cursor: pointer; text-align: left; position: relative; }
.navbtn:hover { background: var(--panel2); }
.navbtn.on { background: var(--accent-soft); color: var(--accent); }
.navbtn .ico { font-size: 18px; width: 24px; text-align: center; }
.navbtn .badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; min-width: 20px; text-align: center; }
.view { overflow: auto; padding: 18px 20px 40px; min-width: 0; outline: none; }
.side { border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.side h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.bottomnav { display: none; }
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.view-head h2 { font-size: 22px; flex: 1; min-width: 160px; }
.view-head p { width: 100%; margin: 0; color: var(--muted); }
.back { margin-bottom: 10px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 44px; }

/* advisor */
.advisor { display: flex; gap: 10px; background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; align-items: flex-start; }
.advisor .face { font-size: 26px; line-height: 1; }
.advisor p { margin: 0; font-size: 13px; }
.advisor b.name { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.agenda { display: flex; flex-direction: column; gap: 6px; }
.agenda button { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; color: inherit; font: inherit; cursor: pointer; }
.agenda .when { font: 700 11px var(--mono); color: var(--muted); min-width: 52px; }
.agenda .what { font-size: 12.5px; }

/* ---------- mission cards ---------- */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; text-align: left; color: inherit; font: inherit; position: relative; }
.mcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.mcard.flag { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-soft); }
.mcard .top { display: flex; gap: 10px; align-items: flex-start; }
.mcard .ico { font-size: 26px; line-height: 1; }
.mcard h3 { font-size: 15px; line-height: 1.25; }
.mcard .route { font: 700 12px var(--mono); color: var(--muted); }
.mcard .meta { display: flex; flex-wrap: wrap; gap: 5px; }
.mcard .foot { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.mcard .legs { display: flex; gap: 4px; }
.mcard .legs i { width: 22px; height: 6px; border-radius: 6px; background: var(--line); }
.mcard .legs i.b { background: var(--accent); } .mcard .legs i.f { background: var(--good); } .mcard .legs i.x { background: var(--bad); }
.mtype { position: absolute; top: 10px; right: 12px; }

/* ---------- mission detail ---------- */
.mhead { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.mhead .ico { font-size: 40px; line-height: 1; }
.mhead h2 { font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
.stat small { display: block; color: var(--muted); font-weight: 700; font-size: 11.5px; }
.stat b { font-size: 17px; }
.timeline { display: flex; flex-direction: column; gap: 10px; position: relative; }
.tl-meet { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); font-weight: 800; }
.tl-meet .t { font: 700 12px var(--mono); }
.tl-trip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); }
.tl-trip.flag { border-color: var(--bad); background: linear-gradient(var(--bad-soft), var(--bad-soft)), var(--panel); }
.tl-trip .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-trip .hd h4 { font-size: 15px; flex: 1; }
.tl-trip .win { font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.cost-bar { margin: 14px 0; }
.cost-bar .bar { height: 12px; }
.cost-bar .lbls { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* boarding pass */
.pass { display: grid; grid-template-columns: 8px 1fr auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel2); }
.pass .stripe { background: var(--c, var(--accent)); }
.pass .main { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pass .stub { padding: 10px 12px; border-left: 2px dashed var(--line); display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 4px; min-width: 120px; }
.pass .stub b { font-size: 17px; }
.legline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legline .t { font: 700 15px var(--mono); }
.legline .t small { font-size: 11px; color: var(--muted); }
.legline .ap { font: 700 12px var(--mono); color: var(--muted); }
.legline .arrow { flex: 1; min-width: 40px; height: 2px; background: var(--line); position: relative; }
.legline .arrow::after { content: '✈'; position: absolute; right: -4px; top: -9px; font-size: 13px; color: var(--muted); }
.plog { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }

/* ---------- booking ---------- */
.bk-head { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.bk-head h2 { font-size: 22px; }
.bk-head .need { font-size: 13px; color: var(--muted); }
.dstrip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.dday { flex: none; min-width: 84px; border: 1px solid var(--line); background: var(--panel); border-radius: 11px; padding: 6px 8px; cursor: pointer; text-align: center; font: inherit; color: inherit; }
.dday small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.dday b { font-size: 14px; }
.dday.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.dday.lo b { color: var(--good); } .dday.hi b { color: var(--bad); }
.dday.none b { color: var(--muted); font-weight: 700; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; }
.results { display: flex; flex-direction: column; gap: 8px; }
.res { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-columns: minmax(0, 1fr) auto; box-shadow: var(--shadow); overflow: hidden; }
.res.invalid { opacity: .55; }
.res .info { padding: 11px 14px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.res .cars { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.res .cars .nm { font-weight: 800; font-size: 13px; margin-left: 2px; }
.res .times { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.res .times b { font: 700 17px var(--mono); }
.res .times small { font: 700 11px var(--mono); color: var(--muted); }
.res .sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fares { display: flex; border-left: 1px solid var(--line); }
.fare { border: 0; border-left: 1px solid var(--line); background: var(--panel); color: inherit; font: inherit; cursor: pointer; padding: 8px 10px; min-width: 96px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; text-align: center; }
.fare:first-child { border-left: 0; }
.fare small { font-size: 10.5px; color: var(--muted); font-weight: 800; line-height: 1.15; }
.fare b { font-size: 15.5px; }
.fare .tag { font-size: 10px; font-weight: 800; padding: 0 5px; border-radius: 6px; }
.fare .tag.sale { background: var(--good-soft); color: var(--good); }
.fare .tag.mistake { background: #fde68a; color: #7c2d12; }
.fare .tag.surge { background: var(--bad-soft); color: var(--bad); }
.fare .tag.left { color: var(--bad); }
.fare:hover:not(:disabled) { background: var(--accent-soft); }
.fare:disabled { cursor: default; }
.fare.cheap b { color: var(--good); }
.fare.na b { color: var(--muted); font-size: 12px; }
.lay { font-size: 11.5px; }

/* review modal */
.rv-legs { display: flex; flex-direction: column; gap: 8px; }
.rv-leg { display: grid; grid-template-columns: auto 1fr; gap: 10px; background: var(--panel2); border-radius: 12px; padding: 10px; }
.rv-lay { font-size: 12px; color: var(--muted); padding-left: 12px; border-left: 3px dotted var(--line); margin-left: 14px; }
.rv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.rv-box { background: var(--panel2); border-radius: 12px; padding: 10px 12px; }
.rv-box h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin-bottom: 4px; }
.rv-box ul { margin: 0; padding-left: 16px; font-size: 13px; }
.earn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.earn-table td, .earn-table th { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.earn-table th { font-size: 11px; text-transform: uppercase; color: var(--muted); }
.earn-table tr.sel { background: var(--accent-soft); }
.earn-table tr { cursor: pointer; }
.earn-table td.n { text-align: right; font-family: var(--mono); font-weight: 700; }
.spark { width: 100%; height: 46px; display: block; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 3px 0; }
.total-row.big { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }

/* ---------- loyalty ---------- */
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.mcardx { border-radius: 16px; padding: 16px; color: #fff; position: relative; overflow: hidden; min-height: 168px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.18); background: linear-gradient(135deg, var(--c1), var(--c2)); }
.mcardx::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.08); }
.mcardx .pn { font-weight: 800; font-size: 13px; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.mcardx .tier { font-size: 22px; font-weight: 800; }
.mcardx .bal { font: 700 13px var(--mono); opacity: .9; }
.mcardx .bar { background: rgba(255,255,255,.2); border: 0; height: 7px; }
.mcardx .bar i { background: #fff; }
.mcardx .nx { font-size: 12px; opacity: .9; }
.mcardx .home { position: absolute; top: 12px; right: 14px; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 999px; }
.lnote { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.alliances { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.alliances .card { padding: 12px 14px; }
.tierlist { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tierlist span { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.15); }
.tierlist span.on { background: #fff; color: #111; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dh { font-size: 11px; font-weight: 800; color: var(--muted); text-align: center; padding: 4px 0; }
.cal .dc { min-height: 88px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal .dc.out { opacity: .4; }
.cal .dc.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cal .dc.past { background: var(--panel2); }
.cal .dn { font: 700 11px var(--mono); color: var(--muted); }
.cal .ev { font-size: 10.5px; font-weight: 800; border-radius: 5px; padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; text-align: left; font-family: var(--font); color: inherit; }
.ev.f { background: var(--accent-soft); color: var(--accent); }
.ev.m { background: var(--warn-soft); color: var(--warn); }
.ev.d { background: var(--bad-soft); color: var(--bad); }
.ev.x { background: var(--good-soft); color: var(--good); }
.ev.h { background: rgba(168,85,247,.14); color: #a855f7; }

/* ---------- map ---------- */
.mapwrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow); }
.mapwrap canvas { width: 100%; aspect-ratio: 2.3; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); padding: 6px 4px 0; }
.legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }

/* ---------- lists & tables ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.item .ic { font-size: 22px; line-height: 1.1; }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; }
.item .tx p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.item .dt { font: 700 11px var(--mono); color: var(--muted); white-space: nowrap; }
.item.deal { border-left: 4px solid var(--good); }
.item.alert { border-left: 4px solid var(--bad); }
.item.status { border-left: 4px solid var(--amber); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: 11px; text-transform: uppercase; color: var(--muted); background: var(--panel2); }
.tbl td.n { text-align: right; font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.ach .e { font-size: 26px; }
.ach.lock { opacity: .45; filter: grayscale(1); }
.ach small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- modals ---------- */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-back { position: fixed; inset: 0; background: rgba(5,12,24,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto; animation: fadein .18s; }
.modal-back.closing { animation: fadeout .16s forwards; }
.modal { background: var(--panel); color: var(--ink); border-radius: 18px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: pop .25s cubic-bezier(.2, 1.3, .4, 1); overflow: hidden; border: 1px solid var(--line); }
.modal.wide { max-width: min(780px, 100%); }
.modal.xwide { max-width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px 0; gap: 10px; }
.modal-head h2 { flex: 1; font-size: 19px; }
.modal-head .x { border: 0; background: var(--panel2); color: var(--ink); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.modal-body { padding: 14px 20px; overflow: auto; }
.modal-body p { margin: 0 0 10px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 20px 18px; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
.rep-lines { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.bigicon { font-size: 54px; text-align: center; line-height: 1.1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); font: 800 13.5px var(--font); padding: 8px 12px; cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.set-sec { border-bottom: 1px solid var(--line); padding: 8px 0 12px; }
.set-sec:last-child { border: 0; }
.set-sec h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; margin: 6px 0 4px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2.5px var(--ink); }

/* ---------- toasts & confetti ---------- */
#toasts { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 60; pointer-events: none; align-items: center; width: max-content; max-width: 92vw; }
.toast { background: rgba(11,31,58,.95); color: #fff; padding: 9px 16px; border-radius: 12px; font-weight: 800; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.3); border-left: 5px solid var(--tc, var(--amber)); animation: pop .3s; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
#confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- end screen ---------- */
#screen-end { overflow: auto; background: radial-gradient(ellipse at 50% 0%, #173a6b, #0b1f3a 60%, #050c18); color: #fff; }
.end { width: 100%; max-width: 860px; margin: 0 auto; padding: 28px 16px 48px; }
.end h1 { font-size: clamp(30px, 6vw, 46px); text-align: center; }
.end .grade { font-size: 96px; font-weight: 800; text-align: center; line-height: 1; color: var(--amber); margin: 16px 0 4px; }
.end .ttl { text-align: center; font-size: 20px; font-weight: 800; }
.end .card { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.end .stats .stat { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); }
.end .stat small { color: rgba(255,255,255,.65); }
.end .total-row { border-color: rgba(255,255,255,.15); }
.end .btns { display: flex; justify-content: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1250px) {
  .layout { grid-template-columns: 190px 1fr; }
  .side { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav { display: none; }
  .bottomnav { display: flex; flex: none; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav .navbtn { flex: 1; flex-direction: column; gap: 1px; font-size: 10.5px; padding: 6px 2px; align-items: center; border-radius: 0; }
  .bottomnav .navbtn .ico { font-size: 19px; }
  .bottomnav .navbtn .badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; font-size: 10px; padding: 0 5px; min-width: 16px; }
  .topbar { height: auto; flex-wrap: wrap; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; gap: 8px 10px; }
  .brand span { display: none; }
  .tb-date { min-width: 0; flex: 1; }
  .tb-date .bar { width: 100%; }
  .tb-kpis { order: 5; flex-basis: 100%; }
  .kpi { min-width: 84px; padding: 3px 8px; }
  .tb-skip span { display: none; }
  .view { padding: 14px 16px 30px; }
  .board { height: 28px; font-size: 11.5px; }
  .res { grid-template-columns: 1fr; }
  .fares { border-left: 0; border-top: 1px solid var(--line); overflow-x: auto; }
  .fare { flex: 1; min-width: 84px; }
  .rv-grid { grid-template-columns: 1fr; }
  .pass { grid-template-columns: 6px 1fr; }
  .pass .stub { grid-column: 2; border-left: 0; border-top: 2px dashed var(--line); flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
  .cal .dc { min-height: 64px; }
  .cal .ev { font-size: 9.5px; }
  .modal { max-height: calc(100dvh - 16px); }
  .modal-back { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation: none !important; transition: none !important; }

/* ---------- airline logos, comfort, taxes ---------- */
.al-chip { position: relative; }
.al-chip.logo { min-width: 24px; width: 24px; height: 24px; padding: 0; overflow: hidden; font-size: 9.5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.al-chip.logo.big { width: 30px; height: 30px; min-width: 30px; border-radius: 8px; font-size: 11px; }
.al-chip.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cars .al-chip + .al-chip { margin-left: 3px; }
.comfort { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; cursor: help; }
.comfort.hi { background: var(--good-soft); color: var(--good); }
.comfort.mid { background: var(--warn-soft); color: var(--warn); }
.comfort.lo { background: var(--bad-soft); color: var(--bad); }
.comfort small { font-weight: 700; opacity: .85; }
.rv-leg.has-cf { grid-template-columns: auto 1fr auto; }
.cf-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 84px; padding: 4px 8px; border-radius: 10px; background: var(--panel); text-align: center; }
.cf-box b { font-size: 16px; }
.cf-box small { font-size: 10.5px; font-weight: 800; }
.cf-box.hi b, .cf-box.hi small:first-of-type { color: var(--good); }
.cf-box.mid b, .cf-box.mid small:first-of-type { color: var(--warn); }
.cf-box.lo b, .cf-box.lo small:first-of-type { color: var(--bad); }
.cf-box i { display: block; width: 100%; height: 5px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.cf-box i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: currentColor; }
.cf-box.hi i { color: var(--good); } .cf-box.mid i { color: var(--warn); } .cf-box.lo i { color: var(--bad); }
.fare small.tx { font-weight: 600; font-size: 10px; }
.total-row.sub { font-size: 12.5px; color: var(--muted); padding-left: 10px; }
@media (max-width: 600px) {
  .rv-leg.has-cf { grid-template-columns: auto 1fr; }
  .rv-leg.has-cf .cf-box { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 8px; }
  .rv-leg.has-cf .cf-box i { width: 80px; }
}
.lmini { display: flex; flex-direction: column; gap: 3px; margin: 2px 0 4px; }
.lm { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.lm .lm-r { font: 700 11.5px var(--mono); color: var(--ink, inherit); min-width: 92px; }
.lm .al-chip { transform: scale(.85); }
.lm .lm-ac { font-weight: 700; }

/* iPhone: text fields under 16px make Safari zoom in and stay zoomed */
@media (pointer: coarse) { input[type=text], input[type=number], select, textarea { font-size: 16px; } }
