:root {
  --ink: #14202e;
  --ink-soft: #4a5b6e;
  --muted: #8094a6;
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e6ecf3;
  --brand: #0f6fff;
  --brand-deep: #0a4fc2;
  --accent: #ff6b5e;
  --gold: #f4a92b;
  --green: #18a86b;
  --shadow: 0 10px 30px rgba(20, 40, 70, .08);
  --shadow-lg: 0 24px 60px rgba(20, 40, 70, .14);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.03em; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  margin-right: 4px; background: linear-gradient(135deg, var(--brand), #5aa0ff);
  color: #fff; border-radius: 9px; transform: translateY(4px); font-size: 16px;
}
.topbar nav { display: flex; align-items: center; gap: 18px; font-weight: 600; }
.topbar nav a { color: var(--ink-soft); }
.topbar nav a:hover { color: var(--brand); }
.who { color: var(--muted); font-weight: 500; font-size: 14px; }
.btn-ghost {
  border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px;
  color: var(--ink) !important; background: #fff;
}
.btn-ghost:hover { border-color: var(--brand); }
.logout-form { display: inline-flex; margin: 0; }
.logout-form button { font-family: inherit; font-size: inherit; cursor: pointer; }

main { min-height: calc(100vh - 140px); }

/* ---- flashes ---- */
.flashes { max-width: 900px; margin: 16px auto 0; padding: 0 20px; }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 8px; font-weight: 600; }
.flash-error { background: #ffeceb; color: #c0392b; }
.flash-success { background: #e7f8ef; color: var(--green); }

/* ---- landing / hero ---- */
.hero {
  max-width: 1000px; margin: 0 auto; padding: 80px 24px 40px; text-align: center;
}
.hero .eyebrow {
  display: inline-block; background: #e7f0ff; color: var(--brand-deep);
  padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px;
  margin-bottom: 22px; letter-spacing: .01em;
}
.hero h1 { font-size: clamp(36px, 6vw, 62px); font-weight: 800; margin: 0 0 18px; }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lede { font-size: 20px; color: var(--ink-soft); max-width: 640px; margin: 0 auto 30px; }
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 14px 28px; border-radius: 999px; font-weight: 700;
  border: none; cursor: pointer; font-size: 16px; font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(15,111,255,.32); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }

.feature-grid {
  max-width: 840px; margin: 36px auto 72px; padding: 0 24px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px;
}
@media (max-width: 640px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow);
}
.feature .ico { font-size: 34px; }
.feature h3 { margin: 16px 0 8px; font-size: 21px; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.55; }

/* ---- auth ---- */
.auth-wrap { max-width: 420px; margin: 60px auto; padding: 0 20px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px; box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 6px; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-family: inherit; font-size: 15px; background: #fbfcfe; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); background: #fff;
}
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); }

/* ---- planner ---- */
.planner-wrap { max-width: 1080px; margin: 0 auto; padding: 34px 20px 80px; }
.planner-head { margin-bottom: 22px; }
.planner-head h1 { font-size: 30px; margin: 0 0 6px; }
.planner-head p { color: var(--ink-soft); margin: 0; }

.search-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px){ .row, .row-3 { grid-template-columns: 1fr; } }

.section-label { font-weight: 700; font-size: 13px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }

/* segmented control / tabs */
.segment { display: inline-flex; background: #eef2f7; border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.segment button {
  border: none; background: transparent; padding: 9px 16px; border-radius: 9px;
  font-family: inherit; font-weight: 600; font-size: 14px; color: var(--ink-soft); cursor: pointer;
}
.segment button.active { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(20,40,70,.08); }

/* typeahead place search */
.typeahead { position: relative; }
.ta-menu {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-top: 4px;
  box-shadow: var(--shadow-lg); overflow: hidden auto; max-height: 280px;
}
.ta-menu.show { display: block; }
.ta-item { padding: 11px 14px; font-size: 14px; cursor: pointer; color: var(--ink); }
.ta-item:hover, .ta-item.active { background: #eef3ff; }
.ta-anywhere { font-weight: 700; color: var(--brand-deep); border-bottom: 1px solid var(--line); }

/* progressive-disclosure helpers */
.link-btn {
  background: none; border: none; padding: 8px 0; margin-top: 4px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--brand);
  display: inline-block;
}
.link-btn:hover { color: var(--brand-deep); text-decoration: underline; }
.link-btn.on { color: var(--accent); }
#anchor-dates {
  margin-top: 14px; padding: 16px 18px; border-radius: var(--radius);
  background: #f4f8ff; border: 1px solid #dce8ff;
}
#anchor-dates .hint { color: var(--brand-deep); font-weight: 600; }
#style-row { align-items: start; }
#finetune { margin-top: 6px; }

