/* =============================================================
   WakuTrip — refined editorial aesthetic
   Warm cream background, deep ink text, terracotta accent
   ============================================================= */

:root {
  /* Palette */
  --cream: #f5f1ea;
  --cream-2: #ebe5db;
  --paper: #faf7f2;
  --ink: #1c1a17;
  --ink-2: #3d3a35;
  --muted: #8a857c;
  --line: #d9d2c4;
  --terra: #b94e2e;
  --terra-deep: #8d3a22;
  --moss: #4a6741;
  --gold: #c89b3c;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.04), 0 8px 24px rgba(28, 26, 23, 0.06);

  /* Type */
  --display: 'Fraunces', Georgia, serif;
  --body: 'Inter Tight', -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--body);
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* =============================================================
   Layout: 3-pane app
   ============================================================= */
.app {
  display: grid;
  grid-template-columns: 340px 1fr 380px;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.25s ease;
}
.app.left-collapsed { grid-template-columns: 0 1fr 380px; }
.app.right-collapsed { grid-template-columns: 340px 1fr 0; }
.app.left-collapsed.right-collapsed { grid-template-columns: 0 1fr 0; }

.sidebar, .chat-panel { background: var(--paper); display: flex; flex-direction: column; min-height: 0; }
.sidebar { border-right: 1px solid var(--line); overflow: hidden; }
.chat-panel { border-left: 1px solid var(--line); overflow: hidden; }
.app.left-collapsed .sidebar,
.app.right-collapsed .chat-panel { display: none; }
.map-area { position: relative; }

/* Inline collapse buttons inside the panel headers */
.brand { position: relative; }
.panel-toggle {
  width: 26px; height: 26px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  transition: all 0.15s;
}
.panel-toggle:hover { background: var(--cream-2); color: var(--ink); }
#collapse-left { margin-left: auto; }
.chat-header #collapse-right { order: -1; margin-right: 4px; }

/* Floating "expand" buttons that live on the map edge when a panel is collapsed */
.edge-toggle {
  position: absolute;
  top: 16px;
  width: 28px; height: 32px;
  background: var(--paper);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-size: 16px;
  line-height: 1;
  z-index: 600;
  box-shadow: var(--shadow);
  transition: all 0.15s;
  display: grid; place-items: center;
}
.edge-toggle:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.edge-left  { left: 0;  border-left: none;  border-radius: 0 4px 4px 0; }
.edge-right { right: 0; border-right: none; border-radius: 4px 0 0 4px; }
.edge-toggle[hidden] { display: none; }

/* =============================================================
   Brand
   ============================================================= */
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  border-radius: 4px;
  letter-spacing: -0.02em;
}
.brand-text { flex: 1; min-width: 0; }
.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.trip-switcher {
  display: block;
  margin-top: 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--body);
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  outline: none;
  max-width: 100%;
  text-overflow: ellipsis;
}
.trip-switcher:hover { color: var(--ink); }
#user-menu-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--paper);
  margin-left: 6px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}
#user-menu-btn:hover { background: var(--terra); }
#user-menu-btn .icon { width: 14px; height: 14px; color: var(--paper); }

.current-trip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.btn-small {
  padding: 4px 8px !important;
  font-size: 10px !important;
  letter-spacing: 0.06em !important;
}

/* Share link rows in user menu */
.share-row {
  margin-top: 12px;
  padding: 12px;
  background: var(--cream-2);
  border-radius: 6px;
}
.share-row + .share-row { margin-top: 8px; }
.share-row-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.share-row-head strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  font-weight: 600;
}
.share-row-help {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.share-url {
  word-break: break-all;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--paper);
  padding: 6px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.share-actions { display: flex; gap: 6px; }

/* =============================================================
   Collaborators (in user menu)
   ============================================================= */
.collab-help { display: block; margin: 6px 0 10px; }
.collab-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.collab-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--cream-2);
  border-radius: 6px;
}
.collab-info { flex: 1; min-width: 0; }
.collab-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.collab-email { font-size: 11px; color: var(--muted); }
.collab-you { color: var(--terra); font-weight: 500; font-size: 11px; }
.collab-role {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 3px; font-weight: 600;
  background: var(--paper); color: var(--ink-2);
}
.collab-role-owner  { background: var(--terra); color: var(--paper); }
.collab-role-editor { background: var(--gold);  color: var(--ink); }
.collab-role-viewer { background: var(--cream-3, var(--cream-2)); color: var(--ink-2); }
.collab-remove {
  width: 24px; height: 24px; padding: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: 4px; color: var(--muted);
  font-size: 16px; line-height: 1;
}
.collab-remove:hover { background: var(--paper); color: var(--ink); border-color: var(--ink-2); }
.collab-add {
  display: flex; gap: 6px; margin-top: 8px;
  align-items: stretch;
}
.collab-add input[type="email"] {
  flex: 1; min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12px;
  color: var(--ink);
}
.collab-add select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12px;
  color: var(--ink);
}
.collab-add button { padding: 6px 14px !important; font-size: 11px !important; }
.collab-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fef0ee;
  color: #b94939;
  border-radius: 4px;
  font-size: 12px;
}

/* =============================================================
   Activity feed (sidebar tab)
   ============================================================= */
.activity-header-row { display: flex; align-items: center; gap: 10px; }
.activity-header-text { flex: 1; font-size: 12px; color: var(--muted); }
.activity-list { display: flex; flex-direction: column; padding: 4px 0; }
.activity-row {
  display: flex; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child { border-bottom: none; }
.activity-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--terra);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-summary {
  font-size: 13px; color: var(--ink-2); line-height: 1.4;
}
.activity-actor {
  color: var(--ink); font-weight: 600;
}
.activity-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
  font-size: 11px; color: var(--muted);
}
.activity-icon { display: inline-flex; align-items: center; }
.activity-icon .icon { width: 12px; height: 12px; color: var(--muted); }
.activity-time { font-variant-numeric: tabular-nums; }

/* =============================================================
   Place photos (place modal)
   ============================================================= */
.place-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.place-photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--cream-2);
}
.place-photo-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.place-photo-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(28, 26, 23, 0.7);
  color: var(--paper);
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.place-photo-tile:hover .place-photo-remove { opacity: 1; }

/* Docs cell in the data table editor — chips + a "+" attach button */
.table-cell.docs-cell {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 4px 6px;
  cursor: default;
}
.docs-cell-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  background: var(--cream-2);
  border-radius: 12px;
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.docs-cell-chip:hover { background: var(--terra); color: var(--paper); }
.docs-cell-attach {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--cream-2);
  border-radius: 50%;
  font-size: 14px; line-height: 1; color: var(--ink-2);
  cursor: pointer; padding: 0;
}
.docs-cell-attach:hover { background: var(--terra); color: var(--paper); }

.api-key-masked {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--cream-2);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.5px;
}

/* Booking docs list inside transport modal */
.transport-docs-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 8px; }
.transport-doc-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--cream-2);
  border-radius: 4px;
  font-size: 12.5px;
}
.transport-doc-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); text-decoration: none;
}
.transport-doc-name:hover { text-decoration: underline; }

/* =============================================================
   Distance/time table (place modal)
   ============================================================= */
.distance-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 12px;
}
.distance-table th, .distance-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--cream-2);
}
.distance-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}

/* =============================================================
   Budget tab in data table
   ============================================================= */
