:root {
  --red: #b9152b;
  --red-dark: #8e0f20;
  --gold: #d4a32c;
  --ink: #1d2230;
  --muted: #6b7280;
  --bg: #fbf7f2;
  --card: #ffffff;
  --line: #ece6dd;
  --shadow: 0 1px 3px rgba(20,16,12,.08), 0 8px 24px rgba(20,16,12,.06);
  --radius: 16px;
  --maxw: 640px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app { max-width: var(--maxw); margin: 0 auto; }

/* ---- Demo banner (DEMO mode only) ---- */
.demo-bar {
  position: sticky; top: 0; z-index: 50;
  background: #1d2230; color: #fff; padding: 8px 12px calc(8px + env(safe-area-inset-top));
  margin-top: calc(-1 * env(safe-area-inset-top));
  text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.demo-tag { font-size: 12px; font-weight: 700; letter-spacing: .02em; opacity: .9; }
.demo-switch { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin-top: 6px; }
.demo-switch-lbl { font-size: 12px; opacity: .7; margin-right: 2px; }
.demo-pill {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; min-height: 36px;
}
.demo-pill-on { background: var(--gold); color: #1d2230; border-color: var(--gold); }
.view { padding: 0 16px 40px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.error { color: var(--red); font-size: 14px; margin: 4px 0 0; }
.center-stack { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 14px; }

/* ---- Icons (consistent SVG set) ---- */
.ico { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }
.section-h .ico { width: 1.05em; height: 1.05em; vertical-align: -0.12em; }
.card-h .ico { width: 1.25em; height: 1.25em; color: var(--red); }
.ev-title .ico { color: var(--red); }
.ev-meet .ico { color: var(--muted); }
.un-icon .ico { width: 24px; height: 24px; color: var(--red); }
.help-btn .ico, .rebook-btn .ico, .btn-dir .ico { vertical-align: -0.2em; }

/* Spinner */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Lookup ---- */
.lookup-card {
  margin: 8vh auto 0; max-width: 420px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 22px; text-align: center;
}
.lookup-logo { max-height: 54px; max-width: 70%; width: auto; object-fit: contain; margin: 0 auto 6px; display: block; }
.lookup-title { color: var(--red); font-size: 24px; margin: 10px 0 12px; letter-spacing: -.02em; }
#lookup-form { text-align: left; margin-top: 14px; display: grid; gap: 12px; }
label { font-weight: 600; font-size: 14px; display: grid; gap: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=number] {
  font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink);
  width: 100%;
}
input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(185,21,43,.12); }
button {
  font: inherit; font-weight: 700; cursor: pointer; border: none;
  background: var(--red); color: #fff; padding: 13px 16px; border-radius: 12px;
  transition: background .15s, transform .05s;
}
button:hover { background: var(--red-dark); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: default; }

/* ---- Trip header (hero) ---- */
.trip-header {
  position: relative; overflow: hidden;
  text-align: center; color: #fff; border-radius: 0 0 26px 26px;
  background:
    radial-gradient(140% 120% at 80% -10%, rgba(212,163,44,.22) 0%, rgba(212,163,44,0) 42%),
    radial-gradient(120% 140% at 50% -20%, #d11e36 0%, var(--red) 45%, var(--red-dark) 100%);
  padding: 26px 18px 40px; margin: 0 -16px 18px;
  box-shadow: var(--shadow);
}
.th-inner { position: relative; z-index: 1; }
.th-skyline { position: absolute; left: 0; right: 0; bottom: 0; z-index: 0; line-height: 0; pointer-events: none; }
.th-skyline svg { width: 100%; height: 56px; display: block; }
.th-logo { min-height: 30px; margin-bottom: 4px; }
.th-logo-img { max-height: 64px; max-width: 80%; width: auto; object-fit: contain; }
.th-wordmark { display: none; font-size: 22px; font-weight: 800; letter-spacing: .01em; color: #fff; font-family: Georgia, "Times New Roman", serif; }
.th-event { letter-spacing: .12em; text-transform: uppercase; font-size: 12px; font-weight: 700; color: #ffd9c2; margin: 6px 0 0; }
.th-name { font-size: 28px; margin: 4px 0 6px; letter-spacing: -.02em; }
.th-hotel { font-size: 15px; margin: 0; font-weight: 600; }
.th-org { font-size: 12.5px; opacity: .85; margin: 8px 0 0; }

/* ---- Countdown + add-to-home ---- */
.countdown {
  margin: -8px 0 4px; text-align: center; font-size: 15px; font-weight: 700; color: var(--red);
  background: rgba(212,163,44,.14); border: 1px solid rgba(212,163,44,.35);
  border-radius: 999px; padding: 9px 14px;
}
.countdown strong { color: var(--red-dark); }
.a2hs {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
}
.a2hs-txt { font-size: 13.5px; color: var(--ink); flex: 1; }
.a2hs-txt .ico { color: var(--red); vertical-align: -.18em; }
.a2hs-x { flex: 0 0 auto; background: transparent; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 8px; min-height: 40px; }

/* ---- Section heading ---- */
.section-h {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 26px 4px 10px;
}

/* ---- Up next (vertical, no hidden horizontal scroll) ---- */
.upnext { display: grid; gap: 8px; }
.upnext-row {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, #fff, #fffdf8); border: 1px solid var(--line);
  border-left: 4px solid var(--gold); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow);
}
.un-icon { font-size: 24px; line-height: 1; flex: 0 0 auto; }
.un-title { font-weight: 700; font-size: 16px; }
.un-when { font-size: 13.5px; color: var(--muted); margin-top: 1px; }

/* ---- Day nav pills ---- */
.day-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 2px 14px; }
.day-pill {
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 700; min-height: 40px;
}
.day-pill:hover { border-color: var(--red); }
.day-pill-today { background: var(--red); color: #fff; border-color: var(--red); }

/* ---- Timeline ---- */
.day { margin-bottom: 18px; scroll-margin-top: 14px; }
.day-head {
  font-weight: 800; font-size: 16px; color: var(--ink);
  padding: 8px 0; border-bottom: 2px solid var(--line); margin-bottom: 10px;
}
.today-tag {
  display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.event {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 15px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.event-personal { border-left: 4px solid var(--red); }
.ev-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ev-time-pill { font-size: 13px; font-weight: 800; color: var(--red); background: rgba(185,21,43,.08); padding: 4px 10px; border-radius: 999px; }
.ev-allday { color: var(--muted); background: rgba(120,120,120,.1); }
.ev-title { font-weight: 700; font-size: 16.5px; line-height: 1.3; }
.ev-meet { font-size: 14.5px; color: var(--ink); margin-top: 5px; }
.ev-det { font-size: 14px; color: var(--muted); margin-top: 5px; }
.ev-actions { margin-top: 10px; }
.btn-dir {
  display: inline-block; text-decoration: none; font-size: 13.5px; font-weight: 700; line-height: 1.3;
  color: var(--red); border: 1.5px solid var(--red); border-radius: 12px; padding: 9px 13px; min-height: 40px;
}
.btn-dir:hover { background: var(--red); color: #fff; }
.badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge-you { background: rgba(185,21,43,.1); color: var(--red); }
.badge-group { background: rgba(212,163,44,.16); color: #8a6a12; }

/* ---- Detail cards ---- */
.cards { display: grid; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.card-h { margin: 0 0 8px; font-size: 16px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 14.5px; }
.kv:first-of-type { border-top: none; }
.kv .k { color: var(--muted); white-space: nowrap; }
.kv .v { font-weight: 600; text-align: right; }
.v-link { color: var(--red); text-decoration: none; border-bottom: 1px dotted var(--red); }
.v-link:hover { border-bottom-style: solid; }

/* ---- Weather ---- */
.wx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wx-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 12px; text-align: center; box-shadow: var(--shadow);
}
.wx-when { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wx-ico { font-size: 34px; line-height: 1.2; }
.wx-temp { font-size: 20px; font-weight: 800; }
.wx-lo { color: var(--muted); font-weight: 600; font-size: 16px; }
.wx-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- Know before you go ---- */
.know { margin-top: 6px; }
.info-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.info-h { margin: 0 0 5px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.info-h .ico { color: var(--red); width: 1.2em; height: 1.2em; }
.info-d { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.5; }

/* ---- Explore NYC ---- */
.explore-cat { font-weight: 800; font-size: 15px; margin: 18px 4px 9px; color: var(--ink); }
.explore-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-explore {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; color: var(--ink); font-weight: 600; font-size: 14.5px; min-height: 44px;
  box-shadow: var(--shadow); transition: border-color .15s, transform .05s;
}
.btn-explore:hover { border-color: var(--red); }
.btn-explore:active { transform: translateY(1px); }
.be-icon { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.be-label { line-height: 1.2; }
.explore .tiny { margin: 12px 4px 0; }

/* ---- Rebook / more experiences ---- */
.rebook { margin-top: 26px; display: grid; gap: 10px; }
.rebook-btn {
  display: block; text-align: center; text-decoration: none; font-weight: 800; font-size: 16px;
  min-height: 52px; line-height: 52px; border-radius: 14px;
  border: 1.5px solid var(--red); color: var(--red); background: var(--card); box-shadow: var(--shadow);
}
.rebook-primary { background: var(--red); color: #fff; }
.rebook-btn:active { transform: translateY(1px); }

/* ---- Footer + Help ---- */
.trip-footer { text-align: center; margin-top: 30px; display: grid; gap: 16px; justify-items: center; }
.help-card {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 16px; box-shadow: var(--shadow);
}
.help-h { font-weight: 800; font-size: 17px; }
.help-sub { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.help-actions { display: grid; gap: 10px; }
.help-btn {
  display: block; text-decoration: none; font-weight: 800; font-size: 16px; min-height: 48px;
  line-height: 48px; border-radius: 12px; border: 1.5px solid var(--red); color: var(--red);
}
.help-call { background: var(--red); color: #fff; }
.footer-utils { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-ghost { background: transparent; color: var(--red); border: 1.5px solid var(--line); padding: 11px 18px; border-radius: 999px; font-size: 14px; min-height: 44px; }
.btn-ghost:hover { background: var(--card); border-color: var(--red); }
.brand-footer { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 4px; justify-items: center; }
.bf-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 800; font-size: 15px; color: var(--red); }
.bf-meta { font-size: 12.5px; color: var(--muted); }
.bf-copy { font-size: 11.5px; color: var(--muted); opacity: .8; }

@media (min-width: 560px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .help-actions { grid-template-columns: 1fr 1fr; }
}

/* ---- Accessibility ---- */
a, button, summary { -webkit-tap-highlight-color: rgba(185,21,43,.15); }
:focus-visible { outline: 3px solid rgba(185,21,43,.5); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---- Print: a clean black-on-white schedule ---- */
@media print {
  .demo-bar, .a2hs, .countdown, .weather, #weather-slot, .reminders,
  .day-nav, .explore, .rebook, .footer-utils, .th-skyline, .th-logo-img { display: none !important; }
  body { background: #fff; color: #000; }
  #app { max-width: 100%; }
  .trip-header { background: #fff !important; color: #000 !important; box-shadow: none; border-radius: 0; margin: 0 0 12px; padding: 0 0 8px; border-bottom: 2px solid #000; }
  .th-wordmark { display: block !important; color: #000 !important; }
  .th-event, .th-name, .th-hotel, .th-org { color: #000 !important; }
  .card, .event, .info-card, .help-card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
  .day, .event, .card, .info-card { break-inside: avoid; }
  .ev-time-pill { background: none; color: #000; padding: 0; }
  .badge { border: 1px solid #999; color: #000; background: none; }
  .help-btn, .help-call, .btn-dir, .v-link { background: none !important; color: #000 !important; border-color: #999 !important; }
  a[href]::after { content: ""; }
  .trip-footer { margin-top: 12px; }
}

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2ede6; --muted: #a9a399; --bg: #16131a;
    --card: #211d27; --line: #322c3a;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
  input[type=text], input[type=email], input[type=tel], input[type=number] { background: #2a2530; color: var(--ink); }
  .reminder { background: linear-gradient(180deg, #241f2b, #211d27); }
}

/* Lookup: email <-> invoice toggle */
.lookup-toggle {
  display: block;
  margin: 2px 0 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #b9152b);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
}
.lookup-toggle:hover,
.lookup-toggle:active,
.lookup-toggle:focus {
  background: none;
  color: var(--red-dark, #8e0f20);
  transform: none;
}

/* ---- Journey-aware UI: glance, progress, hero-next, weather chips, states ---- */

/* Pre-trip "at a glance" chips */
.glance .section-h { margin-top: 18px; }
.glance-row { display: flex; flex-wrap: wrap; gap: 8px; }
.glance-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 700; box-shadow: var(--shadow);
}
.glance-chip .ico { color: var(--red); }

/* During-trip "Day N of M" progress strip */
.progress {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; margin: 4px 0 12px; box-shadow: var(--shadow);
}
.pg-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--red); }
.pg-date { font-size: 15px; font-weight: 800; }
.pg-side { display: grid; gap: 6px; justify-items: end; }
.pg-dots { display: flex; gap: 6px; }
.pd { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line); background: transparent; }
.pd-done { background: var(--gold); border-color: var(--gold); }
.pd-now { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 3px rgba(185,21,43,.15); }

/* Now / Next hero card */
.hero-next {
  background: linear-gradient(180deg, #fff, #fffdf8);
  border: 1.5px solid var(--gold); border-radius: 16px;
  padding: 16px 18px; margin: 0 0 8px; box-shadow: var(--shadow);
}
.hero-live { border-color: var(--red); background: linear-gradient(180deg, #fff, #fff7f5); }
.hn-tag {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: #8a6a12; margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.hero-live .hn-tag { color: var(--red); }
.hn-pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--red);
  animation: hnpulse 1.6s ease-out infinite;
}
@keyframes hnpulse {
  0% { box-shadow: 0 0 0 0 rgba(185,21,43,.4); }
  70% { box-shadow: 0 0 0 8px rgba(185,21,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(185,21,43,0); }
}
.hn-title { font-size: 19px; font-weight: 800; line-height: 1.25; }
.hn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.hn-meet { font-size: 14px; color: var(--ink); }
.hn-meet .ico { color: var(--muted); }
.hn-actions { margin-top: 10px; }

/* Weather chips beside day headers / progress strip */
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dh-label { min-width: 0; }
.dh-side { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.wx-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 800; color: var(--ink);
  background: rgba(212,163,44,.12); border: 1px solid rgba(212,163,44,.3);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.wx-chip-ico { font-size: 14px; line-height: 1; }
.wx-chip-lo { color: var(--muted); font-weight: 700; }
.wx-chip-pop { font-size: 11px; color: var(--muted); margin-left: 2px; }

/* Collapsible days (during the trip, non-today) */
.day-head-btn { cursor: pointer; user-select: none; }
.day-head-btn:hover .dh-label { color: var(--red); }
.dh-count {
  font-size: 11.5px; font-weight: 800; color: var(--muted);
  background: rgba(120,120,120,.12); border-radius: 999px; padding: 2px 8px;
}
.dh-chev { color: var(--muted); font-size: 13px; }
.day-collapsed .event { display: none; }
.day-collapsed .day-head { border-bottom-style: dashed; margin-bottom: 4px; }

/* Event states on today's timeline */
.event-done { opacity: .55; }
.event-done .ev-title { text-decoration: line-through; text-decoration-color: rgba(120,120,120,.5); text-decoration-thickness: 1.5px; }
.event-live { border-color: var(--red); box-shadow: 0 0 0 3px rgba(185,21,43,.1), var(--shadow); }
.badge-now { background: var(--red); color: #fff; }

/* Post-trip hero */
.after-hero {
  text-align: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 20px 20px; margin: 4px 0 16px; box-shadow: var(--shadow);
}
.ah-emoji { font-size: 44px; line-height: 1; }
.ah-title { font-size: 24px; margin: 10px 0 8px; letter-spacing: -.02em; }
.ah-sub { color: var(--muted); font-size: 15.5px; line-height: 1.55; margin: 0 auto; max-width: 46ch; }
.ah-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 4px; }
.ah-ps { margin-top: 12px; }

/* Journey UI in print: show everything, drop interactive chrome */
@media print {
  .hero-next, .progress, .glance, .dh-chev, .dh-count { display: none !important; }
  .day-collapsed .event { display: block !important; }
  .wx-chip { border: 1px solid #bbb; background: none; color: #000; }
}
@media (prefers-color-scheme: dark) {
  .hero-next { background: linear-gradient(180deg, #241f2b, #211d27); }
  .hero-live { background: linear-gradient(180deg, #2b1f22, #211d27); }
  .upnext-row { background: linear-gradient(180deg, #241f2b, #211d27); }
}
