/* App shell layout ("Night flight"): topbar, mobile tab bar, two-pane desktop, page-specific rules. */

/* ---- topbar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--topbar-h) + var(--safe-t)); padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-3); max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s-5); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--accent-text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 0; background: transparent; color: var(--accent-text); display: grid; place-items: center; }
.brand-mark .icon { width: 22px; height: 22px; stroke-width: 2; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-14); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 520px) {
  .brand-name { font-size: var(--fs-12); letter-spacing: .14em; }
  .topbar-actions .btn:not(.btn-icon):not(.btn-primary) { display: none; }   /* signed-out: keep only "Get started" */
  .topbar-actions .btn-primary { min-height: 38px; padding: 0 var(--s-4); font-size: var(--fs-14); }
}
.topbar-title { flex: 1; min-width: 0; font-weight: 600; font-size: var(--fs-16); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { display: none; align-items: center; gap: var(--s-2); margin-left: var(--s-6); }
.topnav a { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-pill); color: var(--fg-3); font-weight: 500; font-size: var(--fs-12); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; }
.topnav a:hover { color: var(--fg); text-decoration: none; }
.topnav a.is-active { color: var(--accent-text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.topbar-actions .logout-form { display: contents; }
@media (min-width: 900px) { .topnav { display: flex; } }

/* ---- mobile tab bar --------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: var(--fg-3); font-size: var(--fs-11); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; min-height: var(--tabbar-h);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.is-active { color: var(--accent-text); }
.tabbar .icon { width: 22px; height: 22px; }
@media (min-width: 900px) { .tabbar { display: none; } }

/* ---- main area -------------------------------------------------------- */
.main { padding: var(--s-5) var(--s-5) calc(var(--tabbar-h) + var(--safe-b) + var(--s-10)); max-width: var(--content-max); margin: 0 auto; }
@media (min-width: 900px) { .main { padding: var(--s-8) var(--s-6) var(--s-12); } }
.page-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head h1 { flex: 1 1 auto; min-width: 0; }
.section-title { font-size: var(--fs-12); font-weight: 500; letter-spacing: var(--track); text-transform: uppercase; color: var(--fg-3); margin: var(--s-8) 0 var(--s-2); }
.section-title:first-child { margin-top: 0; }

/* two-pane desktop for the app: trip list | trip detail */
.two-pane { display: block; }
@media (min-width: 900px) {
  .two-pane { display: grid; grid-template-columns: var(--pane-list) minmax(0, 1fr); gap: var(--s-12); align-items: start; }
  .pane-list { position: sticky; top: calc(var(--topbar-h) + var(--s-8)); max-height: calc(100vh - var(--topbar-h) - var(--s-16)); overflow: auto; padding-right: 2px; scrollbar-width: thin; }
  .pane-detail { min-width: 0; max-width: 720px; }
  .two-pane.is-detail-hidden { grid-template-columns: minmax(0, 1fr); }
  .two-pane.is-detail-hidden .pane-detail { display: none; }
  .two-pane.is-detail-hidden .pane-list { max-width: 720px; }
}
@media (max-width: 899px) {
  .two-pane.show-detail .pane-list { display: none; }
  .two-pane:not(.show-detail) .pane-detail { display: none; }
}

/* ---- trip rows (the list) --------------------------------------------- */
.trip-card {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: var(--s-4); align-items: center;
  padding: var(--s-4) 0; position: relative; overflow: visible;
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none;
  color: inherit; text-decoration: none;
  transition: background var(--t-fast), padding var(--t-fast) var(--ease);
}
.trip-card:hover { background: transparent; border-color: var(--line); text-decoration: none; }
.trip-card:hover .trip-title { color: var(--accent-text); }
.trip-card.is-active { background: transparent; box-shadow: none; }
.trip-card.is-active .trip-title { color: var(--accent-text); }
.trip-card .trip-date { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-28); line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.trip-card .trip-date small { display: block; font-family: var(--font); font-weight: 500; font-size: var(--fs-11); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); margin-top: 5px; }
.trip-card .trip-title { font-weight: 600; font-size: var(--fs-16); line-height: 1.25; transition: color var(--t-fast); }
.trip-card .trip-dates { color: var(--fg-2); font-size: var(--fs-14); margin-top: 3px; font-variant-numeric: tabular-nums; }
.trip-card .trip-meta { margin-top: 0; display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.trip-card .trip-type { width: 8px; height: 8px; border-radius: 50%; background: var(--work); }
.trip-card.is-personal .trip-type { background: var(--personal); }
.trip-card.is-shared .trip-type { background: var(--shared); }
.trip-card.is-shared:hover .trip-title, .trip-card.is-shared.is-active .trip-title { color: var(--shared-text); }
.owner-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--fs-12); font-weight: 600; color: var(--shared-text); letter-spacing: .01em; }
.owner-chip .avatar-sm { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--shared-soft); color: var(--shared-text); border: 1px solid color-mix(in srgb, var(--shared) 50%, transparent); }
.owner-chip .faint { font-weight: 500; color: var(--fg-3); }
.owner-chip.is-together { color: var(--fg-2); }
.owner-chip .avatars { display: inline-flex; }
.owner-chip .avatars .avatar-sm + .avatar-sm { margin-left: -6px; }
.owner-chip.is-together .avatar-sm { background: var(--surface-2); color: var(--fg); border-color: var(--line-strong); }
.trip-card .trip-countdown { text-align: right; font-size: var(--fs-11); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; }
.trip-card .trip-countdown strong { display: block; font-family: var(--font-display); font-size: var(--fs-20); color: var(--fg); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.trip-card .trip-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
/* Groups (In progress / Upcoming / Past) are distinct blocks with their own shade, not one long list. */
.trip-group { padding: var(--s-4) var(--s-5) var(--s-2); border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.trip-group + .trip-group { margin-top: var(--s-4); }
.trip-group .section-title { display: flex; align-items: baseline; gap: var(--s-3); margin: 0 0 var(--s-1); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-24); letter-spacing: -.02em; text-transform: none; color: var(--fg); }
.trip-group .section-title .count { font-family: var(--font); font-weight: 500; font-size: var(--fs-12); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.trip-group .trip-card:last-child { border-bottom: 0; }
.trip-group.is-now { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.trip-group.is-now .section-title { color: var(--accent-text); }
.trip-group.is-now .trip-card { border-bottom-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.trip-group.is-upcoming { background: var(--surface); }
.trip-group.is-shared { background: var(--shared-soft); border-color: color-mix(in srgb, var(--shared) 40%, transparent); }
.trip-group.is-shared .section-title { color: var(--shared-text); }
.trip-group.is-shared .trip-card { border-bottom-color: color-mix(in srgb, var(--shared) 25%, transparent); }
.trip-group.is-past { background: transparent; border-color: var(--line); }
.trip-group.is-past .section-title { color: var(--fg-3); }
.trip-group.is-past .trip-card { opacity: .72; }
.trip-group.is-past .trip-card:hover { opacity: 1; }

/* ---- next-up hero: the biggest thing on the screen ----------------------- */
.hero { position: relative; display: block; padding: var(--s-2) 0 0; margin-bottom: var(--s-8); color: var(--fg); text-decoration: none; }
.hero:hover { text-decoration: none; }
.hero .hero-kicker { font-size: var(--fs-12); font-weight: 500; letter-spacing: var(--track); text-transform: uppercase; color: var(--fg-3); }
.hero .hero-codes { display: flex; align-items: baseline; gap: 14px; margin-top: var(--s-2); font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 12vw, 3.6rem); line-height: 1; letter-spacing: -.03em; color: var(--fg); font-variant-numeric: tabular-nums; }
.hero .hero-codes .icon { width: .6em; height: .6em; stroke: var(--accent); stroke-width: 2; align-self: center; }
.hero .hero-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-28); line-height: 1.1; margin-top: var(--s-2); letter-spacing: -.02em; }
.hero.has-codes .hero-title { font-family: var(--font); font-weight: 500; font-size: var(--fs-16); letter-spacing: 0; margin-top: var(--s-3); color: var(--fg); }
.hero .hero-sub { margin-top: 4px; font-size: var(--fs-14); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.hero .hero-arc { display: block; width: 100%; height: auto; margin: var(--s-3) 0 0; overflow: visible; }
.hero .hero-facts { display: flex; gap: var(--s-5); margin-top: var(--s-2); flex-wrap: wrap; }
.hero .hero-fact { font-size: var(--fs-11); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.hero .hero-fact strong { display: block; font-family: var(--font-display); font-size: var(--fs-16); color: var(--fg); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: 0; text-transform: none; margin-bottom: 2px; }
.hero .hero-fact strong .pill { font-family: var(--font); }
.hero a { color: inherit; }
@media (min-width: 900px) { .hero .hero-codes { font-size: 3.4rem; } }

/* ---- trip detail ------------------------------------------------------ */
.trip-head { margin-bottom: var(--s-6); }
.trip-head .trip-head-top { display: flex; align-items: flex-start; gap: var(--s-2); }
.trip-head h1 { flex: 1; min-width: 0; font-size: clamp(1.9rem, 7vw, 2.5rem); line-height: 1.02; }
.trip-head .trip-sub { color: var(--fg-2); margin-top: var(--s-3); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.trip-head .trip-pills { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-3); }
.trip-head .trip-kicker { font-size: var(--fs-12); font-weight: 500; letter-spacing: var(--track); text-transform: uppercase; color: var(--fg-3); margin-bottom: var(--s-2); display: flex; align-items: center; gap: 8px; }
.trip-head .trip-kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--work); }
.trip-head.is-personal .trip-kicker .dot { background: var(--personal); }
.trip-head.is-shared { padding: var(--s-4) var(--s-4) var(--s-4); border-radius: 18px; background: var(--shared-soft); border: 1px solid color-mix(in srgb, var(--shared) 40%, transparent); }
.trip-head.is-shared .trip-kicker { color: var(--shared-text); }
.trip-head.is-shared .trip-kicker .dot { background: var(--shared); }
.shared-banner { display: flex; align-items: center; gap: 10px; margin-top: var(--s-4); padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--shared) 16%, transparent); font-size: var(--fs-13); line-height: 1.35; }
.shared-banner .avatar-lg { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--shared); color: var(--fg-inverse); font-family: var(--font-display); font-weight: 700; }
.shared-banner .grow { min-width: 0; }
.shared-banner .btn { flex: 0 0 auto; }
.hero.is-shared .hero-kicker { color: var(--shared-text); }
.hero.is-shared .hero-codes .icon { stroke: var(--shared); }
.stat-row { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.stat { padding: 0; background: transparent; border: 0; border-radius: 0; display: flex; align-items: baseline; gap: 6px; }
.stat .stat-label { font-size: var(--fs-11); color: var(--fg-3); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; order: 2; }
.stat .stat-value { font-family: var(--font-display); font-size: var(--fs-20); font-weight: 700; margin-top: 0; font-variant-numeric: tabular-nums; order: 1; }

/* segment detail sheet content */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: var(--s-3) var(--s-3); font-size: var(--fs-14); }
.kv dt { color: var(--fg-3); font-size: var(--fs-11); letter-spacing: .1em; text-transform: uppercase; font-weight: 500; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.big-time { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s-3); align-items: center; padding: var(--s-4) 0 var(--s-5); background: transparent; border-radius: 0; border-bottom: 1px solid var(--line); margin: 0 0 var(--s-4); }
.big-time .bt-code { font-family: var(--font-display); font-size: var(--fs-36); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.big-time .bt-time { font-size: var(--fs-16); font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.big-time .bt-name { font-size: var(--fs-12); color: var(--fg-3); margin-top: 2px; }
.big-time .bt-arrow { color: var(--accent); }
.big-time .bt-arrow .icon { width: 28px; height: 28px; }
.big-time > div:last-child { text-align: right; }
.type-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.type-picker button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--s-3) var(--s-1); border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: transparent; color: var(--fg-2); font-size: var(--fs-12); font-weight: 500; }
.type-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

