/* ============================================================
   bivo — trip planner styles
   Design tokens (colours, type, radii, shadows, fonts) live in
   css/tokens.css, loaded first. Nothing here hard-codes a colour:
   use the semantic tokens so light and dark both work.
   Theme: <html data-theme="light|dark|auto">, set by app.js from
   settings.appearance (and early by an inline script in index.html).
   ============================================================ */

/* App-level tokens built on tokens.css */
:root {
  --pad: 36px;                       /* main area side padding */
  --sidebar-w: 248px;
  --gap: 20px;                       /* gap between cards */
  --scrim: rgba(20, 16, 20, 0.45);   /* behind sheets and dialogs */
  --icon-stroke: 1.8;                /* default icon stroke, see U.icon() */
  --radius-alert-phone: 14px;        /* alert banners on phone (§4) */
  --fs-trip-total-phone: 32px;       /* going trip card total on phone (§3) */
  /* Compare: the cheapest column's tint and its header (Compare add-on). */
  --cmp-tint: #F7F8FF;
  --cmp-tint-head: #EEF1FF;
  /* Plans (PLANS_DESIGN "New tokens"). */
  --cell: #FAFBFD;                                   /* timeline slot background */
  --drop: #EEF1FF;                                   /* drop target, selected option */
  --shadow-lift: 0 16px 36px rgba(20, 16, 40, 0.22); /* a card being dragged */
  --overlay: rgba(20, 16, 20, 0.32);                 /* behind slide-overs and sheets */
  /* Select chevron, drawn in --text (an image can't read a CSS variable). */
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23141014' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
}
:root[data-theme="dark"] { --cmp-tint: #161C3D; --cmp-tint-head: #1C2350; }
:root[data-theme="dark"] {
  --cell: #141726; --drop: #1C2350;
  --shadow-lift: 0 16px 36px rgba(0, 0, 0, 0.55); --overlay: rgba(5, 6, 12, 0.6);
}
:root[data-theme="dark"] { --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23F2F3F8' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]),
  :root[data-theme="auto"] { --cmp-tint: #161C3D; --cmp-tint-head: #1C2350; }
  :root:not([data-theme="light"]):not([data-theme="dark"]),
  :root[data-theme="auto"] {
    --cell: #141726; --drop: #1C2350;
    --shadow-lift: 0 16px 36px rgba(0, 0, 0, 0.55); --overlay: rgba(5, 6, 12, 0.6);
  }
  :root:not([data-theme="light"]):not([data-theme="dark"]),
  :root[data-theme="auto"] { --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23F2F3F8' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

::selection { background: var(--brand-ice); color: var(--brand-ink); }

/* Every interactive thing gets a visible ring from the keyboard. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Money is always tabular. Mark amounts with .money or data-money. */
.money, .tabular, [data-money] { font-variant-numeric: tabular-nums; }
.stat-value, .tile-value, .trip-total-value, .opt-price, .alt-price, .cmp-c,
.watch-nums, .bk-amount, .ov-value, .duo-value, .watch-line,
.cu-amt, .risk-row, .wp-nums, .split-line, .hero-extra, .trip-meta,
.list-amount, .delta, .barlist-amount { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   APP SHELL (DESIGN_SYSTEM §5, WebNotes)
   Three layouts, chosen by width and by html.is-app / html.is-web
   (app.js and the inline script in index.html set those; add
   ?layout=app or ?layout=web to force one for testing):

   1. Desktop, >= 1024px      sidebar + main; avatar in the page head
   2. Mobile web, < 1024px    .webbar (wordmark + avatar) that scrolls
                              away, .webtabs sticky under it, no tab bar
   3. Installed app, < 1024   bottom .tabbar with Trips, Bookings,
      (html.is-app)           Compare, Plans, Account; Account opens a sheet

   app.js builds all of them on every render; CSS shows the right one.
   #main is the scroll container in every layout.
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: minmax(200px, var(--sidebar-w)) minmax(0, 1fr);
  height: 100dvh;
}

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 16px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 0 12px 24px;
  color: var(--wordmark);
  text-decoration: none;
  line-height: 0;
  border-radius: var(--radius-xs);
}

/* The logo, from U.wordmark(). Sized by height; colour comes from --wordmark.
   28px of outline = the design's Bowlby wordmark at 34px. */
.wordmark { display: block; height: 28px; width: auto; fill: currentColor; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 12px;
  border-radius: var(--radius-nav-item);
  color: var(--text-muted);
  font-size: var(--fs-body);
  font-weight: 500;
  text-decoration: none;
  user-select: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item .ic { width: 20px; height: 20px; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item.active,
.nav-item[aria-current="page"] {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}

.nav-spacer { flex: 1; }

/* "Shared" group label above Plans: a 1px divider, then 12px/700 faint. */
.nav-group {
  margin: 14px 12px 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--text-faint);
}

.nav-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 0;
  padding: 12px 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--text-faint);
  font-size: var(--fs-meta);
  text-align: left;
}
.nav-foot:hover { color: var(--text-muted); }

/* ---------- Main + page frame ---------- */
.main {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px var(--pad) 56px;
}
.page.narrow { max-width: calc(960px + 2 * var(--pad)); }

/* Account controls in the page head (desktop only; app.js adds them). */
.head-account { display: flex; align-items: center; gap: 8px; }
.signin-link {
  padding: 10px 6px;
  color: var(--accent);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  border: 0;
  background: none;
}

/* ---------- Mobile web: top bar + sticky tabs ---------- */
.webbar, .webtabs, .tabbar { display: none; }

.webbar {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: var(--bg);
}
.webbar .brand { padding: 0; align-self: center; }
.webbar .wordmark { height: 23px; }   /* Bowlby 28px */
.webbar .avatar { width: 40px; height: 40px; font-size: var(--fs-body); }
.webbar .avatar-dot { width: 11px; height: 11px; right: -1px; bottom: -1px; }

.webtabs {
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 26px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.webtab {
  padding: 15px 2px 13px;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.webtab[aria-current="page"] { color: var(--text); font-weight: 700; border-bottom-color: var(--primary); }

/* ---------- Installed app: bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  justify-content: space-around;
  height: calc(62px + max(22px, env(safe-area-inset-bottom)));
  padding: 8px 8px max(22px, env(safe-area-inset-bottom));
  background: var(--sidebar);
  border-top: 1px solid var(--line);
}
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 0 2px;
  border: none;
  background: none;
  color: var(--text-faint);
  font-size: var(--fs-tab);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tabbar-ic { display: grid; place-items: center; height: 28px; }
.tabbar-ic .ic { width: 22px; height: 22px; }
.tabbar-item.active { color: var(--tab-active-fg); font-weight: 700; }
.tabbar-item.active .tabbar-ic {
  width: 52px;
  border-radius: var(--radius-pill);
  background: var(--tab-active-bg);
  --icon-stroke: 2;
}
.tabbar-item.active .tabbar-ic .ic { width: 20px; height: 20px; }

/* ---------- Account menu (js/account.js) ----------
   .popover: 340px, anchored under the avatar (desktop + mobile web).
   .sheet:   bottom sheet in the installed app. Same inner parts. */
.popover {
  position: fixed;
  z-index: 70;
  width: 340px;
  max-width: calc(100vw - 24px);
  overflow-y: auto;
  padding-bottom: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-popover);
}
.popover:focus { outline: none; }

.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.sheet-scrim.open { opacity: 1; }
.sheet {
  width: 100%;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--text);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(24px);
  transition: transform var(--dur) var(--ease);
}
.sheet:focus { outline: none; }
.sheet-scrim.open .sheet { transform: translateY(0); }
.sheet-grab {
  align-self: center;
  width: 40px; height: 5px;
  border-radius: var(--radius-pill);
  background: var(--line);
}

.acct-profile { display: flex; align-items: center; gap: 14px; padding: 18px 18px 14px; }
.acct-who { flex: 1; min-width: 0; }
.acct-name { font-size: var(--fs-name); font-weight: 600; }
.acct-email {
  margin-top: 2px;
  font-size: var(--fs-meta);
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-sync {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-select);
  background: var(--raised);
}
.acct-sync-when { flex: 1; min-width: 0; font-size: var(--fs-caption); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.acct-syncnow { min-height: 34px; padding: 7px 12px; }
.acct-label {
  display: block;
  padding: 16px 18px 6px;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--text-muted);
}
.acct-pad { padding: 0 14px; }
.seg.acct-seg { display: flex; width: 100%; margin: 0; background: var(--raised); }
.popover select.input { min-height: 42px; font-size: var(--fs-body-sm); }
.acct-links { margin-top: 14px; padding: 6px; border-top: 1px solid var(--line-soft); }
.acct-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-nav-item);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}
.acct-link .ic { width: 20px; height: 20px; }
.acct-link:hover { background: var(--raised); }

/* Sheet sizing (AccountPhone): bigger avatar, 44px segments, 46px select. */
.sheet .acct-profile { padding: 0; }
.sheet .avatar.lg { width: 56px; height: 56px; font-size: var(--fs-title-lg); }
.sheet .acct-name { font-size: var(--fs-section); }
.sheet .acct-close { width: 40px; height: 40px; }
.sheet .acct-sync { margin: 0; border-radius: var(--radius-alert); }
.sheet .acct-sync-when { font-size: var(--fs-meta); }
.sheet .acct-syncnow { min-height: 40px; padding: 9px 14px; font-size: var(--fs-body-sm); }
.sheet .acct-label { padding: 0; margin-bottom: -6px; font-size: var(--fs-meta); }
.sheet .acct-pad { padding: 0; }
.sheet .acct-links { margin: 0 -4px; padding: 0; }
.sheet .acct-link { padding: 14px 4px; min-height: 48px; font-size: var(--fs-body); }

/* Mobile web: the dropdown spans the screen under the avatar (WebAccount). */
@media (max-width: 1023px) {
  .popover { width: calc(100vw - 24px); max-width: 420px; }
  .popover .acct-seg .seg-btn { min-height: 44px; }
}

/* ---------- Layout switches ---------- */
@media (max-width: 1023px) {
  :root { --pad: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .page .head-account { display: none; }
  .page { padding: 18px var(--pad) calc(env(safe-area-inset-bottom) + 80px); }

  /* Mobile web (default below 1024 unless installed) */
  html:not(.is-app) .webbar { display: flex; }
  html:not(.is-app) .webtabs { display: flex; }

  /* Installed app */
  html.is-app .tabbar { display: flex; }
  html.is-app .page {
    padding-top: calc(env(safe-area-inset-top) + 24px);
    padding-bottom: calc(110px + max(0px, env(safe-area-inset-bottom) - 22px));
  }
  html.is-app .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   COMPONENTS — shared building blocks (DESIGN_SYSTEM §6)
   Tokens only. Helpers live in js/ui.js (App.ui.*).

   Class                         Helper (App.ui)            Notes
   ----------------------------  -------------------------  ------------------------------
   .page-head .page-title        pageHead(t, sub, actions)  Bowlby 44 / 36 phone; avatar is
     .page-sub .page-actions                                added to .page-actions by app.js
   .card .card-head .card-title  card(t, actions, body,cls) radius 22 / 20 phone, no shadow
     .card.flush .card.dark                                 .dark = cobalt panel
   .btn                          btn(label, fn, cls, icon)  secondary: line border, 38px/44
   .btn.btn-primary                                         cobalt, 46px, 15/600. One per view
   .btn-md .btn-sm .btn-lg                                  44px / 32px / 46px heights
   .btn-outline .btn-danger                                 cobalt outline / alert colours
   .btn-link                                                text link, cobalt (--accent)
   .icon-btn (.outline .danger)  iconBtn(name, label, fn)   38x38, radius 11, aria-label
   .pills .pill(.on)             pills(opts, val, fn)       filter pills, aria-pressed
   .seg .seg-btn(.on)            segmented(opts, val, fn)   pill track, aria-pressed (or radio)
   .tabs .tab(.on)               tabs(opts, val, fn)        underlined text tabs
   .chip + .chip-pos/-info/      status(kind, text, opts)   always a dot or icon + word
     -warn/-alert/-done          chip(text, kind)           plain chip (neutral = done)
   .chip-dot                                                6px dot inside a chip
   .alert .alert-warn/-alert/-pos alert(kind, bold, rest,..) banner, radius 16 / 14 phone
   .banner(.warn)                                           older banner, same look
   .stat-tile(.is-cobalt/-alert/-warn) statTile(l,v,sub,opts) cobalt = "Days to go" + doodle
   .stat .stat-label/-value      stat(l, v, caption, opts)  bare stat (no tile)
   .doodle                       doodle(opts)               dotted route, tomato end dot
   .hero-panel                   heroPanel(opts)            cobalt total-cost panel
   .progress .progress-fill      progress(frac, left, right) 6px pill bar with labels
   .bar .bar-fill                barTile(...)               6px track (category tiles)
   .barlist .barlist-row         barList(rows)              label 84px | track | amount
   .list-row .icon-tile          listRow(opts)              36px icon tile, title, meta
   .list-group-head                                         13/600 day/group header + rule
   .avatar(.sm .dashed) .avatar-dot  avatar(initial, opts)  46px ring + status dot; 30px
   .avatar-stack                 avatarStack(names)         travellers, overlap -10px
   .sticker(.sticker-peri)       sticker(text, opts)        tomato Bowlby, 5deg, 3px edge
   .empty-hero .empty-tips       emptyHero(opts) emptyTips  cobalt empty state, Bowlby headline
   .btn-on-cobalt                                           white pill on a cobalt panel
   .primary-action .act-round    primaryAction(label, fn)   labelled pill, or round + in the app
   .avatar.tone-0..3                                        cobalt / periwinkle / ink / ice
   .empty-card                   emptyCard(t, text, fn)     dashed 2px card + doodle
   .empty                        empty(icon, t, text, ...)  centred empty state + doodle
   .input .select .textarea      input/select/textarea()    38px r10 / select 46px r12
   .field .field-label .field-hint  field(label, ctl, opts)
   .radio(.on)                                              16px radio dot
   .status-dot(.ok .busy .bad)                              8px dot
   .rows .row .row-title/-sub                               titled rows, line-soft rules
   .scrim .panel                 slideOver(opts)            side sheet over --overlay; opts head/cls/trap/onClose
   .scrim.center .dialog         confirm(opts)              confirm dialog
   .toast(.has-action)           toast(msg, {action,...})   pill toast; optional Undo-style button
   .note                         note(text)                 muted helper paragraph
   .action-menu .action-menu-item  menu(trigger, items, opts) dropdown (260px, radius 16) or,
     .action-menu-rule .menu-sheet                          < 768px, a bottom sheet over --overlay;
     .action-menu-heading/-row/-pill                        headings, pill rows, .is-current ("Now")
   .field-error                                             inline field error, --alert-fg
   .nav-group                                               sidebar group label ("Shared")
   Plans list / plan page classes (.pl-*, .pv-*, cards .pi-*, item panel
   .ip-*, Move to… .mv-*) live in their own section.
   ============================================================ */

:root {
  --fs-hero: 52px;          /* hero total, desktop (44 on phone) */
  --fs-countdown: 40px;     /* Bowlby countdown in the cobalt tile */
  --fs-name: 16px;          /* name in the account menu */
}

/* ---------- Page head ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-title {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 400;
  line-height: 1;
  margin: 0;
}
.page-sub {
  color: var(--text-muted);
  font-size: var(--fs-body);
  margin-top: 8px;
}
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.label {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-muted);
}

.note {
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-lg);
  padding: 22px;
  margin-bottom: var(--gap);
}
.card.flush { padding: 0; overflow: hidden; }
.card.selected { border: 2px solid var(--selected); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-title {
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.card-actions { display: flex; gap: 8px; align-items: center; }

/* Cobalt panel (brand moment / hero). */
.card.dark {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.card.dark .stat-label,
.card.dark .stat-caption,
.card.dark .tile-label { color: var(--on-primary-muted); }
.card.dark .card-title { color: var(--on-primary); }

/* ---------- Buttons ---------- */
.btn {
  --icon-stroke: 2.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--raised); }
.btn:active { background: var(--line-soft); }
.btn .ic { width: 16px; height: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }

.btn-primary {
  --icon-stroke: 2.4;
  min-height: 46px;
  padding: 12px 20px;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--fs-body);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-pressed); border-color: var(--primary-pressed); }

