/* ============================================================
   MyTrips — main.css
   Single source of truth. Inter for everything, Playfair
   Display ONLY for the app logo wordmark.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700&display=swap');

/* ── Design tokens ────────────────────────────────────────── */
:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  --purple-50:  #EEEDFE;
  --purple-200: #AFA9EC;
  --purple-600: #534AB7;
  --purple-800: #3C3489;
  --purple-900: #26215C;

  --teal-50:  #E1F5EE;
  --teal-600: #0F6E56;
  --teal-800: #085041;

  --coral-50:  #FAECE7;
  --coral-600: #993C1D;

  --amber-50:  #FAEEDA;
  --amber-600: #854F0B;

  --green-50:  #EAF3DE;
  --green-600: #3B6D11;
  --green-800: #27500A;

  --red-50:  #FCEBEB;
  --red-600: #A32D2D;

  --blue-50:  #E6F1FB;
  --blue-600: #185FA5;
  --blue-800: #0C447C;

  --gray-50:  #F7F7F5;
  --gray-100: #EFEFEC;
  --gray-200: #DDDDD8;
  --gray-400: #9B9B95;
  --gray-600: #5F5E5A;
  --gray-800: #2C2C2A;
  --gray-900: #18181A;

  --bg:        #F7F7F5;
  --surface:   #FFFFFF;
  --border:    rgba(0,0,0,0.10);
  --border-md: rgba(0,0,0,0.18);
  --text:      #18181A;
  --text-muted:#5F5E5A;
  --text-faint:#9B9B95;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);

  --transition: 0.18s ease;
  --sidebar-w:  260px;
  --topbar-h:   56px;
  --bottom-nav-h: 74px;
}

/* ── Reset + global font ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;    /* prevent any element from making the page wider than the screen */
  width: 100%;
}

