/* ============================================================
   Vakantieplanner — design system
   Dark-mode-first. Accent color is set per trip via --accent.
   ============================================================ */

:root {
  --accent: #7c6cf0;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 80%, white);

  --bg: #0d0d14;
  --bg-elevated: #14141f;
  --panel: rgba(22, 22, 34, 0.72);
  --panel-solid: #16161f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ecedf3;
  --text-dim: #9a9cb0;
  --text-faint: #5c5e72;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
  --radius: 14px;
  --radius-sm: 9px;
  --ok: #3ecf8e;
  --warn: #f0b45c;
  --danger: #ef5f74;
}

[data-theme="light"] {
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-solid: #ffffff;
  --border: rgba(20, 20, 40, 0.09);
  --border-strong: rgba(20, 20, 40, 0.18);
  --text: #1c1d29;
  --text-dim: #5e6075;
  --text-faint: #9b9dae;
  --shadow: 0 8px 32px rgba(30, 30, 60, 0.12);
  --shadow-soft: 0 2px 12px rgba(30, 30, 60, 0.08);
  --accent-text: color-mix(in srgb, var(--accent) 80%, black);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { background-image: radial-gradient(1200px 500px at 15% -10%, var(--accent-soft), transparent 60%); }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }

::selection { background: var(--accent-soft); }

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); background: var(--accent-soft); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.icon { padding: 7px 9px; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn svg.icon { display: block; flex-shrink: 0; }

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 64px; }
label.field { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 12px; }
label.field > span { display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.06em; }
input[type="color"] { padding: 2px; height: 38px; width: 54px; cursor: pointer; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); cursor: pointer; }

/* ---------- Chips / badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge.dreaming { color: #b8a7ff; background: rgba(150, 120, 255, 0.14); }
.badge.planning { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.booked { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.badge.done { color: var(--text-dim); background: color-mix(in srgb, var(--text-dim) 14%, transparent); }
.badge.must { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.badge.nice { color: var(--text-dim); background: color-mix(in srgb, var(--text-dim) 12%, transparent); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 9px;
}

/* ---------- Panels ---------- */

.glass {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ============================================================
   Dashboard
   ============================================================ */

.dash {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.dash-header .sub { color: var(--text-dim); margin-top: 6px; }
.dash-header h1 { font-size: 30px; }
.dash-actions { display: flex; gap: 10px; align-items: center; }

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.trip-card {
  position: relative;
  display: block;
  color: inherit;
  padding: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: rise 0.4s ease backwards;
}
.trip-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration: none;
}
.trip-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent 85%);
}
.trip-card .card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.trip-card h3 { font-size: 18px; }
.trip-card .dest { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.trip-card .dates { color: var(--text-dim); font-size: 12.5px; margin-top: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trip-card .countdown { color: var(--accent-text); font-weight: 650; }
.trip-card .route-preview { margin-top: 14px; height: 56px; opacity: 0.9; }
.trip-card .card-menu { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s ease; }
.trip-card:hover .card-menu { opacity: 1; }
.trip-card.archived { opacity: 0.55; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-state .big { font-size: 44px; margin-bottom: 12px; }
.empty-state h2 { color: var(--text); margin-bottom: 8px; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fade 0.15s ease;
  padding: 20px;
}
.modal {
  width: min(480px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 24px;
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal h2 { font-size: 19px; margin-bottom: 18px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(8px); } }

/* ---------- Toast ---------- */

#toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 550;
  font-size: 13.5px;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease;
}
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ============================================================
   Trip view
   ============================================================ */

.trip-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#map { flex: 1 1 60%; position: relative; background: #0a0a10; }
[data-theme="light"] #map { background: #e8e8ee; }

.map-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.map-topbar > * { pointer-events: auto; }
.map-topbar .title-block {
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.map-topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-topbar .dates { color: var(--text-dim); font-size: 12.5px; white-space: nowrap; }
.map-topbar .spacer { flex: 1; }

.sidebar {
  flex: 0 0 40%;
  max-width: 560px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.3);
  border-left: 1px solid var(--border);
  z-index: 10;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 12px 10px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 9px 13px 11px;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  transition: color 0.15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent-text); }
.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2.5px;
  border-radius: 3px;
  background: var(--accent);
}

.tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 60px;
  scroll-behavior: smooth;
}
.tab-panel::-webkit-scrollbar { width: 10px; }
.tab-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }

.section-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 22px 0 10px;
}
.section-label:first-child { margin-top: 4px; }

/* ---------- Itinerary ---------- */

.day-card {
  padding: 13px 15px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  animation: rise 0.3s ease backwards;
}
.day-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.day-card.today { border-color: var(--accent); }
.day-card .day-head { display: flex; align-items: baseline; gap: 10px; }
.day-card .day-num {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.day-card .day-date { font-weight: 650; font-size: 13.5px; }
.day-card .day-loc { color: var(--text-dim); font-size: 12.5px; margin-left: auto; display: flex; align-items: center; gap: 5px; }
.day-card .day-body { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }

.leg-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.leg-row .leg-meta { color: var(--text-dim); margin-left: auto; font-size: 12px; white-space: nowrap; }

.hl-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  padding: 3px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.hl-row:hover { background: var(--accent-soft); }
.hl-row .hl-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-row.done .hl-title { text-decoration: line-through; color: var(--text-faint); }
.hl-row .cat { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; }
/* row action buttons stay quiet until the row is hovered (always visible on touch) */
.hl-row .btn { opacity: 0.45; transition: opacity 0.13s ease; }
.hl-row:hover .btn, .hl-row .btn:hover { opacity: 1; }

.acc-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.day-note { font-size: 13px; color: var(--text-dim); font-style: italic; }
.day-note-input { font-size: 13px; margin-top: 4px; min-height: 40px; }

/* ---------- Highlight backlog & drag-and-drop scheduling ---------- */

.backlog {
  padding: 13px 15px;
  margin-bottom: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.backlog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 13px;
}
.backlog-head .hint { color: var(--text-faint); font-weight: 400; font-size: 12px; }
.backlog-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.backlog-empty { color: var(--text-faint); font-size: 12.5px; margin-top: 8px; }

.hl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid transparent;
  font-size: 12.5px;
  cursor: grab;
  user-select: none;
  transition: transform 0.12s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.hl-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.hl-chip:active { cursor: grabbing; }
.hl-chip .chip-stop { color: var(--text-faint); font-size: 11px; }
.hl-chip.dragging { opacity: 0.35; }

.hl-row[draggable="true"] { cursor: grab; }
.hl-row.dragging { opacity: 0.35; }

.btn.add-activity {
  width: 100%;
  justify-content: center;
  border-style: dashed;
  color: var(--text-faint);
  background: transparent;
  margin-top: 3px;
}
.btn.add-activity:hover { color: var(--accent-text); border-color: var(--accent); }

.tab-count {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 10.5px;
  text-align: center;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 16px;
}
.picker-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.13s ease, background 0.13s ease;
}
.picker-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.picker-item .picker-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item .picker-stop { color: var(--text-faint); font-size: 11.5px; flex-shrink: 0; }