/* Size modifiers. .btn-md is the 44px pair used side by side (Sync now / Sign out). */
.btn-md { min-height: 44px; padding: 10px 18px; font-size: var(--fs-body-sm); }
.btn-lg { min-height: 46px; padding: 12px 20px; font-size: var(--fs-body); }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: var(--fs-meta); }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-block { width: 100%; }

.btn-outline {
  border: 1.5px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover { background: var(--icon-tile); }

.btn-danger {
  border: 1.5px solid var(--alert-fg);
  background: var(--alert-bg);
  color: var(--alert-fg);
}
.btn-danger:hover { background: var(--alert-bg); filter: saturate(1.15); }

/* Kept for older callers: a positive-coloured button. */
.btn-green {
  border-color: var(--pos-bg);
  background: var(--pos-bg);
  color: var(--pos-fg);
}
.btn-green:hover { background: var(--pos-bg); border-color: var(--pos-fg); }

.btn-link {
  min-height: 0;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { background: none; }

/* Icon button: 38x38, radius 11, transparent. Always has an aria-label. */
.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-icon-button);
  background: transparent;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn.outline { border-color: var(--line); }
.icon-btn.danger:hover { background: var(--alert-bg); color: var(--alert-fg); }
.icon-btn.on { color: var(--pos-fg); border-color: var(--pos-fg); }
.icon-btn.round { border-radius: 50%; background: var(--raised); }

/* ---------- Filter pills ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  --icon-stroke: 2.2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.pill:hover { background: var(--raised); }
.pill.on, .pill[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.pill-ic { display: inline-grid; }
.pill-ic .ic { width: 15px; height: 15px; }
.pills.lg .pill { min-height: 40px; padding: 9px 16px; }
.type-pills .pill { min-height: 36px; padding: 7px 12px; }

/* ---------- Segmented control ---------- */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
}
.seg.on-raised, .popover .seg, .sheet .seg { background: var(--raised); }
.seg-btn {
  --icon-stroke: 2.2;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 18px;
  border: none;
  background: none;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg-btn .ic { width: 16px; height: 16px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on,
.seg-btn[aria-pressed="true"],
.seg-btn[aria-checked="true"] { background: var(--primary); color: var(--on-primary); }
.seg.compact .seg-btn { min-height: 36px; padding: 8px; font-size: var(--fs-meta); }

/* ---------- Underlined tabs ---------- */
.tabs { display: flex; gap: 20px; align-items: center; }
.tab {
  background: none;
  border: none;
  padding: 4px 0 8px;
  color: var(--text-muted);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); font-weight: 700; border-bottom-color: var(--primary); }

/* ---------- Chips + status chips ----------
   A status always shows a dot or icon AND a word (never colour alone).
   Neutral .chip = the "done" pair (quiet). */
.chip {
  --icon-stroke: 2.6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--done-bg);
  color: var(--done-fg);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.chip .ic { width: 11px; height: 11px; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.chip-pos   { background: var(--pos-bg);   color: var(--pos-fg); }
.chip-info  { background: var(--info-bg);  color: var(--info-fg); }
.chip-warn  { background: var(--warn-bg);  color: var(--warn-fg); }
.chip-alert { background: var(--alert-bg); color: var(--alert-fg); }
.chip-done  { background: var(--done-bg);  color: var(--done-fg); }

/* Older names still used by views. */
.chip-green { background: var(--pos-bg);  color: var(--pos-fg); }
.chip-dark  { background: var(--info-bg); color: var(--info-fg); }
.chip-plain { background: transparent; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.chip-faint { background: transparent; color: var(--text-faint); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.chip-initials { letter-spacing: .04em; }

.chip-x {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: transparent; color: currentColor;
  font-size: var(--fs-caption); line-height: 1; cursor: pointer; border: none;
  padding: 0; margin-left: 2px; opacity: .7;
}
.chip-x:hover { opacity: 1; background: var(--line); }

/* ---------- Alert banner ---------- */
.alert, .banner {
  --icon-stroke: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--radius-alert);
  background: var(--raised);
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.45;
  margin-bottom: var(--gap);
}
.alert .ic, .banner .ic { width: 18px; height: 18px; }
.alert b, .alert strong, .banner b, .banner strong { font-weight: 700; }
.alert-text, .banner-text { flex: 1 1 220px; min-width: 0; }
.alert-link {
  border: 0; background: none; padding: 0;
  color: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
}
.alert-warn, .banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert-alert, .banner.alert { background: var(--alert-bg); color: var(--alert-fg); }
.alert-info, .banner.info { background: var(--info-bg); color: var(--info-fg); }
.banner-more { opacity: .8; }

/* ---------- Stat tiles ---------- */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 12px;
}
.stat-tile {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.stat-tile .stat-label { margin: 0; }
.stat-tile .stat-value { margin-top: 8px; }
.stat-tile .stat-caption { margin-top: 6px; }
.stat-tile.is-alert .stat-value { color: var(--alert-fg); }
.stat-tile.is-warn .stat-value { color: var(--warn-fg); }

.stat-tile.is-cobalt {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.stat-tile.is-cobalt .stat-label,
.stat-tile.is-cobalt .stat-caption { color: var(--on-primary-muted); }
.stat-tile.is-cobalt .stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-countdown);
  font-weight: 400;
  line-height: 1;
  color: var(--on-primary);
}
.stat-tile.is-cobalt .stat-value.is-word { font-size: 30px; line-height: 1.05; }
.stat-tile .doodle { position: absolute; right: 12px; top: 16px; }

/* Bare stat (label / value / caption), used inside cards and strips. */
.stat-label {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-size: var(--fs-number-md);
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
}
.stat.hero .stat-value { font-size: var(--fs-hero); line-height: 1; letter-spacing: -.01em; }
.stat-caption {
  margin-top: 6px;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.stat.warn .stat-value { color: var(--warn-fg); }
.stat.dark {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-card);
  padding: 20px 22px;
}
.stat.dark .stat-label, .stat.dark .stat-caption { color: var(--on-primary-muted); }
.stat.dark .stat-value { color: var(--on-primary); }
.card.dark .stat-value { color: var(--on-primary); }

/* Row of bare stats with hairlines between them. */
.stat-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  align-items: stretch;
}
.stat-row > * { padding-right: 24px; }
.stat-row > * + * { border-left: 1px solid var(--line); padding-left: 24px; }
.stat-row.wrap { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); row-gap: 22px; }
.card.dark .stat-row > * + * { border-left-color: var(--on-primary-muted); }

/* ---------- Doodle (dotted route) ---------- */
.doodle { display: block; overflow: visible; }
.doodle-path { fill: none; stroke: var(--brand-periwinkle); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 9; }
.doodle-start { fill: var(--primary); }
.doodle-end { fill: var(--brand-tomato); }
.doodle-ring { fill: none; stroke: var(--brand-periwinkle); stroke-width: 2.5; stroke-dasharray: 3 3; }
.stat-tile.is-cobalt .doodle-start,
.hero-panel .doodle-start { fill: var(--on-primary); }

/* ---------- Hero cost panel ---------- */
.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 20px 22px;
  border-radius: var(--radius-card);
  background: var(--primary);
  color: var(--on-primary);
}
.hero-label { font-size: var(--fs-meta); font-weight: 500; color: var(--on-primary-muted); }
.hero-value {
  margin-top: 10px;
  font-size: var(--fs-hero);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  font-size: var(--fs-meta);
  color: var(--on-primary-muted);
  font-variant-numeric: tabular-nums;
}
.hero-panel > .sticker { position: absolute; right: 18px; top: 18px; }

/* ---------- Progress bar ---------- */
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-meta);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.progress, .bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}
.progress-fill, .bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width .3s var(--ease);
}

/* ---------- Bar list ("Where the money goes") ---------- */
.barlist { display: flex; flex-direction: column; gap: 12px; }
.barlist-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.barlist-label { font-size: var(--fs-meta); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlist .bar-fill { background: var(--accent); }
.barlist-amount { font-size: var(--fs-body-sm); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Category tiles (label, amount, 6px bar). */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
}
.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius-alert);
  padding: 14px 16px;
  background: var(--surface);
}
.tile.muted { background: var(--raised); }
.tile-label { font-size: var(--fs-meta); font-weight: 500; color: var(--text-muted); }
.tile-value {
  font-size: var(--fs-title);
  font-weight: 600;
  margin: 6px 0 12px;
  color: var(--text);
}

/* ---------- List row + icon tile ---------- */
.icon-tile, .item-ic {
  width: 36px; height: 36px;
  flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius-icon-tile);
  border: 0;
  background: var(--icon-tile);
  color: var(--icon-tile-fg);
}
.icon-tile .ic, .item-ic .ic { width: 17px; height: 17px; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
}
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: var(--raised); }
.list-main { flex: 1 1 260px; min-width: 0; }
.list-title { font-size: var(--fs-row-title); font-weight: 600; }
.list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.list-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.list-amount { font-size: var(--fs-body); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.list-amount small { display: block; font-size: var(--fs-caption); font-weight: 500; color: var(--text-faint); }
.delta {
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.delta.down { background: var(--pos-bg); color: var(--pos-fg); }

.list-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px 8px;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-muted);
}
.list-group-head .count { color: var(--text-faint); font-weight: 500; }
.list-group-head::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* ---------- Avatar ---------- */
.avatar {
  position: relative;
  width: 46px; height: 46px;
  flex: none;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line);
}
button.avatar { cursor: pointer; }
button.avatar:not(.dashed)[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--selected); }
.avatar-dot {
  position: absolute; right: 0; bottom: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--pos-fg);
  border: 2px solid var(--bg);
}
.avatar-dot.busy { background: var(--warn-fg); }
.avatar-dot.bad { background: var(--alert-fg); }
.avatar.dashed {
  background: transparent;
  color: var(--text-faint);
  border: 2px dashed var(--text-faint);
  box-shadow: none;
}
.avatar.dashed .ic { width: 20px; height: 20px; }
.avatar.lg { width: 52px; height: 52px; font-size: var(--fs-card-title); box-shadow: none; }
.avatar.xl { width: 72px; height: 72px; font-size: var(--fs-title-lg); box-shadow: none; }
.avatar.sm {
  width: 30px; height: 30px;
  font-size: var(--fs-caption);
  box-shadow: none;
  border: 2px solid var(--bg);
}
/* Profile photo in place of the letters: same circle, same ring. */
.avatar.has-photo { overflow: visible; }
.avatar-img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -10px; }

/* ---------- Sticker (brand moments only, max one per screen) ---------- */
.sticker {
  display: inline-block;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--sticker-edge, var(--bg));
  transform: rotate(5deg);
  line-height: 1;
}
.sticker-inner {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-tomato);
  color: var(--brand-ink);
  font-family: var(--font-display);
  font-size: var(--fs-meta);
  font-weight: 400;
  white-space: nowrap;
}
/* Edge = page colour (spec); on the cobalt hero it is white, as in TripPlan. */
.hero-panel .sticker { --sticker-edge: var(--on-primary); }
/* Periwinkle: quiet wins ("all booked"), never tomato's job. */
.sticker-peri .sticker-inner { background: var(--brand-periwinkle); }

/* ---------- White pill on a cobalt panel ---------- */
.btn-on-cobalt {
  min-height: 46px;
  padding: 12px 22px;
  border-color: var(--brand-white);
  background: var(--brand-white);
  color: var(--brand-cobalt);
  font-size: var(--fs-body);
}
.btn-on-cobalt:hover { background: var(--brand-ice); border-color: var(--brand-ice); }
.btn-on-cobalt:focus-visible { outline-color: var(--brand-white); }

/* ---------- Empty-state hero (EMPTY_AND_JOIN; Plans uses it too) ----------
   ui.emptyHero(): cobalt in both themes, Bowlby <h2>, ice body, white pill,
   one sticker on the top edge whose 3px edge is the page --bg, and three
   tilted white mini cards on a dotted route (aria-hidden). Text left, art
   right; on a phone the art goes on top. */
.empty-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  margin: 8px 0 28px;
  padding: 56px 56px 56px 60px;
  border-radius: 28px;
  background: var(--brand-cobalt);
  color: var(--brand-white);
}
.empty-hero-sticker { position: absolute; right: 28px; top: -14px; z-index: 1; }
.empty-hero-sticker .sticker-inner { font-size: var(--fs-body-sm); }
.empty-hero-copy { display: flex; flex-direction: column; gap: 14px; max-width: 520px; min-width: 0; }
.empty-hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 56px;              /* the one Bowlby moment on the page */
  font-weight: 400;
  line-height: 1.02;
}
.empty-hero-text { margin: 0; font-size: 17px; line-height: 1.5; color: var(--brand-ice); }
.empty-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.btn.empty-hero-btn { --icon-stroke: 2.4; min-height: 48px; font-weight: 700; }
.empty-hero-btn .ic { width: 16px; height: 16px; }
.empty-hero-link {
  padding: 12px 4px;
  border: 0;
  background: none;
  color: var(--brand-white);
  font-size: var(--fs-body);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.empty-hero-link:focus-visible { outline-color: var(--brand-white); }

.empty-hero-art { position: relative; width: 340px; height: 220px; flex: none; }
.empty-hero-route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.empty-hero-route path {
  fill: none;
  stroke: var(--brand-periwinkle);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 1 11;
}
.empty-hero-start { fill: var(--brand-white); }
.empty-hero-end { fill: var(--brand-tomato); }
.empty-mini {
  --icon-stroke: 2;
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: var(--radius-select);
  background: var(--brand-white);
  color: var(--brand-ink);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-lift);
}
.empty-mini-ic {
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--brand-ice);
  color: var(--brand-cobalt);
}
.empty-mini-ic .ic { width: 14px; height: 14px; }
.empty-mini.m1 { left: 11px; top: 93px;  transform: rotate(-5deg); }
.empty-mini.m2 { left: 36%;  top: 6%;    transform: rotate(4deg); }
.empty-mini.m3 { left: 170px; top: 139px; transform: rotate(-3deg); }
/* Where the cards sit for each section's labels (screens 07, 11). */
.eh-bookings .empty-mini.m1 { top: 108px; }
.eh-bookings .empty-mini.m2 { left: 135px; top: 14px; }
.eh-bookings .empty-mini.m3 { top: 138px; }
.eh-compare .empty-mini.m1 { top: 97px; }
.eh-compare .empty-mini.m3 { left: 161px; }

.empty-tips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.empty-tip { display: flex; align-items: flex-start; gap: 12px; padding: 4px; }
.empty-tip-ic {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: var(--radius-icon-tile);
  background: var(--icon-tile);
  color: var(--icon-tile-fg);
}
.empty-tip-ic .ic { width: 18px; height: 18px; }
.empty-tip-title { font-size: var(--fs-body); font-weight: 600; }
.empty-tip-text { margin-top: 4px; font-size: var(--fs-body-sm); line-height: 1.5; color: var(--text-muted); }

/* "You're not signed in." (03): sits 24px under the header and above the panel. */
.alert.signed-out-banner { margin: 4px 0 16px; }

@media (max-width: 767px) {
  .empty-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
    margin-top: 12px;
    padding: 26px 22px 28px;
    border-radius: var(--radius-card-lg);
  }
  .empty-hero-sticker { right: 18px; }
  .empty-hero-sticker .sticker-inner { font-size: var(--fs-caption); }
  .empty-hero-art { order: -1; width: 260px; max-width: 100%; height: 170px; }
  .empty-mini { font-size: var(--fs-caption); }
  .empty-hero-title { font-size: var(--fs-display-phone); }
  .empty-hero-text { font-size: var(--fs-body); }
  .empty-mini.m1 { left: 7px;   top: 69px; }
  .empty-mini.m2 { left: 87px;  top: 6px; }
  .empty-mini.m3 { left: 132px; top: 112px; }
  .eh-bookings .empty-mini.m1 { left: 6px;   top: 68px; }
  .eh-bookings .empty-mini.m2 { left: 88px;  top: 12px; }
  .eh-bookings .empty-mini.m3 { left: 122px; top: 106px; }
  .eh-compare .empty-mini.m1 { left: 8px;   top: 71px; }
  .eh-compare .empty-mini.m2 { left: 36%;   top: 6%; }
  .eh-compare .empty-mini.m3 { left: 130px; top: 113px; }
}

