:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --coral: #f97316;
  --ink: #1e293b;
  --muted: #64748b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* editing controls only show once logged in */
body:not(.authed) .auth-only { display: none !important; }

.view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ===== Trips list ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 20px) 20px 12px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
}
.app-header .lock-btn {
  background: rgba(255, 255, 255, 0.18);
  font-size: 1rem;
}
.trip-lock { font-size: 1rem; }
.login-error { color: var(--danger); font-size: 0.85rem; margin: 0 0 12px; }

/* ===== Login gate ===== */
.login-view {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--teal), var(--teal-dark));
  padding: 24px;
}
.login-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
  padding: 30px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo { font-size: 3rem; }
.login-card h1 { margin: 6px 0 4px; font-size: 1.5rem; }
.login-hint { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; }
.login-card input {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  margin-bottom: 12px;
}
.login-card input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.login-card .btn-primary { width: 100%; }
.app-header h1 { margin: 0; font-size: 1.6rem; }
.app-header .subtitle { margin: 2px 0 0; opacity: 0.85; font-size: 0.9rem; }

.trips-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 96px;
}

.trip-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.trip-card .trip-emoji {
  font-size: 1.6rem;
  background: #ccfbf1;
  border-radius: 12px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.trip-card .trip-info { flex: 1; min-width: 0; }
.trip-card h3 { margin: 0 0 2px; font-size: 1.05rem; }
.trip-card p { margin: 0; font-size: 0.82rem; color: var(--muted); }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 24px;
  font-size: 0.95rem;
}
.empty-state .big { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.empty-state-sm {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 18px 12px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* ===== Trip detail ===== */
.trip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 500;
}
.trip-header-text { min-width: 0; flex: 1; }
.trip-edit { font-size: 1rem; }
.trip-header h2 {
  margin: 0;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-header p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.icon-btn {
  border: none;
  background: var(--bg);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
}

#btn-map-toggle.map-toggle-on {
  background: var(--teal);
  color: #fff;
}

#map {
  height: 42dvh;
  flex-shrink: 0;
  z-index: 1;
}
#map.pin-mode { cursor: crosshair; }

/* drag handle to resize the map height */
.map-resize {
  flex-shrink: 0;
  height: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  touch-action: none;
  z-index: 400;
}
.map-resize-grip {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.map-resize:active .map-resize-grip { background: var(--teal); }

.pin-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 1000;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

/* schedule / itinerary tabs */
.trip-tabs {
  display: flex;
  flex-shrink: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.trip-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 11px 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.trip-tab.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}
.tab-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* trip notes (shared by both tabs) */
.trip-notes-input {
  display: block;
  width: 100%;
  min-height: 260px;
  padding: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  resize: vertical;
}
.trip-notes-input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.trip-notes-status {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  min-height: 1em;
}
.trip-notes-readonly {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-size: 0.95rem;
  line-height: 1.5;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
}

/* itinerary tab content */
.itin-block {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.itin-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.95rem;
}
.itin-block .itin-line { padding: 9px 12px; }

/* each ship's cruise details */
.cruise-ship { margin-bottom: 18px; }
.cruise-ship-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 8px;
  font-weight: 700;
  font-size: 1.12rem;
}

/* stateroom & dining — vertical label/value rows */
.cruise-field {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}
.cruise-field:first-child { border-top: none; }
.cf-label { color: var(--muted); flex-shrink: 0; }
.cf-value { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* passengers (display) */
.pax-line {
  padding: 9px 12px;
  border-top: 1px solid var(--border);
}
.pax-line:first-child { border-top: none; }
.pax-line-name { font-weight: 600; font-size: 0.9rem; }
.pax-line-meta { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }

/* daily activity (display) */
.daily-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
}
.daily-thumb {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.daily-thumb img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.daily-cap {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
}

/* trip documents */
.doc-add { display: block; text-align: center; cursor: pointer; }
.daily-grid { /* shared with documents */ }
.doc-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
}
.doc-card .doc-thumb { width: 100%; border: none; border-radius: 0; }
.doc-card .doc-thumb img { object-position: top; }
.doc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
}
.doc-label {
  flex: 1;
  min-width: 0;
  margin-top: 0 !important;
  padding: 7px 8px !important;
  font-size: 0.82rem;
  background: var(--bg);
}
.doc-del { width: 34px; flex-shrink: 0; }

/* PDF thumbnail */
.pdf-thumb {
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #fef2f2;
}
.pdf-badge { font-size: 2.4rem; line-height: 1; }
.pdf-badge-txt { font-size: 0.7rem; font-weight: 700; color: var(--danger); letter-spacing: 0.05em; }

/* inline daily-activity editor */
.dly-edit { padding: 6px; }
.dly-date {
  width: 100%;
  margin-top: 0 !important;
  margin-bottom: 6px;
  padding: 7px 8px !important;
  font-size: 0.8rem;
  background: var(--bg);
}
.dly-edit .doc-meta { padding: 0; }
.dly-label {
  flex: 1;
  min-width: 0;
  margin-top: 0 !important;
  padding: 7px 8px !important;
  font-size: 0.82rem;
  background: var(--bg);
}
.dly-del { width: 34px; flex-shrink: 0; }

