/* ── Hutwatch ─────────────────────────────────────────────────────
   Palette drawn from the range itself:
   ink      — wet slate at dusk
   stone    — pale dolomia limestone (panels)
   parchment— sun-bleached scree
   enrosadira — alpenglow coral, the accent
   pine     — high forest
   blaze    — CAI red/white trail marker            */

:root {
  --ink: #23282b;
  --ink-soft: #5c6367;
  --stone: #f4f1ea;
  --parchment: #e9e3d5;
  --line: #d8d1c0;
  --enrosadira: #e86a5e;
  --pine: #37544a;
  --blaze: #c6363c;
  --panel-w: 390px;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(35, 40, 43, 0.18);
  font-family: "Archivo", system-ui, sans-serif;
}

* { margin: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { color: var(--ink); background: var(--parchment); }

#map { position: fixed; inset: 0; }

/* ── Left panel ─────────────────────────────────────────────── */

.panel {
  position: fixed;
  top: 14px; left: 14px; bottom: 14px;
  width: var(--panel-w);
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--stone) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 10;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s;
}
.panel.closed { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }

.masthead {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--line);
}

/* One trail-hut mark is shared by the masthead, favicon and map. */
.brand-mark {
  width: 30px; height: 30px; border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
  display: block;
  flex-shrink: 0;
}

.masthead-text { flex: 1; min-width: 0; }
.masthead h1 {
  font-family: "Bricolage Grotesque", serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.01em;
  line-height: 1;
}
.masthead-sub {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-soft); margin-top: 4px;
}

.panel-toggle, .panel-open {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.panel-toggle { width: 28px; height: 28px; }
.panel-toggle:hover, .panel-open:hover { border-color: var(--ink-soft); }

.panel-open {
  position: fixed; top: 14px; left: 14px; z-index: 10;
  padding: 10px 14px;
  font-family: "Archivo", sans-serif; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow);
}

/* ── Search + route toggles ─────────────────────────────────── */