/* ONE font family everywhere — no exceptions */
body, input, select, textarea, button, label,
h1, h2, h3, h4, h5, h6, p, span, div, a, li {
  font-family: var(--font);
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

/* Logo wordmark only — the single use of a decorative font */
.logo-wordmark {
  font-family: 'Georgia', serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a { color: var(--purple-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

/* ── Auth screens ─────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, var(--purple-900) 0%, #185FA5 100%);
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .logo-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.auth-logo .logo-icon img { width: 28px; filter: brightness(0) invert(1); }
.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px; margin-bottom: 22px; gap: 3px;
}
.auth-tab {
  flex: 1; padding: 8px; text-align: center;
  font-size: 13px; font-weight: 500;
  border-radius: 7px; border: none;
  background: transparent; color: var(--text-muted);
  transition: var(--transition);
}
.auth-tab.active { background: var(--purple-600); color: #fff; }

.biometric-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border-radius: var(--radius-md);
  border: 1px solid var(--border-md);
  background: var(--gray-50);
  font-size: 14px; font-weight: 500; color: var(--text);
  margin-top: 12px; transition: var(--transition);
}
.biometric-btn:hover { background: var(--gray-100); }
.biometric-btn img { width: 20px; }

.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0; font-size: 12px; color: var(--text-faint);
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── App shell ────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
  padding-top: 11px;
  background: var(--purple-50);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--purple-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-mark img { width: 16px; filter: brightness(0) invert(1); }
.sidebar-logo .logo-wordmark { font-size: 17px; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer; border: none;
  background: transparent; width: 100%; text-align: left;
  transition: var(--transition);
}
.nav-item:hover { background: var(--gray-50); color: var(--text); }
.nav-item.active { background: var(--purple-50); color: var(--purple-600); }
.nav-item img { width: 18px; opacity: 0.55; }
.nav-item.active img { opacity: 1; }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--purple-600);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info .uname  { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .uemail { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { background: none; border: none; padding: 4px; color: var(--text-faint); font-size: 18px; }
.logout-btn:hover { color: var(--red-600); }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  flex: 1; margin-left: var(--sidebar-w);
  min-height: 100vh; display: flex; flex-direction: column;
  padding-top: var(--topbar-h);
}
.topbar {
  background: var(--purple-50); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; z-index: 60;
}
.topbar-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px;
  pointer-events: none; /* the bar itself ignores clicks; children re-enable */
}
.topbar-center > * { pointer-events: auto; }
.topbar-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
/* On the Show Itinerary view there's no year selector in the center slot,
   so the title can use most of the bar's width instead of staying capped
   at the same narrow width used on Trips/Itineraries/Calendar. */
.topbar-wide-title .topbar-title { max-width: 60vw; }
@media (max-width: 768px) {
  .topbar-wide-title .topbar-title { max-width: calc(100vw - 140px); } /* leaves room for sidebar-toggle + action button */
}
.topbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-icon  { width: 19px; height: 19px; opacity: 0.75; flex-shrink: 0; }
.hamburger    { display: none; background: none; border: none; padding: 6px; font-size: 20px; line-height: 1; color: var(--text); }
.page { padding: 28px; flex: 1; }

/* page section header */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 10px;
}
.page-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
/* Used on Trips: title/subtitle removed (already shown in topbar), just the action button remains */
.page-header-action-only { justify-content: flex-end; }
#calendar-container { margin-top: 2px; }

/* ── Trips grid ───────────────────────────────────────────── */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.trip-card {
  background: var(--surface); border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.trip-card:hover { box-shadow: var(--shadow-md); }
.trip-highlight-flash {
  animation: trip-highlight-flash-anim 1.6s ease-out;
}
@keyframes trip-highlight-flash-anim {
  0%   { box-shadow: 0 0 0 3px var(--purple-600); }
  70%  { box-shadow: 0 0 0 3px var(--purple-600); }
  100% { box-shadow: var(--shadow-sm); }
}
.trip-card-banner {
  height: 60px; padding: 10px 12px 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: relative; cursor: pointer;
}
.trip-card-banner-main {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
}
.trip-card-banner h3 {
  font-size: 16px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35); line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trip-type-icon-inline {
  width: 18px; height: 18px; opacity: 0.9; flex-shrink: 0;
  filter: brightness(0) invert(1);
}
.trip-card-actions {
  display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
}
.trip-card-actions .btn-icon {
  width: 26px; height: 26px; background: rgba(255,255,255,0.18);
}
.trip-card-actions .btn-icon img { width: 13px; height: 13px; filter: brightness(0) invert(1); }
.trip-card-actions .btn-icon:hover { background: rgba(255,255,255,0.32); }
.trip-card-body { padding: 14px 16px 16px; }
.trip-dates { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.trip-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trip-meta  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trip-card-days-panel {
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  max-height: 320px;
  overflow-y: auto;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
}
.badge-purple { background: var(--purple-50); color: var(--purple-800); }
.badge-teal   { background: var(--teal-50);   color: var(--teal-800); }
.badge-amber  { background: var(--amber-50);  color: var(--amber-600); }
.badge-green  { background: var(--green-50);  color: var(--green-800); }
.badge-red    { background: var(--red-50);    color: var(--red-600); }
.badge-blue   { background: var(--blue-50);   color: var(--blue-800); }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state img { width: 72px; margin: 0 auto 18px; opacity: 0.35; }
.empty-state h3  { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-state p   { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Trip detail ──────────────────────────────────────────── */
.trip-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.trip-header-info { flex: 1; min-width: 200px; }
.trip-header-info h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.trip-header-info .meta { font-size: 13px; color: var(--text-muted); }
.trip-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Day section ──────────────────────────────────────────── */
.day-section { margin-bottom: 20px; min-width: 0; overflow: hidden; }
.day-header {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 44px 10px 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 10px;
}
.day-date-block {
  text-align: center; min-width: 54px;
  background: var(--purple-50); border-radius: var(--radius-md);
  padding: 8px 6px; flex-shrink: 0;
}
.day-date-block .dow {
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--purple-600);
}
.day-date-block .dom {
  font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1;
}
.day-date-block .mon {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint); margin-top: 1px;
}
.day-location-wrap { flex: 1; min-width: 0; padding-top: 4px; }
.day-location-label {
  font-size: 17px; font-weight: 700; color: var(--text);
  line-height: 1.3; letter-spacing: -0.01em;
}
.location-placeholder { font-size: 14px; font-weight: 400; color: var(--text-faint); }
.day-notes { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* Edit (top-right) and Add (bottom-right) sit inside the same header block,
   in the same tint as the date block, so they read as a matched pair of
   small round icon actions rather than full text buttons competing with
   the day's location label for attention. */
.day-edit-fab, .day-add-fab {
  position: absolute; right: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--purple-50); border: 1px solid var(--purple-100, #ddd9fb);
  color: var(--purple-600);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: var(--transition);
}
.day-edit-fab { top: 12px; }
.day-add-fab  { bottom: 10px; }
.day-edit-fab img, .day-add-fab img { width: 14px; height: 14px; }
.day-edit-fab:hover, .day-add-fab:hover {
  background: var(--purple-600); color: #fff; border-color: var(--purple-600);
  transform: scale(1.06);
}
.day-edit-fab:hover img, .day-add-fab:hover img { filter: brightness(0) invert(1); }

/* ── Activity cards ───────────────────────────────────────── */
.activity-cards {
  display: flex; flex-direction: column; gap: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--gray-200);
  margin-left: 27px;
  /* Prevent cards from overflowing the parent width */
  min-width: 0;
  overflow: hidden;
}
.activity-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 11px 14px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: var(--transition); cursor: pointer;
  /* Constrain to available width */
  min-width: 0;
  overflow: hidden;
}
.activity-card:hover { border-color: var(--border-md); box-shadow: var(--shadow-sm); }

.act-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.act-icon img { width: 17px; }
.icon-flight      { background: var(--blue-50); }
.icon-train       { background: #FBEAF0; }
.icon-cruise      { background: var(--teal-50); }
.icon-bus         { background: var(--amber-50); }
.icon-hotel       { background: var(--green-50); }
.icon-beach       { background: #E0F4FB; }
.icon-tour        { background: var(--amber-50); }
.icon-walking_tour{ background: var(--purple-50); }
.icon-museum      { background: var(--purple-50); }
.icon-restaurant  { background: var(--coral-50); }
.icon-food_tour   { background: var(--blue-50); }
.icon-transport   { background: var(--gray-100); }
.icon-car_rental  { background: var(--amber-50); }
.icon-free_time   { background: var(--teal-50); }
.icon-note        { background: var(--amber-50); }
.icon-other       { background: var(--gray-100); }

.act-body { flex: 1; min-width: 0; overflow: hidden; }
.act-time  { font-size: 11px; color: var(--text-faint); margin-bottom: 1px; }
.act-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-sub   { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-travelers { font-size: 11px; color: var(--blue-800); margin-top: 2px; }
.act-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; max-width: 40%; }

/* ── Forms ────────────────────────────────────────────────── */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 5px; letter-spacing: 0.02em;
  text-transform: uppercase;
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 400;
  background: var(--surface); color: var(--text);
  transition: var(--transition); appearance: none;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none; border-color: var(--purple-600);
  box-shadow: 0 0 0 3px rgba(83,74,183,0.12);
}
.act-date-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--gray-50);
}
.act-date-row span { font-size: 14px; color: var(--text); font-weight: 500; }

/* ── Custom date picker popover ───────────────────────────────────────── */
.datepicker-pop {
  position: absolute; z-index: 3000;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); border: 1px solid var(--border);
  padding: 12px; width: 280px;
}
.datepicker-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.datepicker-label { font-size: 14px; font-weight: 700; color: var(--text); }
.datepicker-nav {
  width: 28px; height: 28px; border-radius: 50%; border: none; background: none;
  font-size: 18px; color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.datepicker-nav:hover { background: var(--purple-50); color: var(--purple-600); }
.datepicker-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11px; font-weight: 700; color: var(--text-faint);
  text-align: center; margin-bottom: 4px;
}
.datepicker-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.datepicker-day {
  width: 100%; aspect-ratio: 1; border: none; background: none; border-radius: 50%;
  font-size: 13px; color: var(--text); cursor: pointer; transition: var(--transition);
}
.datepicker-day:hover:not(:disabled) { background: var(--purple-50); }
.datepicker-day:disabled { color: var(--text-faint); opacity: 0.4; cursor: not-allowed; }
.datepicker-day-other { color: var(--text-faint); }
.datepicker-day-today { font-weight: 700; color: var(--purple-600); box-shadow: inset 0 0 0 1.5px var(--purple-200); }
.datepicker-day-selected { background: var(--purple-600); color: #fff; font-weight: 700; }
.datepicker-day-selected:hover { background: #463e9e; }

/* ── Custom time picker popover ───────────────────────────────────────── */
.timepicker-pop {
  position: absolute; z-index: 3000;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); border: 1px solid var(--border);
  width: 160px; overflow: hidden;
}
.timepicker-cols { display: flex; height: 200px; }
.timepicker-col {
  flex: 1; overflow-y: auto; scroll-snap-type: y proximity;
  padding: 4px 0; border-right: 1px solid var(--border);
}
.timepicker-col:last-child { border-right: none; }
.timepicker-opt {
  display: block; width: 100%; padding: 7px 0; border: none; background: none;
  font-size: 14px; color: var(--text); cursor: pointer; text-align: center;
  scroll-snap-align: center; transition: var(--transition);
}
.timepicker-opt:hover { background: var(--purple-50); }
.timepicker-opt-selected { background: var(--purple-600); color: #fff; font-weight: 700; }
.timepicker-footer {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 8px 10px; border-top: 1px solid var(--border);
}
.timepicker-done-btn {
  border: none; background: none; font-size: 12px; font-weight: 600;
  color: var(--purple-600); cursor: pointer; padding: 4px 6px;
}
.timepicker-done-btn:hover { text-decoration: underline; }
.form-row textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.form-cols   { display: grid; grid-template-columns: 1fr 1fr;     gap: 14px; }
.form-cols-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.toggle-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }

/* ── Activity attachments ─────────────────────────────────── */
.attachment-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 6px; background: var(--surface);
}
.attachment-item img.attachment-type-icon { width: 22px; height: 22px; flex-shrink: 0; opacity: 0.75; }
.attachment-item-name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 500;
  color: var(--purple-600); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attachment-item-name:hover { text-decoration: underline; }
.attachment-item-size { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.attachment-item-delete {
  background: none; border: none; cursor: pointer; padding: 4px;
  opacity: 0.5; flex-shrink: 0; display: flex; align-items: center;
}
.attachment-item-delete:hover { opacity: 1; }
.attachment-item-delete img { width: 14px; height: 14px; }
.attachment-item-uploading { opacity: 0.6; }

.attachment-upload-btn {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content;
  padding: 8px 14px; border: 1px dashed var(--border-md); border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600; color: var(--purple-600);
  background: var(--purple-50);
  cursor: pointer; margin-top: 4px; transition: var(--transition);
}
.attachment-upload-btn:hover { background: var(--purple-100, #ddd9fb); border-color: var(--purple-200); }
.attachment-upload-btn img { width: 13px; height: 13px; }
.attachment-upload-btn.disabled { opacity: 0.5; pointer-events: none; }
.toggle-row label { cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text); }
.toggle {
  width: 40px; height: 22px; border-radius: 99px;
  background: var(--gray-200); position: relative;
  cursor: pointer; border: none; transition: background var(--transition); flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: left var(--transition); box-shadow: var(--shadow-sm);
}
.toggle.on { background: var(--purple-600); }
.toggle.on::after { left: 21px; }

/* ── Segmented toggle (2+ mutually exclusive options, e.g. Cards/List) ──── */
.segmented-toggle {
  display: inline-flex; background: var(--gray-100); border-radius: var(--radius-md);
  padding: 3px; gap: 2px;
}
.segmented-toggle-btn {
  border: none; background: none; cursor: pointer;
  padding: 6px 14px; border-radius: calc(var(--radius-md) - 2px);
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  transition: var(--transition);
}
.segmented-toggle-btn:hover { color: var(--text); }
.segmented-toggle-btn.active { background: var(--surface); color: var(--purple-600); box-shadow: var(--shadow-sm); }

/* Activity type picker */
.type-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
}
.type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 5px 8px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  transition: var(--transition);
}
.type-btn img { width: 22px; opacity: 0.5; }
.type-btn:hover { border-color: var(--purple-200); background: var(--purple-50); color: var(--purple-800); }
.type-btn:hover img { opacity: 1; }
.type-btn.selected { border-color: var(--purple-600); background: var(--purple-50); color: var(--purple-800); font-weight: 600; }
.type-btn.selected img { opacity: 1; }

/* Trip type grid */
.trip-type-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.trip-type-grid .type-btn { font-size: 11px; padding: 12px 6px 10px; }
.trip-type-grid .type-btn img { width: 26px; margin-bottom: 2px; }

/* Colour swatches */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: var(--transition);
}
.swatch.selected { border-color: var(--gray-900); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent; transition: var(--transition);
  white-space: nowrap; line-height: 1.4;
}
.btn-primary   { background: var(--purple-600); color: #fff; }
.btn-primary:hover { background: var(--purple-800); }
.btn-teal      { background: var(--teal-600); color: #fff; }
.btn-teal:hover { background: var(--teal-800); }
.btn-secondary { background: var(--surface); border-color: var(--border-md); color: var(--text); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-cancel-tinted { background: var(--purple-50); }
.btn-cancel-tinted:hover { background: var(--purple-100, #ddd9fb); }
.btn-danger    { background: var(--red-50); color: var(--red-600); }
.btn-danger:hover { background: #F7C1C1; }
.btn-error-ok  { background: var(--red-600); color: #fff; }
.btn-error-ok:hover { background: #8A2424; }
.btn-ghost     { background: none; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }

/* ── Error modal (Toast.error) — red, not the neutral confirm-modal look ──── */
.error-modal-icon {
  width: 32px; height: 32px; margin-bottom: 10px;
  filter: invert(28%) sepia(54%) saturate(1573%) hue-rotate(335deg) brightness(80%) contrast(95%);
}
.error-modal-title { color: var(--red-600); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn img { width: 15px; }

/* Icon-only round action button — used where the icon alone is unambiguous
   (new trip "+", "Show" eye, "Print/PDF" printer) so the action reads as a
   clean, modern tap target instead of a wordy pill. */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md);
  border: none; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  transition: var(--transition);
}
.btn-icon:hover { transform: translateY(-1px) scale(1.04); box-shadow: 0 4px 10px rgba(0,0,0,0.14); }
.btn-icon:active { transform: translateY(0) scale(0.98); }
.btn-icon img { width: 16px; height: 16px; filter: brightness(0) invert(1); }
.btn-icon.btn-secondary img { filter: none; opacity: 0.75; } /* dark icon on light background, not forced white */

/* Limited-show button: background matches the topbar (var(--purple-50)) per request, with a dark (not white-forced) icon */
.cal-limited-show-btn { background: var(--purple-50); }
.cal-limited-show-btn img { filter: none; opacity: 0.75; }
.cal-limited-show-btn:hover { background: var(--purple-100, #ddd9fb); }
.btn-icon.btn-icon-sm { width: 30px; height: 20px; }
.btn-icon.btn-icon-sm img { width: 13px; height: 13px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 632px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); transform: translateY(20px); transition: transform 0.2s ease;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: var(--gray-100); border: none;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; line-height: 1; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--gray-200); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

.modal.modal-confirm { max-width: 380px; }
.modal-confirm .modal-body { text-align: center; padding: 28px 24px 20px; }
.modal-confirm p { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

/* Settings modal */
.settings-section { margin-bottom: 24px; }
.settings-section h4 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 12px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 14px; font-weight: 500; }
.settings-row-desc  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ── Friends page ─────────────────────────────────────────── */
.friends-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.friend-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px;
  cursor: pointer; transition: var(--transition);
}
.friend-card:hover {
  border-color: var(--purple-200); box-shadow: 0 2px 8px rgba(83,74,183,0.08);
  transform: translateY(-1px);
}
.friend-card:focus-visible { outline: 2px solid var(--purple-600); outline-offset: 1px; }
.friend-card-pending { cursor: default; }
.friend-card-pending:hover { transform: none; box-shadow: none; border-color: var(--border); }
.friend-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--purple-600); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}
.friend-avatar-pending { background: var(--amber-600, #B45309); }
.friend-card-info { flex: 1; min-width: 0; }
.friend-card-name  { font-size: 14px; font-weight: 600; }
.friend-card-email { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-card-chevron { width: 16px; height: 16px; opacity: 0.3; flex-shrink: 0; }
.friend-card-pending-actions {
  display: flex; flex-direction: column; gap: 5px;
  flex-shrink: 0; align-items: stretch;
}
.friend-pending-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; width: 56px; padding: 5px 4px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm, 6px);
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.friend-pending-btn img { width: 14px; height: 14px; }
.friend-pending-btn span { font-size: 10px; font-weight: 600; line-height: 1; }
.friend-pending-btn:hover { background: var(--gray-50); border-color: var(--border); color: var(--text); }
.friend-pending-btn.friend-remove-btn:hover { color: var(--red-600); border-color: var(--red-600); }

.friend-shared-trip-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--border);
}
.friend-shared-trip-row:last-child { border-bottom: none; }

/* ── Today view ──────────────────────────────────────────────── */
.today-trip-section { margin-bottom: 24px; }
.today-trip-heading {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; margin-bottom: 8px;
}

/* ── Back-to-list link on the Show Itinerary page ───────────── */
.itin-back-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; margin-bottom: 14px;
  font-size: 13px; font-weight: 600; color: var(--purple-600);
  cursor: pointer;
}
.itin-back-link:hover { color: var(--purple-800); text-decoration: underline; }
.itin-back-link-chevron { width: 13px; height: 13px; transform: rotate(180deg); }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--gray-900); color: #fff;
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 340px;
  animation: toast-in 0.2s ease;
}
.toast.toast-success { background: var(--teal-800); }
.toast.toast-error   { background: var(--red-600); }
.toast img { width: 16px; filter: brightness(0) invert(1); flex-shrink: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Sidebar overlay ──────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 99;
}

/* ── Skeleton ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Copy pill ────────────────────────────────────────────── */
.copy-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--border); cursor: pointer;
  color: var(--text-muted); background: var(--gray-50);
  transition: var(--transition);
}
.copy-pill:hover { border-color: var(--purple-600); color: var(--purple-600); }
.copy-pill img { width: 11px; }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Calendar view ────────────────────────────────────────── */
.cal-trip-wrap {
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.cal-trip-wrap:hover { box-shadow: var(--shadow-md); }
.cal-trip-row {
  display: flex; align-items: center;
  background: var(--surface);
  cursor: pointer; transition: background var(--transition);
}
.cal-trip-row:hover { background: var(--gray-50); }
.cal-trip-row.cal-past { opacity: 0.65; }
.cal-trip-row.cal-now  { outline: 2px solid var(--purple-600); outline-offset: -2px; }
.cal-color-bar  { width: 9px; align-self: stretch; flex-shrink: 0; }
.cal-trip-icon  { width: 44px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-trip-icon img { width: 20px; opacity: 0.55; }
.cal-trip-info  { flex: 1; padding: 13px 10px; min-width: 0; }
.cal-trip-name  { font-size: 15px; font-weight: 600; }
.cal-trip-dates { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cal-trip-badges{ display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.cal-trip-actions { padding: 10px 14px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; }

/* ── Trips page: List view (alternative to Cards) ───────────────────────── */
.trips-list { display: flex; flex-direction: column; gap: 10px; }
.trip-list-wrap {
  background: var(--surface); border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.trip-list-row {
  display: flex; align-items: center; cursor: pointer;
  transition: background var(--transition);
}
.trip-list-row:hover { background: var(--gray-50); }
.trip-list-row.cal-past { opacity: 0.65; }
.trip-list-row.cal-now  { outline: 2px solid var(--purple-600); outline-offset: -2px; }
.trip-list-actions { padding: 10px 14px; flex-shrink: 0; }
.trip-list-actions .btn-icon { background: var(--gray-100); }
.trip-list-actions .btn-icon img { filter: none; opacity: 0.65; }
.trip-list-actions .btn-icon:hover { background: var(--purple-50); }
.trip-list-actions .btn-icon:hover img { opacity: 1; }

/* Expandable days panel */
.cal-days-panel {
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  max-height: 360px;
  overflow-y: auto;
}
.cal-day-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  gap: 10px; transition: background var(--transition);
  cursor: pointer;
}
.cal-day-item:last-child { border-bottom: none; }
.cal-day-item:hover { background: var(--purple-50); }
.cal-day-today {
  background: var(--purple-50) !important;
  border-left: 3px solid var(--purple-600);
}
.cal-day-info  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.cal-day-date  { font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--text); }
.cal-day-loc   { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day-count { font-size: 11px; color: var(--text-faint); flex-shrink: 0; white-space: nowrap; }

/* ── Print / Itinerary view ───────────────────────────────── */
#print-view {
  display: none;
  position: fixed; inset: 0; background: #fff; z-index: 1000;
  overflow-y: auto; padding: 28px 32px;
}
#print-view.open { display: block; }

.print-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.print-actions-right { display: flex; gap: 8px; }
.print-title { text-align: center; margin-bottom: 24px; }
.print-title h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--purple-900); text-transform: uppercase;
}
.print-title p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Desktop table */
.itin-table {
  width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 32px;
}
.itin-table th {
  background: var(--purple-600); color: #fff;
  padding: 9px 12px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.itin-table th:first-child  { width: 78px; }
.itin-table th:nth-child(2) { width: 130px; }
.itin-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top; line-height: 1.5;
}
.itin-table tr:hover td { background: var(--gray-50); }
.itin-date  { font-weight: 700; white-space: nowrap; }
.itin-place { font-weight: 600; color: var(--purple-800); }

/* Activity list inside each table cell */
.itin-act-list {
  list-style: none; padding: 0; margin: 0;
}
.itin-act-line {
  padding: 5px 0;
  border-bottom: 1px solid var(--gray-100);
  line-height: 1.5;
  font-size: 13px;
}
.itin-act-line:last-child { border-bottom: none; padding-bottom: 0; }
.itin-act-line:first-child { padding-top: 0; }

/* Icon inline with activity */
.itin-act-icon {
  width: 14px; height: 14px;
  vertical-align: middle; margin-right: 4px;
  opacity: 0.65; position: relative; top: -1px;
}
.itin-act-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; }
.itin-act-main img.itin-act-icon { align-self: center; flex-shrink: 0; }