/* ---------- Primary action: labelled pill, round + in the installed app ---------- */
.primary-action { display: inline-flex; }
.act-round {
  --icon-stroke: 2.4;
  display: none;
  width: 48px; height: 48px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
}
.act-round .ic { width: 22px; height: 22px; }
.act-round:hover { background: var(--primary-hover); }
.act-round:active { background: var(--primary-pressed); }
@media (max-width: 1023px) {
  html.is-app .primary-action .act-label { display: none; }
  html.is-app .primary-action .act-round { display: inline-grid; }
}

/* ---------- Avatar tones (traveller chips and stacks) ---------- */
.avatar.tone-0 { background: var(--primary); color: var(--on-primary); }
.avatar.tone-1 { background: var(--brand-periwinkle); color: var(--brand-ink); }
.avatar.tone-2 { background: var(--text); color: var(--bg); }
.avatar.tone-3 { background: var(--info-bg); color: var(--info-fg); }

/* ---------- Empty states ---------- */
.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 300px;
  width: 100%;
  padding: 22px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-card-lg);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-body);
  text-align: center;
}
button.empty-card:hover { background: var(--empty); }
.empty-title { font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.empty-text { font-size: var(--fs-meta); line-height: 1.45; max-width: 260px; color: var(--text-muted); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 48px 20px;
  max-width: 440px;
  margin: 0 auto;
}
.empty h3 { font-size: var(--fs-body); font-weight: 600; margin: 4px 0 0; }
.empty p { color: var(--text-muted); font-size: var(--fs-meta); line-height: 1.5; margin: 0 0 10px; }

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  color: var(--text);
  font-size: var(--fs-body);
  transition: border-color var(--dur-fast) var(--ease);
}
.input:hover { border-color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--focus); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.input::placeholder { color: var(--text-faint); }
input[type="number"].input,
.input.num { text-align: right; font-variant-numeric: tabular-nums; }

textarea.input, .textarea {
  min-height: 0;
  padding: 9px 12px;
  line-height: 1.5;
  resize: vertical;
}

/* Selects: 46px, radius 12. The chevron image is the --select-chevron token. */
select.input, .select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 46px;
  padding: 0 38px 0 12px;
  border-radius: var(--radius-select);
  background-color: var(--raised);
  background-image: var(--select-chevron);
  background-position: right 14px center;
  background-size: 14px 14px;
  background-repeat: no-repeat;
}
select.input.compact, .select.compact { min-height: 38px; border-radius: var(--radius-input); }

input[type="date"].input { padding-right: 8px; }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field-hint { font-size: var(--fs-meta); color: var(--text-faint); margin-top: 6px; line-height: 1.45; }

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

/* Radio dot */
.radio {
  width: 16px; height: 16px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  cursor: pointer;
}
.radio.on { border-color: var(--selected); }
.radio.on::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--selected);
}

/* Status dot */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint); flex: none;
}
.status-dot.ok   { background: var(--pos-fg); }
.status-dot.busy { background: var(--warn-fg); }
.status-dot.bad  { background: var(--alert-fg); }

/* Titled rows with soft rules (Settings "On your phone", etc.) */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: var(--fs-body); font-weight: 600; }
.row-sub { font-size: var(--fs-body-sm); color: var(--text-muted); line-height: 1.5; margin-top: 3px; }

/* ---------- Slide-over, dialog, toast ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  background: var(--overlay);        /* slide-overs (PLANS_DESIGN tokens) */
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.scrim.open { opacity: 1; }
.scrim.center { align-items: center; justify-content: center; background: var(--scrim); }

.panel {
  width: 460px;
  max-width: 92vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-card-lg) 0 0 var(--radius-card-lg);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
  transform: translateX(24px);
  transition: transform var(--dur) var(--ease);
}
.scrim.open .panel { transform: translateX(0); }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title { font-size: var(--fs-card-title); font-weight: 600; line-height: 1.3; }
.panel-sub { font-size: var(--fs-meta); color: var(--text-muted); margin-top: 3px; }
.panel-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.panel-foot {
  display: flex;
  gap: 10px;
  /* Save sits at the LEFT: hosting badges (Netlify's "Powered by") live in
     the bottom-right corner and were covering the primary button. */
  flex-direction: row-reverse;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
.panel-rule { height: 1px; background: var(--line-soft); margin: 20px 0 18px; }

.dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-popover);
}
.dialog-title { font-size: var(--fs-section); font-weight: 600; margin: 0 0 8px; }
.dialog-text { font-size: var(--fs-body-sm); color: var(--text-muted); line-height: 1.55; margin: 0 0 20px; }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.dialog-foot .btn { min-height: 44px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  box-shadow: var(--shadow-menu);
}

/* ---------- Components on phones / tablets (< 1024) ---------- */
@media (max-width: 1023px) {
  .page-title { font-size: var(--fs-display-phone); }
  .page-sub { font-size: var(--fs-meta); margin-top: 8px; }
  .card { border-radius: var(--radius-card); padding: 18px 16px; margin-bottom: 14px; }
  .card-title { font-size: var(--fs-section); }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .icon-btn { width: 44px; height: 44px; }
  .pill { min-height: 40px; }
  .seg-btn { min-height: 44px; }
  .alert, .banner { border-radius: var(--radius-alert-phone); padding: 12px 14px; font-size: var(--fs-body-sm); align-items: flex-start; flex-wrap: nowrap; line-height: 1.4; }
  .alert .alert-ic { padding-top: 1px; }
  .alert.stack .alert-rest { display: block; }
  .alert.stack .alert-sep, .alert.stack .alert-when { display: none; }
  .stat-tile { border-radius: var(--radius-tile); padding: 16px; }
  .stat-value { font-size: var(--fs-number-sm); }
  .stat.hero .stat-value, .hero-value { font-size: var(--fs-number-xl); }
  .list-row { padding: 14px 16px; }
  .list-group-head { padding: 14px 16px 8px; }
  .empty-card { border-radius: var(--radius-card); min-height: 220px; }
  .input { min-width: 0; }
  .sticker-inner { font-size: var(--fs-caption); }
}

/* ---------- Trip cards (home: TripsList / TripsPhone / WebTrips) ---------- */
.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--gap);
}
/* Desktop: three columns, as in TripsList. */
@media (min-width: 1200px) { .trip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.trip-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-lg);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.trip-card:hover { border-color: var(--text-faint); }
.trip-card.going { border: 2px solid var(--primary); padding: 21px; }
.trip-card.going:hover { border-color: var(--primary-hover); }
.trip-card .trip-sticker { position: absolute; right: 18px; top: -14px; z-index: 1; }