.budget-summary { padding: 16px 20px; max-height: 70vh; overflow: auto; }
.budget-totals {
  background: var(--cream-2);
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.budget-totals-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 600;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.budget-home-select {
  font-family: inherit; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
}
.budget-grand {
  font-family: var(--display);
  font-size: 28px; font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.budget-fx-note {
  display: block;
  font-size: 11px;
  margin-top: 6px;
}
.budget-totals-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.budget-total-chip {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  padding: 6px 14px;
  border-radius: 6px;
}
.budget-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.budget-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.budget-card h3 {
  margin: 0 0 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 600;
}
.budget-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.budget-table td, .budget-table th {
  padding: 6px 10px;
  border-bottom: 1px solid var(--cream-2);
  text-align: left;
}
.budget-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.budget-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
  border-bottom: 2px solid var(--line);
}
.budget-help { font-size: 11px; }

/* =============================================================
   Place-search autocomplete (transport From/To, etc.)
   ============================================================= */
/* The wrapper sits where a plain <input> would go inside .form-row, so we let the
   inner <input> inherit the standard .form-row input styling (.form-row input
   selector is descendant — matches through this wrapper). */
.place-search-wrap { position: relative; }
.place-search-results {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  z-index: 100;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  max-height: 280px;
  overflow-y: auto;
}
.place-search-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  border-bottom: 1px solid var(--cream-2);
}
.place-search-row:last-child { border-bottom: none; }
.place-search-row:hover { background: var(--cream-2); }
.place-search-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.place-search-addr {
  font-size: 11px;
  color: var(--muted);
}

/* =============================================================
   Standalone bookend days (out-of-trip transport)
   ============================================================= */
.segment.is-standalone {
  --seg-color: var(--muted);
}
.segment.is-standalone .standalone-city {
  font-size: 16px;
  color: var(--ink-2);
  font-style: italic;
  font-weight: 500;
}
.segment.is-standalone.is-heading-home { --seg-color: var(--ink-2); }

/* =============================================================
   Transport map pins (airports / stations / ports / etc)
   ============================================================= */
.transport-pin-icon {
  background: transparent;
  border: none;
}
.transport-pin-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  color: var(--ink);
  line-height: 1;
}
.transport-pin-svg {
  width: 14px; height: 14px;
  display: block;
  color: inherit;
}

/* Inline mode/category icon used inside .itin-icon and .unscheduled-icon
   slots — replaces the old emoji glyphs (✈, 🍽, etc.) with crisp SVGs. */
.glyph-icon {
  width: 16px; height: 16px;
  display: inline-block;
  vertical-align: middle;
  color: var(--ink-2);
}
.transport-pin-tooltip {
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 3px;
}
.transport-pin-tooltip::before { border-top-color: var(--ink) !important; }

/* =============================================================
   Districts control (floating, collapsible panel)
   ============================================================= */