/* Location: separate line below main activity, no bullet */
.itin-act-location {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  padding-left: 18px; /* indent under icon */
}

/* Notes only: bulleted sub-list, one <li> per newline */
.itin-act-subs {
  list-style: disc;
  padding-left: 28px;
  margin: 4px 0 0 0;
}
.itin-act-attachments {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 6px 0 0 28px;
}
.itin-attachment-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--purple-600);
  background: var(--purple-50); padding: 3px 9px; border-radius: 6px;
  text-decoration: none; max-width: 220px;
}
.itin-attachment-link:hover { background: var(--purple-100, #ddd9fb); text-decoration: underline; }
.itin-attachment-link img { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.8; }
.itin-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Day-level note (italic, slightly muted) */
.itin-day-note {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.itin-time { font-weight: 600; color: var(--purple-600); white-space: nowrap; }
.itin-detail  { font-size: 12px; color: var(--text-muted); }
.itin-platform{ font-size: 12px; color: var(--text-faint); }
.itin-ref {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700;
  background: var(--purple-50); color: var(--purple-800);
  padding: 1px 4px 1px 6px; border-radius: 4px;
}
.itin-ref-copy {
  background: none; border: none; padding: 1px 2px; cursor: pointer;
  display: inline-flex; align-items: center; line-height: 0;
}
.itin-ref-copy img { width: 10px; opacity: 0.7; }
.itin-ref-copy:hover img { opacity: 1; }
.itin-booked {
  display: inline-block; font-size: 10px; font-weight: 700;
  background: var(--green-50); color: var(--green-800);
  padding: 1px 5px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* Mobile itinerary cards */
#itin-mobile { display: none; }
.itin-day-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 12px;
}
.itin-day-header {
  display: flex; align-items: center;
  background: var(--purple-600); color: #fff;
  padding: 8px 12px; gap: 10px;
}
.itin-day-header .itin-date  { font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; white-space: nowrap; }
.itin-day-header .itin-place { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.92); }
.itin-day-body { padding: 6px 12px 10px; }
.itin-day-body .itin-act-line { font-size: 13px; border-bottom-color: var(--border); }

/* @media print: hide everything except the print-view content */
@media print {
  html, body {
    background: #fff !important;
  }
  body > *:not(#print-view) { display: none !important; }
  #print-view {
    display: block !important; position: static !important;
    padding: 0 !important; overflow: visible !important;
    background: #fff !important;
  }
  .print-actions { display: none !important; }
  /* On print always use table layout */
  .itin-desktop { display: table !important; }
  #itin-mobile  { display: none !important; }
  .itin-table   { font-size: 12px; background: #fff !important; }
  .itin-table td, .itin-table tr { background: #fff !important; }
  .itin-act-line{ font-size: 12px; }
  .itin-sub     { font-size: 12px; }
  .itin-table th {
    background: var(--purple-600) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .itin-act-icon { width: 12px; height: 12px; }
  .itin-ref, .itin-booked {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Ensure no element keeps the page's default off-white/beige background */
  * { background-color: transparent !important; }
  .itin-table th { background-color: var(--purple-600) !important; }
  .itin-ref      { background-color: var(--purple-50)  !important; }
  .itin-booked   { background-color: var(--green-50)   !important; }
  .itin-to-book  { background-color: var(--red-50)      !important; }
  .itin-day-note-above { background-color: var(--amber-50) !important; }
}

/* ── Bottom nav (mobile only) ─────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--purple-50);
  border-top: 1px solid var(--border);
  z-index: 200;
  /* Safe area padding at bottom for iPhone notch */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-inner {
  display: flex;
  height: 68px;
  padding-bottom: 6px;
  width: 100%;
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;          /* no asymmetric padding — let flexbox centre */
  margin: 0;
  background: none;
  border: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  text-align: center;
}
.bottom-nav-btn img {
  width: 24px;
  height: 24px;
  display: block;
  opacity: 0.65;
  transition: opacity var(--transition);
  /* prevent img from stretching */
  flex-shrink: 0;
  object-fit: contain;
}
.bottom-nav-btn.active { color: var(--purple-600); }
.bottom-nav-btn.active img {
  opacity: 1;
  filter: invert(28%) sepia(80%) saturate(600%) hue-rotate(224deg) brightness(85%);
}
.bottom-nav-btn span {
  display: block;
  line-height: 1;
  white-space: nowrap;
}

/* ── Mobile slide-up menu (Friends / Settings), opened via bottom-nav "Menu" ── */
.mobile-menu-backdrop {
  display: none; /* only shown on mobile via the media query below, and only when .open */
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  z-index: 250; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.mobile-menu-backdrop.open { opacity: 1; pointer-events: auto; }
.mobile-menu-panel {
  position: absolute; right: 12px;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  min-width: 160px; padding: 6px;
  transform: translateY(10px) scale(0.97); opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.mobile-menu-backdrop.open .mobile-menu-panel { transform: translateY(0) scale(1); opacity: 1; }
.mobile-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: var(--radius-md);
  background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-item:hover { background: var(--purple-50); }
.mobile-menu-item img { width: 19px; height: 19px; opacity: 0.7; flex-shrink: 0; }
.mobile-menu-item.active { color: var(--purple-600); background: var(--purple-50); }
.mobile-menu-item.active img { opacity: 1; filter: invert(28%) sepia(80%) saturate(600%) hue-rotate(224deg) brightness(85%); }

/* ── Utils ────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.hidden      { display: none !important; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar         { transform: translateX(-100%); }
  .sidebar.open    { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay { display: block; }
  .hamburger       { display: none; }

  .bottom-nav      { display: flex; }
  .mobile-menu-backdrop { display: block; }
  .topbar          { padding: 0 16px; left: 0; }
  .main-content    { margin-left: 0; padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); overflow-x: hidden; }
  .page            { padding: 14px 16px; overflow-x: hidden; }

  .type-grid       { grid-template-columns: repeat(3, 1fr); }
  .trip-type-grid  { grid-template-columns: repeat(2, 1fr); }
  .form-cols       { grid-template-columns: 1fr; }
  .form-cols-3     { grid-template-columns: 1fr 1fr; }
  .trips-grid      { grid-template-columns: 1fr; }

  .modal           { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-backdrop  { align-items: flex-end; padding: 0; }

  #toast-container { bottom: calc(var(--bottom-nav-h) + 8px); right: 12px; left: 12px; }
  .toast           { min-width: unset; }

  .day-header      { padding-right: 48px; }
  .day-edit-fab, .day-add-fab { width: 34px; height: 34px; }
  .day-edit-fab img, .day-add-fab img { width: 16px; height: 16px; }
  .activity-cards  { margin-left: 0; padding-left: 0; border-left: none; }
  .activity-card   { padding: 9px 10px; gap: 8px; }
  .act-right       { max-width: 35%; }
  /* Hide copy-pill on mobile — tap to copy works via long-press natively */
  .copy-pill       { display: none; }

  .trip-header     { flex-direction: column; }
  .trip-header-actions { flex-wrap: wrap; }
  #view-trip-detail { overflow-x: hidden; }
  .page-view       { overflow-x: hidden; }
  #print-view      { padding: 16px; }
  .print-actions   { flex-wrap: wrap; }
  .itin-desktop    { display: none; }
  #itin-mobile     { display: block; }
}

/* ── Trip cost badges on card ─────────────────────────────── */
.trip-meta .badge-gray { font-size: 11px; }

/* ── Day note ABOVE activities in print ───────────────────── */
.itin-day-note-above {
  font-size: 13px; font-style: italic;
  color: var(--text-muted); margin-bottom: 6px;
  padding: 4px 8px; background: var(--amber-50);
  border-left: 3px solid var(--amber-600);
  border-radius: 0 4px 4px 0;
}

/* ── Travelers in print ───────────────────────────────────── */
.itin-travelers {
  font-size: 11px; color: var(--blue-800);
  background: var(--blue-50); padding: 1px 6px;
  border-radius: 4px; margin-left: 4px;
}

/* ── Mobile print: 1px bigger font ───────────────────────── */
@media (max-width: 768px) {
  .itin-act-line    { font-size: 14px; }
  .itin-sub         { font-size: 14px; }
  .itin-act-location{ font-size: 13px; }
  .itin-day-body    { font-size: 14px; }
}

/* end of main.css */

/* ── Share autocomplete chips ─────────────────────────────── */
.share-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--purple-50); color: var(--purple-800);
  border: 1px solid var(--purple-200);
  border-radius: 99px; padding: 3px 10px 3px 12px;
  font-size: 12px; font-weight: 500;
}
.share-chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--purple-600); font-size: 13px; line-height: 1;
  padding: 0; margin-left: 2px;
}
.share-chip-remove:hover { color: var(--red-600); }
.share-dd-item, .move-trip-dd-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; cursor: pointer; gap: 10px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.share-dd-item:last-child, .move-trip-dd-item:last-child { border-bottom: none; }
.share-dd-item:hover, .move-trip-dd-item:hover { background: var(--purple-50); }
.share-dd-empty {
  padding: 14px 12px; font-size: 12px; color: var(--text-faint);
  text-align: center; cursor: default;
}
.share-dd-name  { font-size: 13px; font-weight: 500; }
.share-dd-email { font-size: 11px; color: var(--text-faint); }

/* ── 3-state booking status radio group ───────────────────── */
.booking-status-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 2px;
}
/* The label IS the clickable row — reset everything from form-row label */
label.booking-opt {
  all: unset !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}
label.booking-opt input[type="radio"] {
  all: unset;
  width: 18px; height: 18px;
  border: 2px solid var(--border-md);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  -webkit-appearance: radio;
  appearance: radio;
  accent-color: var(--purple-600);
}
label.booking-opt.booking-opt-booked { color: var(--green-600) !important; }
label.booking-opt.booking-opt-tobook  { color: var(--red-600)   !important; }

/* ── itin-to-book badge ───────────────────────────────────── */
.itin-to-book {
  display: inline-block; font-size: 10px; font-weight: 700;
  background: var(--red-50); color: var(--red-600);
  padding: 1px 5px; border-radius: 4px; margin-left: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
/* ── badge-red (for "to book" on activity cards) ─────────── */
.badge-red { background: var(--red-50); color: var(--red-600); }

/* ── Activity URL links ───────────────────────────────────── */
.act-title-link, .itin-act-link {
  color: var(--purple-600);
  text-decoration: none;
  font-weight: 600;
}
.act-title-link:hover, .itin-act-link:hover { text-decoration: underline; }
.itin-link-icon { font-size: 11px; opacity: 0.7; }

/* ── In-app itinerary view (no overlay) ──────────────────── */
#view-itinerary #itin-view-body .itin-day-card { margin-bottom: 14px; }
#itin-view-icon { opacity: 0.75; }

/* ── Settings header with app logo ───────────────────────── */
.settings-app-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.settings-app-logo {
  width: 40px; height: 40px; border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.settings-app-name {
  font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
}
.settings-app-version {
  font-size: 12px; font-weight: 500; color: var(--text-faint);
  background: var(--gray-100, #f1f1f1); padding: 2px 8px; border-radius: 99px;
  margin-left: 2px;
}

/* ── Sidebar logo using PNG icon ──────────────────────────── */
.sidebar-logo .logo-mark img { width: 30px; height: 30px; border-radius: 7px; filter: none; }
.auth-logo .logo-icon img { width: 40px; height: 40px; border-radius: 9px; filter: none; }

/* ── No-share / private badge ─────────────────────────────── */
.badge-gray[title="Hidden from shared users"] { font-size: 10px; }

/* ── Mobile font-size bump (+1pt ≈ +1.33px across the board) ─ */
@media (max-width: 768px) {
  body                { font-size: 17px; }
  .page-header h2     { font-size: 23px; }
  .page-header p      { font-size: 14px; }
  .trip-card-banner h3{ font-size: 18px; }
  .trip-dates         { font-size: 13px; }
  .trip-desc          { font-size: 14px; }
  .badge              { font-size: 12px; }
  .trip-header-info h2{ font-size: 25px; }
  .trip-header-info .meta { font-size: 14px; }
  .day-location-label { font-size: 18px; }
  .day-date-block .dom{ font-size: 27px; }
  .act-title          { font-size: 15px; }
  .act-sub            { font-size: 13px; }
  .act-time           { font-size: 12px; }
  .form-row label      { font-size: 13px; }
  .form-row input,
  .form-row textarea,
  .form-row select     { font-size: 15px; }
  .btn                { font-size: 15px; }
  .topbar-title       { font-size: 17px; }
  .cal-trip-name      { font-size: 16px; }
  .cal-trip-dates     { font-size: 13px; }
  .settings-row-label { font-size: 15px; }
  .settings-row-desc  { font-size: 13px; }
  .modal-header h3    { font-size: 17px; }
  .booking-opt > label, label.booking-opt { font-size: 15px !important; }

  /* Itineraries → Show screen: bump every itin- element by 1pt over its desktop size */
  #view-itinerary .itin-date            { font-size: 14px; }
  #view-itinerary .itin-place           { font-size: 14px; }
  #view-itinerary .itin-act-line        { font-size: 14px; }
  #view-itinerary .itin-act-location    { font-size: 13px; }
  #view-itinerary .itin-sub             { font-size: 14px; }
  #view-itinerary .itin-day-note        { font-size: 14px; }
  #view-itinerary .itin-day-note-above  { font-size: 14px; }
  #view-itinerary .itin-detail          { font-size: 13px; }
  #view-itinerary .itin-platform        { font-size: 13px; }
  #view-itinerary .itin-ref             { font-size: 12px; }
  #view-itinerary .itin-booked          { font-size: 11px; }
  #view-itinerary .itin-to-book         { font-size: 11px; }
  #view-itinerary .itin-travelers       { font-size: 12px; }
  #view-itinerary .itin-day-header .itin-date  { font-size: 13px; }
  #view-itinerary .itin-day-header .itin-place { font-size: 14px; }
  #view-itinerary .itin-day-body .itin-act-line{ font-size: 14px; }
  #itin-view-meta { font-size: 14px; }
}

/* ── Yearly Calendar Grid ─────────────────────────────────── */
.yearcal-header {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-bottom: 22px;
}
.yearcal-header h2 {
  font-size: 26px; font-weight: 700; letter-spacing: -0.01em; min-width: 90px; text-align: center;
}
.yearcal-nav-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-md); background: var(--surface);
  font-size: 18px; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.yearcal-nav-btn:hover { background: var(--purple-50); border-color: var(--purple-200); color: var(--purple-700); }

/* ── Compact year selector that lives in the topbar's center slot ─── */
.topbar-year-selector {
  display: flex; align-items: center; gap: 6px;
}
.topbar-year-nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border-md); background: var(--surface);
  font-size: 18px; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0; padding: 0;
}
.topbar-year-nav-btn:hover { background: var(--purple-100, #ddd9fb); border-color: var(--purple-200); color: var(--purple-700); }
.topbar-year-label {
  font-size: 17px; font-weight: 700; color: var(--text);
  min-width: 48px; text-align: center; letter-spacing: -0.01em;
}
@media (max-width: 768px) {
  .topbar-year-selector { gap: 4px; }
  .topbar-year-nav-btn { width: 30px; height: 30px; font-size: 17px; }
  .topbar-year-label { font-size: 16px; min-width: 42px; }
  .topbar-title { max-width: 84px; }
}

/* ── Year selector used on Trips and Itineraries list pages ─ */
.list-year-header {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.list-year-header h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em; min-width: 110px; text-align: center;
}

/* Bottom copy of the year selector, repeated after the list so switching
   years doesn't require scrolling all the way back to the top. */
.list-year-footer {
  margin-top: 20px; margin-bottom: 4px;
  padding-top: 16px; border-top: 1px solid var(--border);
}

.yearcal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.yearcal-month-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.yearcal-month-title {
  background: var(--gray-600); color: #fff;
  text-align: center; font-size: 15px; font-weight: 700;
  padding: 9px 0; letter-spacing: 0.02em;
}
.yearcal-dow-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}
.yearcal-dow {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-muted); padding: 6px 0;
}
.yearcal-weeks { padding: 4px 6px 8px; }
.yearcal-week {
  position: relative;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto 26px; /* default: day numbers + 1 bar row; JS overrides for more */
  row-gap: 3px;
}
.yearcal-day-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-column: 1 / 8;
  grid-row: 1;
}
.yearcal-day {
  text-align: center; font-size: 12px; color: var(--text);
  padding: 4px 0; min-height: 22px;
}
.yearcal-day-blank { color: transparent; }

/* Trip bar — grid-column AND grid-row are both set inline by JS so multiple
   overlapping trips stack as separate rows within the same week block.
   Made thicker (26px / 30px on mobile) so they're easy to tap, especially
   when several bars are stacked in the same week. */
.yearcal-trip-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  border-radius: 5px;
  padding: 0 7px;
  cursor: pointer;
  overflow: hidden;
  transition: filter var(--transition);
}
.yearcal-trip-bar:hover { filter: brightness(1.08); }
.yearcal-bar-icon {
  width: 13px; height: 13px; flex-shrink: 0;
  filter: brightness(0) invert(1); opacity: 0.9;
}
.yearcal-bar-label {
  font-size: 12px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  flex: 1; min-width: 0;
}
.yearcal-bar-owner {
  flex-shrink: 0; /* never sacrificed for the label's ellipsis truncation */
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,0.32);
  font-size: 8px; font-weight: 700; color: #fff;
  letter-spacing: -0.02em;
}
/* Single-day trips: no type icon (saves space), smaller font so short bars
   still fit a readable chunk of the name instead of truncating immediately. */
.yearcal-trip-bar-single .yearcal-bar-label { font-size: 11px; }

@media (max-width: 768px) {
  .yearcal-grid { grid-template-columns: 1fr; gap: 14px; }
  .yearcal-header h2 { font-size: 22px; }
  .yearcal-day { font-size: 13px; }
  .yearcal-bar-label { font-size: 13px; } /* +1pt over desktop's 12px-equivalent */
  .yearcal-trip-bar { height: 30px; padding: 0 8px; }
  .yearcal-bar-icon { width: 15px; height: 15px; }
  .yearcal-trip-bar-single .yearcal-bar-label { font-size: 11px; }
  .yearcal-week { grid-template-rows: auto 30px; }
}

@media (min-width: 1200px) {
  .yearcal-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 769px) and (max-width: 1199px) {
  .yearcal-grid { grid-template-columns: repeat(2, 1fr); }
}