.trip-name {
  margin: 0;
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.3;
}
.trip-link { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.trip-link:focus-visible { outline: none; }
.trip-card:focus-within:has(.trip-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.trip-card.has-sticker .trip-name { padding-right: 24px; }

.trip-card-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  margin-top: -6px;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.trip-dates { white-space: nowrap; }

/* Mark going / duplicate / delete: shown on hover or keyboard focus with a
   pointer, always on touch. */
.trip-card-actions {
  display: flex;
  gap: 2px;
  margin: -6px -8px -6px auto;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.trip-card:hover .trip-card-actions,
.trip-card:focus-within .trip-card-actions { opacity: 1; }

.trip-route { font-size: var(--fs-body-sm); line-height: 1.55; color: var(--text-muted); }
.trip-divider { height: 1px; background: var(--line-soft); }

.trip-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.trip-total-value {
  margin-top: 4px;
  font-size: var(--fs-number-lg);
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.trip-pp { display: none; font-size: var(--fs-meta); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.trip-pp b, .trip-meta b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.trip-diff { color: var(--warn-fg); font-weight: 600; }

.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: auto;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.trip-grid .empty-card { min-height: 300px; }

/* Phone: the compact card from TripsPhone / WebTrips. */
@media (max-width: 600px) {
  .trips-page .wide-only { display: none; }
  .trip-grid { gap: 14px; }
  .trip-card { gap: 12px; padding: 18px; border-radius: var(--radius-card); }
  .trip-card.going { padding: 17px; margin-top: 6px; }
  .trip-card .trip-sticker { right: 14px; top: -13px; }
  .trip-name { font-size: var(--fs-section); }
  .trip-card-sub { font-size: var(--fs-caption); gap: 8px; }
  .trip-route, .trip-divider, .trip-meta, .trip-total .label { display: none; }
  .trip-total { align-items: baseline; }
  .trip-total-value { margin: 0; font-size: var(--fs-title); }
  .trip-card.going .trip-total-value { font-size: var(--fs-trip-total-phone); }
  .trip-pp { display: block; }
  .trip-card .progress-labels { font-size: var(--fs-caption); }
  .trip-grid .empty-card { min-height: 200px; }
}

/* ---------- Layout visibility helpers ----------
   .wide-only / .narrow-only switch at the shell breakpoint (1024).
   Below it, .hide-in-app / .hide-on-web pick the installed app or the
   mobile-web variant (html.is-app / html.is-web). */
@media (min-width: 1024px) { .narrow-only { display: none !important; } }
@media (max-width: 1023px) {
  .wide-only { display: none !important; }
  html.is-app .hide-in-app, html.is-web .hide-on-web { display: none !important; }
}

/* ---------- Top row (trip plan + bookings dashboard) ---------- */
.back-btn {
  --icon-stroke: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.back-btn:hover { background: var(--raised); }
.back-btn > span { display: inline-grid; }
.back-btn .ic { width: 16px; height: 16px; }

.going-toggle {
  --icon-stroke: 2.4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  white-space: nowrap;
}
.going-toggle > span { display: inline-grid; }
.going-toggle .ic { width: 16px; height: 16px; }
.going-toggle:hover { background: var(--raised); }
.going-toggle.on { border-color: var(--pos-bg); background: var(--pos-bg); color: var(--pos-fg); font-weight: 700; }
.going-toggle.on:hover { border-color: var(--pos-fg); }

.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.top-row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-title { margin: 0; min-width: 0; font-weight: 600; }

/* ---------- Trip plan (TripPlan / TripPlanPhone / WebTripPlan) ---------- */
.plan-top { gap: 10px; flex-wrap: nowrap; margin-bottom: var(--gap); }
.plan-top .top-row-actions { margin-left: auto; align-items: center; gap: 10px; flex-wrap: nowrap; }

.plan-head-card { padding: 24px; }
.plan-head { display: flex; flex-wrap: wrap; gap: 24px; }
.plan-head-main { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.plan-head-main .field { margin: 0; }
.plan-head-side { flex: 1 1 220px; max-width: 280px; }
.plan-head-side .field { margin: 0; }
.plan-head-label { margin-bottom: 8px; }
.plan-head-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.plan-head-card textarea.input { min-height: 72px; font-size: var(--fs-body-sm); }

.plan-name-input {
  display: block;
  width: calc(100% + 16px);
  margin: 4px 0 0 -8px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-title-lg);
  font-weight: 600;
  line-height: 1.25;
}
.plan-name-input:hover { border-color: var(--line); }
.plan-name-input:focus { outline: none; border-color: var(--focus); background: var(--raised); }

.traveler-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.traveler {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px 3px 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-body-sm);
  font-weight: 500;
}
.traveler .avatar.sm { border: 0; }
/* The name opens the traveller panel (name + phone for Nudge). */
.traveler-name {
  min-width: 20px;
  padding: 2px 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.traveler-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.traveler-x {
  --icon-stroke: 2.2;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
}
.traveler-x .ic { width: 14px; height: 14px; }
.traveler-x:hover { background: var(--raised); color: var(--alert-fg); }
.traveler-add {
  width: 160px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body-sm);
}
.traveler-add::placeholder { color: var(--text-faint); }
.traveler-add:focus { outline: none; border-style: solid; border-color: var(--focus); }

/* Phone: avatars + "4 travellers · dates", which opens the details card. */
.plan-compact { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.plan-compact-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: var(--fs-body);
  text-align: left;
}
.plan-compact-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-compact-caret { display: grid; color: var(--text-faint); transition: transform var(--dur) var(--ease); }
.plan-compact-caret .ic { width: 16px; height: 16px; }
.plan-compact-toggle[aria-expanded="true"] .plan-compact-caret { transform: rotate(180deg); }
.plan-compact .avatar-stack .avatar { width: 30px; height: 30px; }

/* Hero + stat tiles */
.plan-stats {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--gap);
}
.plan-stats .stat-tile { min-height: 150px; padding: 20px 22px; border-radius: var(--radius-card); }
.plan-stats .stat-tile .stat-value { font-size: var(--fs-number-md); }
.pp-split { line-height: 1.6; font-variant-numeric: tabular-nums; }
.pp-split b { font-weight: 500; color: inherit; }
.part-trip { color: var(--accent); font-weight: 600; }
.hero-panel .part-trip { color: var(--on-primary); }
.hero-panel .hero-meta b { color: var(--on-primary); font-weight: 700; }
.hero-extra {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  font-size: var(--fs-meta);
  color: var(--on-primary-muted);
  font-variant-numeric: tabular-nums;
}
.hero-panel .hero-label { padding-right: 150px; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .plan-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plan-stats .hero-panel { grid-column: 1 / -1; }
}

/* Where the money goes */
.money-card .tiles { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.tile-value { font-size: var(--fs-number-sm); }
.tile.muted .tile-value { color: var(--text-faint); }

/* Alternatives + Dates check, side by side */
.plan-pair { display: flex; flex-wrap: wrap; gap: var(--gap); margin-bottom: var(--gap); }
.plan-pair > .card { flex: 1 1 380px; min-width: 0; margin: 0; }
.dates-clear { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: var(--fs-body-sm); color: var(--text-muted); }

.issue-row {
  --icon-stroke: 2;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-body-sm);
  line-height: 1.5;
}
.issue-row:first-child { padding-top: 0; }
.issue-row:last-child { border-bottom: none; padding-bottom: 0; }
.issue-ic { display: grid; padding-top: 2px; color: var(--warn-fg); }
.issue-ic .ic { width: 16px; height: 16px; }
.issue-row.soft .issue-ic { color: var(--text-faint); }
.issue-text { flex: 1; min-width: 0; }
.issue-open { flex: none; font-size: var(--fs-meta); }

.alt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.alt-row:first-child { padding-top: 0; }
.alt-row:last-child { border-bottom: none; padding-bottom: 0; }
.alt-title { font-size: var(--fs-body-sm); font-weight: 600; }
.alt-sub { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 2px; }
.alt-price { font-size: var(--fs-body-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Itinerary */
.itin-card .itin-head { padding: 22px 22px 8px; margin: 0; }
.itin-row .list-main { flex: 1 1 300px; }
.itin-row .list-right { gap: 8px; }
.itin-row .list-amount { min-width: 90px; font-size: var(--fs-body); }
.list-meta .chip { padding: 2px 9px; }
.chip-light { font-weight: 500; }
.chip-initials { letter-spacing: .04em; }
.item-link { display: inline-grid; color: var(--text-faint); }
.item-link .ic { width: 14px; height: 14px; }
.itin-chev .ic { transition: transform var(--dur) var(--ease); }
.itin-chev[aria-expanded="true"] .ic { transform: rotate(180deg); }
.itin-row.open { background: var(--raised); }

.item-detail {
  padding: 4px 22px 18px 72px;
  border-top: 1px solid var(--line-soft);
  background: var(--raised);
}
.item-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 4px; }
.item-detail-actions { display: flex; gap: 8px; }
.item-detail-foot { margin-top: 12px; }
.item-notes { margin: 12px 0 0; font-size: var(--fs-meta); line-height: 1.6; color: var(--text-muted); }

.opt-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.opt-row:last-child { border-bottom: none; }
button.radio { padding: 0; background: none; width: 20px; height: 20px; }
.opt-label { font-size: var(--fs-body-sm); font-weight: 600; }
.opt-meta { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 2px; }
.opt-right { display: flex; align-items: center; gap: 6px; }
.opt-price { margin-right: 4px; font-size: var(--fs-body-sm); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Timeline strip: stays as alternating cobalt / periwinkle bars, transport
   as dots with the city; the last stop (home) is tomato. */
.timeline { padding: 12px 22px 18px; }
.tl-axis { position: relative; height: 16px; margin-bottom: 8px; }
.tl-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: var(--fs-caption);
  color: var(--text-faint);
  white-space: nowrap;
}
.tl-tick.first { transform: none; }
.tl-tick.last { transform: translateX(-100%); }
.tl-lane { position: relative; height: 30px; margin-bottom: 3px; }
.tl-bar {
  position: absolute;
  top: 0;
  height: 30px;
  display: flex;
  align-items: center;
  min-width: 10px;
  padding: 0 8px;
  overflow: hidden;
  border-radius: var(--radius-input);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--fs-caption);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tl-bar.alt { background: var(--brand-periwinkle); color: var(--brand-ink); }
.tl-stops { position: relative; height: 40px; margin-top: 10px; }
.tl-stop {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translateX(-50%);
  font-size: var(--fs-caption);
  color: var(--text-muted);
  white-space: nowrap;
}
.tl-stop.at-start { transform: translateX(-6px); align-items: flex-start; }
.tl-stop.at-end { transform: translateX(calc(-100% + 6px)); align-items: flex-end; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.tl-stop.last .tl-dot { background: var(--brand-tomato); }

/* Trip plan below the shell breakpoint (TripPlanPhone, WebTripPlan). */
@media (max-width: 1023px) {
  .plan-top { flex-wrap: wrap; margin-bottom: 14px; }
  .plan-head-card { display: none; }
  .plan-page.details-open .plan-head-card { display: block; }
  .plan-name-input { font-size: var(--fs-section); }
  .plan-head-side { max-width: none; }
  .plan-stats { display: block; margin-bottom: 14px; }
  .plan-stats .stat-tile { display: none; }
  .plan-stats .hero-panel { min-height: 0; padding: 18px 18px 20px; }
  .hero-panel .hero-meta { gap: 4px 18px; font-size: var(--fs-body); }
  .hero-panel .hero-split { display: block; margin-top: 6px; font-size: var(--fs-meta); line-height: 1.5; }
  .hero-panel .hero-split b { font-weight: 600; }
  html.is-app .plan-compact .going-toggle { min-height: 40px; padding: 8px 12px; }
  .hero-panel .hero-label { padding-right: 140px; font-size: var(--fs-body); }
  .plan-pair { gap: 14px; margin-bottom: 14px; }
  .plan-pair > .card { flex-basis: 100%; }
  .dates-card .card-head { display: none; }
  .dates-card:has(.issue-row) .card-head { display: flex; }
  .money-card .barlist { gap: 16px; }
  .money-card .barlist-row { grid-template-columns: 92px minmax(0, 1fr) 76px; gap: 14px; }
  .money-card .barlist-label { font-size: var(--fs-body); }
  .money-card .barlist-amount { font-size: var(--fs-body); font-weight: 700; }
  .itin-card .itin-head { padding: 16px 16px 6px; flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .pills.scroll-x { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .pills.scroll-x::-webkit-scrollbar { display: none; }
  .itin-row { flex-wrap: nowrap; align-items: flex-start; }
  .itin-row .list-main { flex: 1 1 0; }
  .itin-row .list-amount { min-width: 0; }
  .itin-row .itin-chev { width: 36px; height: 36px; margin: -4px -8px 0 -4px; }
  .item-detail { padding: 4px 16px 16px; }
  .timeline { overflow-x: auto; padding: 10px 16px 16px; }
  .tl-axis, .tl-lane, .tl-stops { min-width: 640px; }

  /* Installed app: round back button, one-line title, round + (TripPlanPhone). */
  html.is-app .back-btn { width: 44px; padding: 0; justify-content: center; border-radius: 50%; flex: none; }
  html.is-app .back-btn .back-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  html.is-app .back-btn .ic { width: 20px; height: 20px; }
  html.is-app .top-title {
    flex: 1; font-size: var(--fs-title-phone);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  html.is-app .plan-top { flex-wrap: nowrap; }

  /* Mobile web: "← All trips" link on its own line, the title wraps (WebTripPlan). */
  html.is-web .back-btn {
    flex-basis: 100%; min-height: 36px; padding: 0; border: 0; background: none;
    color: var(--accent); font-size: var(--fs-body); font-weight: 600;
  }
  html.is-web .back-btn .ic { width: 18px; height: 18px; }
  html.is-web .back-btn .back-label { margin-right: auto; }
  html.is-web .top-title { flex: 1; font-size: var(--fs-number-sm); line-height: 1.25; }
  html.is-web .plan-top .top-row-actions { align-self: flex-start; }
  html.is-web .going-toggle { min-height: 36px; padding: 6px 12px; }
  .plan-compact .btn-primary { min-height: 44px; padding: 10px 18px; }
}

/* ---------- Compare (js/views/compare.js) ----------
   design-handoff/compare: CompareDesktop-light/-dark, ComparePhone.
   .cmp-desk (> 600px): verdict banner + one table card; the cheapest
   column gets one cobalt .cmp-outline over the whole column and the
   screen's one sticker. .cmp-phone (<= 600px): cobalt panel, two
   tables, one itinerary at a time. Both are rendered; CSS picks. */
.compare-page .page-head { margin-bottom: var(--gap); }
/* Below 1024 the avatar leaves the head; its empty slot must not add a row gap. */
@media (max-width: 1023px) { .compare-page .page-head { row-gap: 0; margin-bottom: 26px; } }
.cmp-phone { display: none; }

/* Plan pills: filter pills, selected = cobalt with a check (§6). */
.cmp-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); }
.cmp-pill {
  --icon-stroke: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease);
}
.cmp-pill:hover { background: var(--raised); }
.cmp-pill.on {
  padding-left: 12px;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.cmp-pill.on:hover { background: var(--primary-hover); }
.cmp-pill-ic { display: inline-grid; }
.cmp-pill-ic .ic { width: 12px; height: 12px; }
.cmp-pill-short { display: none; }

/* Verdict: a positive alert banner. */
.alert-pos { background: var(--pos-bg); color: var(--pos-fg); }
.cmp-verdict { --icon-stroke: 2.4; }
.cmp-verdict .alert-link { text-decoration-thickness: 1.5px; }

/* Letter badge */
.cmp-badge {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--raised);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-meta);
  font-weight: 700;
  line-height: 1;
}
.cmp-badge.win { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.cmp-badge.sm { width: 24px; height: 24px; font-size: var(--fs-caption); background: var(--surface); }
.cmp-badge.sm.win { background: var(--primary); }
.cmp-badge.on-cobalt { width: 26px; height: 26px; font-size: var(--fs-caption); background: var(--brand-white); color: var(--brand-cobalt); box-shadow: none; }

/* The table card */
.cmp-card {
  --cmp-label: 168px;
  position: relative;
  margin-top: 6px;
  margin-bottom: var(--gap);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-lg);
}
.cmp-scroll {
  overflow-x: auto;
  border-radius: calc(var(--radius-card-lg) - 1px);
}
.cmp-grid {
  --cmp-col: 176px;
  position: relative;
  display: grid;
}
.cmp-row { display: contents; }
.cmp-c {
  min-width: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.cmp-c.win { background: var(--cmp-tint); }
.cmp-label {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-meta);
  font-weight: 600;
}

/* Header row */
.cmp-head .cmp-c {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px 18px;
  border-top: 0;
}
.cmp-head .cmp-c.win { background: var(--cmp-tint-head); }
.cmp-head .cmp-label { font-size: var(--fs-caption); font-weight: 700; color: var(--text-faint); }
.cmp-title-row { display: flex; gap: 10px; align-items: flex-start; }
.cmp-title {
  min-width: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.cmp-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.cmp-route { font-size: var(--fs-meta); line-height: 1.5; color: var(--text-muted); overflow-wrap: anywhere; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-chips:empty { display: none; }

/* Value rows */
.cmp-r-total .cmp-c { background: var(--raised); display: flex; align-items: center; }
.cmp-r-total .cmp-c.win { background: var(--cmp-tint); }
.cmp-total { font-size: var(--fs-number-md); font-weight: 600; line-height: 1.1; }
.cmp-v-base { font-size: var(--fs-body); font-weight: 500; }
.cmp-v-strong { font-size: var(--fs-body); font-weight: 600; }
.cmp-none { font-size: var(--fs-body); color: var(--text-faint); }
.cmp-muted { color: var(--text-muted); }
.cmp-days { font-size: var(--fs-body-sm); }
.cmp-days strong { font-weight: 600; }
.cmp-split { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-meta); }
.cmp-split strong { font-weight: 600; }
.cmp-split .money { color: var(--text-muted); }
.cmp-people { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; font-size: var(--fs-body-sm); }
.cmp-stack .avatar.sm { width: 26px; height: 26px; font-size: var(--fs-tab); border-color: var(--surface); }
.cmp-stack .avatar + .avatar { margin-left: -8px; }
.cmp-c.win .cmp-stack .avatar.sm { border-color: var(--cmp-tint); }

/* "Cost breakdown" subheading */
.cmp-r-sub .cmp-c { padding: 24px 20px 8px; font-size: var(--fs-meta); color: var(--text-faint); }
.cmp-r-sub .cmp-label { padding-top: 22px; font-size: 16px; font-weight: 600; color: var(--text); }

/* Categories: value, "Lowest" pill, 4px bar to the row's max */
.cmp-cat-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.cmp-lowest.chip { --icon-stroke: 3; gap: 3px; padding: 2px 8px; font-size: var(--fs-tab); }
.cmp-lowest.chip .ic { width: 11px; height: 11px; }
.cmp-bar {
  max-width: 220px;
  height: 4px;
  margin-top: 8px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}
.cmp-bar-fill { height: 100%; border-radius: var(--radius-pill); background: var(--brand-periwinkle); }
.cmp-c.win .cmp-bar-fill { background: var(--primary); }

/* Itinerary: date | item | amount */
.cmp-r-itin .cmp-c { padding-top: 14px; padding-bottom: 18px; }
.cmp-r-itin .cmp-label { padding-top: 20px; }
.cmp-itin-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 5px 0;
  font-size: var(--fs-meta);
  line-height: 1.35;
}
.cmp-itin-date { color: var(--text-faint); }
.cmp-itin-amt { color: var(--text-muted); text-align: right; }
.cmp-itin .cmp-none { font-size: var(--fs-meta); }

/* The cheapest column: one 2px cobalt outline over the whole column. */
.cmp-outline {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 2px solid var(--primary);
  border-radius: calc(var(--radius-card-lg) - 1px);
  pointer-events: none;
}
/* Its sticker, on the outline's top edge; compare.js sets `right`. */
.cmp-sticker {
  position: absolute;
  top: -17px;
  right: 16px;
  z-index: 5;
  --sticker-edge: var(--surface);
  pointer-events: none;
}

/* Footnote */
.cmp-foot {
  --icon-stroke: 2;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: var(--fs-meta);
  line-height: 1.45;
  color: var(--text-faint);
}
.cmp-foot .ic { width: 14px; height: 14px; margin-top: 2px; flex: none; }

/* ---------- Compare on a phone (<= 600px) ---------- */
@media (max-width: 600px) {
  .cmp-desk { display: none; }
  .cmp-phone { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
  .compare-page .page-head { margin-bottom: 26px; }

  .cmp-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(-1 * var(--pad)) 14px;
    padding: 0 var(--pad) 2px;
    scrollbar-width: none;
  }
  .cmp-pills::-webkit-scrollbar { display: none; }
  .cmp-pill { flex: none; min-height: 40px; gap: 7px; padding: 8px 14px; }
  .cmp-pill.on { padding-left: 10px; }
  .cmp-pill-full { display: none; }
  .cmp-pill-short { display: inline; }

  /* Cheapest plan panel */
  .cmp-m-hero {
    position: relative;
    margin-top: 4px;
    padding: 18px;
    border-radius: var(--radius-card);
    background: var(--primary);
    color: var(--on-primary);
  }
  .cmp-m-sticker { position: absolute; top: -13px; right: 14px; }
  .cmp-m-sticker .sticker-inner { padding: 5px 11px; font-size: var(--fs-caption); }
  .cmp-m-hero-label { font-size: var(--fs-caption); color: var(--on-primary-muted); }
  .cmp-m-hero-title { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; }
  .cmp-m-hero-title a { color: inherit; font-size: 16px; font-weight: 600; line-height: 1.3; text-decoration: none; }
  .cmp-m-hero-total { margin-top: 14px; font-size: var(--fs-number-xl); font-weight: 600; line-height: 1; }
  .cmp-m-hero-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: var(--fs-meta); color: var(--on-primary-muted); }
  .cmp-m-hero-meta strong { color: var(--on-primary); font-weight: 600; }
  .cmp-m-hero-foot {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--on-primary) 18%, transparent);
    font-size: var(--fs-meta);
    color: var(--on-primary-muted);
  }

  /* Side by side / Per traveller tables */
  .cmp-m-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-tile);
    overflow: hidden;
  }
  .cmp-m-scroll { overflow-x: auto; }
  .cmp-mt {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
  }
  .cmp-mt th, .cmp-mt td { padding: 11px 8px; text-align: right; white-space: nowrap; }
  .cmp-mt th[scope="row"], .cmp-mt .cmp-mt-title {
    position: sticky;
    left: 0;
    z-index: 1;
    max-width: 132px;
    padding-left: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--surface);
    text-align: left;
    font-size: var(--fs-meta);
    font-weight: 600;
    color: var(--text-muted);
  }
  .cmp-mt .cmp-mt-title { padding-top: 12px; padding-bottom: 10px; color: var(--text); }
  .cmp-mt-plan { width: 74px; min-width: 74px; padding-top: 12px; padding-bottom: 10px; }
  .cmp-mt-plan.win { width: 82px; min-width: 82px; background: var(--cmp-tint-head); border-radius: 12px 12px 0 0; }
  .cmp-mt-plan .cmp-badge { vertical-align: middle; }
  .cmp-mt tbody th, .cmp-mt tbody td { border-top: 1px solid var(--line-soft); }
  .cmp-mt td { font-size: var(--fs-body-sm); font-weight: 500; }
  .cmp-mt td.win { background: var(--cmp-tint); }
  .cmp-mt td.none { color: var(--text-faint); }
  .cmp-mt tr.total td { font-size: var(--fs-body); font-weight: 600; }

  /* Itinerary card */
  .cmp-m-itin { padding-top: 12px; }
  .cmp-m-card-title { margin: 0; padding: 0 14px 10px; font-size: var(--fs-meta); font-weight: 600; }
  .cmp-m-seg { display: flex; margin: 0 14px 6px; overflow-x: auto; scrollbar-width: none; }
  .cmp-m-seg .seg-btn { padding: 8px; }
  .cmp-mi-row {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--line-soft);
    font-size: var(--fs-body-sm);
  }
  .cmp-mi-date { padding-top: 2px; font-size: var(--fs-caption); color: var(--text-faint); }
  .cmp-mi-amt { font-weight: 600; }
  .cmp-mi .cmp-none { padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: var(--fs-body-sm); }

  .cmp-foot { font-size: var(--fs-caption); padding: 0 2px; }
}

/* ---------- Settings (js/views/settings.js) ---------- */
.settings .card { border-radius: var(--radius-card); margin-bottom: 18px; }
.settings-card { display: flex; flex-direction: column; gap: 12px; }
.settings-card > .card-head { margin-bottom: 0; }
.settings-card .card-title { margin: 0; }
.settings-card .field-label { margin-bottom: 0; }
.settings-meta { font-size: var(--fs-meta); color: var(--text-faint); }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-select { max-width: 320px; }

