/* =========================================================
   Morocco Crew — Trip Board
   "Dusk" UI direction (2026-05-17)
   Dark luxury · amber accent · Moroccan night-market vibe
   Logic untouched — pure visual layer.
   ========================================================= */

:root {
  /* Dark surfaces */
  --bg:            #0D0B09;
  --bg-2:          #141210;
  --bg-3:          #1C1916;
  --surface:       #211E1A;
  --surface-muted: #1A1714;
  --surface-sunk:  #161310;

  /* Ink (light text on dark) */
  --ink:           #F5F0E8;
  --ink-soft:      #B8AFA5;
  --muted:         #8A827B;
  --muted-soft:    #5A5450;

  /* Lines */
  --line:          rgba(255, 255, 255, 0.07);
  --line-strong:   rgba(255, 255, 255, 0.12);
  --line-bold:     rgba(255, 255, 255, 0.18);

  /* Brand accent — amber/gold (Moroccan dusk) */
  --accent:        #E8A84E;
  --accent-deep:   #C48830;
  --accent-soft:   rgba(232, 168, 78, 0.12);
  --accent-mid:    rgba(232, 168, 78, 0.20);
  --accent-tint:   rgba(232, 168, 78, 0.06);

  /* Secondary palette */
  --clay:          #C96240;
  --clay-soft:     rgba(201, 98, 64, 0.14);
  --gold:          #E8A84E;
  --gold-soft:     rgba(232, 168, 78, 0.14);
  --emerald:       #2DBD8F;
  --emerald-soft:  rgba(45, 189, 143, 0.12);
  --emerald-deep:  #1F8C68;
  --rose:          #D45A6B;
  --rose-soft:     rgba(212, 90, 107, 0.14);
  --indigo:        #6B8BC4;
  --indigo-soft:   rgba(107, 139, 196, 0.14);

  /* Status mapping */
  --status-ready-color:    var(--emerald);
  --status-ready-bg:       var(--emerald-soft);
  --status-almost-color:   var(--gold);
  --status-almost-bg:      var(--gold-soft);
  --status-late-color:     var(--clay);
  --status-late-bg:        var(--clay-soft);
  --status-snooze-color:   var(--clay);
  --status-snooze-bg:      var(--clay-soft);
  --status-busy-color:     var(--rose);
  --status-busy-bg:        var(--rose-soft);
  --status-done-color:     var(--emerald);
  --status-done-bg:        var(--emerald-soft);
  --status-missing-color:  var(--muted);
  --status-missing-bg:     rgba(255, 255, 255, 0.04);
  --status-pending-color:  var(--muted);
  --status-pending-bg:     rgba(255, 255, 255, 0.04);

  --danger:        #E15A4E;
  --danger-soft:   rgba(225, 90, 78, 0.14);

  /* Radius */
  --r-xs: 8px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Shadow */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-3: 0 14px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-pop: 0 22px 60px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 40px rgba(232, 168, 78, 0.18);

  /* Motion */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 240ms;
  --dur-4: 320ms;
}

/* -------- Reset -------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  overflow-x: hidden;
  /* Prevent iOS font inflation on rotation */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { min-height: 100%; }
body { overflow-x: hidden; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* Subtle ambient glows in background — isolated on their own GPU layer */
body::before, body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  /* Own compositing layer — keeps repaints from touching the rest of the page */
  will-change: transform;
  transform: translateZ(0);
}
body::before {
  top: -160px; right: -80px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(232, 168, 78, 0.10) 0%, transparent 70%);
}
body::after {
  bottom: -100px; left: 60px;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(45, 189, 143, 0.05) 0%, transparent 70%);
}

body[data-view="auth"] .app-shell,
body[data-view="auth"] .mobile-tabs,
body[data-view="auth"] .join-gate,
body[data-view="lobby"] .app-shell,
body[data-view="lobby"] .mobile-tabs,
body[data-view="lobby"] .join-gate {
  display: none;
}

