/* One stylesheet for the whole app. Mobile first, light and dark via prefers-color-scheme. */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #0ea5e9;
  --accent-ink: #ffffff;
  --accent-soft: #e0f2fe;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --accent: #38bdf8;
    --accent-ink: #0f172a;
    --accent-soft: #0c4a6e;
    --bad-soft: #450a0a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
img { max-width: 100%; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 10px 10px; text-decoration: none; color: var(--text); border-radius: 10px; }
.nav a:hover { background: var(--accent-soft); }
.nav a.btn-primary { color: var(--accent-ink); }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow);
}
.card.note { border-left: 4px solid var(--accent); }
.card.empty { text-align: center; padding: 28px 16px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 12px 20px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-big { min-height: 56px; font-size: 1.1rem; padding: 14px 28px; width: 100%; max-width: 380px; }
.btn-small { min-height: 40px; padding: 8px 14px; }
.btn[disabled] { opacity: .6; cursor: default; }
form.inline { display: inline; }

/* forms */
.form-row { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.form-row label { font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 6px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* flash messages */
.flashes { margin: 0 0 16px; }
.flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 8px; background: var(--accent-soft); border: 1px solid var(--border); }
.flash-error { background: var(--bad-soft); }
.flash-success { border-left: 4px solid var(--good); }

/* landing */
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: 2rem; }
.lead { font-size: 1.1rem; margin: .25rem 0; }
.price-tag { font-size: 1.25rem; margin: 1rem 0; }
.steps { padding-left: 1.25rem; margin: 0; }
.steps li { margin: 0 0 .5rem; }

/* how to read this */
.howto { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; margin: 0 0 16px; }
.howto summary { cursor: pointer; padding: 14px 0; font-weight: 600; min-height: 48px; }
.howto ul { margin: 0 0 14px; padding-left: 1.2rem; }
.howto li { margin: 0 0 .4rem; }

/* freshness */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.fresh-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.fresh .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.fresh-fresh .dot { background: var(--good); }
.fresh-stale .dot { background: var(--warn); }
.fresh-old .dot { background: var(--bad); }

/* tabs */
.tabs { display: flex; gap: 6px; margin: 0 0 16px; overflow-x: auto; }
.tab { flex: 1 0 auto; text-align: center; min-height: 44px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* deal cards */
.deals { list-style: none; margin: 0; padding: 0; }
.deal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.route { font-weight: 700; font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 6px; }
.route .to { color: var(--muted); font-weight: 400; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge-lm { background: var(--accent-soft); color: var(--text); }
.badge-err { background: var(--bad-soft); color: var(--text); }
.deal-error { border-left: 4px solid var(--bad); }
.deal-title { margin: .25rem 0 0; }
.deal-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 8px 0; }
.price { font-size: 1.8rem; font-weight: 800; }
.pct { color: var(--good); font-weight: 700; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0 0 12px; }
.facts div { min-width: 0; }
.facts dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts-wide { grid-template-columns: 1fr; }
.btn-book { width: 100%; }
.btn-compare { width: 100%; margin-top: 8px; }

/* settings */
.chips { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--accent-soft); }
.chip form { margin: 0; }
.chip-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 1.4rem; cursor: pointer; }
.chip-x:hover { background: var(--surface); }
.typeahead { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; }
.ta-list li { padding: 10px 12px; min-height: 44px; border-radius: 8px; cursor: pointer; }
.ta-list li[aria-selected=true], .ta-list li:hover { background: var(--accent-soft); }
.ta-list .code { font-weight: 700; margin-right: 6px; }
.ios-help { background: var(--bg); border-radius: 10px; padding: 8px 14px; margin: 12px 0; }

/* prose pages */
.prose h2 { margin-top: 1.25rem; }

/* footer */
.footer { text-align: center; padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); border-top: 1px solid var(--border); }
.footer nav { display: flex; justify-content: center; gap: 16px; }
.footer nav a { padding: 10px; }
.footer p { margin: 6px 0 0; font-size: .875rem; }

@media (min-width: 640px) {
  .facts { grid-template-columns: repeat(3, 1fr); }
  .btn-book { width: auto; }
  .btn-compare { width: auto; margin-top: 0; margin-left: 8px; }
  .hero h1 { font-size: 2.4rem; }
}

/* empty states and small helpers */
.card.empty { text-align: center; padding: 28px 18px; }
.card.empty h2 { margin-top: 0; }
form.inline { display: inline-block; margin: 8px 8px 0 0; }