/* Profile */
.settings-profile { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 20px; }
.profile-main { flex: 1 1 220px; min-width: 0; }
.profile-name-input {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-left: -8px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-card-title);
  font-weight: 600;
}
.profile-name-input::placeholder { color: var(--text-faint); font-weight: 500; }
.profile-name-input:hover { border-color: var(--line); }
.profile-name-input:focus { outline: none; border-color: var(--focus); background: var(--raised); }
.profile-sub { margin-top: 2px; font-size: var(--fs-body-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.profile-photo { position: relative; flex: none; display: inline-grid; }
/* Camera badge on the avatar (Settings design): opens the file picker. */
.profile-cam {
  --icon-stroke: 2.2;
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
}
.profile-cam .ic { width: 13px; height: 13px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Appearance radio cards. The previews always show their own theme, so
   they use the fixed preview tokens rather than the live ones. */
:root {
  --tp-light-bg: #F6F7FB; --tp-light-side: #FFFFFF; --tp-light-card: #FFFFFF;
  --tp-dark-bg: #0E0F1A;  --tp-dark-side: #121423;  --tp-dark-card: #171A2B;
}
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 12px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-alert);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.theme-card:hover { border-color: var(--text-faint); }
.theme-card.on { border: 2px solid var(--selected); padding: 9px 9px 11px; }
.theme-preview {
  display: flex;
  gap: 6px;
  height: 72px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
}
.tp-side { width: 22%; border-radius: var(--radius-xs); }
.tp-main { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.tp-bar { height: 16px; width: 55%; border-radius: var(--radius-xs); background: var(--brand-cobalt); }
.tp-card { flex: 1; border-radius: var(--radius-xs); }
.theme-preview.light { background: var(--tp-light-bg); }
.theme-preview.light .tp-side, .theme-preview.light .tp-card { background: var(--tp-light-card); }
.theme-preview.dark { background: var(--tp-dark-bg); }
.theme-preview.dark .tp-side { background: var(--tp-dark-side); }
.theme-preview.dark .tp-card { background: var(--tp-dark-card); }
.theme-preview.auto { background: linear-gradient(90deg, var(--tp-light-bg) 50%, var(--tp-dark-bg) 50%); }
.theme-preview.auto .tp-side { background: var(--brand-ice); }
.theme-preview.auto .tp-card { background: var(--brand-periwinkle); }
.theme-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-body-sm); font-weight: 600; }

/* Exchange rates */
.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 12px;
}
.rate-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-select);
}
.rate-code { flex: 1; min-width: 0; }
.rate-iso { display: block; font-size: var(--fs-body-sm); font-weight: 700; }
.rate-name { display: block; font-size: var(--fs-caption); color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rate-row .input { width: 84px; flex: none; padding: 0 10px; }

/* Sync */
.sync-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-detail { font-size: var(--fs-body-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.sync-form { display: flex; gap: 12px; flex-wrap: wrap; max-width: 560px; }
.sync-field { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sync-msg { min-height: 18px; font-size: var(--fs-meta); color: var(--text-muted); }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px;
}
.about-tile { padding: 14px 16px; border-radius: var(--radius-select); background: var(--raised); }
.about-label { font-size: var(--fs-meta); color: var(--text-muted); }
.about-value { margin-top: 4px; font-size: var(--fs-body); font-weight: 600; font-variant-numeric: tabular-nums; }


/* ============================================================
   Bookings dashboard (#trip/<id>/bookings): DashDesktop, DashPhone,
   DashPhoneMoney, WebBookings. Plus the booking panel.
   ============================================================ */
.mono { font-family: var(--font-mono); font-weight: 500; font-size: .95em; letter-spacing: .01em; }

/* Header row: back, title, Going, Plan/Bookings, avatar */
.dash-top { gap: 14px; flex-wrap: nowrap; margin-bottom: var(--gap); }
.dash-title {
  flex: 1 1 auto;
  font-size: var(--fs-title);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-top .top-row-actions { align-items: center; gap: 10px; flex-wrap: nowrap; }
.dash-top .seg { margin: 0; }
.dash-page > .seg { margin-bottom: 14px; }

/* Stat tiles */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--gap);
}
.stat-tile.clickable {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.stat-tile.clickable:hover { border-color: var(--text-faint); }
.stat-tile.is-cobalt.clickable:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.stat-tile.on { border: 2px solid var(--selected); padding: 17px 19px; }
.stat-tile { border-radius: var(--radius-card); }
.dash-stats .stat-tile .stat-value { font-size: var(--fs-number-md); }
.dash-stats .stat-tile.is-cobalt .stat-value { font-size: var(--fs-countdown); margin-top: 6px; }
.stat-tile.is-cobalt .doodle { width: 104px; height: auto; right: 14px; top: 18px; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Two columns: list + rail */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: var(--gap);
  align-items: start;
}
.dash-main { min-width: 0; }
/* A rail taller than the window scrolls with the page; a shorter one sticks. */
.dash-rail { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rail-card { margin: 0; padding: 18px 20px; border-radius: var(--radius-card); }
.rail-card .card-head { margin-bottom: 8px; }
.rail-card .card-title { font-size: var(--fs-section); }
.rail-more { display: inline-block; align-self: flex-start; margin-top: 12px; font-size: var(--fs-body-sm); }
.rail-expand { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

/* The list card */
.card.bk-listcard { overflow: visible; border-radius: var(--radius-card); }
.bk-listhead { display: flex; flex-direction: column; gap: 14px; padding: 20px 20px 12px; }
.bk-listtop { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.search-field {
  --icon-stroke: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 300px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-select);
  background: var(--raised);
  color: var(--text-faint);
}
.search-field:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.search-field .ic { width: 16px; height: 16px; }
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body-sm);
}
.search-field input::placeholder { color: var(--text-faint); }
.bk-active { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-active .chip-x { width: 18px; height: 18px; }
.bk-active .chip-x .ic { width: 10px; height: 10px; }
.bk-list .list-group-head { padding: 14px 20px 8px; }
.bk-toggle { margin-left: 4px; font-size: var(--fs-meta); }
.bk-pad { padding: 4px 20px 20px; }
.bk-empty { padding: 4px 20px 18px; font-size: var(--fs-body-sm); color: var(--text-faint); }
.bk-allbooked { display: flex; align-items: center; gap: 16px; padding: 8px 20px 18px; color: var(--text-muted); }
.bk-list > :last-child { border-bottom-left-radius: var(--radius-card); border-bottom-right-radius: var(--radius-card); }

/* Rows: icon | title + meta | status | seen | paid | drift */
.bk-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 52px 72px 64px;
  grid-template-areas: "icon main status seen amount drift";
  align-items: center;
  column-gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.bk-row:hover { background: var(--raised); }
.bk-row.faded > :not(.bk-statusctl) { opacity: .6; }
.bk-ic { grid-area: icon; }
.bk-main { grid-area: main; min-width: 0; }
.bk-title {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: var(--fs-row-title);
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bk-row .list-meta { gap: 2px 14px; }
.bk-ref { color: var(--text-faint); }
.bk-docs { display: inline-flex; align-items: center; gap: 4px; color: var(--text-faint); }
.bk-docs .ic { width: 14px; height: 14px; }
.bk-sig { color: var(--text-muted); }
.bk-sig.sig-warn { color: var(--warn-fg); font-weight: 700; }
.bk-sig.sig-alert { color: var(--alert-fg); font-weight: 700; }
.bk-sig.sig-faint { color: var(--text-faint); }
.bk-statusctl { grid-area: status; position: relative; justify-self: end; }
.bk-seen { grid-area: seen; text-align: right; }
.bk-amount { grid-area: amount; text-align: right; font-size: var(--fs-row-title); font-weight: 700; }
.bk-row .delta, .bk-row .delta-none { grid-area: drift; justify-self: end; }
.bk-seen, .bk-seen.money { color: var(--text-faint); font-size: var(--fs-meta); text-decoration: line-through; font-variant-numeric: tabular-nums; }

.bk-status-btn {
  --icon-stroke: 2.4;
  min-height: 28px;
  padding: 5px 8px 5px 11px;
  border: 0;
  cursor: pointer;
}
.bk-status-btn:hover { filter: brightness(.97); box-shadow: inset 0 0 0 1px currentColor; }
.bk-caret { display: inline-grid; opacity: .7; }
.bk-caret .ic { width: 12px; height: 12px; }
.bk-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 170px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-select);
  box-shadow: var(--shadow-menu);
  cursor: default;
}
.bk-menu.up { top: auto; bottom: calc(100% + 6px); }
.bk-menu-item {
  --icon-stroke: 2.4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--radius-input);
  background: none;
  color: var(--text);
  text-align: left;
}
.bk-menu-item:hover, .bk-menu-item:focus-visible { background: var(--raised); }
.bk-menu-check { display: grid; color: var(--accent); }
.bk-menu-check .ic { width: 14px; height: 14px; }

/* Status chip kinds that are not a token pair */
.chip-owes { background: var(--done-bg); color: var(--text); }
.chip-faint .chip-dot { opacity: .7; }

/* Coming up */
.cu-list { display: flex; flex-direction: column; }
.cu-row { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.cu-row:last-of-type { border-bottom: none; }
.cu-date { width: 58px; flex: none; }
.cu-day { font-size: var(--fs-body-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.cu-date .chip { margin-top: 4px; padding: 2px 7px; font-size: var(--fs-tab); }
.cu-main { flex: 1; min-width: 0; }
.cu-title {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cu-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.cu-kind { margin-top: 2px; font-size: var(--fs-caption); color: var(--text-muted); }
.cu-amt { flex: none; font-size: var(--fs-body-sm); font-weight: 700; text-align: right; }

/* Documents */
.docs { display: flex; flex-direction: column; gap: 12px; }
.docs .note { font-size: var(--fs-body-sm); }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-size: var(--fs-body-sm); font-weight: 600; overflow-wrap: anywhere; }
.doc-sub { margin-top: 2px; font-size: var(--fs-caption); color: var(--text-faint); }
.docs-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.docs-hint { flex: 1; min-width: 160px; font-size: var(--fs-caption); color: var(--text-faint); }

/* Who paid */
.wp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% + 16px);
  margin: 0 -8px;
  padding: 11px 8px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius-input);
  background: none;
  color: var(--text);
  text-align: left;
}
.wp-row:hover { background: var(--raised); }
.wp-row.on { background: var(--icon-tile); box-shadow: inset 0 0 0 2px var(--selected); }
.wp-avatar.avatar { width: 32px; height: 32px; font-size: var(--fs-meta); box-shadow: none; }
.wp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wp-name { font-size: var(--fs-body-sm); font-weight: 600; }
.wp-name .part-trip { font-size: var(--fs-caption); }
.wp-nums { margin-top: 2px; font-size: var(--fs-caption); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.wp-row .chip { font-size: var(--fs-meta); padding: 4px 10px; }
.wp-settle-head { margin: 14px 0 6px; font-size: var(--fs-meta); font-weight: 600; color: var(--text-muted); }
.wp-settle-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: var(--fs-body-sm); }
.wp-settle-who { flex: 1; display: inline-flex; align-items: center; gap: 4px; }
/* "Nudge": opens the reminder sheet for whoever owes. */
.wp-nudge { min-height: 32px; padding: 4px 2px; font-size: var(--fs-meta); }

/* Nudge sheet footer: buttons, then the plain note under them. */
.nudge-foot { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.nudge-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.nudge-note { margin: 0; font-size: var(--fs-meta); color: var(--text-muted); }
@media (max-width: 900px) {
  .nudge-actions { flex-direction: column; }
  .nudge-actions .btn { width: 100%; justify-content: center; }
}
.wp-arrow { display: inline-grid; color: var(--text-faint); }
.wp-arrow .ic { width: 14px; height: 14px; }
.wp-square { margin: 14px 0 0; font-size: var(--fs-body-sm); color: var(--text-muted); }
.wp-square strong { color: var(--text); }
.wp .alert { margin: 14px 0 0; padding: 10px 12px; font-size: var(--fs-meta); }
.wp .note { margin-top: 12px; }

/* If I cancel today */
.duo { display: flex; gap: 32px; margin-top: 4px; }
.duo-value { margin-top: 4px; font-size: var(--fs-title-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.duo-value.is-alert { color: var(--alert-fg); }

.risk-table { display: flex; flex-direction: column; }
.risk-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) 90px 90px 90px minmax(150px, 1.4fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-meta);
  font-variant-numeric: tabular-nums;
}
.risk-row.head { padding-top: 0; font-size: var(--fs-caption); font-weight: 600; color: var(--text-muted); font-variant-numeric: normal; }
.risk-row.total { border-bottom: none; font-weight: 600; }
.risk-name { font-weight: 600; }
.risk-lose { color: var(--alert-fg); font-weight: 700; }
.risk-policy { display: flex; flex-direction: column; gap: 2px; color: var(--text-muted); font-variant-numeric: normal; }
.risk-policy small { color: var(--text-faint); font-size: var(--fs-caption); }
.risk-policy .chip { align-self: flex-start; }
/* In the 360px rail the numbers keep their row and the policy drops under. */
@media (min-width: 1024px) {
  .dash-rail .risk-row { grid-template-columns: minmax(0, 1fr) 54px 54px 54px; gap: 4px 8px; }
  .dash-rail .risk-row > span:nth-child(5) { grid-column: 1 / -1; }
  .dash-rail .risk-row.head > span:nth-child(5),
  .dash-rail .risk-row.total > span:nth-child(5) { display: none; }
  .dash-rail .risk-policy { flex-direction: row; flex-wrap: wrap; gap: 6px; font-size: var(--fs-caption); }
}

/* Price watch */
.watch-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; font-size: var(--fs-body); color: var(--text-muted); }
.watch-line strong { color: var(--text); font-weight: 700; }
.watch-arrow { display: inline-grid; color: var(--text-faint); }
.watch-arrow .ic { width: 16px; height: 16px; }
.watch-list { display: flex; flex-direction: column; }
.watch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-meta); }
.watch-row:last-child { border-bottom: none; }
.watch-name { flex: 1; min-width: 120px; font-weight: 600; }
.watch-nums { color: var(--text); font-weight: 600; }