.auth-gate,
.trip-lobby {
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-gate[hidden],
.trip-lobby[hidden] { display: none; }

.auth-card,
.trip-lobby-shell {
  width: min(100%, 960px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: linear-gradient(145deg, rgba(33, 30, 26, 0.96), rgba(20, 18, 16, 0.96));
  box-shadow: var(--shadow-3);
}

.auth-card {
  max-width: 460px;
  padding: 28px;
}
.auth-card h1 { font-size: clamp(1.7rem, 6vw, 2.6rem); line-height: 1.05; margin-bottom: 0.8rem; }
.auth-card > p { margin-bottom: 1.2rem; }
.auth-form,
.trip-lobby-grid {
  display: grid;
  gap: 1rem;
}
.auth-form label {
  display: grid;
  gap: 0.45rem;
  color: var(--ink-soft);
  font-weight: 650;
}
.trip-lobby-shell { padding: 24px; }
.trip-lobby-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.trip-lobby-header h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.trip-lobby-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); align-items: start; }
.trip-list {
  display: grid;
  gap: 0.8rem;
}
.trip-list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.035);
}
.trip-list-card h3 { margin-bottom: 0.15rem; }
.rail-button {
  min-height: 36px;
  width: 64px;
  padding: 0.35rem;
  font-size: 0.72rem;
}

@media (max-width: 760px) {
  .trip-lobby-grid { grid-template-columns: 1fr; }
  .trip-lobby-header { flex-direction: column; }
}

button, input, select, textarea { font: inherit; color: inherit; }
/* Eliminate 300ms tap delay and prevent double-tap zoom on all interactive elements */
button, a, label, [role="button"], [role="tab"] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
a { color: inherit; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--ink);
}
h1 { font-size: 1.25rem; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9375rem; letter-spacing: -0.012em; }
p { margin: 0; color: var(--ink-soft); }

.eyebrow {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

/* -------- App shell — narrow icon rail + main -------- */
.app-shell {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100svh;
  min-height: 100dvh;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
}

/* -------- Sidebar (icon rail on desktop) -------- */
.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 24px 0;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100svh;
  height: 100dvh;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  /* Contain scroll bounce inside the sidebar only, not the whole page */
  overscroll-behavior-y: contain;
}
.sidebar::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 16px;
}
.brand-text { display: none; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--clay) 100%);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.025em;
  box-shadow: 0 0 24px rgba(232, 168, 78, 0.32);
}

/* Tabs become icon-only buttons on desktop */
.sidebar .tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  width: 100%;
  align-items: center;
}
.sidebar .tab-button {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  position: relative;
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.sidebar .tab-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
}
.sidebar .tab-button.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}
.sidebar .tab-button.active::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.sidebar .tab-button .tab-icon { width: 20px; height: 20px; }
.sidebar .tab-button .tab-icon svg { width: 100%; height: 100%; }
.sidebar .tab-button .tab-label { display: none; }
.sidebar .tab-button:active { transform: scale(0.94); }

/* Trip card collapses to icon-only spacer hidden on desktop rail */
.sidebar .trip-card { display: none; }
.trip-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.loading-skeleton {
  position: relative;
  color: transparent !important;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.06);
}
.loading-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.4s linear infinite;
}
.loading-title { width: min(150px, 100%); min-height: 1.25rem; }
.loading-line { width: min(118px, 100%); min-height: 0.9rem; }
.loading-pill { width: 84px; min-height: 1.4rem; }

/* Identity becomes a small avatar pill at bottom */
.sidebar .identity-card {
  margin-top: auto;
  width: 64px;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow-1);
}
.sidebar .identity-card .eyebrow {
  font-size: 0.55rem;
  margin: 0;
  letter-spacing: 0.08em;
}
.sidebar .identity-card strong {
  max-width: 100%;
  font-size: 0.6875rem;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

/* -------- Main column -------- */
main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
}

.live-sync-banner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 50;
  width: min(calc(100vw - 32px), 430px);
  margin: 0;
  padding: 0.7rem 0.85rem;
  background: var(--gold-soft);
  border: 1px solid rgba(232, 168, 78, 0.22);
  border-radius: var(--r);
  color: var(--accent);
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
}
.live-sync-banner[hidden] { display: none; }
.live-sync-banner strong { font-size: 0.875rem; white-space: nowrap; color: var(--accent); }
.live-sync-banner span { font-size: 0.8125rem; color: var(--ink-soft); }

/* -------- Page header (per-panel) -------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.25rem;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.page-header-text { min-width: 0; }
.page-header h2 {
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  letter-spacing: -0.028em;
  color: var(--ink);
}
.page-header .page-sub {
  color: var(--muted);
  margin-top: 0.35rem;
  font-size: 0.9375rem;
  max-width: 52ch;
}
.page-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.page-header-schedule .eyebrow { color: var(--accent); }
.page-header-today .eyebrow    { color: var(--accent); }
.page-header-people .eyebrow   { color: var(--emerald); }
.page-header-photos .eyebrow   { color: var(--indigo); }
.page-header-expenses .eyebrow { color: var(--accent); }

/* -------- Panels -------- */
.tab-panel { display: none; animation: panelIn var(--dur-4) var(--ease-out); padding: 0 28px 40px; }
.tab-panel.active { display: block; }
.tab-panel > .page-header { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }

/* -------- Today dashboard -------- */
.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
  gap: 0.9rem;
}
.today-next-card,
.today-action-card,
.today-day-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.today-next-card {
  padding: 1.15rem 1.2rem;
  display: grid;
  gap: 0.45rem;
}
.today-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.today-next-card h3,
.today-action-card h3,
.today-day-card h3 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.today-next-card > p { color: var(--ink-soft); }
.today-countdown {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.today-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.25rem;
}
.today-reminder {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(232, 168, 78, 0.22);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}
.today-reminder.soon {
  background: var(--clay-soft);
  color: var(--clay);
  border-color: rgba(201, 98, 64, 0.22);
}
.today-reminder.past {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-color: var(--line);
}
.today-action-card {
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.today-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: auto;
}
.today-actions > * { width: 100%; }
.today-day-card {
  grid-column: 1 / -1;
  overflow: hidden;
}
.today-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.compact-button {
  min-height: 38px;
  --pad-y: 0.42rem;
  --pad-x: 0.75rem;
}
.today-timeline {
  display: flex;
  flex-direction: column;
}
.today-timeline-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.today-timeline-item:last-child { border-bottom: 0; }
.today-timeline-item > strong {
  color: var(--accent);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.today-timeline-item h4 {
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}
.today-timeline-item p {
  color: var(--muted);
  font-size: 0.8125rem;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel { animation: none; }
}

/* -------- Buttons (glass pills) -------- */
.primary-button,
.secondary-button,
.danger-button,
.upload-button {
  --pad-y: 0.55rem;
  --pad-x: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: var(--pad-y) var(--pad-x);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background-color var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out),
              color var(--dur-2) var(--ease-out),
              transform var(--dur-1) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out);
  white-space: nowrap;
  font-family: inherit;
}
.primary-button .btn-icon,
.secondary-button .btn-icon,
.upload-button .btn-icon {
  display: inline-flex; width: 14px; height: 14px;
}
.btn-icon svg { width: 100%; height: 100%; }

.primary-button {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.primary-button:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.primary-button:active { transform: scale(0.97); }
.primary-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.secondary-button {
  background: var(--surface);
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.secondary-button:hover { background: var(--bg-3); border-color: var(--line-bold); color: var(--ink); }
.secondary-button:active { transform: scale(0.97); }
.secondary-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.danger-button {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-soft);
}
.danger-button:hover { background: var(--danger-soft); border-color: var(--danger); }
.danger-button:active { transform: scale(0.97); }

.upload-button {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  cursor: pointer;
  position: relative;
  font-weight: 600;
}
.upload-button:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.upload-button:active { transform: scale(0.97); }
.upload-button input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px; min-height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.75rem;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.icon-button:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink-soft); }
.icon-button:active { transform: scale(0.94); }

/* -------- Forms -------- */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input:not([type]),
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg-3);
  color: var(--ink);
  transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
  font-size: 0.9375rem;
  line-height: 1.4;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-muted);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder { color: var(--muted-soft); }

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
}
label input, label select, label textarea { margin-top: 0.3rem; }

/* Override select arrow for dark theme */
.identity-card select,
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238A827B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1.5 6 6.5l5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
}

/* -------- Itinerary (schedule) -------- */
.day-switcher {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 0 0.75rem;
  margin: 0 -4px 1rem;
  scroll-snap-type: x mandatory;
}
.day-switcher::-webkit-scrollbar { display: none; }

.day-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  min-width: 64px;
  scroll-snap-align: start;
  font-size: 0.8125rem;
  font-family: inherit;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
  flex-shrink: 0;
}
.day-chip:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink-soft); border-color: var(--line-strong); }
.day-chip:active { transform: scale(0.97); }
.day-chip.selected,
.day-chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* Event list — unified bordered container */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}

.event-card {
  display: grid;
  grid-template-columns: minmax(150px, 168px) minmax(0, 1fr);
  gap: 0.75rem 1.1rem;
  align-items: start;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  transition: background var(--dur-2) var(--ease-out);
}
.event-card:last-child { border-bottom: 0; }
.event-card:hover { background: var(--bg-3); }