/* full-screen photo viewer */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
}
.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 8px);
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}
.lightbox-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  touch-action: pinch-zoom;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
#lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  cursor: zoom-in;
}
#lightbox-img.zoomed {
  max-width: none;
  max-height: none;
  width: 240%;
  margin: 0;
  cursor: zoom-out;
}
.lightbox-cap {
  flex-shrink: 0;
  color: #fff;
  text-align: center;
  font-size: 0.85rem;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px);
}
.lightbox-cap:empty { display: none; }

/* Menu field (collapsible) in the place form */
.menu-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.menu-toggle.has-menu { border-color: var(--teal); color: var(--teal); }
.menu-toggle .menu-chevron { color: var(--muted); }
.menu-toggle[aria-expanded="true"] .menu-chevron { transform: rotate(180deg); }
.menu-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}
.menu-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-row .menu-label { flex: 1; min-width: 0; margin-top: 0; }
.menu-view {
  flex-shrink: 0;
  border: none;
  background: none;
  padding: 0;
  cursor: zoom-in;
}
.menu-view.btn-outline {
  padding: 6px 10px;
  cursor: pointer;
}
.menu-thumb { border-radius: 8px; overflow: hidden; }
.menu-thumb img { display: block; height: 44px; border-radius: 8px; }

/* website link & menu button shown on a place card */
a.place-link,
button.place-menu-btn {
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
button.place-menu-btn { border: 1px solid var(--border); }

/* itinerary "Places" editor */
.sp-sortbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
}
.sp-sortlabel { font-size: 0.82rem; color: var(--muted); }
.sp-sort {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.sp-sort.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.ship-place {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sp-header .place-name {
  flex: 1;
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
}
.sp-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 32px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.ship-place.open .sp-toggle { transform: rotate(180deg); }
.sp-done {
  margin-left: auto;
  width: auto;
  padding: 0 16px;
  color: var(--teal);
  font-weight: 600;
}
.sp-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-body.hidden { display: none; }
.ship-place input,
.ship-place select,
.ship-place textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: var(--bg);
}
.ship-place .sp-name { font-weight: 600; }
.sp-row {
  display: flex;
  gap: 8px;
}
.sp-row .sp-deck { flex: 1; min-width: 0; }
.sp-row .sp-type { flex: 0 0 42%; }
.sp-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}
.ship-place-view { gap: 4px; }
.ship-place-view .place-name { font-size: 1.02rem; }

/* in-app PDF viewer — the close bar stays fixed above the PDF, so there's
   always a way back even when the PDF itself is pinch-zoomed */
.pdfviewer {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
}
.pdfviewer-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
}
.pdfviewer-close {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.pdfviewer-cap {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdfviewer-zoom,
.pdfviewer-open {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.3rem;
  text-decoration: none;
  cursor: pointer;
}
.pdfviewer-open { font-size: 1.2rem; }
.pdfviewer-pages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  text-align: center;
}
.pdfviewer-pages canvas.pdf-page {
  display: block;
  margin: 0 auto 10px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  max-width: none;
}
.pdfviewer-status {
  color: #fff;
  text-align: center;
  padding: 40px 24px;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* daily activity (editor) */
.daily-edit-row {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}
.daily-edit-top { display: flex; gap: 8px; }
.daily-edit-top .daily-date { flex: 1; margin-top: 0; background: var(--card); }
.daily-del { flex-shrink: 0; }
.daily-label { margin-top: 8px !important; background: var(--card); }
.daily-upload { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.daily-edit-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.daily-pick {
  flex: 1;
  margin-bottom: 0;
  text-align: center;
  cursor: pointer;
}

/* passengers (editor) */
.pax-edit-row {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}
.pax-edit-top { display: flex; gap: 8px; }
.pax-edit-top .pax-name { flex: 1; margin-top: 0; background: var(--card); }
.pax-edit-bottom { display: flex; gap: 8px; margin-top: 8px; }
.pax-edit-bottom input { flex: 1; min-width: 0; margin-top: 0; background: var(--card); }

.filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.places-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 90px;
}

.day-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 6px 2px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.day-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.day-header-muted { color: var(--muted); }
.day-route {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  width: 32px;
  height: 30px;
  font-size: 0.95rem;
  cursor: pointer;
}
.day-route:active { background: var(--bg); }

.place-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 4px;
  margin-bottom: 8px;
}
.place-card.visited { opacity: 0.6; }
.place-card.visited .place-name { text-decoration: line-through; }
.place-top {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.place-icon { font-size: 1.45rem; margin-top: 1px; }
.place-info { flex: 1; min-width: 0; }
.place-name { font-weight: 600; font-size: 1.12rem; line-height: 1.25; }
.place-addr {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.place-when {
  display: block;
  width: fit-content;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--teal-dark);
  background: #ccfbf1;
  border-radius: 8px;
  padding: 4px 9px;
  margin-top: 5px;
}
.place-room {
  display: block;
  width: fit-content;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 9px;
  margin-top: 5px;
}
/* itinerary shown on the card */
.itin-toggle {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 0;
  background: none;
  border: none;
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}
.itin-table {
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.itin-line {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.86rem;
  border-top: 1px solid var(--border);
}
.itin-line:first-child { border-top: none; }
.itin-line-date { color: var(--muted); font-weight: 600; }
.itin-line-port { font-weight: 600; }
.itin-line-times { color: var(--teal-dark); font-size: 0.8rem; margin-top: 1px; }
.place-notes {
  position: relative;
  font-size: 0.9rem;
  color: var(--coral);
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  cursor: pointer;
}
.place-notes.expanded { display: block; -webkit-line-clamp: unset; }
/* fade the tail of the 2nd line so it's obvious there's more */
.place-notes.has-more:not(.expanded)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 45%;
  height: 1.15em;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--card));
  pointer-events: none;
}
.notes-toggle {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 0;
  background: none;
  border: none;
  color: var(--teal-dark);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.place-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}