/* Phone: at-risk line, money heading */
.dash-signals { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.dash-signals .alert { margin: 0; }
.risk-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-alert-phone);
  background: var(--surface);
  font-size: var(--fs-body-sm);
}
.risk-line .status-dot { width: 8px; height: 8px; }
.risk-line-text { flex: 1; min-width: 0; }
.risk-line-text strong { color: var(--alert-fg); }
.money-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 14px 0 0; }
.money-title { margin: 0; font-size: var(--fs-title); font-weight: 600; }
.money-trip { min-width: 0; font-size: var(--fs-body-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1023px) {
  .dash-top { margin-bottom: 14px; flex-wrap: wrap; }
  .dash-title { white-space: normal; }
  .dash-page > .seg, .plan-page > .seg { display: flex; width: 100%; }
  .plan-page > .seg { margin-bottom: 14px; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .dash-stats .dash-risk { display: none; }
  .dash-stats .stat-tile { min-height: 0; padding: 14px 16px; border-radius: var(--radius-tile); }
  .dash-stats .stat-tile.on { padding: 13px 15px; }
  .dash-stats .stat-tile .stat-label, .dash-stats .stat-tile .stat-caption { font-size: var(--fs-caption); }
  .dash-stats .stat-tile .stat-value { font-size: var(--fs-number-sm); margin-top: 6px; }
  .dash-stats .stat-tile.is-cobalt .stat-value { font-size: var(--fs-countdown); margin-top: 4px; }
  .stat-tile.is-cobalt .doodle { width: 64px; right: 10px; top: 16px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dash-rail { position: static; gap: 14px; }
  .rail-card { padding: 18px 16px; }
  .card.bk-listcard { border-radius: var(--radius-tile); }
  .bk-listhead { padding: 14px 16px 8px; gap: 12px; }
  .bk-listtop .card-title { display: none; }
  .search-field { flex: 1 1 100%; }
  .bk-list .list-group-head { padding: 12px 16px 6px; }
  .bk-pad, .bk-empty { padding-left: 16px; padding-right: 16px; }
  .bk-allbooked { padding: 8px 16px 16px; }
  /* Title + amount, then meta, then status + drift on their own line. */
  .bk-row {
    grid-template-columns: 36px auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "icon main main main amount"
      "icon status drift . .";
    align-items: start;
    row-gap: 8px;
    padding: 12px 16px;
  }
  .bk-title { white-space: normal; }
  .bk-seen { display: none; }
  .bk-statusctl { justify-self: start; }
  .bk-row .delta { justify-self: start; align-self: center; }
  .bk-status-btn { min-height: 32px; }
  .bk-menu { right: auto; left: 0; }
  .duo { gap: 24px; }
  .duo-value { font-size: var(--fs-title-lg); }
  .risk-table, .watch-list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .risk-row { min-width: 560px; }

  html.is-app .dash-top { flex-wrap: nowrap; }
  html.is-app .dash-title { white-space: nowrap; font-size: var(--fs-title-phone); }
  html.is-app .dash-top .going-toggle { min-height: 34px; padding: 6px 10px; font-size: var(--fs-caption); }
  html.is-web .dash-title { font-size: var(--fs-number-sm); line-height: 1.25; }
  html.is-web .dash-top .top-row-actions { align-self: flex-start; }
  html.is-web .dash-top .going-toggle { min-height: 36px; padding: 6px 12px; }
}

/* ---------- Bookings overview (#bookings) ---------- */
.ov-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: var(--gap);
  align-items: start;
}
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: var(--gap); }
.ov-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.ov-card:hover { border-color: var(--text-faint); }
.ov-top { display: flex; align-items: center; gap: 14px; }
.ov-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-tile);
  background: var(--primary);
  color: var(--on-primary);
  text-align: center;
}
.ov-count-num { font-family: var(--font-display); font-size: var(--fs-number-md); line-height: 1; max-width: 100%; text-align: center; }
/* Words ("Today", "Day 3", "Done") are wider than a number: shrink them to fit the square. */
.ov-count-num.is-word { font-size: 20px; }
.ov-count-sub { margin-top: 4px; font-size: var(--fs-caption); color: var(--on-primary-muted); line-height: 1.2; }
.ov-head { min-width: 0; }
.ov-name { margin: 0; font-size: var(--fs-card-title); font-weight: 600; line-height: 1.3; }
.ov-name a { color: var(--text); text-decoration: none; }
.ov-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ov-dates { margin-top: 4px; font-size: var(--fs-meta); color: var(--text-muted); }
.ov-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ov-value { margin-top: 4px; font-size: var(--fs-section); font-weight: 600; }
.ov-value.is-alert { color: var(--alert-fg); }
.ov-paid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.ov-paid-key { flex: 1 1 100%; font-weight: 600; }
.ov-paid-who { display: inline-flex; align-items: center; gap: 6px; }
.ov-paid-who .avatar.sm { width: 24px; height: 24px; border: 0; font-size: var(--fs-tab); }
.ov-paid-who b { color: var(--text); font-weight: 700; }
.ov-paid-open { color: var(--warn-fg); font-weight: 600; }
.ov-upcoming { position: sticky; top: 16px; }
.card-sub { margin: -2px 0 6px; font-size: var(--fs-meta); color: var(--text-muted); }
@media (max-width: 1279px) { .ov-layout { grid-template-columns: minmax(0, 1fr); } .ov-upcoming { position: static; } }
@media (max-width: 1023px) {
  .ov-grid { gap: 14px; }
  .ov-layout { gap: 14px; }
  .ov-card { padding: 16px; border-radius: var(--radius-card); }
  .ov-count { width: 72px; height: 72px; }
  .ov-name { font-size: var(--fs-section); }
}

/* ---------- Booking panel ---------- */
.panel-section { display: flex; flex-direction: column; gap: 14px; }
.panel-section-title { margin: 0; font-size: var(--fs-body); font-weight: 600; }
.panel-rule { height: 1px; background: var(--line-soft); margin: 20px 0 18px; }
.panel .seg { display: flex; width: 100%; margin: 0; background: var(--raised); }
.panel .seg-btn { padding: 8px 6px; }
.panel .field { margin-bottom: 14px; }
.panel-simple .field-hint { margin: 0 0 16px; }

.pay-box { display: flex; flex-direction: column; gap: 10px; }
.pay-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-alert);
  background: var(--surface);
}
.pay-row.paid { background: var(--raised); }
.pay-row .field { margin: 0; }
.pay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  flex: 1 1 100%;
}
.pay-grid > .field:first-child { grid-column: 1 / -1; }
.pay-paid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.pay-paid input { width: 18px; height: 18px; accent-color: var(--primary); }
.pay-row-foot { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pay-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
.pay-foot .field-hint { flex: 1; min-width: 160px; margin: 0; }

/* Paid by: avatar pills */
.payer-pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.payer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 3px 12px 3px 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-meta);
  font-weight: 500;
}
.payer-pill:hover { background: var(--raised); }
.payer-pill .avatar { width: 28px; height: 28px; font-size: var(--fs-caption); box-shadow: none; border: 0; }
.payer-pill .avatar.dashed { border: 1.5px dashed var(--text-faint); }
.payer-pill .avatar.dashed .ic { width: 14px; height: 14px; }
.payer-pill[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; }
.payer-pill[aria-pressed="true"] .avatar { box-shadow: 0 0 0 2px var(--on-primary); }
.payer-label { flex: 1 1 100%; font-size: var(--fs-caption); font-weight: 600; color: var(--text-muted); }

/* Cancellation, behind a one-line summary */
.disclose { border: 1px solid var(--line); border-radius: var(--radius-alert); padding: 2px 14px; background: var(--surface); }
.disclose-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 0;
  border: none;
  background: none;
  text-align: left;
}
.disclose-title { flex: none; font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.disclose-sum { flex: 1; min-width: 0; font-size: var(--fs-meta); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.disclose-caret { display: grid; color: var(--text-faint); transition: transform var(--dur) var(--ease); }
.disclose-caret .ic { width: 16px; height: 16px; }
.disclose.open .disclose-caret { transform: rotate(180deg); }
.disclose-body { padding: 12px 0 4px; border-top: 1px solid var(--line-soft); }
.disclose-body .field:last-child { margin-bottom: 10px; }

/* ============================================================
   Plans (#plans, #plan/<id>): js/views/plans.js, js/views/plan.js.
   design-handoff/plans/PLANS_DESIGN.md, screens 01-05, 06/09 headers,
   25/27 plan menu. Prefixes: .pl- list and form, .pv- plan page.
   ============================================================ */

/* ---------- Plans list ---------- */
.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--gap);
}
@media (min-width: 1200px) { .pl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.pl-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-lg);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.pl-card:hover { border-color: var(--text-faint); }
.pl-card:focus-within:has(.pl-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pl-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pl-card-main { min-width: 0; }
.pl-name { margin: 0; font-size: var(--fs-card-title); font-weight: 600; line-height: 1.3; }
.pl-link { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.pl-link:focus-visible { outline: none; }

.pl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.pl-meta-bit { --icon-stroke: 2; display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.pl-meta-ic { display: inline-grid; flex: none; }
.pl-meta-ic .ic { width: 14px; height: 14px; }

.pl-avatars { flex: none; }
.pl-avatars .avatar.sm { border-color: var(--surface); }
.pl-avatars .avatar + .avatar { margin-left: -8px; }

.pl-divider { height: 1px; background: var(--line-soft); }
.pl-counts { font-size: var(--fs-body-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pl-counts strong { color: var(--text); font-weight: 600; }

/* Flag line: an amber well with a clock, or a faint check. Always words. */
.pl-flag {
  --icon-stroke: 2.2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-select);
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: var(--fs-meta);
  font-weight: 600;
}
.pl-flag-ic { display: inline-grid; flex: none; }
.pl-flag-ic .ic { width: 15px; height: 15px; }
.pl-flag.none { --icon-stroke: 2.4; padding: 9px 0; background: none; color: var(--text-faint); font-weight: 400; }
.pl-flag.none .ic { width: 14px; height: 14px; }

.pl-grid .empty-card { min-height: 248px; }

.pl-foot {
  --icon-stroke: 2;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 22px;
  font-size: var(--fs-meta);
  color: var(--text-faint);
  line-height: 1.45;
}
.pl-foot-ic { display: inline-grid; flex: none; padding-top: 1px; }
.pl-foot-ic .ic { width: 15px; height: 15px; }

.pl-loading { padding: 40px 0; font-size: var(--fs-body-sm); color: var(--text-muted); }

/* ---------- Plans empty state / signed out: the shared .empty-hero with
   Plans' own sizes (PlansEmpty 03, 05). ---------- */
.empty-hero.pl-hero .empty-hero-art { width: 320px; height: 210px; }
.pl-hero .empty-mini { padding: 8px 10px; font-size: var(--fs-meta); }
.pl-hero .empty-mini-ic { width: 22px; height: 22px; }
.pl-hero .empty-mini-ic .ic { width: 13px; height: 13px; }
.pl-hero .empty-mini.m1 { left: 4%;  top: 46%; }
.pl-hero .empty-mini.m2 { left: 38%; top: 8%; }
.pl-hero .empty-mini.m3 { left: 52%; top: 58%; }

/* ---------- Create / edit form ---------- */
.field-error { margin-top: 6px; font-size: var(--fs-meta); font-weight: 600; color: var(--alert-fg); }
.input[aria-invalid="true"] { border-color: var(--alert-fg); }
.pl-form-error { margin-bottom: 16px; }
.pl-form-error[hidden], .field-error[hidden], .pl-move-note[hidden] { display: none; }
.pl-move-note { margin: -2px 0 16px; color: var(--warn-fg); font-weight: 600; }

/* ---------- Plan page header (06, 09) ---------- */
.top-row.pv-head { justify-content: flex-start; align-items: center; gap: 14px; margin-bottom: 18px; }
.pv-title { flex: 1 1 360px; min-width: 0; }
.pv-name { margin: 0; font-size: var(--fs-title-lg); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.pv-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 6px;
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}
.pv-meta .pl-meta-bit { gap: 6px; }
.pv-meta .pl-meta-ic .ic { width: 16px; height: 16px; }
.pv-meta .pv-people { gap: 8px; }
.pv-avatars .avatar.sm { width: 24px; height: 24px; font-size: 10px; border-color: var(--bg); }
.pv-avatars .avatar + .avatar { margin-left: -8px; }
.pv-avatars-short, .pv-meta-short { display: none; }
.top-row-actions.pv-actions { gap: 14px; flex-wrap: nowrap; }
.pv-invite .ic { width: 18px; height: 18px; }
.pv-more {
  display: inline-grid;
  place-items: center;
  width: 46px; height: 46px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}
.pv-more .ic { width: 20px; height: 20px; }
.pv-more:hover { background: var(--raised); }
.pv-more[aria-expanded="true"] { border-color: var(--selected); }

.pv-missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
}
.pv-missing-title { margin: 4px 0 0; font-size: var(--fs-section); font-weight: 600; }
.pv-missing .note { margin: 0 0 8px; }

/* ---------- Action menu: dropdown and phone sheet (ui.menu, 25 / 27) ---------- */
.action-menu {
  position: fixed;
  z-index: 70;
  width: 260px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-alert);
  box-shadow: var(--shadow-sheet);
}
.action-menu-item {
  --icon-stroke: 1.8;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body);
  font-weight: 500;
  text-align: left;
}
.action-menu-item:hover, .action-menu-item:focus-visible { background: var(--raised); }
.action-menu-item:focus-visible { outline-offset: -2px; }
.action-menu-item.danger { color: var(--alert-fg); }
.action-menu-ic { display: inline-grid; flex: none; }
.action-menu-ic .ic { width: 18px; height: 18px; }
.action-menu-label { flex: 1; min-width: 0; }
.action-menu-count { font-size: var(--fs-meta); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.action-menu-rule { height: 1px; margin: 6px 8px; background: var(--line-soft); }

.menu-scrim { background: var(--overlay); }
.menu-sheet {
  width: 100%;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 10px 12px calc(22px + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--text);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(24px);
  transition: transform var(--dur) var(--ease);
}
.sheet-scrim.open .menu-sheet { transform: translateY(0); }
.menu-sheet .sheet-grab { display: block; margin: 0 auto 10px; }
.action-menu.in-sheet { position: static; width: auto; max-width: none; border: 0; box-shadow: none; }

/* ---------- Plans on phones ---------- */
@media (max-width: 767px) {
  .empty-hero.pl-hero .empty-hero-art { width: 250px; height: 170px; }
  .pl-hero .empty-mini { font-size: var(--fs-caption); }

  /* PlansEmptyPhone: the panel's own button is the way in. */
  .plans-page.is-empty .primary-action { display: none; }

  .top-row.pv-head { flex-wrap: nowrap; gap: 8px; }
  .pv-back { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; flex: none; }
  .pv-back .pv-back-label { display: none; }
  /* Mobile web styles .back-btn as a full-width text link (trip pages);
     the plan header keeps the round button from PlanPhoneSaved. */
  html.is-web .top-row.pv-head .pv-back {
    flex: none; min-height: 44px; padding: 0;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
  }
  html.is-web .top-row.pv-head .pv-back .ic { width: 16px; height: 16px; }
  .pv-title { flex: 1 1 auto; }
  .pv-name { font-size: var(--fs-title-phone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pv-meta { display: none; }
  .pv-meta-short {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-caption);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pv-avatars-short { display: inline-flex; flex: none; }
  .pv-avatars-short .avatar.sm { width: 26px; height: 26px; }
  .top-row-actions.pv-actions { gap: 8px; }
  .pv-invite {
    width: 44px; height: 44px; min-height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
  }
  .pv-invite:hover { background: var(--raised); }
  .pv-invite .ic { width: 20px; height: 20px; }
  .pv-invite-label { display: none; }
  .pv-more { width: 44px; height: 44px; border: 0; background: transparent; }
}

@media (max-width: 600px) {
  .pl-grid { gap: 14px; }
  .pl-card { gap: 14px; padding: 18px; border-radius: var(--radius-card); }
  .pl-name { font-size: var(--fs-section); }
  .pl-foot { margin-top: 18px; font-size: var(--fs-caption); }
}

/* ============================================================
   Plan board (06-17): flag summary, Saved, timeline, phone
   switch, item cards (.pi-), item panel (.ip-), Move to… (.mv-).
   js/views/plan.js and js/views/plan-item.js.
   ============================================================ */

/* ---------- Flag summary (06, 08) ---------- */
.pv-flags-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -2px 0 18px; }
.pv-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.pv-flag, .pv-booked {
  --icon-stroke: 2.2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-body-sm);
  font-weight: 700;
  white-space: nowrap;
  flex: none;
}
.pv-flag {
  border: 2px solid var(--warn-bg);
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.pv-flag:hover { border-color: color-mix(in srgb, var(--warn-fg) 35%, var(--warn-bg)); }
.pv-flag.is-on { border-color: var(--warn-fg); }
.pv-booked { padding: 9px 14px; background: var(--pos-bg); color: var(--pos-fg); }
.pv-flag-ic { display: inline-grid; }
.pv-flag-ic .ic { width: 16px; height: 16px; }
.pv-flag-x { display: inline-grid; margin-right: -2px; }
.pv-flag-x .ic { width: 14px; height: 14px; }
.pv-flags-hint { font-size: var(--fs-meta); color: var(--text-faint); }

/* The ink pill while a card is being dragged (13). It takes the flag row's place. */
.pv-drag-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: -2px 0 18px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs-body-sm);
}
.pv-drag-hint[hidden] { display: none; }
.pv-drag-hint .pv-flag-ic { opacity: .7; }
.pv-page.is-dragging .pv-flags-row { display: none; }

/* ---------- Board ---------- */
.pv-board { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gap); align-items: start; }

.pv-saved, .pv-timeline {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.pv-saved { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; }
.pv-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pv-sec-title { margin: 0; font-size: var(--fs-section); font-weight: 600; }
.pv-sec-title:focus { outline: none; }
.pv-sec-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.pv-sec-count { font-size: var(--fs-body-sm); font-weight: 500; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.pv-sec-note { font-size: var(--fs-caption); color: var(--text-faint); }

/* Quick add */
.pv-quick { display: flex; gap: 8px; }
.pv-quick-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-select);
  background: var(--raised);
  cursor: text;
}
.pv-quick-field:focus-within { border-color: var(--focus); }
.pv-quick-field:has(.pv-quick-input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.pv-quick-ic { --icon-stroke: 2; display: inline-grid; color: var(--text-faint); }
.pv-quick-ic .ic { width: 16px; height: 16px; }
.pv-quick-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body-sm);
}
.pv-quick-input:focus { outline: none; }
.pv-quick-input::placeholder { color: var(--text-faint); }
.pv-quick-add {
  --icon-stroke: 2.4;
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius-select);
  background: var(--primary);
  color: var(--on-primary);
}
.pv-quick-add:hover { background: var(--primary-hover); }
.pv-quick-add .ic { width: 20px; height: 20px; }