.event-time {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-right: 0.85rem;
  border-right: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.event-day {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
}
.event-time > strong {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.025em;
  line-height: 1;
}

/* Smart reminder card */
.smart-reminder-card {
  display: grid;
  gap: 0.08rem;
  width: 100%;
  min-width: 0;
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--r-sm);
  border: 1px solid rgba(232, 168, 78, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}
.smart-reminder-card > span {
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.smart-reminder-card > strong {
  color: inherit;
  font-size: 0.8125rem;
  line-height: 1.2;
}
.smart-reminder-card > small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}
.smart-reminder-card.soon {
  background: var(--clay-soft);
  color: var(--clay);
  border-color: rgba(201, 98, 64, 0.22);
}
.smart-reminder-card.off,
.smart-reminder-card.warning,
.smart-reminder-card.warn,
.smart-reminder-card.danger {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-color: var(--line);
}

.event-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}
.event-title-row > div:first-child { min-width: 0; flex: 1; }
.event-title-row h4 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.018em;
}
.event-meta {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 0.1rem;
}

.event-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-shrink: 0;
}

/* Right column container */
.event-card > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}
.event-card > div:last-child > p {
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

/* Ready-summary pills row */
.ready-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Status board inside event cards */
.event-card .status-board {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.event-card .my-status-card {
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-sm);
  gap: 0.5rem;
  box-shadow: none;
  background: var(--surface);
  border: 1px solid var(--line);
}
.event-card .my-status-card > div:first-child h5 { font-size: 0.875rem; }
.event-card .my-status-card .eyebrow { font-size: 0.6rem; margin-bottom: 0.1rem; }
.event-card .status-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.3rem;
}
.event-card .status-choice {
  padding: 0.45rem 0.55rem;
  font-size: 0.8125rem;
}
.event-card .group-status-card {
  padding: 0.65rem 0.75rem;
  gap: 0.5rem;
  box-shadow: none;
  background: var(--surface);
  border-radius: var(--r-sm);
}

/* -------- Empty states -------- */
.empty-state {
  padding: 2.25rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--bg-2);
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.empty-state strong { color: var(--ink); font-weight: 600; font-size: 0.9375rem; }
.empty-state p { color: var(--muted); font-size: 0.875rem; max-width: 38ch; }
.empty-state.compact { padding: 1.25rem 1rem; }

/* -------- Crew / People / Readiness -------- */
.people-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.status-board {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.my-status-card {
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.my-status-card.pick-traveler {
  background: linear-gradient(135deg, var(--accent-tint), var(--surface));
  border-color: rgba(232, 168, 78, 0.18);
}

.status-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.status-section-title .eyebrow { margin: 0; }
.status-section-title > span {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Status chip palette */
.status-pill,
.status-summary-chip,
.status-choice {
  --pill-color: var(--ink-soft);
  --pill-bg:    rgba(255, 255, 255, 0.04);
  --pill-ring:  var(--line-strong);
}
.status-ready, .status-pill.status-ready, .status-summary-chip.status-ready, .status-choice.status-ready {
  --pill-color: var(--emerald); --pill-bg: var(--emerald-soft); --pill-ring: rgba(45, 189, 143, 0.28);
}
.status-almost, .status-pill.status-almost, .status-summary-chip.status-almost, .status-choice.status-almost {
  --pill-color: var(--gold); --pill-bg: var(--gold-soft); --pill-ring: rgba(232, 168, 78, 0.28);
}
.status-late, .status-snooze, .status-busy,
.status-pill.status-late, .status-pill.status-snooze, .status-pill.status-busy,
.status-summary-chip.status-late, .status-summary-chip.status-snooze, .status-summary-chip.status-busy,
.status-choice.status-late, .status-choice.status-snooze, .status-choice.status-busy {
  --pill-color: var(--clay); --pill-bg: var(--clay-soft); --pill-ring: rgba(201, 98, 64, 0.28);
}
.status-done, .status-pill.status-done, .status-summary-chip.status-done, .status-choice.status-done {
  --pill-color: var(--bg); --pill-bg: var(--emerald); --pill-ring: var(--emerald);
}
.status-missing, .status-pending,
.status-pill.status-missing, .status-pill.status-pending,
.status-summary-chip.status-missing, .status-summary-chip.status-pending {
  --pill-color: var(--muted); --pill-bg: rgba(255, 255, 255, 0.04); --pill-ring: var(--line-strong);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--pill-bg);
  color: var(--pill-color);
  border: 1px solid var(--pill-ring);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.status-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.status-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--r-pill);
  background: var(--pill-bg);
  color: var(--pill-color);
  border: 1px solid var(--pill-ring);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.4rem;
}
.status-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.875rem;
  text-align: left;
  font-family: inherit;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.status-choice:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line-bold); color: var(--ink); }