.date-pane { display: none; margin-top: 14px; }
.date-pane.active { display: block; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* vibe chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer; user-select: none;
  color: var(--ink-soft); transition: all .12s;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.toggle-row { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #cdd8e3; border-radius: 999px; transition: .2s; cursor: pointer;
}
.slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.search-actions { margin-top: 26px; display: flex; align-items: center; gap: 16px; }
.search-actions .btn { padding: 15px 38px; }

/* ---- loading ---- */
.loader { display: none; text-align: center; padding: 60px 20px; }
.loader.show { display: block; }
.plane-loader {
  width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 50%;
  border: 4px solid #e3ebf5; border-top-color: var(--brand); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader .status { font-weight: 700; font-size: 18px; }
.loader .substatus { color: var(--muted); margin-top: 8px; min-height: 22px; }

/* ---- results ---- */
.results { margin-top: 34px; display: none; }
.results.show { display: block; }
.results-meta {
  background: linear-gradient(120deg, #0f1f33, #163a63); color: #fff;
  border-radius: var(--radius); padding: 22px 26px; margin-bottom: 22px;
}
.results-meta h2 { margin: 0 0 6px; font-size: 22px; }
.results-meta .advice { color: #cfe0ff; font-size: 15px; margin-top: 10px;
  border-left: 3px solid var(--gold); padding-left: 12px; }
.results-meta .ai-badge { display:inline-block; background: rgba(255,255,255,.16);
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-left: 8px; }
.intel-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.intel-chip { background: rgba(255,255,255,.16); color: #fff; padding: 5px 12px;
  border-radius: 999px; font-size: 13px; font-weight: 600; }
.intel-chip.warn { background: rgba(244,169,43,.28); }

.plan-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.plan-card.rank-1 { border: 2px solid var(--brand); box-shadow: var(--shadow-lg); }
.plan-top { display: flex; justify-content: space-between; gap: 18px; padding: 22px 24px; }
.plan-rank {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: #eef3ff; color: var(--brand-deep); font-weight: 800; border-radius: 12px; font-size: 18px;
}
.rank-1 .plan-rank { background: var(--brand); color: #fff; }
.plan-headline { font-size: 19px; font-weight: 800; margin: 0 0 4px; }
.plan-route { color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.plan-price { text-align: right; flex: none; }
.plan-price .amount { font-size: 26px; font-weight: 800; }
.plan-price .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

.plan-body { padding: 0 24px 22px; }
.plan-summary { color: var(--ink-soft); margin: 0 0 16px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.pill-good { background: #e7f8ef; color: var(--green); }
.pill-warn { background: #fff1e3; color: #c97a16; }
.pill-cost { background: #eef2f7; color: var(--ink-soft); }
.pill-event { background: #fde8ff; color: #a02cc0; }

.wrinkles { background: #fff8f0; border: 1px solid #ffe6c7; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.wrinkles .t { font-weight: 700; font-size: 13px; color: #c97a16; margin-bottom: 6px; }
.wrinkles ul, .highlights ul { margin: 0; padding-left: 18px; }
.wrinkles li { color: #8a5a12; font-size: 14px; }
.highlights ul li { color: var(--ink-soft); font-size: 14px; }
.event-note { background: #fbeefe; border: 1px solid #f1d2fb; color: #8e2aab;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px; }

.details-toggle { background: none; border: none; color: var(--brand); font-weight: 700;
  cursor: pointer; font-family: inherit; font-size: 14px; padding: 4px 0; }
.details { display: none; margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 16px; }
.details.show { display: block; }
.leg, .stay { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.leg:last-child, .stay:last-child { border-bottom: none; }
.leg .a, .stay .a { font-weight: 700; }
.muted { color: var(--muted); }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 8px; margin-top: 10px; }
.score-item { background: #f4f7fb; border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.score-item .v { font-weight: 800; }
.score-item .v.neg { color: var(--accent); }
.score-item .v.pos { color: var(--green); }
.reasons { margin: 10px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 13.5px; }

.save-btn { background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--ink); }
.save-btn:hover { border-color: var(--brand); color: var(--brand); }
.save-btn.saved { background: #e7f8ef; color: var(--green); border-color: #bfe9d3; }

.err-box { display:none; background:#ffeceb; color:#c0392b; padding:16px 20px; border-radius:12px; font-weight:600; margin-top: 24px; }
.err-box.show { display:block; }

/* profile */
.profile-wrap { max-width: 880px; margin: 0 auto; padding: 34px 20px 80px; }
.sliders { display: grid; gap: 20px; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; }
.slider-label { font-weight: 700; font-size: 15px; }
.slider-val { font-weight: 800; color: var(--brand); font-size: 15px; }
.slider-help { color: var(--ink-soft); font-size: 14px; margin: 4px 0 10px; }
.range { width: 100%; accent-color: var(--brand); height: 6px; }
.slider-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 6px; }
@media (max-width: 680px) { .dest-grid { grid-template-columns: 1fr; } }
.dest-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.dest-name { font-weight: 600; font-size: 14px; }
.been-toggle { font-size: 13px; color: var(--ink-soft); white-space: nowrap; display: flex; gap: 5px; align-items: center; cursor: pointer; }
.pref-sel { padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 12.5px; background: #fff; max-width: 175px; }

/* saved trips */
.trips-wrap { max-width: 820px; margin: 0 auto; padding: 34px 20px 80px; }
.trip-row { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  max-width: 1080px; margin: 0 auto; padding: 24px 24px; color: var(--ink-soft); font-size: 13px; }
.foot .muted { color: var(--muted); }