/* Kind filter pills */
.pv-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-kind {
  --icon-stroke: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 11px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-meta);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.pv-kind:hover { background: var(--raised); }
.pv-kind.is-on { border-color: var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; }
.pv-kind-ic { display: inline-grid; }
.pv-kind-ic .ic { width: 14px; height: 14px; }

/* Lists (Sortable containers) */
.pv-list { display: flex; flex-direction: column; gap: 10px; }
.pv-saved-list { min-height: 72px; margin-top: 2px; }
.pv-list-empty { padding: 10px 2px; font-size: var(--fs-meta); color: var(--text-faint); line-height: 1.45; }
.pv-list:has(.pi-card) .pv-list-empty,
.pv-list:has(.pi-ghost) .pv-list-empty { display: none; }

.pv-foot {
  --icon-stroke: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  font-size: var(--fs-caption);
  color: var(--text-faint);
}
.pv-foot-ic { display: inline-grid; }
.pv-foot-ic .ic { width: 14px; height: 14px; }

/* Timeline */
.pv-timeline { padding: 18px 0 0 16px; overflow: hidden; }
.pv-timeline .pv-sec-head { align-items: center; padding-right: 16px; margin-bottom: 12px; }
.pv-tl-nav { display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); color: var(--text-faint); }
.pv-tl-btns { display: inline-flex; gap: 6px; margin-left: 6px; }
.pv-nav {
  --icon-stroke: 2.2;
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}
.pv-nav:hover:not(:disabled) { background: var(--raised); }
.pv-nav:disabled { opacity: .4; cursor: default; }
.pv-nav .ic { width: 16px; height: 16px; }

.pv-tl-wrap { position: relative; }
.pv-tl-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.pv-tl-scroll:focus { outline: none; }
.pv-tl-fade {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 56px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--surface));
}
.pv-tl-fade[hidden] { display: none; }
.pv-grid { display: grid; width: max-content; }
.pv-corner, .pv-slot-label { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.pv-day-head { padding: 4px 10px 10px; min-width: 0; }
.pv-day-wd { font-size: var(--fs-caption); font-weight: 700; color: var(--text-faint); }
.pv-day-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pv-day-date { font-size: 16px; font-weight: 600; }
.pv-day-count { font-size: var(--fs-caption); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.pv-slot-label {
  padding: 12px 10px 0 2px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--text-muted);
}
.pv-cell {
  gap: 8px;
  min-width: 0;
  min-height: 128px;
  padding: 8px;
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  background: var(--cell);
}

/* ---------- Item card (12) ---------- */
.pi-card {
  --icon-stroke: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              opacity var(--dur) var(--ease);
}
.pi-card:hover { border-color: var(--text-faint); background: var(--raised); }
.pi-card:focus { outline: none; }
.pi-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pi-card.is-open { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.pi-card.is-faded { opacity: .4; cursor: default; }
.pi-card.is-faded:hover { border-color: var(--line); background: var(--surface); }
.pi-card.is-compact { padding: 10px 11px; }

.pi-top { display: flex; align-items: flex-start; gap: 10px; }
.pi-grip { display: inline-grid; margin-left: -4px; padding-top: 2px; color: var(--text-faint); }
.pi-grip .ic { width: 14px; height: 14px; }
.pi-tile {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--icon-tile);
  color: var(--icon-tile-fg);
}
.pi-tile .ic { width: 17px; height: 17px; }
.pi-card.is-compact .pi-tile { width: 28px; height: 28px; }
.pi-card.is-compact .pi-tile .ic { width: 15px; height: 15px; }
.pi-main { flex: 1; min-width: 0; }
.pi-title { font-size: var(--fs-row-title); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pi-card.is-compact .pi-title { font-size: var(--fs-body-sm); }
.pi-ic { display: inline-grid; flex: none; }
.pi-bookby {
  --icon-stroke: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--warn-fg);
}
.pi-bookby .ic { width: 13px; height: 13px; }

.pi-bottom { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.pi-flag {
  --icon-stroke: 2.6;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.pi-flag .ic { width: 12px; height: 12px; }
.pi-flag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pi-flag-pos { background: var(--pos-bg); color: var(--pos-fg); }
.pi-flag[hidden] { display: none; }
.pi-haslink { display: inline-grid; color: var(--text-faint); }
.pi-haslink .ic { width: 14px; height: 14px; }
.pi-by { margin-left: auto; display: inline-flex; }
.avatar.sm.pi-avatar { width: 22px; height: 22px; font-size: 10px; border-color: var(--surface); }

/* ⋯ on a card: a small button on hover / focus on desktop, always on phone. */
.pi-more {
  --icon-stroke: 2;
  position: absolute;
  top: 6px; right: 6px;
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  opacity: 0;
  cursor: pointer;
}
.pi-more .ic { width: 18px; height: 18px; }
.pi-more:hover { color: var(--text); background: var(--raised); }
.pi-card:hover .pi-more, .pi-card:focus-visible .pi-more, .pi-card:has(.pi-more:focus-visible) .pi-more,
.pi-more[aria-expanded="true"] { opacity: 1; }
html.pv-grabbing .pi-card:hover .pi-more { opacity: 0; }
.pi-card.is-faded .pi-more { display: none; }
.pi-card.is-phone .pi-more {
  position: static;
  width: 32px; height: 32px;
  margin: -6px -6px 0 0;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  opacity: 1;
}
@media (hover: none) {
  .pi-more { opacity: 1; }
  .pi-card:hover { border-color: var(--line); background: var(--surface); }
}

/* ---------- Drag and drop (13) ----------
   Sortable classes: .pi-lifted = the copy under the pointer (on <body>;
   Sortable sets its transform, so the tilt uses `rotate`), .pi-ghost =
   the card's own node, drawn as the dashed "Drop here" box where it
   would land, .pi-origin = the dashed space it left behind. */
html.pv-grabbing, html.pv-grabbing * { cursor: grabbing !important; }
.pi-card.pi-lifted {
  opacity: 1 !important;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  rotate: -3deg;
}
html.pv-no-tilt .pi-card.pi-lifted { rotate: none; }
.pi-card.pi-lifted .pi-more, .pi-card.pi-lifted .pi-grip { display: none; }
.pi-card.pi-ghost {
  position: relative;
  min-height: 72px;
  border: 2px dashed var(--primary);
  background: var(--surface);
  box-shadow: none;
}
.pi-card.pi-ghost > * { visibility: hidden; }
.pi-card.pi-ghost::after {
  content: "+  Drop here";
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  text-align: center;
  white-space: pre;
  color: var(--accent);
  font-size: var(--fs-meta);
  font-weight: 700;
}
.pi-origin {
  flex: none;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.pi-origin[hidden] { display: none; }
.pv-list.is-over { background: var(--drop); box-shadow: inset 0 0 0 2px var(--primary); }
.pv-saved-list.is-over, .pv-phone-list.is-over { border-radius: 14px; }

/* ---------- Phone board (09-11) ---------- */
.seg.pv-tabs { display: flex; width: 100%; margin: 0 0 14px; }
.pv-tabs .seg-btn { min-height: 44px; padding: 10px; }
.pv-tab-count { opacity: .75; font-weight: 500; font-variant-numeric: tabular-nums; }
.pv-phone-saved { display: flex; flex-direction: column; gap: 14px; }
.pv-days { display: flex; flex-direction: column; gap: 14px; }
.pv-daycard {
  padding: 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
}
.pv-daycard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 8px; }
.pv-daycard-title { margin: 0; font-size: var(--fs-section); font-weight: 600; }
.pv-daycard-count { font-size: var(--fs-caption); color: var(--text-faint); }
.pv-phone-slot {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.pv-phone-label { padding-top: 8px; font-size: var(--fs-caption); font-weight: 700; color: var(--text-muted); }
.pv-phone-slot:has(.pv-nothing:only-child) .pv-phone-label { padding-top: 3px; }
.pv-phone-list { gap: 8px; min-height: 28px; }
.pv-nothing { padding: 2px 0 4px; }

@media (max-width: 1100px) and (min-width: 768px) {
  .pv-board { grid-template-columns: 272px minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .pv-board { display: block; }
  .pv-flags-row { margin: -4px 0 14px; }
  .pv-flags {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-right: calc(-1 * var(--pad));
    padding-right: var(--pad);
    scrollbar-width: none;
  }
  .pv-flags::-webkit-scrollbar { display: none; }
  .pv-flags-hint.wide-hint { display: none; }
  .pv-flags-row .pv-flags-hint { flex-basis: 100%; }
  .pv-kinds {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-right: calc(-1 * var(--pad));
    padding-right: var(--pad);
    scrollbar-width: none;
  }
  .pv-kinds::-webkit-scrollbar { display: none; }
  .pv-saved-list { min-height: 96px; }
}

/* ---------- Item panel (15-17) ---------- */
.scrim .panel.ip-panel { box-shadow: var(--shadow-popover); }
.ip-head { align-items: center; gap: 12px; padding: 20px 22px 16px; }
.pi-tile.ip-tile { width: 38px; height: 38px; border-radius: var(--radius-icon-tile); }
.pi-tile.ip-tile .ic { width: 20px; height: 20px; }
.ip-head-main { flex: 1; min-width: 0; }
.ip-title { font-size: var(--fs-card-title); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ip-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.ip-flags[hidden] { display: none; }
.ip-flags .pi-bookby { margin: 0; }
.ip-close, .ip-more {
  --icon-stroke: 2.2;
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--raised);
  color: var(--text);
}
.ip-close:hover, .ip-more:hover { background: var(--line-soft); }
.ip-close .ic, .ip-more .ic { width: 18px; height: 18px; }
.ip-close { order: 9; }
.ip-more { display: none; background: transparent; }

.ip-panel .panel-body { display: flex; flex-direction: column; gap: 18px; padding: 20px 22px 24px; }
.ip-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ip-field[hidden], .ip-book-row[hidden] { display: none; }
.ip-label { font-size: var(--fs-meta); font-weight: 600; color: var(--text-muted); }
.ip-hint { font-size: var(--fs-caption); color: var(--text-faint); line-height: 1.45; }
.ip-hint:empty { display: none; }
.ip-field .field-error { margin: 0; }
.ip-panel .input { min-height: 44px; border-radius: var(--radius-select); font-size: var(--fs-body); }
.ip-panel .textarea.ip-notes { min-height: 76px; padding: 11px 12px; line-height: 1.45; resize: vertical; }
.ip-rule { height: 1px; background: var(--line-soft); }

.ip-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ip-kind {
  --icon-stroke: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-select);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-meta);
  font-weight: 600;
}
.ip-kind .ic { width: 16px; height: 16px; }
.ip-kind:hover { background: var(--raised); }
.ip-kind[aria-pressed="true"] {
  padding: 0 9px;
  border: 2px solid var(--primary);
  background: var(--drop);
  color: var(--accent);
}

.ip-links { border: 1px solid var(--line); border-radius: var(--radius-select); overflow: hidden; }
.ip-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ip-link + .ip-link { border-top: 1px solid var(--line-soft); }
.ip-link-tile { width: 30px; height: 30px; }
.ip-link-tile .ic { width: 16px; height: 16px; }
.ip-link-main { flex: 1; min-width: 0; }
.ip-link-a {
  --icon-stroke: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  color: var(--accent);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  text-decoration: none;
}
.ip-link-a > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-link-a:hover > span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.ip-link-a .ic { width: 13px; height: 13px; }
.ip-link-url { font-size: var(--fs-caption); color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-link-x {
  --icon-stroke: 2;
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
}
.ip-link-x:hover { background: var(--raised); color: var(--text); }
.ip-link-x .ic { width: 16px; height: 16px; }
.ip-link-rows:not(:empty) + .ip-link-add { border-top: 1px solid var(--line-soft); }
.ip-link-addbtn {
  --icon-stroke: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--fs-body-sm);
  text-align: left;
}
.ip-link-addbtn:hover { color: var(--text); background: var(--raised); }
.ip-link-addbtn .ic { width: 16px; height: 16px; }
.ip-link-form { display: flex; gap: 8px; align-items: center; padding: 8px; }
.ip-link-form .input { flex: 1; min-width: 0; min-height: 40px; }
.ip-link-form .btn { min-height: 40px; flex: none; }
.ip-link-add > .field-error { margin: 0 12px 10px; }

.seg.ip-seg { display: flex; width: 100%; margin: 0; padding: 3px; background: var(--raised); }
.ip-seg .seg-btn { min-height: 36px; padding: 0 6px; font-size: var(--fs-meta); }

.ip-book-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ip-due-wrap { display: flex; align-items: flex-end; padding-bottom: 12px; }
.pi-flag.ip-due { font-size: var(--fs-meta); }

.ip-when {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-select);
}
.ip-when-main { --icon-stroke: 2; display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-body); font-weight: 600; }
.ip-when-main .ic { width: 16px; height: 16px; }
.btn.ip-move { min-height: 38px; padding: 8px 14px; background: var(--surface); flex: none; }
.ip-meta { display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); color: var(--text-faint); }
.ip-meta-av { display: inline-flex; }

.ip-panel .panel-foot {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-top-color: var(--line);
}
.ip-delete {
  --icon-stroke: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 6px;
  border: 0;
  background: transparent;
  color: var(--alert-fg);
  font-size: var(--fs-body-sm);
  font-weight: 600;
}
.ip-delete .ic { width: 16px; height: 16px; }
.ip-delete:hover { text-decoration: underline; text-underline-offset: 3px; }
.ip-saved { display: inline-flex; align-items: center; gap: 7px; min-width: 0; font-size: var(--fs-meta); color: var(--text-faint); text-align: right; }
.ip-saved-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--pos-fg); }
.ip-saved.is-waiting .ip-saved-dot { background: var(--warn-fg); }

@media (max-width: 900px) {
  .ip-panel .panel-foot .btn { flex: none; }
  .ip-panel .panel-body { padding: 18px var(--pad) 24px; }
}
@media (max-width: 767px) {
  .ip-head { padding: 12px var(--pad); gap: 12px; }
  .ip-head .ip-close { order: -1; width: 44px; height: 44px; }
  .ip-more { display: inline-grid; width: 44px; height: 44px; }
  .ip-head .ip-tile, .ip-head .ip-flags { display: none; }
  .ip-title { font-size: var(--fs-title-phone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ip-panel .panel-foot { padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); }
  .ip-saved { font-size: var(--fs-caption); }
}

/* ---------- Move to… (14): dropdown on desktop, sheet on phone ---------- */
.action-menu { max-height: calc(100dvh - 24px); overflow-y: auto; }
.action-menu.mv-menu { width: 320px; padding: 6px 10px 10px; }
.mv-head { display: flex; align-items: center; gap: 10px; padding: 8px 2px 10px; }
.pi-tile.mv-tile { width: 34px; height: 34px; border-radius: var(--radius-icon-tile); }
.pi-tile.mv-tile .ic { width: 18px; height: 18px; }
.mv-head-main { flex: 1; min-width: 0; }
.mv-caption { font-size: var(--fs-caption); color: var(--text-faint); }
.mv-title { font-size: var(--fs-body); font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sheet .mv-head { padding: 0 0 4px; }
.menu-sheet .mv-title { font-size: 17px; }
.menu-sheet.mv-menu-sheet { padding: 10px 18px calc(30px + env(safe-area-inset-bottom)); }
.action-menu.mv-menu.in-sheet { padding: 0; }

.action-menu-item.mv-saved {
  justify-content: space-between;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 600;
}
.action-menu-item.is-current { padding: 0 15px; border: 2px solid var(--primary); background: var(--drop); color: var(--accent); }
.action-menu-now { font-size: var(--fs-body-sm); font-weight: 700; }
.action-menu-heading {
  margin-top: 8px;
  padding: 12px 2px 8px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text);
}
.action-menu-row { display: flex; gap: 6px; padding-bottom: 4px; }
.action-menu-pill {
  --icon-stroke: 2.6;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 40px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-meta);
  font-weight: 600;
}
.action-menu-pill:hover, .action-menu-pill:focus-visible { background: var(--raised); }
.action-menu-pill:focus-visible { outline-offset: 1px; }
.action-menu-pill .ic { width: 13px; height: 13px; }
.action-menu-pill.is-current { border: 2px solid var(--primary); background: var(--drop); color: var(--accent); }