.districts-control {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 600;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  min-width: 200px;
  max-width: 280px;
  font-size: 12px;
  font-family: var(--body);
}
/* Header is now a button (whole-row click to toggle collapse). */
.districts-control-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px 6px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cream-2);
  cursor: pointer;
  text-align: left;
}
.districts-control.is-collapsed .districts-control-head { border-bottom: none; }
.districts-control-head:hover { background: var(--cream-2); }
.districts-control-title { flex: 1; }
.districts-control-count {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--cream-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
}
.districts-control-chev {
  font-size: 10px;
  color: var(--muted);
  width: 10px;
  text-align: center;
}
.districts-control.is-collapsed .districts-control-list { display: none; }
.districts-control-list {
  max-height: 320px;
  overflow-y: auto;
}
.districts-city-group + .districts-city-group {
  border-top: 1px solid var(--cream-2);
}
.districts-city-header {
  padding: 5px 12px 3px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terra);
  font-weight: 600;
  background: var(--cream-2);
}
.district-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--cream-2);
}
.district-row:last-child { border-bottom: none; }
.district-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  border-radius: 3px;
}
.district-toggle:hover { background: var(--cream-2); }
.district-toggle.is-off { opacity: 0.4; }
.district-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1.5px dashed currentColor;
  flex-shrink: 0;
  background-color: currentColor;
  background-clip: padding-box;
}
.district-toggle.is-off .district-swatch {
  background-color: transparent;
}
.district-name {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.district-focus, .district-remove {
  width: 22px; height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
}
.district-focus:hover, .district-remove:hover {
  background: var(--cream-2);
  color: var(--ink);
}
.district-tooltip {
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 4px;
}

/* In share-readonly mode, hide the "remove" buttons on districts */
body.share-readonly .district-remove,
body.share-readonly .districts-tab-action.danger { display: none !important; }

/* =============================================================
   Districts SIDEBAR tab — full per-district detail with linked places
   ============================================================= */
.districts-tab-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 12px;
}
.districts-tab-city-group + .districts-tab-city-group { margin-top: 8px; }
.districts-tab-city-header {
  padding: 8px 18px 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terra);
  font-weight: 600;
  border-bottom: 1px solid var(--cream-2);
  background: var(--cream-2);
}
.districts-tab-card {
  padding: 12px 18px;
  border-bottom: 1px solid var(--cream-2);
}
.districts-tab-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.districts-tab-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1.5px dashed currentColor;
  background-clip: padding-box;
}
.districts-tab-name {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  min-width: 0;
}
.districts-tab-toggle {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--cream-2);
  color: var(--ink-2);
  border: none;
  cursor: pointer;
}
.districts-tab-toggle.is-on { background: #2f7a3a; color: #fff; }
.districts-tab-toggle.is-off { background: var(--cream-2); color: var(--muted); }
.districts-tab-action {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.districts-tab-action:hover { background: var(--cream-2); }
.districts-tab-action.danger { color: #b94939; border-color: #b94939; }
.districts-tab-action.danger:hover { background: #fef0ee; }
.districts-tab-desc {
  margin: 8px 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}
.districts-tab-places {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.districts-tab-place-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--cream-2);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.districts-tab-place-chip:hover { background: var(--cream-3, var(--cream-2)); border-left: 3px solid var(--terra); }
.districts-tab-place-cat {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.districts-tab-place-meta {
  margin-left: auto;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.districts-tab-no-places {
  margin-top: 8px;
  font-size: 11px;
  font-style: italic;
}

/* =============================================================
   Places filter — three dropdowns (City × District × Type)
   ============================================================= */
.places-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.places-filter-select {
  flex: 1 1 30%;
  min-width: 80px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12px;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}
.places-filter-select:focus { outline: none; border-color: var(--ink); }
.places-filter-row .add-place-btn { flex-shrink: 0; }

.panel-help {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* =============================================================
   Inline flight status badge (on itinerary cards)
   ============================================================= */
.flight-status-badge-inline {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 3px;
  background: var(--cream-2);
  color: var(--ink-2);
  vertical-align: 1px;
  font-family: var(--body);
}
.flight-status-badge-inline:empty { display: none; }
.flight-status-badge-inline.is-checking { color: var(--muted); background: var(--cream-2); }
.flight-status-badge-inline.is-scheduled { background: var(--cream-2); color: var(--ink); }
.flight-status-badge-inline.is-active    { background: #2f7a3a; color: #fff; }
.flight-status-badge-inline.is-landed    { background: var(--terra); color: var(--paper); }
.flight-status-badge-inline.is-cancelled,
.flight-status-badge-inline.is-incident,
.flight-status-badge-inline.is-diverted  { background: #b94939; color: #fff; }

/* =============================================================
   Flight live status (transport modal)
   ============================================================= */
.flight-status-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.flight-status-help { font-size: 11px; margin-left: 8px; }
.flight-status-card {
  margin-top: 10px;
  padding: 12px;
  background: var(--cream-2);
  border-radius: 6px;
  font-size: 13px;
}
.flight-status-card.error { background: #fef0ee; color: #b94939; }
.flight-status-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.flight-status-badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 3px; font-weight: 600;
  background: var(--paper); color: var(--ink-2);
}
.flight-status-active     { background: #2f7a3a; color: #fff; }
.flight-status-scheduled  { background: var(--cream-3, var(--cream-2)); color: var(--ink); }
.flight-status-landed     { background: var(--terra); color: var(--paper); }
.flight-status-cancelled  { background: #b94939; color: #fff; }
.flight-status-incident   { background: #b94939; color: #fff; }
.flight-status-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.flight-status-leg { display: flex; flex-direction: column; gap: 2px; }
.flight-status-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}
.flight-delay {
  display: inline-block; margin-left: 4px;
  font-size: 11px; padding: 1px 6px;
  background: var(--gold); color: var(--ink); border-radius: 3px;
  font-weight: 500;
}
.flight-status-cached { margin-top: 6px; font-size: 11px; }

/* Share read-only banner. Anonymous visitors get a hint about asking the owner;
   logged-in viewer collaborators get a different message tied to their role. */
body.share-readonly::before {
  content: "Read-only · ask the owner for an edit link or to add you as a collaborator";
  display: block;
  background: var(--gold);
  color: var(--ink);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1500;
}
/* Logged-in viewer collaborator — they ARE on the trip, just not editing */
body.share-readonly:not(.share-anonymous)::before {
  content: "Viewing as collaborator (read-only) · ask the owner to upgrade you to editor";
  background: var(--cream-2);
  color: var(--ink-2);
}
body.share-readonly .app { margin-top: 26px; height: calc(100vh - 26px); }

/* Hide UI bits visitors can't use in read-only share mode */
/* Share-readonly mode collapses the chat column entirely. display:none on the
   chat-panel alone wasn't enough — the .app CSS grid still reserved the 380px
   column, leaving a beige void where the chat would be. Force the grid template
   to drop that column too. */
body.share-readonly .app { grid-template-columns: 340px 1fr 0 !important; }
body.share-readonly .app.left-collapsed { grid-template-columns: 0 1fr 0 !important; }
body.share-readonly .chat-panel { display: none !important; }
body.share-readonly .edge-right { display: none !important; }
body.share-readonly .map-area { right: 0 !important; }
/* Mobile: hide the Chat tab in the bottom nav since chat is gone */
body.share-readonly .mobile-nav-btn[data-mobile-pane="chat"] { display: none !important; }
/* View-only visitors don't have access to documents — hide the inline doc chips
   (e.g. "ICNEUR_Dakota.pdf" on a flight card) since clicking them would 403. */
body.share-readonly .doc-chip { display: none !important; }
body.share-readonly .add-place-btn,
body.share-readonly #add-segment-btn,
body.share-readonly #add-transport-btn,
body.share-readonly #table-btn,
body.share-readonly #refresh-activity-btn,
body.share-readonly .day-add-btn,
body.share-readonly .upload-btn,
body.share-readonly #reorganize-docs-btn,
body.share-readonly .segment-actions,
body.share-readonly .place-actions,                /* schedule / info / remove on places list */
body.share-readonly .doc-actions,                  /* analyze / remove on doc cards */
body.share-readonly .district-toggle,              /* visibility toggle (mutates server state) */
body.share-readonly .district-remove,
body.share-readonly .districts-tab-toggle,
body.share-readonly .districts-tab-action.danger,
body.share-readonly #place-photos-section,
body.share-readonly .modal-actions [data-act="delete"],
body.share-readonly .modal-actions [data-act="save"],
body.share-readonly .modal-actions [data-act="save-manual"],
body.share-readonly .modal-actions [data-act="create"],
body.share-readonly .modal-actions [data-act="ai-suggest"],
body.share-readonly .modal-actions [data-act="clear"],
body.share-readonly .modal-actions [data-act="unschedule"],
body.share-readonly .modal-actions [data-act="delete-trip"],
body.share-readonly [data-act="reextract-doc"]  /* uses chat which is hidden */
{ display: none !important; }
/* =============================================================
   Chat thread switcher (in chat header)
   ============================================================= */
.thread-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.thread-switcher select {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
}
.thread-switcher .icon-btn-sm {
  width: 22px; height: 22px;
  font-size: 13px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 3px;
  cursor: pointer;
  color: var(--ink-2);
}
.thread-switcher .icon-btn-sm:hover { background: var(--cream-2); color: var(--ink); }

/* =============================================================
   Trip audit modal
   ============================================================= */
.audit-summary {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.audit-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 3px;
}
.audit-pill.warn { background: #fef0ee; color: #b94939; }
.audit-pill.info { background: var(--cream-2); color: var(--ink-2); }
.audit-clear { font-size: 14px; color: var(--ink-2); padding: 12px 0; }
.audit-section-h {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 16px 0 6px;
  font-weight: 600;
}
.audit-list { display: flex; flex-direction: column; gap: 6px; }
.audit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--cream-2);
  border-radius: 4px;
  font-size: 12px;
}
.audit-row.sev-warning { background: #fef0ee; }
.audit-kind {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 110px;
}
.audit-msg { flex: 1; color: var(--ink-2); line-height: 1.4; }
.audit-fix-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
}
.audit-fix-btn:hover { background: var(--terra); }

/* Hide audit button in view-only mode (only owner/editor cares) */
body.share-readonly #audit-btn { display: none !important; }
/* Hide thread switcher in view-only mode (anonymous visitors can't chat anyway) */
body.share-readonly .thread-switcher { display: none !important; }

/* Anonymous-only — these would burn the owner's API quota for no reason */
body.share-anonymous [data-act="check-distance"],
body.share-anonymous [data-act="check-flight-status"] { display: none !important; }

/* Suggestion-pin popup actions (Add / Dismiss) — both would 404 for visitors */
body.share-readonly .popup-add-btn,
body.share-readonly .popup-dismiss-btn { display: none !important; }
/* The trip switcher dropdown's "+ New trip…" option doesn't apply for visitors */
body.share-anonymous .trip-switcher option[value="__new__"] { display: none !important; }
/* Leave-trip stays visible for logged-in viewer collaborators (it's how they
   remove themselves from the trip). delete-trip is owner-only via JS already
   so no need to hide it specifically. */
body.share-readonly .tab[data-tab="activity"] { display: none !important; }

/* Inline-editable city/date affordance disabled — text remains readable but
   the click-to-edit hover/cursor disappears so visitors don't think they can edit. */
body.share-readonly .inline-editable {
  cursor: default !important;
  background: none !important;
  border-bottom: none !important;
}

/* Anonymous-only (true view-link visitors, NOT logged-in viewer collaborators):
   hide account chrome since they have no account here to manage. Logged-in
   viewer collaborators KEEP their user menu so they can leave the trip / log out. */
body.share-anonymous #user-menu-btn { display: none !important; }

/* =============================================================
   Trip header
   ============================================================= */
.trip-header { padding: 22px; border-bottom: 1px solid var(--line); }
#trip-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 144;
}
.trip-dates {
  font-size: 12px;
  color: var(--terra);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.trip-notes {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}

/* =============================================================
   Tabs
   ============================================================= */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  /* Allow horizontal scrolling when tabs overflow (e.g. narrow sidebar / mobile).
     - overflow-x:auto handles scrolling; flex-wrap:nowrap keeps tabs on one line.
     - min-width:0 + width:100% are CRITICAL: in a flex column parent, a flex item
       with display:flex children defaults to its content's intrinsic min-width,
       so it grows to fit all tabs and is then clipped by .sidebar's overflow:hidden
       — never triggering its own scroll. min-width:0 + width:100% pin it to the
       parent's width so overflow-x kicks in.
     - max-width:100% as belt-and-suspenders.
     - position:relative for the fade gradient pseudo-element.
     - -webkit-overflow-scrolling:touch enables momentum on iOS. */
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 0;
  position: relative;
}
.tabs::-webkit-scrollbar { display: none; }
/* Wrapper sits between .sidebar (flex column) and the scrolling .tabs nav so the
   right-edge fade gradient has a non-scrolling positioning context. Explicit
   flex props + min-height keep the row from collapsing when the panel below grows
   to fit a long itinerary. */
.tabs-wrap {
  position: relative;
  display: block;
  width: 100%;
  flex: 0 0 auto;        /* don't grow, don't shrink, take natural size */
  min-height: 41px;      /* tab button height (12+font+12+2 border) — prevents collapse */
  background: var(--paper);
}
.tabs-wrap::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 1px;
  width: 24px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(255,247,242,0), var(--paper));
}
.tab {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); border-color: var(--terra); }
.badge {
  font-size: 10px;
  background: var(--cream-2);
  color: var(--ink-2);
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0;
  font-weight: 600;
}
.tab.is-active .badge { background: var(--terra); color: var(--paper); }

/* =============================================================
   Panel base
   ============================================================= */
.panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel[hidden] { display: none; }
.panel-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--cream-2);
  flex-shrink: 0;
}

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.filter {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  transition: all 0.15s;
  font-weight: 500;
}
.filter:hover { color: var(--ink-2); border-color: var(--ink-2); }
.filter.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* =============================================================
   Places list
   ============================================================= */
.places-list, .docs-list {
  flex: 1; overflow-y: auto; padding: 10px 14px 22px;
}
.place-card, .doc-card {
  background: var(--paper);
  border: 1px solid var(--cream-2);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.place-card.has-photo { padding: 0; overflow: hidden; }
.place-photo {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: var(--cream-2);
}
.place-card.has-photo .place-card-body { padding: 10px 14px 12px; }
.popup-photo {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
  background: var(--cream-2);
}
.modal-photo {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 14px;
  background: var(--cream-2);
}
.place-card:hover, .doc-card:hover {
  border-color: var(--ink);
  transform: translateX(2px);
}
.place-card.is-active {
  border-color: var(--terra);
  background: linear-gradient(to right, rgba(185, 78, 46, 0.04), var(--paper));
}
.place-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  line-height: 1.2;
  padding-right: 24px;
}
.place-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex; gap: 8px; align-items: center;
}
.place-cat {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--terra);
}
.place-cat.hotel { background: var(--gold); }
.place-cat.restaurant { background: var(--terra); }
.place-cat.sight { background: var(--moss); }
.place-cat.bar { background: #6b4cc8; }
.place-cat.beach { background: #2a8aa8; }
.place-cat.transport { background: #5a5a5a; }
.place-notes {
  font-size: 12px;
  color: var(--ink-2);
  margin: 6px 0 0;
  line-height: 1.45;
}
.place-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.place-card:hover .place-actions { opacity: 1; }
.icon-btn-sm {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 4px;
  font-size: 14px;
  color: var(--muted);
  background: var(--cream);
}
.icon-btn-sm:hover { background: var(--ink); color: var(--paper); }

/* =============================================================
   Itinerary
   ============================================================= */
.itin-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.itin-actions-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.itin-actions-row.icon-row { gap: 4px; }
.action-spacer { flex: 1; min-width: 4px; }
.mini-btn {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--cream-2);
  color: var(--ink-2);
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mini-btn:hover { background: var(--ink); color: var(--paper); }
.mini-btn .icon { width: 13px; height: 13px; flex-shrink: 0; }
.mini-btn.icon-only { padding: 6px 8px; }
.mini-btn.icon-only .icon { width: 14px; height: 14px; }

/* Generic icon sizing — defaults to 16px, currentColor */
.icon { width: 16px; height: 16px; vertical-align: -2px; flex-shrink: 0; }
.icon-sm { width: 13px; height: 13px; }
.icon-lg { width: 20px; height: 20px; }

.itinerary {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 22px;
}

.segment {
  margin: 14px 0 18px;
  border-left: 2px solid var(--cream-2);
  padding-left: 14px;
  position: relative;
}
.segment-pin {
  position: absolute;
  left: -8px;
  top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--terra);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--terra);
  padding: 0;
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
}
.segment-pin.is-clickable {
  cursor: pointer;
}
.segment-pin.is-clickable:hover {
  transform: scale(1.4);
  box-shadow: 0 0 0 2px var(--terra), 0 2px 6px rgba(185, 78, 46, 0.4);
}
.segment.travel-block .segment-pin {
  background: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

/* Unscheduled places tray — drag onto any day */
.unscheduled-tray {
  margin: 12px 0 16px;
  padding: 10px 12px;
  background: var(--cream-2);
  border: 1px dashed var(--line);
  border-radius: 6px;
}
.unscheduled-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.unscheduled-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--ink-2);
}
.unscheduled-count {
  font-size: 10px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 600;
}
.unscheduled-hint {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-style: italic;
}
.unscheduled-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.unscheduled-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  cursor: grab;
  transition: all 0.12s;
  max-width: 100%;
}
.unscheduled-item:hover { border-color: var(--terra); transform: translateY(-1px); }
.unscheduled-item:active { cursor: grabbing; }
.unscheduled-item.dragging { opacity: 0.4; }
.unscheduled-icon { font-size: 12px; flex-shrink: 0; }
.unscheduled-name { font-weight: 500; color: var(--ink); }
.unscheduled-cat { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Stand-alone travel blocks (pre/post trip + unscheduled) */
.travel-block {
  margin: 14px 0 18px;
  padding: 10px 12px 12px;
  background: rgba(200, 155, 60, 0.08);
  border: 1px dashed var(--gold);
  border-radius: 6px;
}
.travel-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.travel-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.travel-block .transport-leg {
  background: var(--paper);
  margin-top: 4px;
}
.travel-day {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dashed rgba(200, 155, 60, 0.3);
}
.travel-day:first-of-type {
  margin-top: 8px;
  border-top: none;
  padding-top: 0;
}
.travel-day .day-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 4px;
  font-weight: 600;
}

/* Inter-segment transition — same visual band as pre/post-trip travel blocks. */
.transition {
  margin: 12px 0;
  padding: 10px 12px 12px;
  background: rgba(200, 155, 60, 0.08);
  border: 1px dashed var(--gold);
  border-radius: 6px;
}
.transition-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 6px;
}
.transition .transport-leg {
  background: var(--paper);
  margin-top: 6px;
}