.status-choice:active { transform: scale(0.97); }
.status-choice.selected, .status-choice.active {
  background: var(--pill-bg);
  border-color: var(--pill-ring);
  color: var(--pill-color);
}

.ready-toggle {
  min-height: 48px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-align: center;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.ready-toggle.status-ready {
  background: var(--emerald-soft);
  border-color: rgba(45, 189, 143, 0.32);
  color: var(--emerald);
}
@media (hover: hover) and (pointer: fine) {
  .ready-toggle:hover {
    border-color: var(--line-bold);
    background: rgba(255, 255, 255, 0.06);
  }
  .ready-toggle.status-ready:hover {
    background: rgba(45, 189, 143, 0.18);
  }
}
.ready-toggle:active {
  transform: scale(0.98);
}

/* Status avatar (small) */
.status-avatar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.status-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--pill-bg);
  color: var(--pill-color);
  border: 1px solid var(--pill-ring);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Group status card */
.group-status-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.group-status-details {
  border-radius: var(--r-sm);
  overflow: hidden;
}
.group-status-details > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
  transition: color var(--dur-2) var(--ease-out);
}
.group-status-details > summary::-webkit-details-marker { display: none; }
.group-status-details > summary::before {
  content: "";
  display: inline-block;
  width: 0; height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent currentColor;
  transition: transform var(--dur-2) var(--ease-out);
}
.group-status-details[open] > summary::before { transform: rotate(90deg); }
.group-status-details > summary:hover { color: var(--ink-soft); }

.group-status-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.group-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: background-color var(--dur-2) var(--ease-out);
  font-size: 0.875rem;
}
.group-status-name {
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.status-admin-select {
  min-width: 128px;
  padding-block: 0.35rem;
  font-size: 0.75rem;
}
.group-status-row:hover { background: rgba(255, 255, 255, 0.05); }

.ready-summary strong { color: var(--ink); font-weight: 600; }

/* Person card */
.person-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out);
}
.person-card:hover { border-color: var(--line-strong); background: var(--bg-3); }
.person-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.person-card .eyebrow { margin-bottom: 0; }
.person-card strong {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.012em;
}
.person-card .claimed,
.person-card .open {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.person-card .claimed { background: var(--emerald-soft); color: var(--emerald); border: 1px solid rgba(45, 189, 143, 0.28); }
.person-card .open { background: rgba(255, 255, 255, 0.04); color: var(--muted); border: 1px solid var(--line-strong); }

.person-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.person-delete-button {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  border-radius: var(--r-pill);
  border: 1px solid rgba(225, 90, 78, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.person-edit-button {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .person-edit-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-bold);
  }
  .person-delete-button:hover {
    background: rgba(225, 90, 78, 0.2);
    border-color: rgba(225, 90, 78, 0.35);
  }
}
.person-edit-button:active,
.person-delete-button:active { transform: scale(0.97); }

.person-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.person-avatar:not(.open-avatar) {
  background: linear-gradient(135deg, var(--accent) 0%, var(--clay) 100%);
  color: var(--bg);
  border-color: transparent;
}

.organiser-panel {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(232, 168, 78, 0.22);
  border-radius: var(--r-lg);
  background: var(--accent-tint);
}
.organiser-panel h3 { margin-bottom: 0.15rem; }
.organiser-panel p:last-child { font-size: 0.875rem; }

/* Invite actions — button only, input hidden but kept for JS */
.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
/* Keep #inviteLink in the DOM so app.js can write to it, but never show it */
#inviteLink {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
  opacity: 0 !important;
}
.invite-actions .secondary-button {
  width: 100%;
  justify-content: center;
}