.planner-form {
  padding: 13px 14px 14px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.28);
}
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.field {
  display: grid; gap: 4px; min-width: 0;
  color: var(--ink-soft); font: 500 10px "IBM Plex Mono", monospace;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.field input, .field select {
  width: 100%; min-width: 0; height: 35px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink); font: 500 12px "Archivo", sans-serif;
  text-transform: none; letter-spacing: 0;
}
.field input:focus, .field select:focus { outline: 2px solid var(--enrosadira); outline-offset: -1px; }
.date-range-control { position: relative; display: block; }
.date-range-button {
  width: 100%; min-height: 43px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 9px;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  cursor: pointer; font: 600 12px "Archivo", sans-serif; text-align: left; text-transform: none; letter-spacing: 0;
}
.date-range-button:hover, .date-range-button[aria-expanded="true"] { border-color: var(--pine); }
.date-range-button i { color: var(--blaze); font-style: normal; }
.date-range-button span:last-child { text-align: right; }
.date-picker {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 100%;
  padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  box-shadow: 0 12px 30px rgba(35,40,43,0.2); color: var(--ink); text-transform: none; letter-spacing: 0;
}
.date-picker[hidden] { display: none; }
.date-picker-head { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; margin-bottom: 8px; }
.date-picker-head strong { text-align: center; font: 700 13px "Bricolage Grotesque", sans-serif; }
.date-picker-head button {
  width: 28px; height: 28px; border: 0; border-radius: 6px; background: var(--stone); color: var(--ink);
  cursor: pointer; font-size: 18px;
}
.date-weekdays, .date-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.date-weekdays i { padding: 3px 0 5px; color: var(--ink-soft); font: 500 8px "IBM Plex Mono", monospace; text-align: center; font-style: normal; }
.date-grid button {
  position: relative; height: 32px; border: 0; background: transparent; color: var(--ink);
  cursor: pointer; font: 500 10px "IBM Plex Mono", monospace;
}
.date-grid button:hover:not(:disabled) { background: var(--stone); border-radius: 6px; }
.date-grid button:disabled { color: #c4bdae; cursor: default; }
.date-grid button.in-range { background: #e5ebe8; }
.date-grid button.range-start { border-radius: 6px 0 0 6px; background: var(--pine); color: #fff; }
.date-grid button.range-end { border-radius: 0 6px 6px 0; background: var(--pine); color: #fff; }
.date-grid button.range-start.range-end { border-radius: 6px; }
.date-picker > small { display: block; margin-top: 8px; color: var(--ink-soft); font-size: 9.5px; text-align: center; }
.route-source {
  margin-top: -5px; color: var(--ink-soft); font: 500 10px "IBM Plex Mono", monospace;
  text-decoration: underline; text-underline-offset: 2px;
}
.plan-submit {
  height: 39px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--pine); color: #fff; font: 600 13px "Archivo", sans-serif;
}
.plan-submit:hover { background: #29443b; }
.plan-submit:disabled { opacity: 0.62; cursor: wait; }
.ferrata-option { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; background: #fff; cursor: pointer; }
.ferrata-option input { width: 15px; height: 15px; accent-color: var(--blaze); }
.ferrata-option span { display: grid; gap: 1px; text-transform: none; letter-spacing: 0; }
.ferrata-option strong { color: var(--ink); font: 600 10.5px "Archivo", sans-serif; }
.ferrata-option small { color: var(--ink-soft); font: 9px "Archivo", sans-serif; }

.planner-meta {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink-soft); font-size: 11px; line-height: 1.4;
}
.planner-results {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.plan-card {
  padding: 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
}
.plan-card.selected { border-color: var(--line); }
.plan-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.plan-card-head > div { display: grid; gap: 2px; }
.plan-card-head strong { font: 700 16px "Bricolage Grotesque", sans-serif; }
.plan-card-head small { color: var(--ink-soft); font-size: 10.5px; }
.route-history { display: flex; gap: 4px; }
.route-history button { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--pine); cursor: pointer; font: 600 8.5px "Archivo", sans-serif; }
.plan-rank { color: var(--blaze); font: 500 9px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.08em; }
.trip-totals { display: flex; gap: 5px; margin-top: 10px; }
.trip-totals span {
  flex: 1; padding: 7px 4px; border-radius: 6px; background: var(--stone);
  color: var(--ink-soft); font: 500 9px "IBM Plex Mono", monospace; text-align: center;
}
.trip-totals b { color: var(--ink); font-weight: 600; }
.availability-key {
  display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: 9px; padding: 7px 8px;
  border-radius: 6px; background: var(--stone); color: var(--ink-soft); font-size: 8.5px;
}
.availability-key span { display: inline-flex; align-items: center; gap: 4px; }
.availability-key i { width: 7px; height: 7px; border-radius: 50%; background: #d39b36; }
.availability-key .available i { background: #2f855a; }
.availability-key .open i { background: #6d9b4c; }
.availability-key .unavailable i { background: #c6363c; }
.availability-key .not-released i { background: #71808a; }
.plan-days { margin-top: 2px; list-style: none; }
.stage { display: grid; grid-template-columns: 25px 1fr; gap: 8px; padding-top: 14px; }
.stage.active { margin: 8px -5px 0; padding: 10px 5px 6px; border-radius: 8px; background: #faf8f3; }
.stage-rail { position: relative; display: flex; justify-content: center; }
.stage:not(:last-child) .stage-rail::after {
  content: ""; position: absolute; top: 24px; bottom: -14px; left: 12px;
  width: 1px; background: var(--line);
}
.day-num {
  z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border: 1px solid var(--pine); border-radius: 50%; background: #fff; color: var(--pine);
  font: 600 9px "IBM Plex Mono", monospace;
}
.stage-body { min-width: 0; padding-bottom: 2px; }
.stage-heading { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 10px; }
.stage-heading > strong { color: var(--ink); font: 600 11px "IBM Plex Mono", monospace; text-transform: uppercase; }
.stage-heading time { flex: 1; }
.stage-open {
  padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--pine);
  cursor: pointer; font: 600 8.5px "Archivo", sans-serif;
}
.stage-open:hover, .stage-open[aria-expanded="true"] { border-color: var(--pine); }
.stage-route { display: flex; align-items: baseline; gap: 5px; margin-top: 4px; min-width: 0; font-size: 12px; }
.stage-route span, .stage-route strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stage-route span { color: var(--ink-soft); }
.stage-route i { color: var(--blaze); font-style: normal; flex: none; }
.stage-route strong { color: var(--ink); }
.stage-effort { display: flex; gap: 12px; margin-top: 6px; color: var(--ink-soft); font: 500 9.5px "IBM Plex Mono", monospace; }
.stage-effort b { color: var(--ink); font-weight: 600; }
.detour-status { padding: 2px 4px; border: 1px solid #ba8b62; border-radius: 4px; color: #80572f; font: 500 8px "IBM Plex Mono", monospace; }
.terrain-warning { padding: 2px 4px; border-radius: 4px; background: #f2e9c8; color: #685315; font: 500 8px "IBM Plex Mono", monospace; white-space: nowrap; }
.terrain-warning.ferrata { background: #f8e3e1; color: var(--blaze); }
.overnight {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center;
  margin-top: 8px; padding: 8px 9px; border-left: 3px solid #a9a08e; border-radius: 5px; background: var(--stone);
}
.overnight.available { border-color: #3d8a60; background: #e5f0e7; }
.overnight.open { border-color: #b08c26; background: #f5edd3; }
.overnight.unavailable { border-color: var(--blaze); background: #f8e3e1; }
.overnight.not_released { border-color: #7b8790; background: #edf0f1; }
.overnight.finish { border-color: var(--pine); background: #e5ebe8; }
.overnight.swappable { cursor: pointer; transition: box-shadow 120ms ease, transform 120ms ease; }
.overnight.swappable:hover { box-shadow: 0 0 0 1px var(--pine); transform: translateY(-1px); }
.overnight-label { color: var(--ink-soft); font: 500 8px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.05em; }
.overnight strong { overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.availability-text { color: var(--ink-soft); font-size: 9.5px; }
.stay-link { grid-column: 2; grid-row: 1 / span 2; color: var(--pine); font-size: 9.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.stay-link:hover { text-decoration: underline; }
.stage-detail[hidden] { display: none; }
.stage-detail { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.stage-detail-stats { display: grid; grid-template-columns: 0.8fr 1.35fr 1fr; gap: 5px; }
.stage-detail-stats span { display: grid; gap: 2px; padding: 6px; border-radius: 5px; background: #fff; }
.stage-detail-stats small { color: var(--ink-soft); font: 500 7.5px "IBM Plex Mono", monospace; text-transform: uppercase; }
.stage-detail-stats b { font-size: 9.5px; white-space: nowrap; }
.elevation-profile { margin-top: 7px; height: 98px; border-radius: 6px; overflow: hidden; background: linear-gradient(#eef2ef, #fff); }
.elevation-profile svg { width: 100%; height: 100%; overflow: visible; }
.profile-area { fill: rgba(55,84,74,0.13); }
.profile-line { fill: none; stroke: var(--pine); stroke-width: 2; vector-effect: non-scaling-stroke; }
.elevation-profile text { fill: var(--ink-soft); font: 7px "IBM Plex Mono", monospace; }
.profile-empty { margin-top: 7px; padding: 14px; border-radius: 6px; background: var(--stone); color: var(--ink-soft); font-size: 9.5px; text-align: center; }
.stage-actions { display: flex; gap: 6px; margin-top: 7px; }
.change-night, .edit-path {
  flex: 1; padding: 8px; border: 1px solid var(--pine); border-radius: 6px;
  background: #fff; color: var(--pine); cursor: pointer; font: 600 10px "Archivo", sans-serif;
}
.change-night:hover, .edit-path:hover { background: #e5ebe8; }
.change-night:disabled, .edit-path:disabled { opacity: 0.6; cursor: wait; }
.route-edit-panel:empty { display: none; }
.route-edit-panel { margin-top: 7px; }
.edit-instruction, .reroute-preview, .reroute-error {
  display: grid; gap: 5px; padding: 9px; border: 1px solid #8ab1bc; border-radius: 6px; background: #edf5f6;
}
.edit-instruction strong { font-size: 10.5px; }
.edit-instruction span, .reroute-error span { color: var(--ink-soft); font-size: 9.5px; line-height: 1.35; }
.edit-instruction button, .reroute-error button { justify-self: end; border: 0; background: none; color: var(--pine); cursor: pointer; font: 600 9px "Archivo", sans-serif; }
.reroute-loading { padding: 9px; border-radius: 6px; background: #edf5f6; color: var(--ink-soft); font-size: 9.5px; }
.preview-label { color: #17718a; font: 600 8px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.reroute-warnings { display: flex; flex-wrap: wrap; gap: 4px; }
.reroute-warnings span { padding: 3px 5px; border-radius: 4px; background: #f8e3e1; color: var(--blaze); font: 500 8.5px "IBM Plex Mono", monospace; }
.reroute-no-warning { color: var(--pine); font-size: 9px; }
.preview-changes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.preview-changes span { display: grid; gap: 2px; padding: 6px; border-radius: 5px; background: #fff; }
.preview-changes small { color: var(--ink-soft); font: 500 7.5px "IBM Plex Mono", monospace; text-transform: uppercase; }
.preview-changes b { font-size: 9.5px; }
.preview-changes em { color: var(--ink-soft); font: 500 7.5px "IBM Plex Mono", monospace; font-style: normal; }
.preview-actions { display: flex; justify-content: end; gap: 5px; }
.preview-actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); cursor: pointer; font: 600 9px "Archivo", sans-serif; }
.preview-actions button:last-child { border-color: #17718a; background: #17718a; color: #fff; }
.hut-options { display: grid; gap: 5px; margin-top: 7px; }
.hut-options-title, .no-hut-options { color: var(--ink-soft); font-size: 9.5px; line-height: 1.4; }
.hut-option {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; width: 100%; padding: 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; text-align: left;
}
.hut-option:hover:not(:disabled) { border-color: var(--pine); }
.hut-option:disabled { opacity: 0.55; cursor: not-allowed; }
.hut-option-name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.hut-option-name i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #d39b36; }
.hut-option.available .hut-option-name i { background: #2f855a; }
.hut-option.open .hut-option-name i { background: #6d9b4c; }
.hut-option.unavailable .hut-option-name i { background: var(--blaze); }
.hut-option.not_released .hut-option-name i { background: #71808a; }
.hut-option-name strong { overflow: hidden; font-size: 10.5px; white-space: nowrap; text-overflow: ellipsis; }
.hut-option-name small { color: var(--ink-soft); font-size: 8px; white-space: nowrap; }
.hut-option-status { color: var(--ink-soft); font: 500 8.5px "IBM Plex Mono", monospace; white-space: nowrap; }
.hut-option-days { grid-column: 1 / -1; color: var(--ink-soft); font-size: 8.5px; }

.controls { padding: 12px 14px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }

#search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: 500 13px "Archivo", sans-serif;
  color: var(--ink);
}
#search:focus { outline: 2px solid var(--enrosadira); outline-offset: -1px; border-color: transparent; }
#search::placeholder { color: var(--ink-soft); }

.route-toggles { display: flex; gap: 8px; }
.route-picker { border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.route-toggle {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 0; background: transparent; cursor: pointer; text-align: left;
  font: 600 12px "Archivo", sans-serif; color: var(--ink);
}
.route-toggle-label { flex: 1; }
.route-summary { font: 500 11px "IBM Plex Mono", monospace; color: var(--ink-soft); }
.route-none { font: 500 10px "IBM Plex Mono", monospace; color: var(--ink-soft); padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; }
.route-none:hover { color: var(--blaze); border-color: var(--blaze); }
.route-caret { color: var(--ink-soft); transition: transform 0.2s; }
.route-picker.open .route-caret { transform: rotate(180deg); }
.route-list { list-style: none; display: none; max-height: 240px; overflow-y: auto; border-top: 1px solid var(--line); }
.route-picker.open .route-list { display: block; }
.route-row {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; cursor: pointer;
  font: 500 12px "Archivo", sans-serif; color: var(--ink-soft);
}
.route-row:hover { background: var(--stone); }
.route-row.on { color: var(--ink); }
.route-row:not(.on) .swatch { opacity: 0.2; }
.route-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-km { font: 500 10.5px "IBM Plex Mono", monospace; color: var(--ink-soft); }
.swatch { width: 16px; height: 4px; border-radius: 2px; flex: none; }

/* ── Hut list ───────────────────────────────────────────────── */

.list-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 16px 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}
.meta-note { letter-spacing: 0.05em; }

.hut-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 6px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.hut-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  user-select: none;
}
.hut-row:hover, .hut-row.active { background: var(--parchment); }
.hut-row.active { outline: 1px solid var(--line); }

.hut-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--enrosadira);
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(35,40,43,0.25);
  flex-shrink: 0;
}

.hut-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hut-ele {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.panel-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 7px;
}
.foot-legal a { color: var(--ink-soft); }
.soon-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--enrosadira);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }

/* ── Map controls (right) ───────────────────────────────────── */

.map-ctl {
  position: fixed; top: 14px; right: 14px; z-index: 10;
  display: flex; flex-direction: column; gap: 8px;
}
.ctl-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--stone) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font: 600 13px "Archivo", sans-serif;
  color: var(--ink-soft);
  cursor: pointer;
}
.ctl-btn.on { color: var(--enrosadira); border-color: var(--enrosadira); }
.ctl-btn:hover { border-color: var(--ink-soft); }

/* ── Popup ──────────────────────────────────────────────────── */

.maplibregl-popup-content {
  font-family: "Archivo", sans-serif;
  background: var(--stone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-width: 220px;
  color: var(--ink);
}
.maplibregl-popup-tip { border-top-color: var(--stone) !important; border-bottom-color: var(--stone) !important; }
.maplibregl-popup-close-button { font-size: 18px; color: var(--ink-soft); right: 6px; top: 4px; }

.hut-photo { margin: 0; overflow: hidden; background: #e7e2d8; }
.hut-photo-image { display: block; }
.hut-photo img { width: 100%; display: block; object-fit: cover; }
.hut-photo figcaption {
  overflow: hidden;
  color: var(--ink-soft);
  font: 8px/1.35 "Archivo", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hut-photo figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.popup-photo { margin: -14px -16px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.popup-photo img { height: 142px; }
.popup-photo figcaption { padding: 5px 16px 6px; }
.maplibregl-popup-content:has(.popup-photo) .maplibregl-popup-close-button {
  top: 7px;
  right: 7px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
}

.pop-name {
  font-family: "Bricolage Grotesque", serif;
  font-weight: 600; font-size: 17px; line-height: 1.15;
  margin-bottom: 3px; padding-right: 12px;
}
.pop-ele {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px; color: var(--ink-soft);
  margin-bottom: 10px;
}
.pop-facts { display: grid; gap: 4px; font-size: 12px; margin-bottom: 10px; }
.pop-facts a { color: var(--pine); font-weight: 600; text-decoration: none; }
.pop-facts a:hover { text-decoration: underline; }

.pop-avail {
  border-top: 1px dashed var(--line);
  padding-top: 9px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.pop-avail.live { display: block; }
.pop-avail-head { margin-bottom: 5px; }
.pop-avail-head b { font-weight: 500; }
.pop-avail-head .t-ok { color: #3e7a55; }
.pop-avail-head .t-full { color: var(--blaze); }
.pop-avail-head a, .pop-avail a { color: var(--pine); font-weight: 600; text-decoration: none; }
.pop-avail-foot { margin-top: 5px; font-size: 9.5px; }
.pop-avail .days { display: flex; gap: 2.5px; }
.pop-avail .d {
  width: 11px; height: 14px; border-radius: 2.5px;
  background: var(--line);
}
.pop-avail .d.ok     { background: #55925f; }
.pop-avail .d.low    { background: #e0a53c; }
.pop-avail .d.full   { background: var(--blaze); }
.pop-avail .d.open   { background: #9db8a4; }
.pop-avail .d.closed { background: repeating-linear-gradient(135deg, #c9c2b2 0 2px, #efeadf 2px 4px); }
.pop-avail .d.unk    { background: var(--line); }
.soon-dot.live { background: #55925f; animation: none; }

/* keyboard focus */
:focus-visible { outline: 2px solid var(--enrosadira); outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 82vh;
           border-radius: var(--radius) var(--radius) 0 0; }
  .panel.closed { transform: translateY(110%); }
  .panel-open { top: auto; bottom: 14px; }
}

/* ── Account / alerts ───────────────────────────────────────── */

.acct-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; cursor: pointer; height: 28px; padding: 0 10px;
  font: 600 12px "Archivo", sans-serif; white-space: nowrap; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis;
}
.acct-btn:hover { border-color: var(--ink-soft); }
.acct-btn.in { color: var(--pine); border-color: var(--pine); }

.modal-back[hidden], .toast[hidden] { display: none; }
.modal-back {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(35,40,43,0.35); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  position: relative; width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto;
  background: var(--stone); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 22px 20px;
}
.modal-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 22px; color: var(--ink-soft); cursor: pointer; }
.modal h2 { font-family: "Bricolage Grotesque", serif; font-weight: 600; font-size: 20px; line-height: 1.15; margin-bottom: 6px; padding-right: 20px; }
.modal p { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 12px; }
.modal .plan { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft); margin-bottom: 14px; }
.modal .plan b { color: var(--pine); font-weight: 500; }
.modal .field { display: grid; gap: 5px; margin-bottom: 10px; }
.modal .field label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.modal .field input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font: 500 14px "Archivo", sans-serif; color: var(--ink);
}
.modal .field input:focus { outline: 2px solid var(--enrosadira); outline-offset: -1px; border-color: transparent; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  font: 600 13px "Archivo", sans-serif; background: var(--blaze); color: #fff;
}
.btn:hover { filter: brightness(0.95); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-soft); filter: none; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.full { width: 100%; }
.form-err { font-size: 12px; color: var(--blaze); margin: 6px 0 0; }
.form-err:empty { display: none; }

.watch-list { list-style: none; display: grid; gap: 8px; margin: 12px 0 16px; }
.watch {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
.watch .w-name { font-weight: 600; font-size: 13px; }
.watch .w-meta { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft); grid-column: 1; }
.watch .w-del { grid-row: 1 / span 2; border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 18px; padding: 4px; }
.watch .w-del:hover { color: var(--blaze); }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.modal-foot .email { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { border: 0; background: none; color: var(--pine); font: 600 12px "Archivo", sans-serif; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.empty { font-size: 13px; color: var(--ink-soft); padding: 14px 0; text-align: center; border: 1px dashed var(--line); border-radius: 8px; margin: 12px 0 16px; }


.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  font: 500 13px "Archivo", sans-serif; box-shadow: var(--shadow); max-width: 90vw;
}
@media (max-width: 640px) { .toast { bottom: auto; top: 14px; } }
.upgrade {
  display: grid; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 0 0 14px; font-size: 13px; line-height: 1.45;
}
.upgrade.pro { grid-template-columns: 1fr auto; align-items: center; color: var(--pine); font-family: "IBM Plex Mono", monospace; font-size: 11.5px; }
.upgrade-btns { display: flex; gap: 8px; }
.upgrade-btns .btn { flex: 1; }

/* ── saved trips (account modal) + planner "Alert me" ── */
.trip-summary-actions > #saveTrip { background: var(--pine); color: #fff; border-color: var(--pine); }
.trip-summary-actions > #saveTrip:hover { background: #29443b; }
.trip-summary-actions > #saveTrip:disabled { opacity: 0.6; cursor: wait; }
.modal-sub { font: 600 10px "IBM Plex Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 4px 0 8px; }
.trip-list { list-style: none; display: grid; gap: 10px; margin: 12px 0 16px; max-height: 46vh; overflow-y: auto; }
.trip { border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; padding: 10px 12px; }
.trip .t-head { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: start; }
.trip .t-head > * { grid-column: 1; }
.trip .t-route { color: var(--blaze); font: 600 9px "IBM Plex Mono", monospace; letter-spacing: 0.07em; text-transform: uppercase; }
.trip .t-dates { font: 700 15px "Bricolage Grotesque", sans-serif; grid-column: 1; }
.trip .t-meta { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-soft); grid-column: 1; line-height: 1.4; }
.trip .t-meta .ok { color: #2f855a; font-weight: 500; }
.trip .t-head > .w-del { grid-column: 2; grid-row: 1 / span 2; border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 18px; padding: 0 2px; }
.trip .w-del:hover { color: var(--blaze); }
.trip .t-nights { list-style: none; margin: 8px 0 0; display: grid; gap: 4px; }
.trip .t-nights li { display: grid; grid-template-columns: 8px 1fr; column-gap: 8px; align-items: center; font-size: 12.5px; }
.trip .t-nights li i { width: 8px; height: 8px; border-radius: 50%; background: #d39b36; }
.trip .t-nights li i.available { background: #2f855a; }
.trip .t-nights li i.unavailable { background: #c6363c; }
.trip .t-nights li small { grid-column: 2; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-soft); }
.trip .t-nights li small b { color: var(--pine); font-weight: 500; }
.upgrade.nudge { outline: 2px solid var(--enrosadira); outline-offset: 2px; }
.modal .fine { font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; margin: 10px 0 0; }
.modal .fine b { color: var(--ink); font-weight: 600; }
.form-ok { font-size: 13px; color: #2f855a; background: #eef6f0; border: 1px solid #cfe3d5; border-radius: 8px; padding: 9px 11px; margin: 0 0 12px; line-height: 1.45; }
.trip.compact { margin: 6px 0 12px; }
.trip.compact .t-nights { max-height: 22vh; overflow-y: auto; }
.upgrade.choose { gap: 8px; padding: 8px; }
.plan-opt { display: grid; gap: 4px; padding: 9px 10px; border-radius: 7px; border: 1px solid var(--line); }
.plan-opt.current { background: var(--stone); border-style: dashed; }
.plan-opt b { font-size: 13px; }
.plan-opt span { font-size: 12px; color: var(--ink-soft); }
.plan-opt em { font: 500 10px "IBM Plex Mono", monospace; color: var(--pine); text-transform: uppercase; letter-spacing: 0.06em; }
.plan-opt .upgrade-btns { margin-top: 4px; }