/* Multi-day journey: depart + arrive cards visually linked with the gold travel color
   so it's obvious they're the same trip spanning calendar days. */
.itin-item.phase-depart,
.itin-item.phase-arrive {
  background: rgba(200, 155, 60, 0.08);
  border-left: 3px solid var(--gold);
  border-radius: 0 4px 4px 0;
  padding-left: 6px;
}
.itin-item.phase-depart .itin-icon,
.itin-item.phase-arrive .itin-icon {
  color: var(--gold);
}
.itin-item.phase-depart .itin-title,
.itin-item.phase-arrive .itin-title {
  color: var(--ink);
}
/* Subtle "in transit" indicator on the depart card — animated dots after the title */
.itin-item.phase-depart .itin-title::after {
  content: " · in transit overnight";
  font-size: 11px;
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.itin-item.phase-arrive::before {
  content: "← continued from yesterday";
  display: block;
  position: absolute;
  top: -16px;
  left: 6px;
  font-size: 9px;
  font-style: italic;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.itin-item.phase-arrive { margin-top: 18px; position: relative; }

/* Hover one half → highlight the matching journey-id pair */
.itin-item[data-journey-id]:hover {
  background: rgba(200, 155, 60, 0.18);
}

/* Same treatment for the larger transport-leg cards in pre/post/transition blocks */
.transport-leg.phase-depart,
.transport-leg.phase-arrive {
  border-left: 4px solid var(--gold);
  background: rgba(200, 155, 60, 0.1);
}

/* Tentative transport — no booking ref yet — shown italic + dotted */
.transport-leg.tentative {
  border-left-style: dashed;
  border-left-color: var(--muted);
}
.transport-leg.tentative .transport-route { font-style: italic; opacity: 0.85; }
.transport-leg.tentative::after {
  content: "tentative";
  position: absolute;
  top: 8px; right: 10px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
}
.transport-leg { position: relative; }
.itin-item.tentative .itin-title { font-style: italic; opacity: 0.85; }

/* Drag-and-drop visual states */
.itin-item, .transport-leg { user-select: none; }
.itin-item[draggable="true"] { cursor: grab; }
.itin-item[draggable="true"]:active { cursor: grabbing; }
.itin-item.dragging, .transport-leg.dragging { opacity: 0.4; }
.day-block { transition: background 0.12s, box-shadow 0.12s; border-radius: 4px; }
.day-block.drag-over {
  background: rgba(185, 78, 46, 0.08);
  box-shadow: inset 0 0 0 2px var(--terra);
}
.day-block.drag-over .day-empty { color: var(--terra); font-weight: 500; }

/* Today highlight */
.day-block.is-today {
  background: rgba(185, 78, 46, 0.05);
  box-shadow: inset 3px 0 0 var(--terra);
  padding-left: 6px;
  margin-left: -6px;
}
.today-badge {
  margin-left: 8px;
  display: inline-block;
  background: var(--terra);
  color: var(--paper);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Conflict indicators */
.conflict-banner {
  font-size: 11px;
  color: var(--terra-deep);
  background: rgba(185, 78, 46, 0.08);
  border-left: 2px solid var(--terra);
  padding: 5px 8px;
  margin: 4px 0 6px;
  border-radius: 0 4px 4px 0;
  font-weight: 500;
}
.itin-item.has-conflict {
  background: rgba(185, 78, 46, 0.06);
  border-radius: 4px;
}
.itin-item.has-conflict .itin-time { color: var(--terra-deep); font-weight: 600; }
.itin-item.has-conflict::after {
  content: "⚠";
  position: absolute;
  right: 4px;
  top: 4px;
  color: var(--terra);
  font-size: 12px;
}

/* Multi-day events (conferences, festivals, etc.) — visual indicator across spanning days */
.multi-day-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--moss);
  color: var(--paper);
  font-size: 9px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: middle;
}
.itin-item.is-multi-day {
  border-left: 3px solid var(--moss);
  padding-left: 5px;
  background: rgba(74, 103, 65, 0.04);
}

.schedule-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
  font-style: italic;
  line-height: 1.4;
}
.itin-item { position: relative; }
.segment-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  cursor: pointer;
}
.segment-city {
  font-family: var(--display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.15;
}
.segment-country {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 4px;
}
.inline-editable {
  cursor: text;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.12s;
  display: inline-block;
}
.inline-editable:hover { border-bottom-color: var(--muted); }
.inline-editable.inline-editing { border-bottom-color: var(--terra); }
.inline-edit-input {
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--terra);
  border-radius: 3px;
  padding: 1px 4px;
  outline: none;
  width: auto;
  min-width: 60px;
  max-width: 200px;
}
.seg-date-sep { margin: 0 3px; color: var(--muted); }