/* Toast with an action (Delete → Undo). */
.toast.has-action { display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 18px; }
.toast-action {
  min-height: 36px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg) 18%, transparent);
  color: inherit;
  font-size: var(--fs-body-sm);
  font-weight: 700;
}
.toast-action:hover { background: color-mix(in srgb, var(--bg) 28%, transparent); }
.toast-action:focus-visible { outline-color: var(--bg); }

/* ============================================================
   Panels on phones and small tablets: the slide-over becomes a
   full-screen sheet. (Each screen's own < 1024 rules sit with it.)
   ============================================================ */
@media (max-width: 900px) {
  input[type="date"].input { min-width: 0; }

  .scrim { justify-content: stretch; }
  .panel {
    width: 100vw;
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
    transform: translateY(18px);
  }
  .scrim.open .panel { transform: translateY(0); }

  .panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: center;
    padding: 12px var(--pad);
    background: var(--surface);
  }
  .panel-title { font-size: var(--fs-card-title); }
  .panel-body { padding: 18px var(--pad); }
  .panel-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  }
  .panel-foot .btn { flex: 1; justify-content: center; }
}

/* ============================================================
   Phones — 600px and down
   ============================================================ */
@media (max-width: 600px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .alt-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .alt-row > .chip { justify-self: start; }
  .stat-value { font-size: var(--fs-number-sm); }
  .tabs { gap: 14px; }
}

/* ============================================================
   Touch devices — no hover to rely on, and iOS must not zoom
   the page when a field takes focus (16px is its threshold).
   ============================================================ */
@media (hover: none) {
  .trip-card-actions { opacity: 1; }

  .input,
  input, select, textarea { font-size: 16px; }
  .field-hint, .field-label { font-size: var(--fs-caption); }
}

/* ============================================================
   Plans: Invite people (18-20), the reset dialog (19), Recently
   removed (26, 28) and the join page (21-24).
   ============================================================ */

/* Ink button: the reset dialog's confirm (19). Follows the theme. */
.btn-ink { min-height: 44px; padding: 0 20px; border-color: var(--text); background: var(--text); color: var(--bg); font-size: var(--fs-body); }
.btn-ink:hover { background: var(--text-muted); border-color: var(--text-muted); }

/* confirm({ icon, tone }): a tile above the title. */
.dialog-tile {
  --icon-stroke: 2;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; margin-bottom: 16px;
  border-radius: 12px;
  background: var(--icon-tile); color: var(--icon-tile-fg);
}
.dialog-tile .ic { width: 22px; height: 22px; }
.dialog-tile.is-warn { background: var(--warn-bg); color: var(--warn-fg); }
.dialog.iv-dialog { width: 440px; padding: 26px; border-radius: var(--radius-card-lg); border: 0; }
.dialog.iv-dialog .dialog-title { font-size: 20px; margin: 0; }
.dialog.iv-dialog .dialog-text { font-size: var(--fs-body); margin: 10px 0 22px; }

/* ---------- Invite people ---------- */
.iv-head { align-items: center; gap: 12px; padding: 22px 22px 16px; }
.iv-grab { display: none; }
.icon-tile.iv-tile { width: 38px; height: 38px; }
.icon-tile.iv-tile .ic { width: 20px; height: 20px; }
.iv-title { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; }
.iv-panel .panel-body { display: flex; flex-direction: column; gap: 22px; padding: 22px; }
.iv-panel .panel-foot, .rr-panel .panel-foot { display: none; }
.iv-intro { margin: 0; font-size: var(--fs-body); line-height: 1.5; color: var(--text-muted); }
.iv-intro b { color: var(--text); font-weight: 600; }

.iv-linkrow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
}
.iv-link {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-weight: 500; font-size: 13px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn.iv-copy { min-height: 44px; padding: 0 16px; font-size: var(--fs-body-sm); flex: none; }
.btn.iv-copy .ic { width: 15px; height: 15px; }
.btn.iv-copy.is-copied,
.btn.iv-copy.is-copied:hover { background: var(--pos-bg); border-color: var(--pos-bg); color: var(--pos-fg); }
.iv-share {
  --icon-stroke: 2;
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--text);
}
.iv-share .ic { width: 18px; height: 18px; }
.iv-share:hover { background: var(--line-soft); }

.iv-mhead-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.iv-mhead { margin: 0; font-size: 16px; font-weight: 600; }
.iv-mhead:focus { outline: none; }
.iv-mhead:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.iv-count { font-size: var(--fs-body-sm); font-weight: 500; color: var(--text-faint); }
.iv-mnote { font-size: var(--fs-caption); color: var(--text-faint); text-align: right; }
.iv-member { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.avatar.iv-av { width: 36px; height: 36px; font-size: var(--fs-body); font-weight: 700; border: 2px solid var(--surface); box-shadow: none; flex: none; }
.iv-mmain { flex: 1; min-width: 0; }
.iv-mname { font-size: var(--fs-body); font-weight: 600; overflow-wrap: anywhere; }
.iv-you { font-weight: 500; color: var(--text-faint); }
.iv-mrole { font-size: var(--fs-meta); color: var(--text-muted); margin-top: 1px; }
.iv-remove {
  flex: none; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--alert-fg);
  font-size: var(--fs-meta); font-weight: 600;
}
.iv-remove:hover { background: var(--alert-bg); border-color: var(--alert-bg); }
.iv-edit {
  --icon-stroke: 2;
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--text-faint);
}
.iv-edit .ic { width: 16px; height: 16px; }
.iv-edit:hover { background: var(--raised); color: var(--text); }
.iv-editing { display: flex; flex-direction: column; gap: 6px; }
.iv-editing .input { min-height: 40px; border-radius: var(--radius-select); }
.iv-editing .field-error { margin: 0; }
.iv-name-help { font-size: var(--fs-caption); color: var(--text-faint); }
.iv-name-actions { display: flex; gap: 6px; }
.iv-name-actions .btn-link { padding-left: 8px; padding-right: 8px; }

.iv-reset { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border-radius: 16px; background: var(--raised); }
.iv-reset[hidden] { display: none; }
.iv-reset-ic { --icon-stroke: 2; display: inline-flex; margin-top: 2px; color: var(--text-muted); }
.iv-reset-ic .ic { width: 18px; height: 18px; }
.iv-reset-main { flex: 1; min-width: 0; }
.iv-reset-title { font-size: var(--fs-body); font-weight: 600; }
.iv-reset-text { margin: 4px 0 12px; font-size: var(--fs-meta); line-height: 1.5; color: var(--text-muted); }
.btn.iv-reset-btn { background: var(--surface); }
.btn.iv-reset-btn:hover { background: var(--line-soft); }

@media (max-width: 900px) {
  .iv-panel .panel-body { padding: 18px var(--pad) calc(24px + env(safe-area-inset-bottom)); gap: 18px; }
}
/* Phone (20): a sheet from the bottom, under a sliver of the plan. */
@media (max-width: 767px) {
  .scrim .panel.iv-panel {
    height: calc(100dvh - 56px);
    margin-top: auto;
    border-radius: 24px 24px 0 0;
  }
  .iv-head { position: relative; padding: 30px 18px 6px; border-bottom: 0; }
  .iv-grab { display: block; position: absolute; top: 10px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: var(--radius-pill); background: var(--line); }
  .icon-tile.iv-tile { display: none; }
  .iv-panel .panel-body { padding: 8px 18px calc(30px + env(safe-area-inset-bottom)); }
  .iv-mnote { font-size: var(--fs-caption); }
}

/* ---------- Recently removed ---------- */
.scrim .panel.rr-panel { width: 420px; }
.rr-head { align-items: center; gap: 12px; padding: 22px 22px 16px; }
.rr-title { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-card-title); font-weight: 600; }
.rr-title:focus { outline: none; }
.rr-back { display: none; }
.rr-panel .panel-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 22px 24px; }
.rr-intro { margin: 0; font-size: var(--fs-body-sm); line-height: 1.5; color: var(--text-muted); }
.rr-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.rr-tile {
  --icon-stroke: 1.8;
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--raised); color: var(--text-faint);
}
.rr-tile .ic { width: 16px; height: 16px; }
.rr-main { flex: 1; min-width: 0; }
.rr-name { font-size: var(--fs-body); font-weight: 600; color: var(--text-muted); overflow-wrap: anywhere; }
.rr-meta { margin-top: 2px; font-size: var(--fs-meta); color: var(--text-faint); }
.btn.rr-restore { flex: none; background: var(--surface); }
.rr-empty { margin: 0; padding: 18px 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-body-sm); color: var(--text-faint); }
.rr-foot { margin: 0; font-size: var(--fs-meta); color: var(--text-faint); }
@media (max-width: 900px) {
  .scrim .panel.rr-panel { width: 100vw; }
  .rr-head { padding: 12px 14px; gap: 10px; }
  .rr-close { display: none; }
  .rr-back { display: inline-grid; order: -1; width: 44px; height: 44px; }
  .rr-title { font-size: 17px; }
  .rr-panel .panel-body { padding: 18px var(--pad) calc(24px + env(safe-area-inset-bottom)); }
}

/* ---------- Join (#join/<token>): no app shell ---------- */
.app.is-bare { display: block; height: auto; min-height: 100dvh; background: var(--bg); }
.jn-page { min-height: 100dvh; padding: 32px 56px 56px; }
.jn-brand { display: inline-flex; color: var(--wordmark); border-radius: 6px; }
.jn-brand .wordmark { height: 30px; }
.jn-main { display: block; }
.jn-body { max-width: 1120px; margin: 44px auto 0; }
.jn-body.is-split { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 32px; align-items: stretch; }
.jn-loading { margin: 0; padding: 80px 0; text-align: center; font-size: var(--fs-body-sm); color: var(--text-muted); }

.jn-hero {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
  min-width: 0;
  padding: 48px 44px;
  border-radius: 28px;
  background: var(--primary); color: var(--on-primary);
}
.sticker.jn-sticker { position: absolute; right: 30px; top: -14px; }
.jn-sticker .sticker-inner { font-size: var(--fs-body-sm); }
.jn-hero-title { margin: 0; font-family: var(--font-display); font-size: 52px; font-weight: 400; line-height: 1.02; }
.jn-hero-text { margin: 0; max-width: 420px; font-size: 16px; line-height: 1.5; color: var(--on-primary-muted); }
.jn-plan {
  padding: 20px;
  border-radius: 20px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 18px 40px rgba(8, 14, 80, 0.28);
}
.jn-from { display: flex; align-items: center; gap: 10px; font-size: var(--fs-body-sm); color: var(--text-muted); }
.jn-from b { color: var(--text); font-weight: 700; }
.avatar.jn-from-av { width: 30px; height: 30px; font-size: var(--fs-caption); border-color: var(--surface); }
.jn-plan-name { margin: 14px 0 0; font-size: var(--fs-title); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.jn-plan-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: var(--fs-body-sm); color: var(--text-muted); }
.jn-plan-meta .pl-meta-bit { gap: 6px; }
.jn-plan-meta .pl-meta-ic .ic { width: 15px; height: 15px; }
.jn-plan-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-meta); color: var(--text-muted);
}
.jn-stack { flex: none; }
.jn-stack .avatar.sm { width: 26px; height: 26px; font-size: 10px; border-color: var(--surface); }
.jn-stack .avatar + .avatar { margin-left: -8px; }
.jn-route { display: block; overflow: visible; }
.jn-route path { fill: none; stroke: var(--brand-periwinkle); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 10; }
.jn-route-start { fill: var(--brand-white); }
.jn-route-end { fill: var(--brand-tomato); }

.jn-card {
  display: flex; flex-direction: column; gap: 18px;
  min-width: 0;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}
.jn-form { display: flex; flex-direction: column; gap: 18px; }
.jn-card-title { margin: 0; font-size: 24px; font-weight: 600; }
.jn-card-sub { margin: 6px 0 0; font-size: var(--fs-body); line-height: 1.5; color: var(--text-muted); }
.seg.jn-seg { display: flex; width: 100%; margin: 0; padding: 3px; background: var(--raised); border: 1px solid var(--line); }
.jn-seg .seg-btn { flex: 1; min-height: 36px; padding: 0 6px; font-size: var(--fs-meta); }
.jn-field { display: flex; flex-direction: column; gap: 8px; }
.jn-label { font-size: var(--fs-meta); font-weight: 600; color: var(--text-muted); }
.input.jn-input { min-height: 44px; border-radius: var(--radius-select); font-size: var(--fs-body); }
.jn-hint { font-size: var(--fs-caption); color: var(--text-faint); line-height: 1.45; }
.jn-field .jn-hint { margin-top: -2px; }
.jn-error[hidden] { display: none; }
.btn.jn-submit { width: 100%; min-height: 50px; margin-top: 4px; font-size: 16px; }
.jn-privacy { --icon-stroke: 2; display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-meta); line-height: 1.5; color: var(--text-faint); }
.jn-privacy-ic { display: inline-flex; margin-top: 2px; }
.jn-privacy-ic .ic { width: 15px; height: 15px; }
.jn-signed { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: var(--fs-meta); color: var(--text-muted); }
.jn-signed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos-fg); }
.jn-signed-email { min-width: 0; color: var(--text-faint); overflow-wrap: anywhere; }
.jn-signed-email::before { content: "· "; }
.jn-sent { align-items: flex-start; justify-content: center; }
.jn-sent-title { margin: 0; font-size: 24px; font-weight: 600; }
.jn-sent-title:focus, .jn-centre-title:focus { outline: none; }
.jn-sent-text { margin: 0; font-size: var(--fs-body); line-height: 1.55; color: var(--text-muted); overflow-wrap: anywhere; }
.jn-sent-text b { color: var(--text); }
.jn-sent .jn-centre-tile { background: var(--pos-bg); color: var(--pos-fg); }
.jn-joining { justify-content: center; }

.jn-body.is-centred { max-width: 480px; margin-top: 120px; }
.jn-centre {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}
.jn-centre-tile { --icon-stroke: 2; display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--raised); color: var(--text-muted); }
.jn-centre-tile .ic { width: 24px; height: 24px; }
.jn-centre-title { margin: 0; font-size: 24px; font-weight: 600; }
.jn-centre-text { margin: 0; max-width: 360px; font-size: var(--fs-body); line-height: 1.55; color: var(--text-muted); }

@media (max-width: 1023px) {
  .jn-page { padding: calc(env(safe-area-inset-top) + 24px) 32px 40px; }
  .jn-body.is-split { grid-template-columns: minmax(0, 1fr); max-width: 560px; gap: 14px; }
}
@media (max-width: 767px) {
  .jn-page { padding: calc(env(safe-area-inset-top) + 24px) 16px 30px; }
  .jn-brand .wordmark { height: 26px; }
  .jn-body { margin-top: 22px; }
  .jn-hero { gap: 18px; padding: 24px 20px 22px; border-radius: 22px; }
  .sticker.jn-sticker { right: 16px; }
  .jn-sticker .sticker-inner { font-size: var(--fs-caption); }
  .jn-hero-title { font-size: 34px; }
  .jn-hero-text { font-size: var(--fs-body-sm); }
  .jn-card { gap: 14px; padding: 20px 18px; border-radius: 20px; }
  .jn-form { gap: 14px; }
  .jn-body.is-centred { margin-top: 100px; }
  .jn-centre { padding: 28px 22px; }
  .jn-centre-title { font-size: 22px; }
}

/* Phones: give page titles and their subtitle room to breathe before the
   first card (Trips, Bookings, Compare, Plans, Settings and trip headers). */
@media (max-width: 1023px) {
  .page-head { margin-bottom: 28px; }
  .compare-page .page-head { margin-bottom: 26px; }
  .stat-tile.is-cobalt .stat-value.is-word { font-size: 26px; }
}
