:root {
  --bg: #0a0f1e;
  --panel: #111827;
  --card: #0d1424;
  --card-hover: #121c30;
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --border: #1e293b;
  --border-light: #243044;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --flight: #38bdf8;
  --car: #f59e0b;
  --train: #ef4444;
  --bus: #22c55e;
  --ferry: #06b6d4;
  --boat: #0284c7;
  --accommodation: #a78bfa;
  --hotel: #a78bfa;
  --airbnb: #a78bfa;
  --tour: #14b8a6;
  --other: #64748b;
  --panel-w: 420px;
  --rail-w: 48px;
  --header-h: 61px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

body.planner-page {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100dvh;
}
body.planner-page .app-header,
body.planner-page .flash {
  flex-shrink: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7dd3fc; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(10, 15, 30, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20050; /* above map/leaflet so account dropdown is clickable & visible */
  overflow: visible;
}
.header-brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}
.header-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.header-brand:hover { text-decoration: none; color: inherit; }
.header-welcome {
  display: block;
  min-width: 0;
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(280px, 36vw);
}
.header-welcome strong {
  color: #f8fafc;
  font-weight: 700;
}
.brand-logo {
  display: block !important;
  height: 96px !important;
  width: auto !important;
  max-width: min(420px, 52vw) !important;
  object-fit: contain !important;
  object-position: left center;
  flex-shrink: 0;
}
.header-brand.has-tagline .brand-logo {
  max-width: min(280px, 42vw) !important;
  height: 72px !important;
}
.brand-tagline {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding-right: 4px;
}
.brand-tagline-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7dd3fc;
  line-height: 1.1;
}
.brand-tagline .subtitle {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-top: 0;
  line-height: 1.25;
  max-width: 220px;
}
.brand-aside { min-width: 0; }
.brand-trip-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(280px, 40vw);
}
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.75rem; color: #fff;
}
.header-brand h1 { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.header-brand h1 span { color: var(--accent); }
.subtitle { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 1;
}
.header-nav .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.header-nav .user-email { font-size: 0.8rem; color: var(--muted); margin-right: 4px; }

/* Account settings dropdown */
.account-menu {
  position: relative;
  z-index: 2;
}
.account-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  cursor: pointer;
}
.account-menu-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.account-menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.account-menu-caret { opacity: 0.7; font-size: 0.75rem; }
.account-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(360px, calc(100vw - 16px));
  max-height: none;
  overflow: visible;
  background: #0f172a;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
  padding: 10px;
}
.account-menu.open .account-menu-panel,
.account-menu-panel.is-open {
  display: block;
}
.account-menu-panel[hidden] { display: none !important; }
.account-menu.open .account-menu-panel[hidden] { display: block !important; }
.account-menu-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.account-menu-head strong { font-size: 0.88rem; line-height: 1.2; }
.account-menu-head span { font-size: 0.7rem; color: var(--muted); word-break: break-all; line-height: 1.25; }
.account-menu-verify-link {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fcd34d;
  text-decoration: none;
}
.account-menu-verify-link:hover { text-decoration: underline; }
.account-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}
.account-menu-form .form-row { margin-bottom: 0; min-width: 0; }
.account-menu-form label {
  margin-bottom: 2px;
  font-size: 0.68rem;
  line-height: 1.2;
}
.account-menu-form input,
.account-menu-form select {
  padding: 5px 8px;
  font-size: 0.78rem;
  border-radius: 6px;
  min-height: 0;
}
.account-menu-spacer-label {
  display: block;
  visibility: hidden;
  height: 0.68rem;
  margin-bottom: 2px;
}
.account-menu-save {
  width: 100%;
  justify-content: center;
}
.account-menu-check {
  margin: 8px 0 6px !important;
  font-size: 0.74rem !important;
  column-gap: 8px !important;
}
.account-2fa-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15,23,42,0.65);
  margin-top: 0;
}
.account-2fa-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.account-2fa-status { font-size: 0.82rem; font-weight: 700; margin-top: 0; line-height: 1.2; }
.account-2fa-status.on { color: #4ade80; }
.account-2fa-status.off { color: #fbbf24; }
.account-2fa-row .btn-sm { padding: 3px 8px; font-size: 0.72rem; }
.account-menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  line-height: 1.3;
}
.account-menu-links a { color: #93c5fd; }
.account-menu-links a:hover { color: #bfdbfe; }
@media (max-width: 700px) {
  .account-menu-label { max-width: 96px; }
  .account-menu-panel {
    width: min(340px, calc(100vw - 12px));
    right: -4px;
  }
}

/* Buttons / forms */
button, .btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover:not(:disabled), .btn:hover { border-color: #334155; background: #1a2540; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none; color: #fff;
}
.btn-primary:hover { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fff;
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-ghost { background: transparent; }

input, select, textarea {
  width: 100%;
  max-width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.88rem;
  outline: none;
  min-width: 0;
}
/* Never let checkboxes inherit width:100% — that pushes label text off-screen */
input[type="checkbox"] {
  width: 16px !important;
  max-width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none;
  border-radius: 3px;
  background: var(--card);
  accent-color: #0ea5e9;
  flex: 0 0 16px;
}
/* Native date/time pickers — browser calendar, always works */
input[type="date"],
input[type="time"] {
  color-scheme: dark;
  min-height: 42px;
  cursor: pointer;
}

.form-status {
  min-height: 1.2em;
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
.form-status.ok { color: #4ade80; }
.form-status.error { color: #f87171; }

/* City autocomplete — list is position:fixed on body (see city-autocomplete.js) */
.city-ac-wrap {
  position: relative;
}
.city-ac-list {
  position: fixed;
  z-index: 30000;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 240px;
  overflow-y: auto;
  background: #0d1424;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  box-sizing: border-box;
}
.city-ac-list[hidden] { display: none !important; }
.city-ac-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.city-ac-list li:hover,
.city-ac-list li.active {
  background: #1a2540;
}
.city-ac-main {
  font-size: 0.9rem;
  font-weight: 600;
}
.city-ac-sub {
  font-size: 0.72rem;
  color: var(--muted);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px; }
.form-row { margin-bottom: 12px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid.dates-grid { grid-template-columns: 1fr; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.88rem; }
.flash.error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); color: #f87171; }
.flash.ok { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }

/* Auth pages */
.auth-wrap {
  min-height: calc(100vh - 70px);
  display: grid; place-items: center;
  padding: 28px 16px;
}
.auth-page-globe {
  position: relative;
  isolation: isolate;
  background: radial-gradient(ellipse at 38% 28%, #0e1828, #05080f 70%);
}
.auth-page-globe .app-header {
  position: relative;
  z-index: 2;
  background: rgba(8, 14, 28, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.auth-globe {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  display: block;
}
.auth-page-globe .auth-wrap {
  position: relative;
  z-index: 1;
}
.auth-card-on-globe {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.security-page .security-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  margin: 16px 0;
  max-width: 560px;
}
.security-page .security-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.security-page .security-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
  line-height: 1.4;
}
.security-status.on strong { color: #4ade80; }
.security-status.off strong { color: #fbbf24; }
.totp-qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 10px 0 14px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  box-sizing: content-box;
}
.totp-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}
.totp-secret {
  display: inline-block;
  padding: 8px 10px;
  background: #0b1220;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: #7dd3fc;
  font-size: 0.92rem;
}
.backup-codes {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}
.backup-codes code {
  display: block;
  text-align: center;
  padding: 8px;
  background: #0b1220;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  letter-spacing: 0.04em;
  color: #e2e8f0;
}
.backup-codes-card {
  border-color: rgba(34,197,94,0.45);
  background: rgba(34,197,94,0.08);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
}
.auth-card h2 { font-size: 1.3rem; margin-bottom: 6px; }
.auth-card .lede { color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; }
.auth-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.auth-actions .btn-primary { flex: 1; justify-content: center; }
.register-accept { margin-top: 4px; }
.register-accept .checkbox-label {
  align-items: flex-start;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}
.register-accept .checkbox-label a { color: #7dd3fc; }
.register-accept .checkbox-label input { margin-top: 3px; }
.auth-legal-links {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
}
.auth-legal-links a { color: #7dd3fc; }

.legal-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}
.legal-card {
  background: var(--panel);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 12px;
  padding: 28px 24px 36px;
  color: #e2e8f0;
  line-height: 1.55;
}
.legal-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.legal-card h1 {
  font-size: 1.65rem;
  margin: 0 0 6px;
  color: #f8fafc;
}
.legal-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 20px;
}
.legal-card h2 {
  font-size: 1.05rem;
  margin: 28px 0 10px;
  color: #bae6fd;
}
.legal-card p { margin: 0 0 12px; font-size: 0.92rem; }
.legal-card ul {
  margin: 0 0 14px;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  color: #cbd5e1;
}
.legal-card li { margin-bottom: 6px; }
.legal-card a { color: #7dd3fc; }
.legal-also {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(148,163,184,0.15);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Planner shell — fills remaining viewport under header */
.planner-shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
  position: relative;
}

/* Left panel */
.side-rail {
  width: var(--rail-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  gap: 8px;
  z-index: 30;
  flex-shrink: 0;
}
.rail-btn {
  width: 36px; height: 36px; padding: 0;
  border-radius: 10px;
  justify-content: center;
  font-size: 1.1rem;
}
.rail-btn.active { border-color: var(--accent); color: var(--accent); }

.itinerary-panel {
  width: 0;
  max-width: 0;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid transparent;
  transition: width 0.22s ease, max-width 0.22s ease, border-color 0.22s ease;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  z-index: 25;
  position: relative;
}
.itinerary-panel.open {
  width: var(--panel-w);
  max-width: var(--panel-w);
  border-right-color: var(--border);
  overflow: visible;
}
body.is-panel-resizing .itinerary-panel {
  transition: none;
}

.panel-inner {
  width: var(--panel-w);
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Drag handle on the panel's right edge */
.panel-resizer {
  display: none;
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 40;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.itinerary-panel.open .panel-resizer { display: block; }
.panel-resizer::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 36px;
  margin: -18px 0 0 -1.5px;
  border-radius: 2px;
  background: var(--border-light);
  transition: background 0.15s ease, height 0.15s ease;
}
.panel-resizer:hover::before,
.panel-resizer:focus-visible::before,
body.is-panel-resizing .panel-resizer::before {
  background: var(--accent);
  height: 56px;
  margin-top: -28px;
}
.panel-resizer:focus-visible {
  outline: none;
}
body.is-panel-resizing {
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
}
body.is-panel-resizing .map-area {
  pointer-events: none;
}
.panel-top {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  max-width: 100%;
  overflow-x: hidden;
}
.panel-top .trip-select-row {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}
.panel-top .trip-select-row select,
.panel-top select {
  display: block;
  width: 100%;
  flex: none;
}
.panel-top .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-top .trip-actions-row .btn { flex: 0 0 auto; }
.item-confirmation {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Collapsible trip cost / breakdown */
.trip-overview {
  margin-top: 10px;
}
.trip-overview-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(14,165,233,0.35);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(2,132,199,0.18), rgba(15,23,42,0.9));
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.trip-overview-toggle:hover {
  border-color: rgba(56,189,248,0.55);
  background: linear-gradient(135deg, rgba(2,132,199,0.26), rgba(15,23,42,0.95));
}
.trip-overview-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.trip-overview-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.trip-overview-cost {
  font-size: 1.15rem;
  color: #7dd3fc;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.trip-overview-meta {
  font-size: 0.74rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-overview-chevron::before {
  content: "▸";
  display: inline-block;
  font-size: 0.85rem;
  color: #7dd3fc;
  opacity: 0.9;
  transition: transform 0.15s ease;
}
.trip-overview-toggle.open .trip-overview-chevron::before,
.trip-overview:not(.collapsed) .trip-overview-chevron::before {
  transform: rotate(90deg);
}
.trip-overview-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trip-overview-body[hidden] { display: none !important; }
.trip-overview:not(.collapsed) .trip-overview-toggle {
  border-radius: 10px 10px 8px 8px;
}

.trip-cost-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(2,132,199,0.18), rgba(15,23,42,0.9));
  border: 1px solid rgba(14,165,233,0.35);
  border-radius: 10px;
}
.trip-cost-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.trip-cost-main > span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.trip-cost-main strong {
  font-size: 1.35rem;
  color: #7dd3fc;
  font-variant-numeric: tabular-nums;
}
.trip-dates {
  font-size: 0.82rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.trip-dates span {
  color: #e2e8f0;
}
.field-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.stay-end-mode {
  margin-top: 2px;
}
.budget-section {
  width: 100%;
  margin-top: 2px;
}
.trip-budget-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.trip-budget-summary strong {
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
#statBudgetRemainingWrap.under strong { color: #86efac; }
#statBudgetRemainingWrap.over strong { color: #fca5a5; }
.budget-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 6px 0;
  border: none;
  border-top: 1px solid rgba(125,211,252,0.12);
  background: transparent;
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.budget-toggle:hover { color: #bae6fd; }
.budget-toggle.open { color: #bae6fd; }
.budget-toggle-chevron::before {
  content: "▸";
  display: inline-block;
  font-size: 0.7rem;
  opacity: 0.85;
  transition: transform 0.15s ease;
}
.budget-toggle.open .budget-toggle-chevron::before {
  transform: rotate(90deg);
}
.budget-panel {
  margin-top: 2px;
  padding: 8px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.budget-panel[hidden] { display: none !important; }
.budget-cat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: #cbd5e1;
}
.budget-cat-row strong {
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}
.budget-days-title {
  margin-top: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}
.budget-set-row label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.budget-set-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.budget-set-inputs input { flex: 1; min-width: 0; }

.field-hint.flight-no-hint {
  margin-top: 4px;
  min-height: 1.1em;
}
.field-hint.flight-no-hint.is-ok { color: #86efac; }
.field-hint.flight-no-hint.is-warn { color: #fcd34d; }
.field-hint.flight-no-hint.is-error { color: #fca5a5; }
.day-notes-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.day-notes-badge {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
}
.day-notes-chevron::before {
  content: "▸";
  font-size: 0.7rem;
  opacity: 0.85;
  display: inline-block;
  transition: transform 0.15s ease;
}
.day-notes-toggle.open .day-notes-chevron::before {
  transform: rotate(90deg);
}
.day-notes-body { margin-top: 8px; }
.day-notes-body[hidden] { display: none !important; }

/* Scrapbook days */
.day-scrapbook { margin-top: 10px; }
.scrapbook-body { display: flex; flex-direction: column; gap: 10px; }
.scrapbook-hero {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, #0c4a6e 0%, #0f172a 55%, #1e293b 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  min-height: 140px;
}
.scrapbook-hero.is-dragover {
  outline: 2px dashed #38bdf8;
  outline-offset: -4px;
}
.scrapbook-hero-img {
  display: block;
  width: 100%;
  height: 168px;
  object-fit: cover;
}
.story-mode .scrapbook-hero-img { height: 220px; }
.scrapbook-hero-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 140px;
  padding: 18px 14px;
  cursor: pointer;
  text-align: center;
  color: #e0f2fe;
}
.scrapbook-hero-empty.is-readonly {
  cursor: default;
  color: var(--muted);
}
.scrapbook-hero-cta {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.scrapbook-hero-hint {
  font-size: 0.72rem;
  color: #94a3b8;
}
.scrapbook-hero-del {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.72) !important;
  border-color: rgba(255,255,255,0.2) !important;
}
.scrapbook-journal-row { margin-bottom: 0; }
.scrapbook-journal {
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}
.scrapbook-strip-wrap { margin-top: 2px; }
.scrapbook-strip-title {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-bottom: 6px;
}
.scrapbook-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scrapbook-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #0f172a;
  flex: 0 0 auto;
}
.scrapbook-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scrapbook-thumb-actions {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: linear-gradient(transparent, rgba(2,6,23,0.85));
  opacity: 0;
  transition: opacity 0.15s ease;
}
.scrapbook-thumb:hover .scrapbook-thumb-actions { opacity: 1; }
.scrapbook-thumb-actions .btn {
  padding: 1px 5px;
  font-size: 0.65rem;
  min-height: 0;
  background: rgba(15,23,42,0.75);
}
.scrapbook-thumb-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #7dd3fc;
  font-size: 1.4rem;
  font-weight: 300;
  border-style: dashed;
}
.scrapbook-thumb-add:hover {
  border-color: #38bdf8;
  color: #e0f2fe;
}
.day-empty-hint {
  margin: 0 0 6px;
  font-size: 0.75rem;
  color: var(--muted);
}
#itineraryList.story-mode .day-flow { display: none; }
#itineraryList.story-mode .day-group.story-day {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
#itineraryList.story-mode .day-scrapbook .day-notes-toggle { pointer-events: none; }
#itineraryList.story-mode .day-packing { opacity: 0.92; }
#storyViewBtn.btn-primary {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.day-packing { margin-top: 8px; }
.day-packing-title {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-bottom: 6px;
}
.day-packing-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.day-packing-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  color: #e2e8f0;
  cursor: pointer;
}
.day-packing-item.done span { text-decoration: line-through; color: var(--muted); }
.day-packing-add {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.day-packing-add input { flex: 1; min-width: 0; }

.trip-duration {
  display: flex;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(125,211,252,0.15);
}
.trip-duration span {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.trip-duration strong {
  font-size: 0.95rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.summary-box {
  margin-top: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.trip-overview-body .summary-box { margin-top: 0; }
.summary-box .stat { text-align: center; }
.summary-box .stat strong { display: block; font-size: 1rem; color: var(--accent); }
.summary-box .stat span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.validation-row {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.validation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.validation-row .btn { align-self: flex-start; }
.item-tz {
  font-size: 0.72rem;
  color: #93c5fd;
  margin-top: 4px;
  font-weight: 600;
}
.item-country {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}
.validation-banner {
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.35;
  border: 1px solid rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.12);
  color: #fcd34d;
}
.validation-banner[hidden] { display: none !important; }
.validation-banner.error {
  border-color: rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}
.validation-banner.ok {
  border-color: rgba(34,197,94,0.4);
  background: rgba(34,197,94,0.12);
  color: #86efac;
}
.validation-banner ul {
  margin: 6px 0 0 16px;
  padding: 0;
}
.validation-banner li { margin-bottom: 4px; }
.checkbox-label {
  display: grid !important;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  cursor: pointer;
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.35;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-weight: 500;
  overflow: hidden;
}
.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
  margin-top: 2px !important;
  justify-self: start;
}
.checkbox-label span {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
  text-transform: none;
  letter-spacing: normal;
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.4;
}
.option-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
  box-sizing: border-box;
}
.field-hint {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.shift-later-row {
  padding: 8px 10px;
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: 8px;
  background: rgba(14,165,233,0.08);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.add-form.editing .shift-later-row { display: none; }
.item-cost {
  font-size: 0.85rem;
  font-weight: 700;
  color: #7dd3fc;
  margin-top: 4px;
}
.item-cost-home {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.78rem;
}
.cost-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.cost-input-row input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
}
.cost-input-row select {
  flex: 0 0 88px;
  width: 88px;
  padding-left: 8px;
  padding-right: 8px;
}
.budget-fx-note {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.budget-fx-note.budget-fx-warn { color: #fcd34d; }
.item-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.item-atts a {
  font-size: 0.72rem;
  color: #93c5fd;
  text-decoration: none;
  border: 1px solid rgba(147,197,253,0.25);
  background: rgba(30,58,138,0.25);
  border-radius: 6px;
  padding: 3px 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-atts a:hover { border-color: #60a5fa; color: #bfdbfe; }
.att-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid rgba(147,197,253,0.25);
  background: rgba(30,58,138,0.25);
  border-radius: 6px;
  overflow: hidden;
}
.att-chip a {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 3px 8px;
}
.att-chip .att-del {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: none;
  border-left: 1px solid rgba(147,197,253,0.25);
  border-radius: 0;
  background: transparent;
  color: #fca5a5;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  justify-content: center;
}
.att-chip .att-del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
  border-color: rgba(248, 113, 113, 0.45);
}
.item-atts-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}
.item-atts-edit[hidden] { display: none !important; }
.item-atts-edit .att-chip {
  background: rgba(15, 23, 42, 0.65);
}
.item-atts label.att-add {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px dashed rgba(148,163,184,0.4);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}
.item-atts label.att-add input { display: none; }
input[type="file"] {
  padding: 7px;
  font-size: 0.78rem;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
}
.drag-hint {
  margin: 0 0 10px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.move-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(14,165,233,0.4);
  background: rgba(14,165,233,0.1);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.move-panel[hidden] { display: none !important; }
.move-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.move-panel .form-row { margin-top: 8px; }
.move-panel .checkbox-label { margin-top: 8px; }
.move-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.flow-timeline { position: relative; }
.day-group {
  margin-bottom: 22px;
  border-radius: 10px;
  transition: background 0.15s, box-shadow 0.15s, outline-color 0.15s;
  outline: 2px solid transparent;
}
.day-group.drop-target {
  background: rgba(14,165,233,0.12);
  outline-color: rgba(56,189,248,0.55);
  box-shadow: inset 0 0 0 1px rgba(56,189,248,0.25);
}
.day-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #fbbf24;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  font-weight: 700;
}
.item-card[draggable="true"] { cursor: grab; }
.item-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.flow-timeline.dnd-active .day-group {
  min-height: 48px;
}
.day-label span:last-child {
  color: #fbbf24;
  text-shadow: 0 0 18px rgba(251,191,36,0.25);
}
.day-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251,191,36,0.22);
  flex-shrink: 0;
}
.day-flow {
  position: relative;
  margin-left: 4px;
  padding-left: 18px;
  border-left: 2px solid rgba(56,189,248,0.22);
}
.flow-connector {
  height: 14px;
  margin-left: 0;
  position: relative;
}
.flow-connector::after {
  content: "";
  position: absolute;
  left: -21px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(56,189,248,0.45);
  border-bottom: 2px solid rgba(56,189,248,0.45);
  transform: rotate(45deg);
}
.item-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--other);
  border-radius: 10px;
  padding: 10px 12px 10px 14px;
  margin-bottom: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.item-card .flow-node {
  position: absolute;
  left: -24px;
  top: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid rgba(56,189,248,0.7);
  z-index: 1;
}
.item-card.flow-transport .flow-node { border-color: #38bdf8; background: #0c4a6e; }
.item-card.flow-stay .flow-node { border-color: #c4b5fd; background: #4c1d95; }
.item-card.flow-transport {
  background: linear-gradient(90deg, rgba(14,165,233,0.08), var(--card) 40%);
}
.item-card.flow-stay {
  background: linear-gradient(90deg, rgba(167,139,250,0.1), var(--card) 40%);
}
.item-meta.item-address {
  color: #93c5fd;
  font-weight: 600;
}
.item-card:hover { background: var(--card-hover); }
.item-card.active,
.item-card.editing-card { border-color: var(--accent); background: #121c30; box-shadow: inset 0 0 0 1px rgba(14,165,233,0.25); }
.form-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.form-heading-row h3 { margin: 0; }
.add-form.editing {
  border-color: rgba(14,165,233,0.45);
  box-shadow: 0 0 0 1px rgba(14,165,233,0.15);
}
.item-card.type-flight { border-left-color: var(--flight); }
.item-card.type-car { border-left-color: var(--car); }
.item-card.type-train { border-left-color: #ef4444; }
.item-card.type-bus { border-left-color: #22c55e; }
.item-card.type-ferry { border-left-color: var(--ferry); }
.item-card.type-boat { border-left-color: var(--boat); }
.item-card.type-accommodation,
.item-card.type-hotel,
.item-card.type-airbnb { border-left-color: var(--accommodation); }
.item-card.type-tour { border-left-color: var(--tour); }
.item-card .item-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.item-card-actions .btn {
  min-width: 0;
  line-height: 1.2;
}
.item-card-actions .btn-ghost {
  border-color: rgba(148,163,184,0.35);
  color: #cbd5e1;
}
.item-card-actions .btn-ghost:hover {
  border-color: rgba(14,165,233,0.55);
  color: #7dd3fc;
  background: rgba(14,165,233,0.1);
}
.item-card .item-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.item-pin-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.item-pin-tip-btn {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.item-pin-tip-btn:hover,
.item-pin-tip-btn:focus-visible,
.item-pin-tip.is-open .item-pin-tip-btn {
  border-color: #38bdf8;
  color: #e0f2fe;
  background: rgba(14, 165, 233, 0.16);
  outline: none;
}
.item-pin-tip-bubble {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: min(16.5rem, 72vw);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.item-pin-tip:hover .item-pin-tip-bubble,
.item-pin-tip:focus-within .item-pin-tip-bubble,
.item-pin-tip.is-open .item-pin-tip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.item-card .item-title { font-weight: 650; font-size: 0.95rem; margin: 4px 0 2px; }
.item-card .item-meta { font-size: 0.78rem; color: var(--muted); }
.item-card .item-stay {
  color: #cbd5e1;
  font-weight: 600;
  margin-top: 2px;
}
.item-actions { display: flex; gap: 6px; margin-top: 8px; }

.add-form {
  margin-top: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.add-form h3 {
  font-size: 0.9rem;
  margin: 0;
  font-weight: 700;
}
.form-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  background: transparent;
  border: none;
  color: inherit;
  padding: 4px 0;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.form-toggle:hover { background: transparent; border: none; }
.form-toggle-chevron {
  display: inline-block;
  width: 1em;
  color: var(--accent);
  transition: transform 0.15s ease;
  font-size: 0.85rem;
}
.add-form:not(.collapsed) .form-toggle-chevron {
  transform: rotate(90deg);
}
.add-form-body {
  margin-top: 10px;
  padding-top: 4px;
}
.add-form.collapsed .add-form-body {
  display: none;
}
.add-form.collapsed {
  padding-top: 8px;
  padding-bottom: 8px;
}
.type-fields { display: none; }
.type-fields.show { display: block; }

/* Map — fill remaining shell width/height */
.map-area {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 240px;
  background: #bcd0e0;
}
#map.leaflet-container {
  background: #dbe4ee;
}
.map-loader {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 40% 30%, rgba(14, 24, 40, 0.92), rgba(5, 8, 15, 0.96) 70%);
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.map-loader.is-hidden,
.map-loader[hidden] {
  display: none;
}
.map-loader.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.map-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 16px 18px;
}
.map-loader-globe {
  width: min(168px, 42vw);
  height: min(168px, 42vw);
  display: block;
}
.map-loader-text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(186, 230, 253, 0.9);
}

/* Day filter + places overlay (top-left) */
.map-day-filter {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 500;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  max-width: min(720px, calc(100% - 170px));
  background: rgba(17, 24, 39, 0.94);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.map-address-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 340px;
}
.map-address-search input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
}
.map-address-search input::placeholder { color: #94a3b8; }
.map-address-search .city-ac-wrap { flex: 1 1 auto; min-width: 0; width: 100%; }
.map-day-filter label {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.map-day-filter select {
  min-width: 140px;
  max-width: 200px;
  font-size: 0.82rem;
  padding: 6px 8px;
}
.map-places-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 500 !important;
  color: #e2e8f0 !important;
  cursor: pointer;
}
.map-places-toggle input { margin: 0; }
.map-day-filter #mapPinPlaceBtn.active {
  border-color: rgba(251, 191, 36, 0.7);
  color: #fbbf24;
}

/* Packing dropdown (from Map day bar) */
.map-packing-wrap {
  position: relative;
}
.map-packing-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 520;
  width: min(320px, calc(100vw - 40px));
  max-height: min(420px, calc(100vh - 120px));
  overflow: auto;
  padding: 12px;
  background: rgba(17, 24, 39, 0.97);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.map-packing-dropdown[hidden] { display: none !important; }
.map-packing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.map-packing-head strong {
  font-size: 0.85rem;
  color: #e2e8f0;
}
.map-packing-content .day-packing { margin-top: 0; }
.map-packing-empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.map-packing-day-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.map-packing-day-pick button {
  justify-content: flex-start;
  text-align: left;
}
#mapPackingBtn.is-open {
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}

/* Right-side scrapbook panel (beside zoom, not over it) */
.map-scrapbook-panel {
  position: absolute;
  top: 14px;
  right: 68px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(300px, calc(100% - 100px));
  pointer-events: none;
}
.map-scrapbook-panel > * { pointer-events: auto; }
.map-scrapbook-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: rgba(17, 24, 39, 0.94);
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.map-scrapbook-toggle:hover {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.45);
}
.map-scrapbook-toggle.open {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.55);
}
.map-scrapbook-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #93c5fd;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  padding: 1px 7px;
}
.map-scrapbook-badge[hidden] { display: none !important; }
.map-scrapbook-chevron::before {
  content: "▸";
  font-size: 0.7rem;
  opacity: 0.85;
  display: inline-block;
  transition: transform 0.15s ease;
}
.map-scrapbook-toggle.open .map-scrapbook-chevron::before {
  transform: rotate(90deg);
}
.map-scrapbook-drawer {
  width: min(300px, calc(100vw - 100px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 12px;
  background: rgba(17, 24, 39, 0.97);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.map-scrapbook-drawer[hidden] { display: none !important; }
.map-scrapbook-head {
  margin-bottom: 10px;
}
.map-scrapbook-head strong {
  font-size: 0.88rem;
  color: #e2e8f0;
}
.map-scrapbook-content .scrapbook-hero-img { height: 140px; }
.map-scrapbook-content .scrapbook-hero,
.map-scrapbook-content .scrapbook-hero-empty { min-height: 120px; }
.map-scrapbook-empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}
.map-scrapbook-day-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.map-scrapbook-day-links button {
  justify-content: flex-start;
  text-align: left;
}

/* Scrapbook thumb stamped onto the day pin (not a free-floating marker) */
.trip-marker.has-scrap {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(125, 211, 252, 0.85) !important;
}
.marker-scrap-badge {
  position: absolute;
  left: 18px;
  top: -10px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  overflow: hidden;
  border: 2px solid #7dd3fc;
  background: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.marker-scrap-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.marker-scrap-badge--notes {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fde68a;
  font-size: 0.7rem;
  font-weight: 800;
  background: #0c4a6e;
}
.map-popup-scrap {
  margin-top: 6px;
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 600;
}
.map-pin-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
  font-size: 0.82rem;
  white-space: nowrap;
  pointer-events: none;
}
#map.map-pin-mode,
.map-pin-mode {
  cursor: crosshair !important;
}
/* Let map clicks through while dropping a pin (routes/markers otherwise swallow them) */
#map.map-pin-mode .leaflet-overlay-pane,
#map.map-pin-mode .leaflet-marker-pane,
#map.map-pin-mode .leaflet-shadow-pane,
#map.map-pin-mode .leaflet-tooltip-pane,
#map.map-pin-mode .leaflet-popup-pane {
  pointer-events: none !important;
}

.pin-choice-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pin-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  height: auto;
  white-space: normal;
  line-height: 1.35;
}
.pin-choice-btn strong {
  font-size: 0.95rem;
}
.pin-choice-btn span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}
.pin-split-label {
  margin-top: 10px;
  align-items: flex-start;
}
.pin-split-label span {
  line-height: 1.35;
}

.leaflet-div-icon.temp-drop-pin {
  background: transparent !important;
  border: none !important;
}
.temp-drop-pin-inner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fbbf24;
  border: 3px solid #0f172a;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45);
}

.saved-places-panel {
  margin: 12px 0 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.saved-places-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.saved-places-head h3 {
  margin: 0;
  font-size: 0.9rem;
}
.saved-places-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.saved-place-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.saved-place-main {
  flex: 1;
  text-align: left;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: inherit;
  cursor: pointer;
}
.saved-place-main:hover { border-color: rgba(14, 165, 233, 0.45); }
.saved-place-main strong { display: block; font-size: 0.88rem; }
.saved-place-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}
.add-place-form { margin-top: 10px; }

.place-visibility-toggle {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.place-vis-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.35);
}
.place-vis-option input { margin: 0; }
.place-vis-option:has(input:checked) {
  border-color: rgba(14, 165, 233, 0.55);
  color: var(--accent);
}
.place-rating {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}
.place-star {
  background: transparent;
  border: none;
  color: #475569;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.place-star.is-on { color: #fbbf24; }
.place-stars-display {
  display: inline-block;
  margin-left: 6px;
  color: #fbbf24;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.public-city-places {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.public-city-places-title {
  margin: 0 0 4px;
  font-size: 0.85rem;
}
.public-city-block {
  margin-top: 10px;
}
.public-city-block h5 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.public-place-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.84rem;
}
.public-place-toggle:hover { border-color: var(--border); }
.public-place-toggle input { margin-top: 3px; }
.public-place-toggle span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.leaflet-div-icon.trip-marker--saved,
.leaflet-marker-icon.trip-marker--saved {
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35) !important;
}
.leaflet-div-icon.trip-marker--place,
.leaflet-marker-icon.trip-marker--place { background: #fbbf24 !important; color: #111827 !important; }
.leaflet-div-icon.trip-marker--restaurant,
.leaflet-marker-icon.trip-marker--restaurant { background: #fb923c !important; color: #111827 !important; }
.leaflet-div-icon.trip-marker--sight,
.leaflet-marker-icon.trip-marker--sight { background: #34d399 !important; color: #064e3b !important; }
.leaflet-div-icon.trip-marker--tip,
.leaflet-marker-icon.trip-marker--tip { background: #c084fc !important; color: #3b0764 !important; }
.leaflet-div-icon.trip-marker--maybe,
.leaflet-marker-icon.trip-marker--maybe { background: #94a3b8 !important; color: #0f172a !important; }
.leaflet-div-icon.trip-marker--place .marker-pin-label,
.leaflet-marker-icon.trip-marker--place .marker-pin-label,
.leaflet-div-icon.trip-marker--restaurant .marker-pin-label,
.leaflet-marker-icon.trip-marker--restaurant .marker-pin-label,
.leaflet-div-icon.trip-marker--maybe .marker-pin-label,
.leaflet-marker-icon.trip-marker--maybe .marker-pin-label,
.leaflet-div-icon.trip-marker--place .marker-type-svg,
.leaflet-marker-icon.trip-marker--place .marker-type-svg,
.leaflet-div-icon.trip-marker--restaurant .marker-type-svg,
.leaflet-marker-icon.trip-marker--restaurant .marker-type-svg,
.leaflet-div-icon.trip-marker--sight .marker-type-svg,
.leaflet-marker-icon.trip-marker--sight .marker-type-svg,
.leaflet-div-icon.trip-marker--maybe .marker-type-svg,
.leaflet-marker-icon.trip-marker--maybe .marker-type-svg {
  color: #111827;
}
.leaflet-div-icon.trip-marker--tip .marker-type-svg,
.leaflet-marker-icon.trip-marker--tip .marker-type-svg {
  color: #3b0764;
}
.leaflet-div-icon.trip-marker--sight .marker-pin-label,
.leaflet-marker-icon.trip-marker--sight .marker-pin-label {
  color: #064e3b;
}

/* Big visible zoom controls (keep clear of scrapbook panel) */
.map-zoom-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 510;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.map-zoom-bar button {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 0;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  justify-content: center;
  padding: 0;
}
.map-zoom-bar button + button {
  border-top: 1px solid var(--border-light);
}
.map-zoom-bar button:hover {
  background: #1a2540;
  color: var(--accent);
  border-color: transparent;
}

/* Basemap style switcher (bottom of map) */
.map-basemap-bar {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 510;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  max-width: min(520px, calc(100% - 28px));
  background: rgba(17, 24, 39, 0.94);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.map-basemap-bar button {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.map-basemap-bar button:hover {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}
.map-basemap-bar button.is-active {
  background: var(--accent);
  color: #0a0f1e;
}
.map-basemap-bar button.is-active:hover {
  background: #7dd3fc;
  color: #0a0f1e;
}

/* Leaflet */
.leaflet-container {
  background: #bcd0e0;
  font: inherit;
  width: 100% !important;
  height: 100% !important;
}
.leaflet-tile-pane { filter: none; }
.leaflet-control-zoom {
  border: 1px solid var(--border-light) !important;
  border-radius: 10px !important;
  overflow: hidden;
  margin-top: 110px !important; /* sit below custom zoom */
  display: none; /* custom bar used instead */
}
.leaflet-control-attribution {
  background: rgba(17,24,39,0.75) !important;
  color: #94a3b8 !important;
  font-size: 0.65rem !important;
}
.leaflet-control-attribution a { color: #7dd3fc !important; }
.leaflet-popup-content-wrapper {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 10px 12px; font-size: 0.85rem; }

/* Kill Leaflet's default square white div-icon — circle is the icon itself */
.leaflet-div-icon.trip-marker,
.leaflet-marker-icon.trip-marker {
  background: var(--other) !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  overflow: visible !important;
  cursor: pointer;
  position: absolute; /* Leaflet already sets this; keep for badge positioning */
  color: #fff !important;
  width: 30px !important;
  height: 30px !important;
}
.leaflet-div-icon.trip-marker--flight,
.leaflet-marker-icon.trip-marker--flight { background: var(--flight) !important; }
.leaflet-div-icon.trip-marker--car,
.leaflet-marker-icon.trip-marker--car { background: var(--car) !important; }
.leaflet-div-icon.trip-marker--train,
.leaflet-marker-icon.trip-marker--train { background: #ef4444 !important; }
.leaflet-div-icon.trip-marker--bus,
.leaflet-marker-icon.trip-marker--bus { background: #22c55e !important; }
.leaflet-div-icon.trip-marker--ferry,
.leaflet-marker-icon.trip-marker--ferry { background: var(--ferry) !important; }
.leaflet-div-icon.trip-marker--boat,
.leaflet-marker-icon.trip-marker--boat { background: var(--boat) !important; }
.leaflet-div-icon.trip-marker--accommodation,
.leaflet-marker-icon.trip-marker--accommodation,
.leaflet-div-icon.trip-marker--hotel,
.leaflet-marker-icon.trip-marker--hotel,
.leaflet-div-icon.trip-marker--airbnb,
.leaflet-marker-icon.trip-marker--airbnb { background: var(--accommodation) !important; }
.leaflet-div-icon.trip-marker--tour,
.leaflet-marker-icon.trip-marker--tour { background: var(--tour) !important; }
.leaflet-div-icon.trip-marker--other,
.leaflet-marker-icon.trip-marker--other { background: var(--other) !important; }

.marker-type-svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}
.marker-pin-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  pointer-events: none;
}

.marker-end-badge {
  position: absolute;
  right: -5px;
  top: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  font-size: 0.55rem;
  font-style: normal;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fff;
  line-height: 1;
}

/* Soft city hub under overlapping markers */
.leaflet-div-icon.trip-marker-hub,
.leaflet-marker-icon.trip-marker-hub {
  background: rgba(15, 23, 42, 0.55) !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.15) !important;
  padding: 0 !important;
}
.marker-city-hub { display: none; }

/* Legacy inner pin classes (kept so old cached HTML still looks round) */
.marker-pin,
.marker-stay {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transform: none !important;
}
.marker-pin span,
.marker-stay span {
  transform: none !important;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.marker-stay-ring { display: none !important; }
.pin-flight { background: var(--flight) !important; }
.pin-car { background: var(--car) !important; }
.pin-train { background: #ef4444 !important; }
.pin-bus { background: #22c55e !important; }
.pin-ferry { background: var(--ferry) !important; }
.pin-boat { background: var(--boat) !important; }
.pin-accommodation,
.pin-hotel,
.pin-airbnb { background: var(--accommodation) !important; }
.pin-tour { background: var(--tour) !important; }
.pin-other { background: var(--other) !important; }

.map-popup-type {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.map-popup-city,
.map-popup-when,
.map-popup-addr {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 0.8rem;
}
.map-popup-notes {
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 0.8rem;
}
.map-popup-hint {
  margin-top: 8px;
  font-size: 0.68rem;
  color: #64748b;
}
.item-card.map-focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--card-hover);
}

/* Profile */
.page-main { padding: 22px 28px 60px; max-width: 980px; margin: 0 auto; }
.page-main-wide { max-width: 1100px; }
.page-main h2 { font-size: 1.4rem; margin-bottom: 6px; }
.page-main .lede { color: var(--muted); margin-bottom: 20px; font-size: 0.9rem; }

/* Help */
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 4px 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.help-toc a {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}
.help-toc a:hover { color: var(--accent); }
.help-section {
  margin-bottom: 28px;
  max-width: 68ch;
}
.help-section h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
  color: var(--text);
}
.help-section p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 10px;
}
.help-section ul,
.help-section ol {
  margin: 0 0 4px;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.help-section li { margin-bottom: 6px; }
.help-section li strong,
.help-section p strong { color: var(--text); font-weight: 600; }
.help-support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.page-head .lede { margin-bottom: 20px; }
.page-head .btn { flex-shrink: 0; margin-top: 2px; }
@media (max-width: 520px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; justify-content: center; }
}

/* Admin dashboard */
body.admin-page {
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(700px 380px at 90% 0%, rgba(129, 140, 248, 0.10), transparent 50%),
    var(--bg);
}
.admin-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 80px;
}
.admin-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.admin-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.admin-hero h2 {
  font-size: clamp(1.7rem, 2.4vw, 2.15rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.admin-hero .lede {
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 42ch;
  line-height: 1.55;
  margin: 0;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.admin-stat {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(13, 20, 36, 0.98));
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.admin-stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.admin-stat-value {
  display: block;
  font-size: 2.15rem;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #f8fafc;
}

.admin-panel {
  background: rgba(13, 20, 36, 0.88);
  border: 1px solid var(--border-light);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}
.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
}
.admin-panel-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
}
.admin-panel-head span {
  color: var(--muted);
  font-size: 0.85rem;
}
.admin-shares-panel {
  margin-top: 18px;
}
.admin-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 20px 26px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: rgba(15, 23, 42, 0.55);
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.admin-shares-panel:not(.collapsed) .admin-panel-toggle {
  border-bottom-color: var(--border);
}
.admin-panel-toggle-text {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-width: 0;
}
.admin-panel-toggle-text h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.admin-panel-toggle-meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.admin-panel-chevron {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  opacity: 0.75;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.18s ease;
}
.admin-shares-panel.collapsed .admin-panel-chevron {
  transform: rotate(-90deg);
}
.admin-shares-panel.collapsed .admin-panel-body {
  display: none;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
}
.admin-user-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(0, 1.6fr);
  gap: 28px;
  align-items: center;
  padding: 26px 28px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.9);
  transition: background 0.18s ease;
}
.admin-user-row:last-child { border-bottom: none; }
.admin-user-row:hover { background: rgba(18, 28, 48, 0.72); }
.admin-panel-pad { padding: 8px 28px 22px; }
.admin-share-table-wrap {
  overflow-x: auto;
  padding: 0 16px 18px;
}
.admin-share-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-share-table th,
.admin-share-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-share-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-share-owner { font-weight: 600; }
.admin-share-sub {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}
.admin-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.admin-user-trips {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 12, 24, 0.55);
}
.admin-user-trips-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-user-trips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-user-trips-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.admin-user-trip-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 180px;
}
.admin-metric .admin-toggle-trips {
  margin-top: 4px;
  display: inline-block;
}
.flash.admin-view-banner {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.flash.admin-view-banner a { color: #fde68a; }
.admin-user-row.is-inactive {
  opacity: 0.78;
  background: rgba(15, 23, 42, 0.45);
}
.admin-user-row.is-inactive .admin-avatar {
  filter: grayscale(0.35);
  opacity: 0.85;
}
.admin-metric-actions .btn { margin-top: 2px; }
.admin-action-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.admin-mail-panel { margin-bottom: 18px; }
.admin-mail-panel .form-row { margin: 0 0 12px; }
.admin-mail-panel textarea {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
}
.admin-mail-panel .checkbox-label { margin: 0 0 12px; }
.admin-mail-test {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 0 0 14px;
}
.admin-mail-test .form-row {
  flex: 1 1 16rem;
  margin: 0;
}
.admin-purge-panel { margin-bottom: 18px; }
.admin-purge-body { padding: 8px 28px 22px; }
.admin-purge-body .lede { margin-bottom: 12px; max-width: 62ch; }
.admin-purge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.admin-purge-row label {
  font-size: 0.8rem;
  color: var(--muted);
}
.admin-purge-row select {
  min-width: 120px;
}

.admin-user-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.admin-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(145deg, #0284c7, #6366f1);
  box-shadow: 0 8px 18px rgba(2, 132, 199, 0.25);
}
.admin-user-meta { min-width: 0; }
.admin-user-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.admin-id {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.admin-user-email {
  color: #94a3b8;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.admin-metric {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.admin-metric-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.admin-metric strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.admin-metric time {
  color: #cbd5e1;
  font-size: 0.95rem;
}
.admin-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.admin-status.on {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(134, 239, 172, 0.28);
}
.admin-status.off {
  color: #94a3b8;
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(148, 163, 184, 0.22);
}
.admin-role-user {
  color: #cbd5e1;
  font-size: 0.95rem;
}
.admin-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(2, 132, 199, 0.18);
}

@media (max-width: 900px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-user-row {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 20px;
  }
  .admin-user-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .admin-shell { width: min(100%, calc(100% - 28px)); padding-top: 24px; }
  .admin-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .admin-stat { padding: 18px; }
  .admin-stat-value { font-size: 1.7rem; }
}
.trips-section { margin-bottom: 32px; }
.trips-section-past { margin-top: 28px; }
.trips-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}
.trips-section-past .trips-section-title { color: var(--muted); }
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.trip-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; transition: background 0.15s, transform 0.14s, border-color 0.15s;
}
.trip-card:hover { background: var(--card-hover); transform: translateY(-2px); }
.trip-card h3,
.trip-card .trip-card-name { font-size: 1.05rem; margin-bottom: 6px; }
.trip-card .dates { color: var(--muted); font-size: 0.82rem; margin-bottom: 14px; }
.trip-card .dates:has(+ .trip-days-away) { margin-bottom: 6px; }
.trip-card-future {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}
.trip-card-future:hover { background: rgba(34, 197, 94, 0.1); }
.trip-card-ongoing { border-color: rgba(34, 197, 94, 0.3); }
.trip-days-away {
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 22px;
}
.trip-days-away-now { color: var(--success); font-weight: 500; }
.trip-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.trip-card-actions .inline-form,
.past-trips-actions .inline-form {
  display: inline;
  margin: 0;
}
.past-trips-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.past-trips-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.past-trips-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.past-trips-table th,
.past-trips-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.past-trips-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(15, 23, 42, 0.55);
}
.past-trips-table tbody tr:last-child td { border-bottom: 0; }
.past-trips-table tbody tr:hover { background: var(--card-hover); }
.past-trips-table .trip-card-name { font-weight: 600; color: var(--text); }
.past-trips-dates { color: var(--muted); white-space: nowrap; }
.past-trips-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.past-trips-table th:last-child,
.past-trips-table td:last-child { text-align: right; }
.share-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 4px 0 8px;
}
.share-password-gate .share-password-form {
  max-width: 320px;
  margin: 16px auto 0;
  text-align: left;
}
.share-password-gate .share-password-form .btn {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}
.empty-state { color: var(--muted); padding: 28px 0; font-size: 0.95rem; }

/* Share */
.share-banner {
  text-align: center;
  padding: 8px 14px;
  font-size: 0.82rem;
  color: #bae6fd;
  background: rgba(2,132,199,0.18);
  border-bottom: 1px solid rgba(14,165,233,0.3);
}
.verify-banner {
  border-bottom: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
  font-size: 0.84rem;
}
.verify-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 18px;
}
.verify-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.email-verified-pill,
.email-unverified-pill {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.email-verified-pill {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(134, 239, 172, 0.35);
}
.email-unverified-pill {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.share-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
}
.share-badge.view { color: #93c5fd; border-color: rgba(147,197,253,0.35); }
.share-badge.edit { color: #86efac; border-color: rgba(134,239,172,0.35); }
.shared-trip-name {
  flex: 1;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 0;
}
.share-error {
  max-width: 480px;
  margin: 60px auto;
  padding: 28px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.share-error h2 { margin-bottom: 8px; }
.share-error p { color: var(--muted); margin-bottom: 18px; }
/* Contact support — compact floating panel (not full-screen) */
.contact-header-btn {
  flex-shrink: 0;
}
.contact-drawer {
  position: fixed;
  inset: 0;
  z-index: 21000;
  pointer-events: none;
}
.contact-drawer[hidden] { display: none !important; }
.contact-drawer.open[hidden] { display: block !important; }
.contact-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}
.contact-drawer.open .contact-drawer-backdrop {
  pointer-events: auto;
}
.contact-drawer-panel {
  position: absolute;
  top: 58px;
  right: 12px;
  width: min(340px, calc(100vw - 20px));
  max-height: min(520px, calc(100vh - 72px));
  background: #111827;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 14px 14px 16px;
  overflow-y: auto;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}
.contact-drawer.open .contact-drawer-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.contact-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.contact-drawer-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.contact-drawer-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}
.contact-drawer-panel .form-row { margin-bottom: 8px; }
.contact-drawer-panel .form-row label { font-size: 0.78rem; margin-bottom: 3px; }
.contact-drawer-panel textarea { min-height: 88px; resize: vertical; }
.contact-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.contact-drawer-note {
  margin: 10px 0 0;
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
}
.contact-drawer .muted { color: var(--muted); font-weight: 400; }
.contact-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
@media (max-width: 520px) {
  .contact-drawer-panel {
    top: auto;
    bottom: 12px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: min(70vh, 480px);
  }
}

body.modal-open { overflow: hidden; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open,
.modal:not([hidden]) {
  display: flex;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(2,6,23,0.72);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-width: 100%;
  max-height: min(80vh, 640px);
  overflow-x: hidden;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
  box-sizing: border-box;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.modal-head h2 { font-size: 1.1rem; margin: 0; }
.modal-lead { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
#newTripModal .muted { color: var(--muted); font-weight: 400; }
#newTripModal .form-status { margin-top: 4px; }
.share-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
#emailModal .field-hint { margin: 4px 0 10px; }
#emailModal .form-status { margin-top: 12px; min-height: 1.2em; }
#shareModal .form-status { margin: 8px 0 0; min-height: 1.2em; }
#shareModal .share-create-actions { margin-top: 12px; }
#emailModal .muted { color: var(--muted); font-weight: 400; }
#emailModal .form-row,
#emailModal .option-stack,
#emailModal .share-create-actions { max-width: 100%; }
.share-list-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.share-list .muted { color: var(--muted); font-size: 0.85rem; }
.share-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--card);
}
.share-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.share-perm {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
}
.share-perm.view { background: rgba(59,130,246,0.15); color: #93c5fd; }
.share-perm.edit { background: rgba(34,197,94,0.15); color: #86efac; }
.share-label { flex: 1; font-size: 0.85rem; color: var(--muted); }
.share-url-row { display: flex; gap: 6px; }
.share-url-row input {
  flex: 1;
  font-size: 0.75rem;
  padding: 7px 9px;
}

@media (max-width: 900px) {
  :root {
    --rail-w: 44px;
    --panel-w: calc(100vw - var(--rail-w));
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body.planner-page {
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
  }

  /* Header: brand on first row, nav wraps underneath — never clips off-screen */
  .app-header {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    overflow: visible;
  }
  .header-brand-wrap {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    flex-wrap: wrap;
  }
  .header-brand { gap: 8px; min-width: 0; }
  .header-brand .brand-tagline { display: none; }
  .header-welcome {
    font-size: 0.82rem;
    max-width: 100%;
    flex: 1 1 100%;
    order: 3;
  }
  .brand-logo,
  .header-brand.has-tagline .brand-logo {
    height: 34px !important;
    max-width: min(140px, 40vw) !important;
  }
  .brand-aside .brand-trip-name {
    max-width: min(150px, 36vw);
    font-size: 0.86rem;
  }
  .header-nav {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 1;
    gap: 6px;
    overflow: visible;
  }
  .header-nav .btn {
    flex-shrink: 1;
    padding: 6px 9px;
    font-size: 0.74rem;
  }
  .header-nav .btn.btn-sm { padding: 5px 8px; font-size: 0.72rem; }
  .account-menu-btn {
    max-width: none;
    padding-left: 8px;
    padding-right: 8px;
  }
  .account-menu-label,
  .account-menu-caret { display: none; }
  .account-menu-panel {
    position: fixed;
    top: max(56px, calc(env(safe-area-inset-top, 0px) + 52px));
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    max-height: min(70dvh, 560px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .account-menu-grid { grid-template-columns: 1fr; }

  /* Keep rail above the slide-out panel */
  .side-rail {
    z-index: 1300;
    position: relative;
    padding-top: 8px;
    gap: 6px;
  }
  .rail-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  /* Always overlay on mobile (never sit under Leaflet tiles) */
  .itinerary-panel {
    position: absolute;
    left: var(--rail-w);
    top: 0;
    bottom: 0;
    width: 0;
    max-width: 0;
    z-index: 1200;
    border-right: none;
    box-shadow: none;
    overflow: hidden; /* required for iOS nested scroll */
  }
  .itinerary-panel.open {
    width: min(var(--panel-w), calc(100vw - var(--rail-w) - env(safe-area-inset-right, 0px)));
    max-width: min(var(--panel-w), calc(100vw - var(--rail-w) - env(safe-area-inset-right, 0px)));
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 24px rgba(0,0,0,0.45);
    overflow: hidden;
  }

  /*
   * One scroll surface for the whole drawer (top chrome + list).
   * Nested panel-top (fixed) + panel-scroll was nearly unusable on iOS.
   */
  .itinerary-panel .panel-inner {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .panel-resizer { display: none !important; }

  .panel-top {
    flex-shrink: 0;
    padding: 10px 10px 8px;
    max-width: 100%;
  }
  .panel-top .trip-select-row {
    margin-bottom: 6px;
  }
  .panel-top .trip-select-row select,
  .panel-top select {
    width: 100%;
    min-height: 42px;
  }
  .panel-top .row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .panel-top .row .btn,
  .panel-top .trip-actions-row .btn {
    flex: 1 1 calc(33.33% - 6px);
    justify-content: center;
    min-width: 0;
    padding: 7px 6px;
    font-size: 0.74rem;
  }

  .panel-scroll {
    flex: 0 0 auto;
    overflow: visible;
    height: auto;
    min-height: 0;
    padding: 10px 10px max(28px, env(safe-area-inset-bottom, 0px));
    max-width: 100%;
  }

  /* Dim map while itinerary is open; tap to close */
  .panel-backdrop {
    display: none;
    position: absolute;
    inset: 0;
    left: var(--rail-w);
    background: rgba(2, 6, 23, 0.45);
    z-index: 1150;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .panel-backdrop.show { display: block; }

  .form-grid { grid-template-columns: 1fr; }
  .summary-box {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 8px 6px;
  }
  .summary-box .stat strong { font-size: 0.92rem; }
  .summary-box .stat span { font-size: 0.62rem; }
  .trip-cost-bar { padding: 10px 12px; }
  .trip-cost-main strong { font-size: 1.15rem; }
  .validation-actions { width: 100%; }
  .validation-actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Timeline gutter was eating the card width on narrow drawers */
  .day-flow {
    margin-left: 0;
    padding-left: 14px;
  }
  .item-card {
    padding: 10px;
    max-width: 100%;
    overflow: hidden;
  }
  .item-card .flow-node {
    left: -20px;
    width: 10px;
    height: 10px;
  }
  .flow-connector::after { left: -18px; }
  .item-card .item-top {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .item-card .item-title {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .item-card-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
  .item-meta,
  .item-atts a {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }
  .cost-input-row { flex-wrap: wrap; }
  .cost-input-row select {
    flex: 1 1 100%;
    width: 100%;
  }
  .move-panel-actions { flex-wrap: wrap; }
  .move-panel-actions .btn { flex: 1 1 auto; justify-content: center; }

  .add-form {
    position: sticky;
    bottom: 0;
    max-width: 100%;
  }

  /* Avoid iOS zoom-on-focus */
  input,
  select,
  textarea {
    font-size: 16px;
  }
  .account-menu-form input,
  .account-menu-form select {
    font-size: 16px;
  }

  .map-day-filter {
    top: 10px;
    left: 10px;
    right: 56px;
    max-width: none;
    width: auto;
    gap: 6px;
    padding: 7px 8px;
  }
  .map-day-filter select {
    min-width: 0;
    flex: 1 1 120px;
    max-width: none;
    font-size: 16px;
  }
  .map-day-filter .btn { padding: 5px 8px; font-size: 0.72rem; }
  .map-places-toggle { font-size: 0.72rem !important; }
  .map-address-search {
    flex: 1 1 100%;
    max-width: none;
    order: 10;
  }
  .map-address-search input { font-size: 16px; }

  .map-zoom-bar {
    top: 10px;
    right: 10px;
  }
  .map-zoom-bar button {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }

  .map-basemap-bar {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: max(64px, calc(env(safe-area-inset-bottom, 0px) + 54px));
    max-width: none;
    justify-content: flex-start;
  }
  .map-basemap-bar button {
    font-size: 0.72rem;
    padding: 6px 8px;
  }

  .map-scrapbook-panel {
    top: auto;
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    right: 10px;
    left: 10px;
    max-width: none;
    align-items: stretch;
  }
  .map-scrapbook-toggle { width: 100%; justify-content: center; }
  .map-scrapbook-drawer {
    width: 100%;
    max-height: min(42dvh, 360px);
  }

  .map-packing-dropdown {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: min(50dvh, 360px);
  }

  .map-pin-hint {
    left: 12px;
    right: 12px;
    bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 64px));
    transform: none;
    white-space: normal;
    text-align: center;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .leaflet-control-attribution {
    max-width: calc(100% - 8px);
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Auth / content pages */
  .auth-wrap {
    min-height: calc(100dvh - 70px);
    padding: 16px 12px max(28px, env(safe-area-inset-bottom, 0px));
    align-content: start;
  }
  .auth-card {
    padding: 22px 16px;
    border-radius: 12px;
  }
  .auth-actions { flex-wrap: wrap; }
  .auth-actions .btn { flex: 1 1 auto; justify-content: center; }
  .page-main {
    padding: 16px 14px max(40px, env(safe-area-inset-bottom, 0px));
  }
  .legal-wrap {
    padding: 16px 12px max(40px, env(safe-area-inset-bottom, 0px));
  }
  .legal-card { padding: 20px 16px 28px; }
  .legal-card h1 { font-size: 1.35rem; }
  .trips-grid { grid-template-columns: 1fr; }
  .backup-codes { grid-template-columns: 1fr; }

  .modal {
    align-items: flex-end;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: min(88dvh, 720px);
    border-radius: 16px 16px 0 0;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom, 0px));
  }

  .verify-banner-inner {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .verify-banner-actions .btn { flex: 1 1 auto; justify-content: center; }

  .share-url-row { flex-wrap: wrap; }
  .share-url-row .btn { flex: 1 1 auto; justify-content: center; }

  .contact-drawer-panel {
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    left: 10px;
    right: 10px;
    width: auto;
    max-height: min(72dvh, 520px);
  }

  .scrapbook-hero-img { height: 140px; }
  .story-mode .scrapbook-hero-img { height: 180px; }
  .scrapbook-thumb-actions { opacity: 1; }

  .pin-choice-btn { padding: 12px; }
}

/* Backdrop hidden on desktop (must stay after the mobile rules) */
@media (min-width: 901px) {
  .panel-backdrop,
  .panel-backdrop.show { display: none !important; }
}

/* Default width on large screens when no saved preference is applied yet */
@media (min-width: 1200px) {
  :root { --panel-w: 460px; }
}

/* Security / layout utilities (replace common inline styles) */
.btn-block { width: 100%; justify-content: center; }
.logout-form { display: inline; margin: 0; }
.logout-form.inline { display: inline-flex; }
.logout-link-btn {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.logout-link-btn:hover { color: var(--accent); }
.auth-muted-form { margin-top: 16px; }
.auth-muted-form .linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}
.diagnose-card.diagnose-ok { border-left: 3px solid #22c55e; }
.diagnose-card.diagnose-fail { border-left: 3px solid #ef4444; }
.diagnose-smoke { margin-top: 20px; }
.flash-banner { margin: 0; border-radius: 0; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mb-16 { margin-bottom: 16px; }
.auth-stack { flex-direction: column; align-items: stretch; gap: 8px; }
.auth-lede-sm { font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; }
.auth-lede-sm.flat { margin-bottom: 0; }
.muted-sm { font-size: 0.78rem; font-weight: 400; }
.share-create-actions.tight { margin-top: 14px; margin-bottom: 0; }
.auth-link-row { font-size: 0.85rem; }
.auth-link-row.muted { color: var(--muted); }

/* —— Trip analytics report —— */
#tripReportModal .modal-card {
  max-width: 820px;
  width: min(820px, 96vw);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
}
#tripReportModal .modal-scroll {
  overflow: auto;
  padding-right: 2px;
  margin-top: 8px;
}
.report-scope {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 4px 0 8px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.16);
}
.report-scope-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.78;
}
.report-scope-btn.is-active {
  background: var(--card, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  opacity: 1;
}
.report-range {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
}
.report-range-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}
.report-range-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted, #64748b);
}
.report-range-label input[type="date"] {
  min-width: 10.5rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: var(--card, #fff);
  font: inherit;
  color: inherit;
}
.report-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.report-preset-btn {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: var(--card, #fff);
  color: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.report-preset-btn:hover,
.report-preset-btn.is-active {
  border-color: #0ea5e9;
  color: #0369a1;
  background: rgba(14, 165, 233, 0.1);
}
.report-range-banner {
  margin: 0 0 12px;
  font-size: 0.86rem;
  font-weight: 650;
  color: #0369a1;
}
.report-trip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.report-trip-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
}
.report-trip-name { font-weight: 650; }
.report-trip-meta { color: var(--muted); font-size: 0.86rem; }
.report-status--mixed {
  background: rgba(56, 189, 248, 0.16);
  color: #0369a1;
}
.report-loading {
  padding: 28px 8px;
  text-align: center;
  color: var(--muted);
}
.report-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 16px;
}
.report-status {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text);
}
.report-status--past { background: rgba(148, 163, 184, 0.25); }
.report-status--future { background: rgba(56, 189, 248, 0.22); color: #0369a1; }
.report-status--ongoing { background: rgba(52, 211, 153, 0.25); color: #065f46; }
.report-hero-dates { font-weight: 700; font-size: 1.05rem; }
.report-hero-meta { color: var(--muted); font-size: 0.86rem; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.report-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) {
  .report-grid,
  .report-grid-3,
  .report-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .report-grid-4 { grid-template-columns: 1fr 1fr; }
}
.report-card {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}
.report-card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}
.report-card-value {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.2;
  word-break: break-word;
}
.report-card-hint {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}
.report-section { margin-bottom: 18px; }
.report-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
.report-section-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .report-section-split { grid-template-columns: 1fr; }
}
.report-chart-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.report-donut-wrap {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
  position: relative;
}
.report-donut {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}
.report-donut-center {
  position: absolute;
  left: 0;
  top: 0;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  padding: 28px;
  line-height: 1.2;
}
.report-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
}
.report-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.report-bars { display: flex; flex-direction: column; gap: 8px; }
.report-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 28%) 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}
.report-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.report-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}
.report-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}
.report-bar-value { font-weight: 700; white-space: nowrap; }
.report-fun {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.report-fun-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.report-fun-item strong {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 4px;
}
.report-fun-item span { color: var(--muted); font-size: 0.84rem; }
.report-note { color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; }
.report-cities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.report-cities span {
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
}