.segment-tz {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  color: var(--moss);
  background: rgba(74, 103, 65, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: none;
  vertical-align: middle;
  cursor: help;
}
.segment-dates {
  font-size: 11px;
  color: var(--terra);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  white-space: nowrap;
}
.segment-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.segment-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.segment:hover .segment-actions { opacity: 1; }

.day-block {
  margin-top: 8px;
  padding: 8px 0;
  border-top: 1px dashed var(--cream-2);
}
.day-block:first-of-type { border-top: none; }
.day-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.day-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

.day-label {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
}
.day-label-text { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Mid-day-travel role badges. Surface "→ Departing 13:00" or "Arrived 14:45 →"
   so users instantly see why this date appears under two cities. */
.day-role-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.day-role-badge.is-departure { background: var(--gold); color: var(--ink); }
.day-role-badge.is-arrival   { background: #2f7a3a; color: #fff; }

/* Departure days get a subtle right-edge tint so they read as "winding down here";
   arrival days get a left-edge tint so they read as "starting here". */
.day-block.role-departure { background: linear-gradient(to right, transparent 70%, rgba(200,155,60,0.06)); }
.day-block.role-arrival   { background: linear-gradient(to left,  transparent 70%, rgba(47,122,58,0.06)); }
.weather-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
  font-weight: 500;
  padding: 2px 6px;
  background: var(--cream-2);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.weather-pill .weather-temp { font-size: 10px; color: var(--muted); }
.day-add-btn {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--cream-2);
  color: var(--ink-2);
  border: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: all 0.12s;
  padding: 0;
}
.day-block:hover .day-add-btn { opacity: 1; }
.day-add-btn:hover { background: var(--terra); color: var(--paper); transform: scale(1.1); }

.add-place-btn { margin-left: auto; }

/* Search-first add-place modal */
.manual-entry-details {
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--cream);
  border-radius: 4px;
  border: 1px solid var(--cream-2);
}
.manual-entry-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 0;
  outline: none;
}
.manual-entry-details summary:hover { color: var(--ink); }
.manual-entry-details[open] summary { margin-bottom: 8px; }

#place-search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  font-family: var(--body);
  outline: none;
  transition: border-color 0.15s;
}
#place-search-input:focus { border-color: var(--terra); }

#place-search-results {
  margin-top: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--cream-2);
  background: var(--paper);
}
.search-result:last-child { border-bottom: none; }
.search-result-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}
.search-result-meta {
  font-size: 11px;
  color: var(--muted);
}
.search-result > div { flex: 1; min-width: 0; }
.search-add { flex-shrink: 0; }
.search-loading, .search-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.itin-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 5px 8px;
  margin: 2px -8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.itin-item:hover { background: var(--cream-2); }
.itin-time {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
  width: 38px;
  flex-shrink: 0;
  padding-top: 1px;
  font-weight: 500;
}
.itin-icon {
  width: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 18px;
  color: var(--ink-2);
}
.itin-icon .glyph-icon { width: 14px; height: 14px; }
.unscheduled-icon .glyph-icon { width: 12px; height: 12px; }

/* Depart/Arrive times line on transport rows. Always visible so users know
   when they land — never just "Departing 13:00" with no clue when they arrive. */
.itin-times {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.itin-body { flex: 1; min-width: 0; }
.itin-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  margin: 0;
}
.itin-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.transport-leg {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--cream-2);
  border-radius: 5px;
  border-left: 3px solid var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.transport-leg:hover { border-left-color: var(--terra); }