.nav-btn {
  flex: 0 0 auto;          /* compact — sized to content, not stretched */
  height: 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  border-radius: 9px;
  padding: 0 11px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  white-space: nowrap;
}
.nav-walk { background: var(--teal); }
.nav-drive { background: var(--ink); }
.actions-spacer { flex: 1 1 auto; } /* push the icon buttons to the right */
.mini-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 9px;
  font-size: 1.05rem;
  cursor: pointer;
}
.mini-btn.danger { color: var(--danger); }

/* per-place photo (hotel / meal / place) */
.place-photo-wrap {
  position: relative;
  margin-top: 9px;
}
.place-photo {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
}
.place-photo img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}
.place-photo-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--coral);
  color: #fff;
  font-size: 1.9rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.45);
  cursor: pointer;
  z-index: 600;
}

/* ===== Bottom sheets ===== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1100;
  display: flex;
  align-items: flex-end;
}
.sheet {
  background: var(--card);
  width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 86dvh;
  overflow-y: auto;
  animation: slideUp 0.22s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(40%); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 4px auto 10px;
}
.sheet h3 { margin: 0 0 14px; font-size: 1.15rem; }

.sheet label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}
.sheet input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.sheet input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.when-optional { font-weight: 400; color: var(--muted); opacity: 0.7; }

/* itinerary editor in the place sheet */
#itinerary-section { margin-bottom: 12px; }
.itin-head {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.itin-row {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}
.itin-row-top { display: flex; gap: 8px; }
.itin-row-top .itin-port {
  flex: 1;
  margin-top: 0;
  background: var(--card);
}
.itin-del {
  flex-shrink: 0;
  width: 38px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  color: var(--danger);
  font-size: 0.9rem;
  cursor: pointer;
}
.itin-row-times {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.itin-row-times input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  background: var(--card);
  font-size: 0.85rem;
  padding: 9px 8px;
}
#btn-add-stop { margin-bottom: 4px; }
.sheet textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  resize: vertical;
  min-height: 90px;
}
.sheet textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }
.row { display: flex; gap: 10px; }
.row label { flex: 1; }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.btn-primary, .btn-secondary, .btn-outline {
  flex: 1;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
}
.btn-primary { background: var(--teal); color: #fff; border: none; }
.btn-secondary { background: var(--bg); color: var(--ink); border: none; }
.btn-outline {
  display: block;
  width: 100%;
  background: var(--card);
  border: 1.5px dashed var(--teal);
  color: var(--teal-dark);
  margin-bottom: 14px;
}

/* type selector */
.type-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.type-toggle button {
  flex: 1 1 28%;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 9px 6px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.type-toggle button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* search */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.search-results { margin-top: 6px; }
.search-result {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  cursor: pointer;
}
.search-result:active { background: var(--bg); }
.search-result .sr-name { font-weight: 600; }
.search-result .sr-addr { color: var(--muted); font-size: 0.78rem; margin-top: 1px; }
.search-hint { color: var(--muted); font-size: 0.82rem; padding: 8px 2px; }

.picked-summary {
  background: #ccfbf1;
  color: var(--teal-dark);
  font-size: 0.82rem;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.change-loc-btn {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 2px 0 12px;
  cursor: pointer;
}

/* toast */
.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 1200;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

/* map marker */
.poi-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: var(--card);
  border: 2px solid var(--teal);
  border-radius: 50% 50% 50% 4px;
  box-shadow: var(--shadow);
}
.poi-marker.restaurant { border-color: var(--coral); }
.leaflet-popup-content { margin: 12px 14px; }
.popup-name { font-weight: 700; margin-bottom: 8px; }
.popup-actions { display: flex; gap: 6px; }
.popup-actions a {
  text-decoration: none;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
}

/* slightly roomier on tablets/desktop */
@media (min-width: 700px) {
  .trips-list, .places-list { max-width: 820px; margin: 0 auto; width: 100%; }
  .sheet { max-width: 560px; margin: 0 auto; border-radius: 20px; margin-bottom: 24px; }
  .sheet-backdrop { align-items: center; }
}