/* ---- auth / marketing pages ------------------------------------------ */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; margin-bottom: var(--s-8); }
.auth-card .brand-mark { width: 30px; height: 30px; }
.auth-card h1 { text-align: center; margin-bottom: var(--s-6); font-size: var(--fs-28); }
.auth-alt { text-align: center; margin-top: var(--s-5); color: var(--fg-2); font-size: var(--fs-14); }
.or { display: flex; align-items: center; gap: var(--s-3); color: var(--fg-3); font-size: var(--fs-11); letter-spacing: .12em; text-transform: uppercase; margin: var(--s-5) 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.landing-hero { padding: var(--s-16) var(--s-4) var(--s-10); text-align: center; max-width: 820px; margin: 0 auto; }
.landing-hero h1 { font-size: clamp(2.4rem, 7vw, 4.25rem); letter-spacing: -.035em; line-height: 1; }
.landing-hero h1 em { font-style: normal; color: var(--accent-text); }
.landing-hero p { font-size: var(--fs-20); color: var(--fg-2); margin-top: var(--s-6); }
.landing-hero .actions { margin-top: var(--s-8); display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; max-width: var(--content-max); margin: var(--s-8) auto var(--s-16); padding: 0 var(--s-4); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: var(--s-6); border: 1px solid var(--line); border-radius: var(--r-card); background: transparent; }
.feature .f-icon { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--accent-text); display: grid; place-items: center; margin-bottom: var(--s-4); }
.feature h3 { margin-bottom: var(--s-1); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-20); letter-spacing: -.01em; }
.feature p { color: var(--fg-2); font-size: var(--fs-14); }
.footer { padding: var(--s-8) var(--s-4); text-align: center; color: var(--fg-3); font-size: var(--fs-12); }
.footer a { color: inherit; margin: 0 var(--s-2); }

/* ---- settings --------------------------------------------------------- */
.settings-nav { display: flex; gap: var(--s-5); overflow: auto; padding-bottom: 0; margin-bottom: var(--s-6); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.settings-nav a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; padding: 0 2px; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 0; color: var(--fg-3); font-weight: 500; font-size: var(--fs-12); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.settings-nav a.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.settings-nav a:hover { text-decoration: none; color: var(--fg); }

/* ---- offline / update banners (quiet, top of main) ------------------- */
.banner { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-4); border-radius: var(--r-ctl); background: var(--warn-soft); color: var(--warn-text); font-size: var(--fs-14); margin-bottom: var(--s-4); }

/* ---- team ------------------------------------------------------------- */
.team-row { padding: var(--s-4) 0; border-bottom: 1px solid var(--line); }
.team-row:last-child { border-bottom: 0; }
.team-who { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.team-row .list-row { padding-left: 0; padding-right: 0; }
.arrivals-city + .arrivals-city { margin-top: var(--s-3); }