.transport-route {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 3px;
}
.transport-meta {
  font-size: 11px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.transport-meta strong { color: var(--ink); font-weight: 600; }
.transport-layover {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}
.transport-traveler {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.itin-traveler {
  font-size: 10px;
  color: var(--ink-2);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 4px 4px 0 0;
  padding: 3px 8px;
  background: var(--cream-2);
  color: var(--ink-2);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
  transition: all 0.12s;
}
.doc-chip:hover { background: var(--ink); color: var(--paper); }
.doc-chip .icon { width: 11px; height: 11px; }

/* =============================================================
   Documents
   ============================================================= */
.docs-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px;
  border: 1.5px dashed var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.upload-btn:hover {
  border-color: var(--terra);
  color: var(--terra);
}
.upload-btn.uploading {
  border-style: solid;
  background: var(--cream-2);
}
.doc-card { display: flex; gap: 10px; align-items: flex-start; }
.doc-icon {
  width: 32px; height: 36px;
  background: var(--cream-2);
  border-radius: 3px;
  display: grid; place-items: center;
  font-family: var(--display);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.doc-info { flex: 1; min-width: 0; }
.doc-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.doc-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 20px;
}
.doc-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* =============================================================
   Empty states
   ============================================================= */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-state p {
  margin: 4px 0;
  font-size: 13px;
}
.empty-state .muted { color: var(--muted); }

/* =============================================================
   Map
   ============================================================= */
#map {
  width: 100%;
  height: 100%;
  background: var(--cream-2);
}

.map-overlay-top {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  pointer-events: none;
}

.status-pill {
  background: rgba(28, 26, 23, 0.92);
  color: var(--paper);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
}
.status-pill.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.status-pill.is-thinking::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1.2s infinite;
  vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Custom Leaflet markers */
.leaflet-pin {
  width: 28px; height: 28px;
  background: var(--terra);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid var(--paper);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: grid; place-items: center;
}
.leaflet-pin-inner {
  transform: rotate(45deg);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
}
.leaflet-pin.hotel { background: var(--gold); }
.leaflet-pin.restaurant { background: var(--terra); }
.leaflet-pin.sight { background: var(--moss); }
.leaflet-pin.bar { background: #6b4cc8; }
.leaflet-pin.beach { background: #2a8aa8; }
.leaflet-pin.transport { background: #5a5a5a; }

/* Suggestion pins — half-size, dashed outline, semi-transparent — visually "not yet committed" */
.leaflet-pin.suggestion {
  width: 18px; height: 18px;
  border: 1.5px dashed var(--paper);
  opacity: 0.78;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.leaflet-pin.suggestion .leaflet-pin-inner {
  font-size: 10px;
  transform: rotate(45deg);
}
.leaflet-pin.suggestion:hover { opacity: 1; transform: rotate(-45deg) scale(1.15); }

.popup-add-btn {
  margin-top: 8px;
  display: inline-block;
  padding: 5px 10px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.popup-add-btn:hover { background: var(--terra); }
.popup-dismiss-btn {
  margin-top: 8px;
  margin-left: 4px;
  display: inline-block;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  border: 1px solid var(--line);
  cursor: pointer;
}
.popup-dismiss-btn:hover { color: var(--terra-deep); border-color: var(--terra-deep); }

/* City stop markers — visually distinct from POI pins */
.city-marker {
  width: 32px; height: 32px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: transform 0.15s, border-color 0.15s;
}
.city-marker:hover { transform: scale(1.12); border-color: var(--terra); }

.leaflet-tooltip.city-tooltip {
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.leaflet-tooltip.city-tooltip::before { display: none; }

.leaflet-popup-content-wrapper {
  background: var(--paper);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.leaflet-popup-content {
  margin: 14px 16px;
  font-family: var(--body);
}
.popup-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 15px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.popup-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.popup-notes {
  font-size: 12px;
  color: var(--ink-2);
  margin: 6px 0;
  line-height: 1.45;
}
.popup-address {
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 6px;
  line-height: 1.4;
}
.popup-links {
  font-size: 11px;
  margin: 6px 0;
}
.popup-link {
  color: var(--terra);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.popup-link:hover { border-bottom-color: var(--terra); }
.popup-link-sep { color: var(--muted); }
.popup-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.popup-detail-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
}
.popup-detail-btn:hover { background: var(--terra); }

/* =============================================================
   Chat
   ============================================================= */
.chat-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-title-block { flex: 1; min-width: 0; }
.chat-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.model-picker {
  display: block;
  margin-top: 2px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--body);
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  outline: none;
  max-width: 100%;
  text-overflow: ellipsis;
}
.model-picker:hover { color: var(--ink); }
.model-picker:focus { color: var(--ink); }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 16px;
  color: var(--muted);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--cream-2); color: var(--ink); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.welcome {
  margin: auto 0;
  text-align: left;
  padding: 20px 0;
}
.welcome-line {
  font-family: var(--display);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 14px;
}
.welcome p {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 0 18px;
}
.suggestions { display: flex; flex-direction: column; gap: 6px; }
/* Scope to .suggestions parent — bare `.suggestion` collided with the
   `.leaflet-pin.suggestion` map-marker modifier and added padding/border
   that distorted the pins into spiky bursts on the map. */
.suggestions .suggestion {
  text-align: left;
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--cream-2);
  color: var(--ink-2);
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.suggestions .suggestion:hover {
  background: var(--paper);
  border-left-color: var(--terra);
  color: var(--ink);
  padding-left: 14px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  animation: msg-in 0.25s ease-out;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.user {
  align-self: flex-end;
  align-items: flex-end;
}
.message.assistant {
  align-self: flex-start;
}
.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}
/* User bubbles preserve whitespace (their literal input); assistant bubbles render markdown */
.message.user .bubble { white-space: pre-wrap; }

/* Markdown styling inside assistant bubbles */
.message.assistant .bubble p { margin: 0 0 8px; }
.message.assistant .bubble p:last-child { margin-bottom: 0; }
.message.assistant .bubble strong { font-weight: 600; color: var(--ink); }
.message.assistant .bubble em { font-style: italic; }
.message.assistant .bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}
.message.assistant .bubble ul,
.message.assistant .bubble ol {
  margin: 4px 0 8px;
  padding-left: 22px;
}
.message.assistant .bubble li { margin: 2px 0; }
.message.assistant .bubble a {
  color: var(--terra);
  text-decoration: underline;
  text-decoration-color: rgba(185, 78, 46, 0.4);
}
.message.assistant .bubble a:hover { text-decoration-color: var(--terra); }
.message.assistant .bubble hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 8px 0;
}
/* Headings inside chat bubbles. The renderer maps # → h3, ## → h4, ### → h5,
   #### → h6 because chat is a small visual context where full h1/h2 sizes look
   comically large. Tighter top margin so headings don't push too far from the
   line above (the AI sometimes drops a heading right after a sentence). */
.message.assistant .bubble h3,
.message.assistant .bubble h4,
.message.assistant .bubble h5,
.message.assistant .bubble h6 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  margin: 12px 0 6px;
}
.message.assistant .bubble h3 { font-size: 16px; }
.message.assistant .bubble h4 { font-size: 14px; }
.message.assistant .bubble h5 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.message.assistant .bubble h6 { font-size: 12px; color: var(--muted); }
.message.assistant .bubble h3:first-child,
.message.assistant .bubble h4:first-child,
.message.assistant .bubble h5:first-child,
.message.assistant .bubble h6:first-child { margin-top: 0; }
.message.user .bubble {
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 4px;
}
.message.assistant .bubble {
  background: var(--cream-2);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.message-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 4px;
}
.tool-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--moss);
  margin-top: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tool-indicator::before {
  content: "✓";
  font-weight: bold;
}
.stream-indicators { display: flex; flex-direction: column; }

/* Transport proposal cards (rendered inline in chat) */
.proposal-card {
  margin-top: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}
.proposal-header {
  padding: 10px 14px;
  background: var(--cream-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.proposal-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.proposal-option {
  padding: 12px 14px;
  border-bottom: 1px dashed var(--cream-2);
}
.proposal-option:last-child { border-bottom: none; }
.proposal-mode {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.proposal-time {
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.proposal-tradeoff {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 4px;
  line-height: 1.4;
}
.proposal-tradeoff strong { color: var(--terra); font-weight: 600; }
.proposal-notes {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.4;
}
.proposal-accept {
  width: 100%;
  margin-top: 6px;
  padding: 8px 12px !important;
  font-size: 11px !important;
}
.proposal-accept:disabled { background: var(--cream-2); color: var(--muted); cursor: default; }

.message.streaming .bubble::after {
  content: "▍";
  display: inline-block;
  margin-left: 1px;
  color: var(--terra);
  animation: stream-cursor 1s steps(2, jump-none) infinite;
  vertical-align: baseline;
  font-weight: 400;
}
@keyframes stream-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.typing {
  display: flex; gap: 4px;
  padding: 12px 14px;
  background: var(--cream-2);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.typing span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* =============================================================
   Chat form
   ============================================================= */
.chat-form {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--paper);
}
#chat-input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 13.5px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  color: var(--ink);
  transition: border-color 0.15s;
  outline: none;
}
#chat-input:focus { border-color: var(--ink); }
#send-btn {
  width: 36px; height: 36px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
#send-btn:hover { background: var(--terra); }
#send-btn:disabled { background: var(--line); cursor: not-allowed; }

/* =============================================================
   Modal
   ============================================================= */
.modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(28, 26, 23, 0.45);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s;
}
.modal-card {
  position: relative;
  background: var(--paper);
  border-radius: 8px;
  padding: 28px;
  max-width: 460px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(28, 26, 23, 0.25);
  animation: modal-in 0.25s ease-out;
}
.modal-card.wide { max-width: 900px; max-height: 92vh; padding: 22px; }
.modal-card.fullscreen { max-width: 96vw; width: 96vw; max-height: 92vh; padding: 18px; }

/* =============================================================
   Timeline view — horizontal city strip
   ============================================================= */
.tl-container {
  margin-top: 18px;
  padding: 4px 0 16px;
}
.tl-strip {
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow);
  min-height: 130px;
  scrollbar-width: thin;
}
.tl-block {
  flex: 1 1 auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 130px;   /* keep 1-night cities readable */
  transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  border: none;
  text-align: left;
  font: inherit;
  position: relative;
}
.tl-block:hover {
  filter: brightness(1.08);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.tl-block:active { filter: brightness(0.95); }
.tl-block::after {
  content: "Click for details →";
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.15s;
}
.tl-block:hover::after { opacity: 0.7; }
.tl-city {
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.1;
}
.tl-dates {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
  font-weight: 500;
}
.tl-nights {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.75;
  font-style: italic;
}
.tl-connector {
  width: 14px;
  background: var(--paper);
  position: relative;
  flex-shrink: 0;
}
.tl-connector::before {
  content: "→";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  color: var(--gold);
  font-weight: 600;
}
.tl-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* =============================================================
   Calendar view — month grid color-coded by city
   ============================================================= */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 18px;
  padding: 10px 12px;
  background: var(--cream-2);
  border-radius: 6px;
  font-size: 11px;
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--ink-2);
}
.cal-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.cal-months {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  align-items: start;
}
.cal-month { min-width: 0; }
@media (max-width: 640px) {
  .cal-months { grid-template-columns: 1fr; }
  .cal-month { max-width: 360px; margin: 0 auto; }
}
.cal-month-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--cream-2);
  padding: 2px;
  border-radius: 4px;
}
.cal-day-header {
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 0;
}
.cal-cell {
  aspect-ratio: 1;
  background: var(--paper);
  border-radius: 3px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  font-size: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  transition: transform 0.1s, box-shadow 0.1s;
}
.cal-cell:hover { transform: scale(1.05); box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 2; }
.cal-cell-empty { background: transparent; cursor: default; pointer-events: none; }
.cal-cell-empty:hover { transform: none; box-shadow: none; }
.cal-cell-num {
  font-size: 11px;
  font-weight: 600;
}
.cal-cell-filled { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.cal-cell-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-cell-today {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  z-index: 1;
}
.cal-cell-today .cal-cell-num::after {
  content: " ●";
  color: var(--ink);
  font-size: 8px;
  vertical-align: middle;
}

/* Travel-day split: diagonal gradient where the top-left half is the origin
   city's color and the bottom-right is the destination's. The gradient stops
   at exactly 50% on each side so it reads as a clean angled split, not a fade. */
.cal-cell-split {
  background: linear-gradient(135deg,
    var(--from-bg) 0%, var(--from-bg) 49.5%,
    var(--to-bg)   50.5%, var(--to-bg)   100%);
  /* Subtle inner shadow on both halves */
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}
.cal-cell-split .cal-cell-num {
  /* The day number sits on the origin (top-left) half — color it with the
     origin's foreground so it stays legible regardless of the swatch. */
  color: var(--from-fg);
  text-shadow: 0 0 2px rgba(0,0,0,0.3);
}
.cal-cell-split-label {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.1;
  text-shadow: 0 0 2px rgba(0,0,0,0.35);
}
.cal-cell-split-label > span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cal-cell-arrow { opacity: 0.7; flex-shrink: 0; }

/* Day / City detail popups — slim, no heavy colored band */
.detail-popup {
  --accent: var(--terra);
  position: relative;
  padding-left: 14px;
  border-left: 4px solid var(--accent);
  margin-bottom: 14px;
}
.detail-back {
  position: absolute;
  top: -2px;
  left: -14px;     /* hug the left accent stripe; well clear of the modal × at top-right */
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 4px 10px 4px 0;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  transition: color 0.12s;
}
.detail-back:hover { color: var(--accent); }

.detail-head {
  margin-bottom: 14px;
  margin-top: 22px;        /* leave room for the back button above */
  padding-right: 40px;     /* clear the modal × on the right */
}
.detail-popup:not(:has(.detail-back)) .detail-head { margin-top: 0; }
.detail-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-meta {
  font-size: 12px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.detail-travel-tag {
  font-size: 10px;
  background: var(--gold);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day-detail-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 24px 0;
}
.city-detail-body { gap: 14px; }
.city-detail-day {
  padding-top: 10px;
  border-top: 1px dashed var(--cream-2);
}
.city-detail-day:first-child { border-top: none; padding-top: 0; }
.city-detail-day .day-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}

/* Data table editor */
.table-editor { display: flex; flex-direction: column; height: calc(92vh - 36px); }
.table-editor-head {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.table-editor-head .modal-title { margin: 0; }
.table-editor-tabs { display: flex; gap: 4px; }
.table-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--cream-2);
  color: var(--ink-2);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.table-tab:hover { background: var(--line); }
.table-tab.is-active { background: var(--ink); color: var(--paper); }
.table-tab-count {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 6px;
  border-radius: 999px;
}
.table-tab.is-active .table-tab-count { background: var(--terra); }

.table-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cream-2);
}
.table-editor-toolbar .mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.table-selected-count {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.table-selected-count.has-sel { color: var(--terra); font-weight: 600; }

.table-scroll { flex: 1; overflow: auto; border: 1px solid var(--cream-2); border-radius: 4px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--cream-2);
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}
.data-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--cream-2);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table tbody tr:hover { background: var(--cream); }
.data-table tbody tr.is-selected { background: rgba(185, 78, 46, 0.08); }
.data-table tbody tr.dragging { opacity: 0.4; }
.data-table tbody tr.drag-target { box-shadow: inset 0 -2px 0 var(--terra); }