.day-card.drop-hover,
.backlog.drop-hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hl-time {
  font-size: 11px;
  font-weight: 650;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.hl-att-count { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }

.att-pill-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.att-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.att-pill a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* ---------- Stops tab ---------- */

.stop-card {
  padding: 14px 16px;
  margin-bottom: 12px;
  animation: rise 0.3s ease backwards;
  transition: border-color 0.15s ease, opacity 0.2s ease, transform 0.2s ease;
}
.stop-card.dragging { opacity: 0.4; }
.stop-card.drag-over { border-color: var(--accent); }
.stop-card .stop-head { display: flex; align-items: center; gap: 11px; }
.stop-card .grab { cursor: grab; color: var(--text-faint); font-size: 15px; padding: 2px; }
.stop-card .grab:active { cursor: grabbing; }
.stop-num {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.stop-card h3 { font-size: 15.5px; flex: 1; min-width: 0; }
.stop-card .stop-sub { color: var(--text-dim); font-size: 12px; }
.stop-card .stop-body { margin-top: 12px; display: none; }
.stop-card.open .stop-body { display: block; animation: fade 0.2s ease; }
.stop-card .hl-list { margin: 6px 0; display: flex; flex-direction: column; gap: 2px; }
.mini-form { display: flex; gap: 8px; margin-top: 8px; }
.mini-form input, .mini-form select { font-size: 13px; padding: 6px 9px; }

.nights-stepper { display: inline-flex; align-items: center; gap: 2px; }
.nights-stepper button {
  font: inherit; border: 1px solid var(--border); background: none; color: var(--text-dim);
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer; line-height: 1;
}
.nights-stepper button:hover { color: var(--text); border-color: var(--border-strong); }
.nights-stepper .n { min-width: 52px; text-align: center; font-size: 12.5px; color: var(--text-dim); }

/* Search box */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 50;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.search-result {
  padding: 10px 13px;
  cursor: pointer;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.focused { background: var(--accent-soft); }
.search-result .sub { color: var(--text-dim); font-size: 12px; margin-top: 1px; }

/* ---------- Documents ---------- */

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 16px;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.att-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.att-row .file-icon { font-size: 20px; width: 26px; text-align: center; flex-shrink: 0; }
.att-row .att-info { flex: 1; min-width: 0; }
.att-row .att-label { font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-row .att-sub { color: var(--text-faint); font-size: 11.5px; }
.att-row img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- Overview ---------- */

.budget-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.budget-table td { padding: 7px 4px; border-bottom: 1px solid var(--border); }
.budget-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.budget-table tr.total td { font-weight: 700; border-bottom: none; color: var(--accent-text); }

.pack-row { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-size: 13.5px; }
.pack-row.done span { text-decoration: line-through; color: var(--text-faint); }
.pack-row .del { margin-left: auto; }

/* ============================================================
   Map elements
   ============================================================ */

.stop-marker {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
  cursor: pointer;
  transition: transform 0.15s ease;
  font-family: "Inter", sans-serif;
}
.stop-marker:hover { transform: scale(1.18); }

.hl-marker {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--panel-solid);
  border: 2.5px solid var(--c, var(--accent));
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
}
.hl-marker:hover { transform: scale(1.4); }
.hl-marker.done { opacity: 0.45; }

/* selection state: set when a highlight or day is clicked in the sidebar */
.hl-marker.selected {
  background: var(--c, var(--accent));
  border-color: #fff;
  transform: scale(1.55);
  animation: hl-pulse 1.5s ease-out infinite;
}
.hl-marker.selected:hover { transform: scale(1.7); }
.hl-marker.dimmed { opacity: 0.28; }

@keyframes hl-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, var(--accent)) 55%, transparent); }
  100% { box-shadow: 0 0 0 13px transparent; }
}

.maplibregl-popup-content {
  background: var(--panel-solid) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 16px !important;
  font-family: "Inter", sans-serif !important;
  min-width: 240px;
  max-width: 300px;
}
.maplibregl-popup-tip { border-top-color: var(--panel-solid) !important; border-bottom-color: var(--panel-solid) !important; }
.maplibregl-popup-close-button { color: var(--text-dim) !important; font-size: 18px; right: 6px !important; top: 4px !important; }

.popup-photo {
  height: 74px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 40%, transparent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 10px;
}
.popup-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.popup-sub { color: var(--text-dim); font-size: 12px; margin: 3px 0 8px; }
.popup-hl { font-size: 12.5px; padding: 2px 0; display: flex; gap: 6px; align-items: center; }
.popup-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-top: 9px; }
.popup-acc { font-size: 12.5px; color: var(--text-dim); }

.map-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 550;
  color: var(--accent-text);
  animation: rise 0.25s ease;
}

/* ============================================================
   Photos: day strips, popup grids, lightbox, story mode
   ============================================================ */

.photo-strip { display: flex; gap: 5px; margin-top: 4px; overflow-x: auto; padding-bottom: 2px; }
.photo-strip img {
  height: 54px; width: 54px;
  object-fit: cover;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: transform 0.12s ease;
}
.photo-strip img:hover { transform: scale(1.07); }
.photo-strip .more { align-self: center; flex-shrink: 0; }

.popup-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 9px; }
.popup-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; }

.att-pill img.pill-thumb { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }

.lightbox {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(4, 4, 10, 0.9);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fade 0.15s ease;
}
.lightbox figure { margin: 0; max-width: 88vw; text-align: center; }
.lightbox img { max-width: 88vw; max-height: 80vh; border-radius: 12px; box-shadow: var(--shadow); background: #fff; }
.lightbox figcaption { color: #cfd0dd; margin-top: 10px; font-size: 13.5px; }
.lightbox button {
  position: absolute;
  background: rgba(255, 255, 255, 0.09);
  color: #fff; border: none;
  font-size: 22px; border-radius: 50%;
  width: 44px; height: 44px; cursor: pointer;
}
.lightbox button:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox .lb-close { top: 18px; right: 18px; font-size: 17px; }
.lightbox .lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* Story mode: fullscreen, image first — info stays at the edges */
.story-view {
  position: fixed; inset: 0; z-index: 2500;
  background: #07070c;
  animation: fade 0.25s ease;
}
.story-stage {
  position: absolute; inset: 0;
  padding: clamp(14px, 3vmin, 34px);
}
.story-frame {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: #0b0b12;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}
#story-img { position: absolute; inset: 0; }
#story-img img {
  width: 100%; height: 100%;
  object-fit: cover;   /* fills the frame — the photo owns the screen */
  animation: storyfade 0.6s ease;
}
.story-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 110px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--c, var(--accent)) 32%, #14141c),
    color-mix(in srgb, var(--c, var(--accent)) 62%, #05050a));
  animation: storyfade 0.5s ease;
}
@keyframes storyfade { from { opacity: 0; transform: scale(0.985); } }

.story-scrim {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 38%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
}
.story-meta {
  position: absolute; left: 24px; bottom: 20px; right: 200px;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
.story-meta .story-day {
  font-size: 12px; font-weight: 650;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.story-meta .story-title { font-size: 22px; font-weight: 700; margin-top: 4px; }
.story-meta .story-caption {
  font-size: 13.5px; color: rgba(255, 255, 255, 0.82);
  margin-top: 4px; max-width: 60ch;
}

.story-topbar {
  position: absolute; top: 16px; right: 16px;
  display: flex; gap: 8px; align-items: center;
  z-index: 3;
}
.story-topbar .btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  color: #fff;
  backdrop-filter: blur(8px);
}
.story-topbar .btn:hover { background: rgba(255, 255, 255, 0.22); }
.story-chip { color: rgba(255, 255, 255, 0.7); font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0 4px; }

.story-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.09);
  border: none; color: #fff;
  width: 46px; height: 46px; border-radius: 50%;
  font-size: 24px; cursor: pointer; z-index: 3;
  transition: background 0.15s ease;
}
.story-arrow:hover { background: rgba(255, 255, 255, 0.22); }
.story-arrow.prev { left: 18px; }
.story-arrow.next { right: 18px; }

/* map attribution lives on the main map view; hide it inside the tiny locator */
#story-minimap .maplibregl-ctrl-attrib { display: none; }
#story-minimap {
  position: absolute; right: 20px; bottom: 20px;
  width: 172px; height: 172px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  z-index: 2;
}
@media (max-width: 700px) {
  #story-minimap { width: 112px; height: 112px; right: 12px; bottom: 100px; }
  .story-meta { right: 16px; bottom: 18px; }
  .story-meta .story-title { font-size: 18px; }
  .story-arrow.prev { left: 8px; }
  .story-arrow.next { right: 8px; }
}

/* ============================================================
   Responsive — map on top, sliding bottom sheet
   ============================================================ */

@media (max-width: 900px) {
  .trip-layout { flex-direction: column; }
  #map { flex: 1; }
  .sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto;
    max-width: none;
    min-width: 0;
    height: 62vh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% - 92px));
    transition: transform 0.3s cubic-bezier(0.3, 0.9, 0.3, 1);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateY(0); }
  .sheet-handle {
    display: flex !important;
    justify-content: center;
    padding: 9px 0 2px;
    cursor: grab;
  }
  .sheet-handle::before {
    content: "";
    width: 42px; height: 4.5px;
    border-radius: 3px;
    background: var(--border-strong);
  }
  .map-topbar .dates { display: none; }
}
.sheet-handle { display: none; }

/* ============================================================
   Print — one-page trip summary
   ============================================================ */

@media print {
  body { background: #fff !important; color: #000; font-size: 11px; }
  .map-topbar, #map, .tabs, .dropzone, .btn, .mini-form, .search-wrap, #toast-host, .sheet-handle { display: none !important; }
  .trip-layout { display: block; height: auto; overflow: visible; }
  .sidebar { position: static; max-width: none; min-width: 0; background: #fff; border: none; backdrop-filter: none; transform: none; height: auto; }
  .tab-panel { display: block !important; overflow: visible; padding: 0; }
  .tab-panel[data-print="skip"] { display: none !important; }
  .glass { background: #fff; border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  .day-card { margin-bottom: 6px; padding: 8px 10px; }
  #print-header { display: block !important; margin-bottom: 14px; }
}
#print-header { display: none; }
