  :root {
    /* ---- Wildhart Travel brand palette ----
       Neutrals (Sandstone / Cloud White) carry ~70% of the UI,
       Midnight Expedition ~20% (text + dark surfaces),
       Wild Teal ~8% (the signature interactive accent),
       Sunrise Coral ~2% (reserved for primary calls-to-action). */
    --bg: #f6f2ea;          /* Sandstone — page background */
    --bg-soft: #efe9dd;     /* soft warm surface / hover */
    --bg-soft-2: #e7dfce;   /* deeper sandstone */
    --surface: #fcfcfa;     /* Cloud White — cards & panels */
    --border: #e6ddcd;
    --border-strong: #d6cab2;
    --text: #112240;        /* Midnight Expedition */
    --muted: #6b7280;       /* Slate */
    --muted-2: #9aa1ad;
    --ink: #112240;         /* Midnight Expedition — dark surfaces */
    --brand: #0ea5a4;       /* Wild Teal — signature accent */
    --brand-soft: #e0f4f3;
    --brand-dark: #0c8281;
    --cta: #ff6b57;         /* Sunrise Coral — primary actions */
    --cta-dark: #f0563f;
    --cta-soft: #ffe7e2;
    --gold: #f4b942;        /* Golden Hour */
    --sage: #7c9a7a;        /* Sage Trail */
    --slate: #6b7280;       /* Slate */
    --highlight: #e0f4f3;
    --selected: #0ea5a4;
    --selected-bg: #e0f4f3;
    --warning: #f4b942;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px rgba(17,34,64,0.05);
    --shadow: 0 1px 3px rgba(17,34,64,0.07), 0 1px 2px rgba(17,34,64,0.05);
    --shadow-lg: 0 10px 25px -5px rgba(17,34,64,0.12), 0 8px 10px -6px rgba(17,34,64,0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --font-head: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
  }
  button, input, select, textarea { font-family: inherit; color: inherit; }
  button { cursor: pointer; }
  /* Brand headings — Montserrat */
  h1, h2, h3, h4,
  .brand-text, .view-title, .main-title h2, .detail-title,
  .wishlist-header h1, .auth-brand h1, .filter-head h2, .empty-state h3 {
    font-family: var(--font-head);
    letter-spacing: -0.01em;
  }

  /* With a translucent iOS status bar the web view draws under it. This
     Midnight strip keeps the status-bar text readable on the signed-in
     app (white header). It sits below the auth overlay (z-index 500), so
     on the welcome/auth screens the full-bleed hero shows through instead. */
  .safe-top-fill {
    position: fixed; top: 0; left: 0; right: 0;
    height: env(safe-area-inset-top, 0px);
    background: var(--ink);
    z-index: 400;
    pointer-events: none;
  }

  /* ---------- Layout ---------- */
  .app {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
  }
  @media (max-width: 900px) {
    .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .sidebar { height: auto !important; max-height: 60vh; border-right: none !important; border-bottom: 1px solid var(--border); }
  }

  /* ---------- Sidebar ---------- */
  .sidebar {
    border-right: 1px solid var(--border);
    background: #fff;
    height: 100vh;
    overflow-y: auto;
    padding: 22px 18px 22px;
    display: flex; flex-direction: column;
  }
  .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 6px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
  }
  .brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--brand);
    display: grid; place-items: center;
    flex-shrink: 0;
  }
  .brand-mark svg { width: 22px; height: 22px; color: white; }
  .brand-text {
    font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
    color: var(--brand);
  }
  .brand-text small {
    display: block; font-size: 10px; font-weight: 600;
    color: var(--muted-2); letter-spacing: 0.12em;
    text-transform: uppercase; margin-top: 2px;
  }

  .trip-picker { position: relative; margin-bottom: 14px; }
  .trip-picker-btn {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    transition: border-color .15s, box-shadow .15s;
    text-align: left;
  }
  .trip-picker-btn:hover { border-color: var(--border-strong); }
  .trip-picker-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .trip-thumb {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--bg-soft-2);
    background-size: cover; background-position: center;
    display: grid; place-items: center;
    color: var(--muted-2); flex-shrink: 0;
  }
  .trip-thumb svg { width: 16px; height: 16px; }
  .trip-info { flex: 1; min-width: 0; }
  .trip-name { font-weight: 700; font-size: 14px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .trip-meta { font-size: 11px; color: var(--muted); margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chevron { color: var(--muted-2); flex-shrink: 0; }
  .trip-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: white; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
    display: none; max-height: 320px; overflow-y: auto;
  }
  .trip-dropdown.open { display: block; }
  .trip-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 8px 10px;
    background: transparent; border: none; border-radius: 8px;
    text-align: left; transition: background .12s;
  }
  .trip-dropdown-item:hover { background: var(--bg-soft); }
  .trip-dropdown-item.active { background: var(--brand-soft); }
  .trip-dropdown-item .trip-name { font-size: 13px; }
  .trip-dropdown-item .trip-meta { font-size: 10px; }
  .trip-dropdown-divider { height: 1px; background: var(--border); margin: 4px 6px; }
  .add-trip-btn { color: var(--brand); font-weight: 600; }
  .add-trip-btn .trip-thumb { background: var(--brand-soft); color: var(--brand); }

  .section-nav-top {
    display: flex; flex-direction: column; gap: 2px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
  }
  .section-toggle {
    display: flex; padding: 4px;
    background: var(--bg-soft); border-radius: 12px;
    margin-bottom: 18px;
  }
  .section-toggle button {
    flex: 1; border: none; background: transparent;
    padding: 8px 10px; border-radius: 9px;
    font-weight: 600; font-size: 13px; color: var(--muted);
    transition: all .15s ease;
  }
  .section-toggle button.active {
    background: white; color: var(--text); box-shadow: var(--shadow-sm);
  }

  .section-nav { display: flex; flex-direction: column; gap: 2px; }
  .section-nav-group { padding-bottom: 14px; }
  .section-nav-label {
    font-size: 10px; font-weight: 700; color: var(--muted-2);
    letter-spacing: 0.1em; text-transform: uppercase; padding: 10px 10px 6px;
  }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 10px;
    background: transparent; border: none; border-radius: 9px;
    font-weight: 500; font-size: 14px; color: var(--text);
    text-align: left; transition: background .12s;
  }
  .nav-item:hover { background: var(--bg-soft); }
  .nav-item.active { background: var(--highlight); color: var(--text); font-weight: 700; }
  .nav-item svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
  .nav-item.active svg { color: var(--brand); }

  .sidebar-footer {
    margin-top: auto; padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 11px; color: var(--muted-2);
    display: flex; justify-content: space-between; align-items: center;
  }
  .install-btn {
    border: 1px solid var(--brand); background: white; color: var(--brand);
    padding: 6px 10px; border-radius: 8px; font-size: 11px; font-weight: 600;
    display: none;
  }
  .install-btn.show { display: inline-block; }

  /* ---------- Main ---------- */
  .main { overflow-y: auto; padding: 28px 36px 60px; }
  .main-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
  }
  .main-title h2 { font-size: 24px; margin: 0; letter-spacing: -0.015em; }
  .main-title .crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .chip {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); border-radius: 999px;
    padding: 8px 14px; background: white; font-size: 13px; font-weight: 500;
  }
  .chip:hover { background: var(--bg-soft); }

  /* ---------- Compact budget bar ---------- */
  .budget-bar {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    background: white;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 18px;
  }
  .budget-stat .label {
    font-size: 11px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  }
  .budget-stat .value { font-size: 17px; font-weight: 700; margin-top: 3px; }
  .budget-stat .value.over { color: var(--danger); }
  .budget-stat .editable {
    border: 1px solid var(--border); border-radius: 8px;
    padding: 4px 8px; background: var(--bg-soft);
    font-size: 16px; font-weight: 700;
    width: 110px; outline: none;
  }
  .budget-stat .editable:focus { background: white; border-color: var(--brand); }
  .budget-stat .progress-wrap {
    height: 6px; background: var(--bg-soft); border-radius: 99px; overflow: hidden;
    margin-top: 6px;
  }
  .budget-stat .progress-bar {
    height: 100%; background: var(--selected);
    transition: width .25s ease, background-color .25s ease;
    width: 0%;
  }
  .budget-stat .progress-bar.over { background: var(--danger); }

  /* Spent / Planned / Remaining color tokens */
  :root {
    --spent: #0ea5a4;       /* Wild Teal */
    --spent-soft: #e0f4f3;
    --planned: #f4b942;     /* Golden Hour */
    --planned-soft: #fdf3da;
    --remaining: #6b7280;   /* Slate */
    --remaining-soft: #f0f1f3;
  }
  .budget-stat.spent-stat .value { color: var(--spent); }
  .budget-stat.planned-stat .value { color: var(--planned); }
  .budget-stat.remaining-stat .value { color: var(--remaining); }
  .budget-stat.remaining-stat .value.over { color: var(--danger); }
  .budget-stat .swatch {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 6px;
    vertical-align: middle;
  }

  .budget-stack {
    display: flex; height: 14px;
    background: var(--remaining-soft);
    border-radius: 99px;
    overflow: hidden;
    margin: 18px 0 22px;
    border: 1px solid var(--border);
  }
  .budget-stack .seg-spent { background: var(--spent); transition: width .25s ease; }
  .budget-stack .seg-planned { background: var(--planned); transition: width .25s ease; }
  .budget-stack .seg-over { background: var(--danger); transition: width .25s ease; }
  .budget-stack-legend {
    display: flex; flex-wrap: wrap; gap: 14px;
    font-size: 12px; color: var(--muted);
    margin-top: -12px; margin-bottom: 16px;
  }
  .budget-stack-legend .li { display: inline-flex; align-items: center; gap: 6px; }
  .budget-stack-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

  .budget-cat-bar {
    height: 8px; background: var(--remaining-soft);
    border-radius: 99px; overflow: hidden;
    display: flex;
  }
  .budget-cat-bar .seg-spent { background: var(--spent); }
  .budget-cat-bar .seg-planned { background: var(--planned); }

  /* Paid toggle (used in detail modal and transport modal) */
  .paid-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: white;
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    user-select: none;
    color: var(--muted);
    transition: background .12s, color .12s, border-color .12s;
  }
  .paid-toggle:hover { background: var(--bg-soft); }
  .paid-toggle.is-paid {
    background: var(--spent-soft);
    color: var(--spent);
    border-color: #86efac;
  }
  .paid-toggle .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--planned);
    box-shadow: 0 0 0 2px var(--planned-soft);
  }
  .paid-toggle.is-paid .dot { background: var(--spent); box-shadow: 0 0 0 2px var(--spent-soft); }

  /* Saved-pill on detail header showing paid state */
  .paid-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--planned-soft);
    color: var(--planned);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .paid-pill.is-paid { background: var(--spent-soft); color: var(--spent); }