.checkbox-col { width: 30px; padding-left: 10px !important; padding-right: 0 !important; text-align: center; }
.grip-col {
  width: 22px;
  padding: 0 !important;
  cursor: grab;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}
.grip-col .icon { width: 14px; height: 14px; }
.actions-col { width: 36px; padding: 0 8px !important; text-align: center; }

.table-cell {
  cursor: text;
  transition: background 0.1s;
}
.table-cell:hover { background: rgba(185, 78, 46, 0.08); }
.table-cell.editing { padding: 0 !important; background: var(--paper); }
.table-cell-input {
  width: 100%;
  border: 2px solid var(--terra);
  background: var(--paper);
  font: inherit;
  color: inherit;
  padding: 4px 8px;
  outline: none;
  border-radius: 0;
}

.table-empty {
  padding: 30px !important;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}
.doc-viewer {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--cream-2);
  margin-top: 8px;
}
.doc-viewer-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--cream-2);
  border-radius: 4px;
  margin-top: 8px;
  display: block;
}
.doc-fallback {
  padding: 40px 20px;
  text-align: center;
  background: var(--cream-2);
  border-radius: 4px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
}
.doc-fallback a {
  display: inline-block;
  margin-top: 12px;
  color: var(--terra);
  text-decoration: none;
  font-weight: 500;
}
.doc-fallback a:hover { text-decoration: underline; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  font-size: 26px;
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  line-height: 1;
}
.modal-close:hover { background: var(--cream-2); color: var(--ink); }