/* -------- Photos -------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}
.photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.photo-card img {
  aspect-ratio: 1 / 1;
}
.photo-card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.photo-name {
  position: absolute;
  inset: auto 0.6rem 0.6rem 0.6rem;
  z-index: 1;
  padding: 0.35rem 0.5rem;
  border-radius: var(--r-sm);
  background: rgba(13, 11, 9, 0.72);
  color: var(--ink);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-link { position: absolute; inset: 0; display: block; }
.photo-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-4) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .photo-card:hover img { transform: scale(1.04); }
}
.photo-actions {
  position: absolute;
  inset: 0.55rem 0.55rem auto auto;
  display: flex;
  gap: 0.35rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.photo-card:hover .photo-actions,
.photo-card:focus-within .photo-actions { opacity: 1; transform: translateY(0); }
.photo-action {
  --pad-y: 0.42rem;
  --pad-x: 0.58rem;
  font-size: 0.75rem;
  backdrop-filter: blur(8px);
}
.photo-action span {
  display: inline-flex;
  width: 14px;
  height: 14px;
}
.photo-action span svg { width: 100%; height: 100%; }
.photo-action.secondary-button {
  background: rgba(20, 18, 16, 0.85);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.1);
}
.photo-action.danger-button {
  background: rgba(225, 90, 78, 0.92);
  color: #fff; border-color: transparent;
}

/* -------- Expenses -------- */
.expense-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
@media (min-width: 900px) {
  .expense-shell { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .expense-overview, .expense-sync-notice { grid-column: 1 / -1; }
  .expense-form-card { grid-row: span 2; }
}

.expense-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}
.expense-stat-card {
  padding: 0.95rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.expense-stat-card > span:first-child {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}
.expense-stat-card strong {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.1;
}
.expense-stat-card.subtle { background: var(--bg-2); }
.expense-stat-card.positive { border-color: rgba(45, 189, 143, 0.28); background: var(--emerald-soft); }
.expense-stat-card.positive strong { color: var(--emerald); }
.expense-stat-card.negative { border-color: rgba(201, 98, 64, 0.28); background: var(--clay-soft); }
.expense-stat-card.negative strong { color: var(--clay); }

.expense-sync-notice {
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--ink-soft);
  font-size: 0.8125rem;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.expense-sync-notice strong { color: var(--ink); font-weight: 600; }
.expense-sync-notice.success {
  background: var(--emerald-soft); color: var(--emerald);
  border-color: rgba(45, 189, 143, 0.22);
}
.expense-sync-notice.success strong { color: var(--emerald); }
.expense-sync-notice.warning {
  background: var(--gold-soft); color: var(--accent);
  border-color: rgba(232, 168, 78, 0.28);
}
.expense-sync-notice.warning strong { color: var(--accent); }

.expense-card {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.expense-card-heading h4 { font-size: 1rem; }

.expense-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.expense-form > label:first-child,
.expense-form .split-fieldset,
.expense-form > button[type="submit"] { grid-column: 1 / -1; }
.paid-people-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.paid-people-block > small {
  color: var(--muted);
  font-size: 0.75rem;
}
.paid-people-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.paid-person-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0.4rem 0.65rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-soft);
  font-size: 0.75rem;
}
.paid-person-chip > span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: transparent;
}
.paid-person-chip > b { font-weight: 600; }
.paid-person-chip > small { color: var(--muted); }
.paid-person-chip.paid,
.paid-person-chip.settled {
  border-color: rgba(45, 189, 143, 0.28);
  background: var(--emerald-soft);
  color: var(--emerald);
}
.paid-person-chip.paid > span,
.paid-person-chip.settled > span {
  background: var(--emerald);
  color: var(--bg);
}
.paid-person-chip.settled {
  cursor: default;
  opacity: 0.92;
}

.split-fieldset {
  border: 0; padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.split-fieldset legend {
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.split-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.split-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem 0.4rem 0.6rem;
  border-radius: var(--r-pill);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.split-option:hover { background: var(--surface); color: var(--ink); }
.split-option input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--accent);
  margin: 0;
}
.split-option:has(input:checked) {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.split-option:has(input:checked) input[type="checkbox"] { accent-color: var(--bg); }

.expense-list,
.settlement-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Settlement row: From → Amount → To */
.settlement-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem 0.6rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.settlement-row:hover { background: var(--surface); border-color: var(--line-strong); }
.settlement-row > span:first-child { color: var(--ink); font-weight: 500; }
.settlement-row > strong {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--bg);
  background: var(--accent);
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  text-align: center;
  white-space: nowrap;
}
.settlement-row > span:last-child { color: var(--muted); text-align: right; font-size: 0.8125rem; }

/* Expense item row */
.expense-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.85rem;
  align-items: start;
  padding: 0.85rem 1rem;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.expense-item:hover { background: var(--surface); border-color: var(--line-strong); }

.expense-item > div:first-child { min-width: 0; }
.expense-item h5 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.expense-item .eyebrow { color: var(--muted); margin-bottom: 0.2rem; }
.expense-item > div:first-child > p {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}
.expense-item > div:first-child > span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.expense-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  padding-top: 0.1rem;
}
.expense-item-side > strong {
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--accent);
}

