/* LYVR — light, airline-app styling */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --ink: #16202c;
  --muted: #5b6b7c;
  --line: #dbe3ec;
  --brand: #2b6ff0;
  --brand-teal: #0d9488;
  --brand-gradient: linear-gradient(135deg, #4e8cfb 0%, #1e97c4 55%, #0fae9c 100%);
  --brand-ink: #ffffff;
  --navy: #0a2540;
  --ok: #157a3d;
  --ok-bg: #e6f4ea;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --shadow: 0 1px 2px rgba(16, 32, 44, .06), 0 8px 24px rgba(16, 32, 44, .08);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--brand-gradient);
  color: #fff;
}
.brand-mark { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; display: block; }
.brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 4px;
  margin: 0;
}
.tabs { margin-left: auto; display: flex; gap: 8px; }
.tabs button {
  font: inherit;
  font-size: 13px;
  color: #cfe0ff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tabs button:hover { background: rgba(255, 255, 255, .1); }
.tabs button.active { background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }

.user-chip { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; background: #cbd5e1; }
.user-chip span { font-size: 13px; color: #eaf1ff; max-width: 140px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.user-chip .btn-ghost { background: rgba(255,255,255,.1); color: #eaf1ff; border-color: rgba(255,255,255,.25); }

/* ---------- app shell: sidebar + content ---------- */
.app-shell { display: flex; align-items: stretch; min-height: calc(100vh - 58px); }
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
}
.side-user {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.side-avatar { width: 38px; height: 38px; border-radius: 50%; background: #cbd5e1; flex: 0 0 38px; }
.side-user-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.side-user-name {
  font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.linklike {
  background: none; border: 0; padding: 0;
  color: var(--muted); font: inherit; font-size: 12px;
  cursor: pointer; text-align: left;
}
.linklike:hover { color: var(--brand); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .side-about {
  display: block;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.side-nav a:hover, .side-about:hover { background: #eef4ff; }
.side-nav a.active { background: var(--brand-gradient); color: #fff; }
.side-about { margin-top: auto; color: var(--muted); font-weight: 500; }
.content { flex: 1; min-width: 0; padding: 34px 40px; }

.blank-page {
  min-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blank-page h2 {
  font-size: 22px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .5px;
  margin: 0;
}

/* ---------- Home page blocks ---------- */
.home { max-width: 720px; }
.welcome h2 { margin: 0 0 4px; font-size: 22px; }
.catchphrase { color: var(--muted); font-size: 15px; margin: 0; font-style: italic; }
.countdown { font-size: 18px; font-weight: 600; margin: 0; line-height: 1.5; }
.countdown b { font-size: 22px; color: var(--brand); }
.code-chip {
  display: inline-block;
  background: #eaf1ff; color: var(--brand);
  font-weight: 700; letter-spacing: 1px;
  padding: 1px 8px; border-radius: 6px;
}
.suggestion-card { display: flex; gap: 14px; align-items: flex-start; }
.photo-ph {
  width: 96px; height: 96px; flex: 0 0 96px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, #dbe7ff, #b9c6ff);
}
.s-name { font-weight: 700; margin-bottom: 4px; }
.s-desc { color: var(--muted); font-size: 13px; line-height: 1.55; }

.suggestion-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.suggestion-row:first-of-type { border-top: 0; padding-top: 2px; }
.suggestion-row .photo-ph { width: 72px; height: 72px; flex: 0 0 72px; font-size: 26px; }
.s-meta { font-size: 12px; color: var(--brand); font-weight: 600; margin: 1px 0 5px; }
.upcoming-list { display: flex; flex-direction: column; }
.upcoming-item {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.upcoming-item:first-child { border-top: 0; }
.upcoming-item .u-main b { font-weight: 700; }
.upcoming-item .u-sub { color: var(--muted); font-size: 12px; }
.upcoming-item .u-when { color: var(--brand); font-weight: 600; white-space: nowrap; }

.lay-flight { font-size: 14px; margin: 0 0 12px; }
.lay-steps { list-style: none; margin: 0; padding: 0; }
.lay-steps li {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.lay-steps li:first-child { border-top: 0; }
.lay-steps li.bad { color: var(--bad); }
.ls-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }

/* ---------- Flights page ---------- */
.page { max-width: 640px; }
.page > h2 { margin: 0 0 18px; font-size: 20px; }
.page .hint { color: var(--muted); font-size: 13px; }

.flights-page > .btn-primary { margin-bottom: 18px; }
.flights-list { display: flex; flex-direction: column; gap: 12px; }
.flight-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 15px 16px;
}
.fc-head { display: flex; align-items: baseline; gap: 10px; }
.fc-num { font-weight: 700; font-size: 16px; }
.fc-head .linklike { margin-left: auto; }
.fc-route { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.fc-delay { color: var(--bad); font-size: 12px; font-weight: 600; margin-left: 6px; }
.fc-status { color: var(--muted); font-size: 12px; margin-left: 6px; }

.fc-legs { display: flex; align-items: center; gap: 10px; }
.fc-leg { display: flex; flex-direction: column; gap: 2px; }
.fc-leg b { font-size: 15px; font-variant-numeric: tabular-nums; }
.fc-legdate { font-size: 12px; color: var(--muted); }
.fc-arrow { color: var(--muted); }
.day-offset {
  display: inline-block;
  vertical-align: super;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  margin-left: 2px;
}

/* a flight's airport code / date that matches a connecting flight */
.layover-match {
  display: inline-block;
  border: 1.5px solid var(--ok);
  color: var(--ok);
  border-radius: 999px;
  padding: 0 7px;
  font-weight: 700;
}

/* the "these two flights connect" link between consecutive flight cards */
.layover-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: -2px 0;
}
.lc-dots {
  width: 0;
  height: 14px;
  border-left: 2px dotted var(--line);
}
.lc-btn { white-space: nowrap; }

.add-flight-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.add-flight-row .ac { flex: 1; }
.add-flight-row input[type="date"] { width: 168px; }

.confirm-grid { display: flex; flex-direction: column; gap: 12px; margin: 10px 0 22px; }
.confirm-grid > div { display: flex; gap: 12px; }
.confirm-grid .cl { width: 84px; flex: 0 0 84px; color: var(--muted); font-size: 13px; font-weight: 600; }
.confirm-grid .cv { font-size: 14px; }

/* ---------- confirmation: details card + flight-plan card ---------- */
.page.confirm-page { max-width: 760px; }
.confirm-row { display: flex; gap: 16px; align-items: flex-start; }
.confirm-card { flex: 1 1 300px; margin-bottom: 0; }
.flight-map-card { flex: 1 1 300px; margin-bottom: 0; }
.flight-plan-svg { width: 100%; height: auto; display: block; }
.fp-arc { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 5 5; }
.fp-dot { fill: var(--navy); }
.fp-code { font-size: 12px; font-weight: 700; fill: var(--ink); }
.fp-plane { font-size: 15px; fill: var(--brand); }
.flight-plan-stats {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
}
.flight-plan-map { width: 100%; height: auto; display: block; border-radius: 10px; }

@media (max-width: 720px) {
  .confirm-row { flex-direction: column; }
}

/* ---------- Airport Maps ---------- */
.page.airport-maps-page { max-width: 900px; }
.airport-maps-page h2 { margin: 0 0 16px; font-size: 22px; }
.airport-maps-page .hint { margin-top: 10px; }
.am-chip-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.am-chip {
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .5px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.am-chip:hover { border-color: #b9c6d5; }
.am-chip.active { background: var(--brand-gradient); color: #fff; border-color: transparent; }
.mapbox-canvas {
  width: 100%;
  height: 560px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.am-missing { height: 100%; display: flex; align-items: center; justify-content: center; background: var(--surface); }

/* ---------- Layovers page ---------- */
.layovers-page .flights-list { margin-top: 4px; }

.layover-detail { max-width: 640px; }
.lo-back { display: inline-block; margin-bottom: 16px; }
.lo-header { margin-bottom: 16px; }
.lo-header h2 { margin: 0; font-size: 21px; font-weight: 600; }
.lo-header h2 b { color: var(--brand); }
.lo-header .code-chip { font-size: 15px; }

.card.lo-legs { display: flex; flex-direction: column; padding: 6px 16px; }
.lo-leg { padding: 12px 0; border-top: 1px solid var(--line); }
.lo-leg:first-child { border-top: 0; }
.lo-leg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.lo-leg-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--brand); background: #eaf1ff; padding: 2px 8px; border-radius: 999px;
}
.lo-leg-info { color: var(--muted); font-size: 13px; }

.lo-actions { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }

.ask-ai-box { margin-bottom: 16px; }
.ask-ai-row { display: flex; gap: 8px; }
.ask-ai-row input { flex: 1; }
.ask-answer {
  margin-top: 10px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}
.ask-answer.unavailable { color: var(--muted); font-style: italic; }

/* ---------- itinerary timeline (built from "+ add to itinerary") ---------- */
.lo-itinerary { display: flex; flex-direction: column; padding: 6px 18px 16px; }
.lo-step { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.lo-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 22px;
  bottom: -10px;
  width: 0;
  border-left: 2px dotted var(--line);
}
.lo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex: 0 0 9px; margin-top: 5px; }
.lo-step-body { flex: 1; min-width: 0; }
.lo-step-label { font-weight: 700; font-size: 14px; }
.lo-step-label .lo-suggestion-link { font-weight: 700; color: var(--brand); font-size: inherit; padding: 0; }
.lo-step-sub { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.lo-more-dots { text-align: center; color: var(--muted); font-size: 18px; letter-spacing: 2px; margin-top: -2px; }

.lo-suggestion-row { flex-wrap: wrap; }
.lo-suggestion-row .lo-add-btn { margin-top: 10px; }

.lo-save-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.lo-save-status { font-size: 13px; color: var(--ok); font-weight: 600; }
.lo-save-status.error { color: var(--bad); }

/* Home's saved-layover card: same timeline, no card-in-card padding/shadow. */
.home-itinerary.lo-itinerary { padding: 8px 0 4px; }

@media (max-width: 640px) {
  .app-shell { flex-direction: column; min-height: 0; }
  .sidebar { width: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-about { margin-top: 8px; }
  .content { padding: 24px 16px; }
}

/* ---------- sign-in screen ---------- */
body.login-mode .topbar, body.login-mode .app-shell { display: none; }
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(30,151,196,.16), transparent),
    var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 40px 34px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.logo-mark { width: 48px; height: 48px; border-radius: 13px; object-fit: cover; display: block; box-shadow: var(--shadow); }
.logo-word { font-size: 30px; font-weight: 800; letter-spacing: 6px; color: var(--navy); }
.login-tag { color: var(--muted); margin: 2px 0 24px; font-size: 13px; }
.login-h { font-size: 19px; margin: 0 0 6px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.login-fine { color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.login-card .error { text-align: left; }

/* ---------- layout ---------- */
main { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin: 0 0 14px; }
.card h2 .pill { float: right; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 4px;
}

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 5px; }
input, select {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 95, 255, .15);
}
input[type="date"], input[type="time"] { min-height: 42px; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.flight-block { border: 0; margin: 0; padding: 0; }

/* autocomplete */
.ac { position: relative; }
.ac-list {
  position: absolute;
  z-index: 20;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.ac-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: #eef4ff; }
.ac-item .route { font-weight: 600; color: var(--ink); }
.ac-item .times { color: var(--muted); }
.ac-note { padding: 10px 12px; font-size: 13px; color: var(--muted); }

.flight-chosen {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ok);
  background: var(--ok-bg);
  border: 1px solid #bfe2cc;
  border-radius: 8px;
  padding: 8px 10px;
}
.flight-chosen::before { content: "✓ "; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; }
.checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.checks input { width: auto; }
.inline-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 500; color: var(--ink); }
.inline-check input { width: auto; }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  padding: 11px 18px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #0a54e0; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #b9c6d5; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
}
.muted { color: var(--muted); }
.error { color: var(--bad); background: var(--bad-bg); border: 1px solid #f3c2c2;
         padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-top: 12px; }
.empty { color: var(--muted); padding: 8px 0 4px; }

/* ---------- trips list ---------- */
.trip { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.trip:first-of-type { border-top: none; }
.trip .grow { flex: 1; }
.trip .code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: #eaf1ff;
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
}
.trip strong { display: block; }
.trip .sub { font-size: 13px; color: var(--muted); }

/* ---------- suggestions ---------- */
.suggestion { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-top: 1px solid var(--line); }
.suggestion:first-of-type { border-top: none; }
.suggestion .grow { flex: 1; }
.suggestion .name { font-weight: 600; }
.suggestion .meta { font-size: 12px; color: var(--muted); }
.suggestion .reason { font-size: 13px; color: var(--muted); margin-top: 3px; }
.suggestion .btn.added { background: var(--ok-bg); color: var(--ok); border-color: #bfe2cc; }

/* ---------- itinerary ---------- */
.trip-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.trip-head .code { width: 52px; height: 52px; font-size: 15px; }
.legs { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.legs b { color: var(--ink); }

table.timeline { width: 100%; border-collapse: collapse; font-size: 14px; }
table.timeline th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 2px solid var(--line);
}
table.timeline td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.timeline td.clock { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
table.timeline td.where { color: var(--muted); }
table.timeline tr.infeasible td { background: var(--bad-bg); color: var(--bad); }
table.timeline tr.infeasible td.clock { color: var(--bad); }

.verdict { margin-top: 16px; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- About ---------- */
.side-about.active { color: var(--brand); }
.page.about-page { max-width: 640px; }
.about-hero { text-align: center; padding: 12px 0 28px; }
.about-hero .logo-mark { margin: 0 auto 14px; box-shadow: none; }
.about-hero h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: 6px; color: var(--navy); }
.about-tagline { margin: 6px 0 0; color: var(--muted); font-style: italic; }
.about-mission p { margin: 0; line-height: 1.6; }
.about-features { display: flex; flex-direction: column; }
.about-feature { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.about-feature:first-of-type { border-top: 0; padding-top: 4px; }
.about-feature-icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 10px;
  background: #eaf1ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.about-feature-name { font-weight: 700; margin-bottom: 3px; }
.about-feature-body { color: var(--muted); font-size: 13px; line-height: 1.55; }
.about-footer { text-align: center; }
.about-footer p { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.about-footer p:last-child { margin-bottom: 0; }
.about-footer a { color: var(--brand); }
.about-credit { font-weight: 600; }

@media (max-width: 520px) {
  .grid-2 { grid-template-columns: 1fr; }
  .brand { letter-spacing: 2px; }
  main { padding: 16px 12px 40px; }
}