.modal-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  padding-right: 30px;
}
.modal-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.modal-section { margin-top: 14px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.modal-section strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.modal-section a { color: var(--terra); text-decoration: none; }
.modal-section a:hover { text-decoration: underline; }
.modal-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--cream-2);
  display: flex;
  gap: 8px;
}
.btn {
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--terra); }
.btn-danger { background: var(--cream-2); color: var(--terra-deep); }
.btn-danger:hover { background: var(--terra); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }

/* =============================================================
   Form fields (modal)
   ============================================================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-top: 8px;
}
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--ink);
  font-family: var(--body);
  outline: none;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { border-color: var(--ink); }
.form-row textarea { resize: vertical; min-height: 60px; }

/* =============================================================
   Scrollbars
   ============================================================= */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* =============================================================
   Print — formal trip dossier (immigration / official use)
   The screen UI is hidden; a separate #print-doc is built in JS
   when Print is clicked, then rendered with the rules below.
   ============================================================= */
#print-doc { display: none; }

@media print {
  @page { margin: 0.55in 0.6in; }
  html, body { background: white; height: auto; overflow: visible; color: black; }
  body { font-family: Georgia, 'Times New Roman', serif; font-size: 10.5pt; line-height: 1.45; }

  /* Hide ALL screen UI */
  body > .app, body > .modal, body > nav, body > #user-menu-btn { display: none !important; }
  body.share-readonly::before { display: none !important; }

  /* Show ONLY the printable doc */
  #print-doc { display: block; }

  .print-cover {
    border-bottom: 2pt solid #000;
    padding-bottom: 16pt;
    margin-bottom: 22pt;
  }
  .print-eyebrow {
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 600;
    color: #555;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin-bottom: 10pt;
  }
  .print-title {
    font-family: Georgia, serif;
    font-size: 26pt;
    font-weight: 600;
    margin: 0 0 14pt;
    letter-spacing: -0.01em;
    line-height: 1.1;
  }
  .print-cover-meta {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10pt;
    font-size: 10pt;
  }
  .print-cover-meta th {
    text-align: left;
    padding: 4pt 12pt 4pt 0;
    width: 130pt;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 9pt;
    letter-spacing: 0.06em;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    vertical-align: top;
  }
  .print-cover-meta td {
    padding: 4pt 0;
    color: #000;
  }

  .print-section {
    margin-top: 18pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-section-title {
    font-family: Georgia, serif;
    font-size: 14pt;
    font-weight: 600;
    margin: 0 0 10pt;
    padding-bottom: 4pt;
    border-bottom: 0.5pt solid #999;
    letter-spacing: -0.005em;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  }
  .print-table th {
    text-align: left;
    padding: 6pt 8pt;
    background: #f5f1ea;
    border-bottom: 1pt solid #555;
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #333;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-table td {
    padding: 5pt 8pt;
    border-bottom: 0.5pt solid #ddd;
    vertical-align: top;
  }
  .print-table tr:nth-child(even) td {
    background: #fafafa;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-table small { color: #666; font-size: 8.5pt; }
  .print-table em { color: #999; font-style: italic; }

  .print-day {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 14pt;
    padding-left: 10pt;
    border-left: 2pt solid #999;
  }
  .print-day-title {
    font-family: Georgia, serif;
    font-size: 11pt;
    font-weight: 600;
    margin: 0 0 6pt;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 0.5pt dashed #ccc;
    padding-bottom: 3pt;
  }
  .print-day-date { color: #000; }
  .print-day-city {
    font-size: 9pt;
    color: #555;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .print-day-list { list-style: none; padding: 0; margin: 0; }
  .print-day-item {
    display: grid;
    grid-template-columns: 60pt 70pt 1fr;
    gap: 8pt;
    padding: 3pt 0;
    font-size: 9.5pt;
    border-bottom: 0.25pt dotted #eee;
  }
  .print-day-item:last-child { border-bottom: none; }
  .print-time {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 600;
    color: #000;
    font-variant-numeric: tabular-nums;
  }
  .print-icon-text {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 8pt;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
  }
  .print-line { color: #000; }
  .print-line small { color: #666; font-size: 8.5pt; }
  .print-line em { color: #777; }

  .print-footer {
    margin-top: 24pt;
    padding-top: 8pt;
    border-top: 0.5pt solid #ccc;
    font-size: 8pt;
    color: #999;
    text-align: center;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  }
}

/* =============================================================
   Mobile bottom-tab nav (hidden on desktop)
   ============================================================= */
.mobile-nav { display: none; }

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 1100px) {
  .app {
    grid-template-columns: 300px 1fr 320px;
  }
}

/* Tablet — collapse to 2-column with chat hidden behind a toggle */
@media (max-width: 900px) and (min-width: 641px) {
  .app {
    grid-template-columns: 280px 1fr 0;
  }
  .app.right-collapsed { grid-template-columns: 280px 1fr 0; }
  .app:not(.right-collapsed) { grid-template-columns: 280px 1fr 320px; }
}

/* Mobile — single pane with bottom-tab nav, full-screen pane swap */
@media (max-width: 640px) {
  .app {
    display: block !important;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: none !important;
    grid-template-columns: none !important;
  }
  .sidebar, .chat-panel, .map-area {
    position: absolute;
    inset: 0;
    border: none !important;
    width: 100%;
    height: calc(100% - 60px);
    transition: opacity 0.18s, transform 0.18s;
  }
  .sidebar, .chat-panel { display: flex !important; flex-direction: column; }

  /* Hide what isn't active */
  body[data-mobile-pane="map"]      .sidebar,
  body[data-mobile-pane="map"]      .chat-panel,
  body[data-mobile-pane="sidebar"]  .map-area,
  body[data-mobile-pane="sidebar"]  .chat-panel,
  body[data-mobile-pane="chat"]     .map-area,
  body[data-mobile-pane="chat"]     .sidebar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    z-index: 0;
  }
  body[data-mobile-pane="map"]      .map-area,
  body[data-mobile-pane="sidebar"]  .sidebar,
  body[data-mobile-pane="chat"]     .chat-panel {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    z-index: 1;
  }

  /* Bottom tab nav */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--paper);
    border-top: 1px solid var(--line);
    z-index: 1000;
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
  }
  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.12s;
    padding: 4px;
  }
  .mobile-nav-icon { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
  .mobile-nav-icon svg { width: 22px; height: 22px; }
  .mobile-nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
  }
  .mobile-nav-btn.is-active { color: var(--terra); }

  /* Hide desktop-only chrome on mobile */
  .panel-toggle, .edge-toggle { display: none !important; }

  /* Larger touch targets and spacing */
  .place-card, .doc-card { padding: 14px; }
  .icon-btn-sm { width: 28px; height: 28px; font-size: 16px; }
  .place-actions { opacity: 1; }   /* Always visible on mobile (no hover) */
  .segment-actions { opacity: 1; }
  .mini-btn { padding: 7px 12px; font-size: 12px; }

  /* Trip header more compact */
  .trip-header { padding: 14px 18px; }
  #trip-name { font-size: 20px; }

  /* Chat input full width with bigger send button */
  #chat-input { font-size: 16px; }   /* prevent iOS zoom-on-focus */
  #send-btn { width: 42px; height: 42px; }

  /* Modal: full-screen on mobile */
  .modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 22px;
  }
  .modal-card.wide { max-width: 100%; }

  /* Brand bar with city pill stays compact */
  .brand { padding: 14px 18px; }
}