/* Trip setup */
.trip-setup-details {
  margin-top: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 0.6rem 0.9rem;
  background: var(--bg-2);
}
.trip-setup-details > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.875rem;
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.trip-setup-details > summary::-webkit-details-marker { display: none; }
.trip-setup-details > summary::before {
  content: "+";
  width: 18px; height: 18px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--ink-soft);
}
.trip-setup-details[open] > summary::before { content: "−"; }
.setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 0.85rem;
}
@media (min-width: 800px) {
  .setup-grid { grid-template-columns: 1fr 1fr; }
}
.editor-panel {
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.editor-panel h4 { font-size: 1rem; margin-bottom: 0.25rem; }
.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* -------- Mobile bottom dock -------- */
.mobile-tabs { display: none; }

@media (max-width: 880px) {
  /* Prevent iOS from zooming in when focusing inputs (requires font-size ≥ 16px) */
  input, select, textarea {
    font-size: max(16px, 1em);
  }

  /* Disable expensive background glows on mobile — they cause repaint lag */
  body::before, body::after { display: none; }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100svh;
    padding: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  }

  /* Sidebar collapses to a top bar with brand + identity */
  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    height: auto;
    padding: 14px 18px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
    overflow: visible;
  }
  .brand { padding: 0; }
  .brand-text { display: flex; flex-direction: column; gap: 2px; }
  .brand-text .eyebrow { font-size: 0.625rem; color: var(--muted); margin: 0; }
  .brand-text h1 { font-size: 0.9375rem; color: var(--ink); letter-spacing: -0.02em; }
  .brand { display: flex; align-items: center; gap: 0.6rem; }

  .sidebar > .tabs { display: none; }
  .sidebar .trip-card { display: none; }

  .sidebar .identity-card {
    margin: 0;
    width: auto;
    padding: 0.4rem 0.5rem;
    flex-direction: row;
    background: var(--surface);
    gap: 0.5rem;
  }
  .sidebar .identity-card .eyebrow { display: none; }
  .sidebar .identity-card strong {
    max-width: 150px;
    font-size: 0.8125rem;
    text-align: left;
  }

  /* Page headers */
  .tab-panel { padding: 0 16px 24px; }
  .tab-panel { animation: none; }
  .tab-panel.active {
    min-height: calc(100svh - 180px);
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 18px 0 14px;
    margin: 0 0 14px;
  }
  .page-header h2 { font-size: 1.5rem; }
  .page-header-actions { width: 100%; }
  .page-header-actions > * { flex: 1; }
  .today-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }
  .today-day-card { grid-column: auto; }

  .event-card { grid-template-columns: 1fr; padding: 0.9rem 1rem; gap: 0.7rem; }
  .event-time {
    display: grid;
    grid-template-columns: auto minmax(150px, 180px);
    grid-template-areas:
      "day reminder"
      "time reminder";
    justify-content: space-between;
    align-items: start;
    gap: 0.2rem 0.75rem;
    padding-right: 0;
    padding-bottom: 0.8rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .event-day { grid-area: day; }
  .event-time > strong { grid-area: time; }
  .event-time > strong { font-size: 1.0625rem; }
  .smart-reminder-card {
    grid-area: reminder;
    justify-self: end;
    margin-top: 0;
  }

  .expense-form { grid-template-columns: 1fr; }

  /* Bottom dock */
  .mobile-tabs {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    left: 14px; right: 14px;
    padding: 5px;
    background: rgba(20, 18, 16, 0.82);
    backdrop-filter: saturate(135%) blur(18px);
    -webkit-backdrop-filter: saturate(135%) blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), 0 1px 1px rgba(255, 255, 255, 0.04) inset;
    z-index: 30;
    gap: 0;
    /* Own compositing layer — prevents jitter as content scrolls beneath */
    will-change: transform;
    transform: translateZ(0);
  }
  .mobile-tabs .tab-button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0.4rem 0.2rem;
    min-height: 54px;
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(245, 240, 232, 0.58);
    border: 1px solid transparent;
    border-radius: 18px;
    width: auto;
    height: auto;
    background: transparent;
    text-align: center;
    letter-spacing: 0.02em;
    /* GPU-only transition — no layout properties change */
    transition: background-color var(--dur-2) var(--ease-out),
                border-color var(--dur-2) var(--ease-out),
                color var(--dur-2) var(--ease-out),
                transform var(--dur-1) var(--ease-out);
  }
  .mobile-tabs .tab-button:active { transform: scale(0.96); }
  .mobile-tabs .tab-button::after { display: none; }
  .mobile-tabs .tab-button .tab-label { display: inline; }
  .mobile-tabs .tab-button .tab-icon { width: 20px; height: 20px; }
  .mobile-tabs .tab-button.active {
    background: rgba(232, 168, 78, 0.14);
    border-color: rgba(232, 168, 78, 0.2);
    color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  .mobile-tabs .tab-button.active .tab-label { color: var(--accent); }
  .mobile-tab-indicator { display: none; }
}

@media (max-width: 480px) {
  .auth-gate,
  .trip-lobby { padding: 16px; align-items: start; }
  .auth-card,
  .trip-lobby-shell { padding: 18px; border-radius: var(--r-lg); }
  .trip-lobby-header,
  .trip-list-card { flex-direction: column; align-items: stretch; }
  .trip-lobby-grid { grid-template-columns: 1fr; }
  .sidebar { padding: 12px 14px; }
  .brand-mark { width: 32px; height: 32px; font-size: 0.875rem; border-radius: 9px; }
  .brand-text h1 { font-size: 0.875rem; }
  .brand-text .eyebrow { font-size: 0.5625rem; }

  .tab-panel { padding: 0 14px 24px; }
  .page-header h2 { font-size: 1.25rem; }
  .page-header .page-sub { display: none; }
  .today-section-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .today-timeline-item {
    grid-template-columns: 62px minmax(0, 1fr);
    padding: 0.8rem 0.9rem;
  }

  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.35rem; }
  .photo-actions { opacity: 1; transform: none; }
  .photo-actions { gap: 0.25rem; }
  .photo-action {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 0;
  }
  .photo-action span {
    width: 16px;
    height: 16px;
  }

  .expense-overview { grid-template-columns: 1fr 1fr; gap: 0.45rem; }
  .expense-stat-card { padding: 0.75rem 0.85rem; }
  .expense-stat-card strong { font-size: 1.05rem; }

  .settlement-row {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 0.3rem;
  }
  .settlement-row > span:last-child { text-align: center; }
  .settlement-row > strong { justify-self: center; }

  .status-choice-grid { grid-template-columns: 1fr 1fr; }
  .event-card .status-choice-grid { grid-template-columns: 1fr 1fr; }

  .person-card { padding: 0.6rem 0.8rem; gap: 0.6rem; }
  .person-avatar { width: 38px; height: 38px; font-size: 0.8125rem; }
  .person-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 108px;
  }

  .event-card { grid-template-columns: 1fr; padding: 0.75rem 0.85rem; }
  .event-time {
    grid-template-columns: 1fr;
    grid-template-areas:
      "day"
      "time"
      "reminder";
  }
  .smart-reminder-card {
    justify-self: stretch;
    margin-top: 0.3rem;
  }
  .event-time > strong { font-size: 1rem; }
  .group-status-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .group-status-row .status-pill {
    justify-self: start;
  }
  .expense-item {
    grid-template-columns: 1fr;
  }
  .expense-item-side {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
  }
  .status-admin-select {
    min-width: 0;
    width: 100%;
  }
}

/* -------- Invite join gate -------- */
.join-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(13, 11, 9, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.join-gate[hidden] { display: none; }
.join-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.join-card form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.join-status {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* -------- Confirm sheet -------- */
.confirm-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: end center;
  padding: 1rem;
  z-index: 50;
  animation: backdropIn var(--dur-3) var(--ease-out);
}
.confirm-backdrop[hidden] { display: none; }
.confirm-sheet {
  width: 100%;
  max-width: 420px;
  margin-bottom: env(safe-area-inset-bottom, 0px);
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl) var(--r-xl) var(--r) var(--r);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transform-origin: bottom center;
  animation: sheetIn var(--dur-4) var(--ease-drawer);
}
@media (min-width: 600px) {
  .confirm-backdrop { place-items: center; }
  .confirm-sheet { border-radius: var(--r-xl); transform-origin: center; }
}
.confirm-sheet p { color: var(--ink-soft); }
.confirm-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.confirm-actions > * { flex: 1; }

@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------- Toast -------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  transform: translateX(-50%) translateY(20px);
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--r-pill);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-pop), 0 0 30px rgba(232, 168, 78, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--dur-4) var(--ease-out), opacity var(--dur-3) var(--ease-out);
  z-index: 60;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (min-width: 881px) {
  .toast { bottom: 24px; }
}

/* -------- Accessibility -------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  .photo-actions { opacity: 1; transform: none; }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
