/* ── Beach Design — KiteNow ── */
:root {
  --sand:       #fdf8f0;
  --sand-dark:  #f5ede0;
  --coral:      #e07a5f;
  --live-red:   #d63031;
  --teal:       #2a9d8f;
  --teal-light: #3bb5a6;
  --text:       #2d2d2d;
  --text-muted: #8a8a8a;
  --border:     #e8ddd0;
  --warn:       #e08c00;

  /* Wind colours — industry standard */
  --w0:   #ddeeff; /* 0-3 kt   — calm, pale blue */
  --w1:   #aaddcc; /* 3-7 kt   — light, teal-green */
  --w2:   #66bb88; /* 7-12 kt  — gentle, green */
  --w3:   #99cc44; /* 12-17 kt — good, yellow-green */
  --w4:   #ffcc00; /* 17-22 kt — fresh, yellow */
  --w5:   #ff8800; /* 22-28 kt — strong, orange */
  --w6:   #ee3300; /* 28-34 kt — very strong, red */
  --w7:   #aa00cc; /* 34+ kt   — storm, purple */

  --tide:   #1a6eb5;
  --tide-w: 44px;

  --radius: 12px;
  --row-h:  52px;
  --hdr-h:  34px;
}

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

html {
  font-size: 18px;
}
input, textarea, select {
  font-size: 16px !important;
}

/* ── iOS install banner ── */
#ios-install-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #1c1c1e; color: #fff;
  padding: 14px 16px 14px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 9999; align-items: center; gap: 12px;
  font-size: 0.85rem; line-height: 1.4;
}
#ios-install-banner.visible { display: flex; }
#ios-install-banner p { margin: 0; flex: 1; }
#ios-install-banner i.fa-arrow-up-from-bracket { color: #0a84ff; }
#ios-install-close {
  background: none; border: none; color: #aaa; font-size: 1rem;
  cursor: pointer; flex-shrink: 0; padding: 4px;
}
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--sand);
  color: var(--text);
  overscroll-behavior: none;
}

/* ── App shell ── */
#app { display: flex; flex-direction: column; height: 100dvh; max-width: 480px; margin: 0 auto; }

/* ── Token gate screen ── */
#gate-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100dvh; gap: 24px; padding: 32px;
  background: var(--sand);
}
#gate-screen h1 { font-size: 2rem; font-weight: 800; color: var(--teal); letter-spacing: -1px; }
#gate-screen p  { color: var(--text-muted); text-align: center; font-size: 0.9rem; }
#gate-screen input {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: var(--radius); font-size: 1rem; background: #fff;
  text-align: center; letter-spacing: 4px;
}
#gate-screen button {
  width: 100%; padding: 14px; background: var(--coral); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 700;
  cursor: pointer;
}
#gate-error { color: var(--coral); font-size: 0.85rem; display: none; }

.section-header-row { display: flex; align-items: center; justify-content: center; position: relative; }
.btn-add-inline {
  position: absolute; right: 0;
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--teal); color: #fff; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer;
}
#spot-list { display: flex; flex-direction: column; }
.spot-row {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
#spot-list .spot-row:last-child { border-bottom: none; }
.spot-left-col {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 26px;
}
.drag-handle {
  display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 1rem; cursor: grab; touch-action: none;
  width: 26px; height: 26px;
}
.drag-handle:active { cursor: grabbing; }
.spot-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.spot-line1 { display: flex; gap: 5px; align-items: center; }
.spot-line1 [data-field="name"] {
  flex: 1; min-width: 0; height: 36px; padding: 0 10px; font-size: 0.9rem;
  border: 1.5px solid var(--border); border-radius: 7px; background: #fff;
}
.spot-line1 .btn-map-pick { width: 36px; height: 36px; font-size: 0.9rem; flex-shrink: 0; border-radius: 50%; }
.spot-right-col {
  display: flex; align-items: center; flex-shrink: 0;
}
.spot-right-col .btn-spot-del {
  width: 36px; height: 36px; font-size: 1.1rem; flex-shrink: 0;
  background: transparent; border: none; color: #e03535; border-radius: 50%;
}
.field-incomplete { background: #fff7e0 !important; border-color: var(--warn) !important; }
.warn-icon { color: var(--warn); display: none; }
.warn-icon.active { display: inline; }
#confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 510; display: none;
}
#confirm-overlay.visible { display: block; }

/* Reset confirmation bubble */
#reset-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 340; display: none;
}
#reset-confirm-overlay.visible { display: block; }
#reset-confirm-bubble {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-16px);
  width: min(92vw, 440px); background: #fff; border-radius: 18px;
  padding: 20px 22px 18px; z-index: 350;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(.32,1,.53,1);
}
#reset-confirm-bubble.visible {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
#reset-confirm-msg {
  margin: 0 0 16px; font-size: 0.95rem; font-weight: 500; color: var(--text);
  line-height: 1.4;
}
.reset-confirm-btns { display: flex; gap: 10px; }
.reset-confirm-btns button {
  flex: 1; padding: 10px; border-radius: 10px; border: none;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
#reset-confirm-cancel { background: var(--border); color: var(--text); }
#reset-confirm-ok { background: var(--teal); color: #fff; }
#confirm-panel {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-16px);
  width: min(92vw, 440px); background: #fff; border-radius: 18px;
  padding: 20px 22px 18px; z-index: 520;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(.32,1,.53,1);
}
#confirm-panel.visible {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.confirm-title {
  margin: 0 0 6px; font-size: 0.95rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.confirm-title i { color: #e03535; }
.confirm-subtitle { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 16px; }
.confirm-buttons { display: flex; gap: 10px; }
.confirm-btn-cancel {
  flex: 1; padding: 10px; border: none;
  background: var(--border); border-radius: 10px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; color: var(--text);
}
.confirm-btn-delete {
  flex: 1; padding: 10px; border: none; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  background: #e03535; color: #fff; border-radius: 10px;
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
}
.pw-field-wrap { position: relative; }
.pw-field-wrap input { padding-right: 44px !important; }
.btn-pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 0.95rem; padding: 4px; line-height: 1;
}
.btn-icon { width: 36px; height: 36px; border: 1.5px solid var(--border); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.btn-save {
  width: 100%; padding: 14px; background: var(--teal); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 700; cursor: pointer;
}

/* ── Bottom floating bar ── */
#bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--teal);
  box-shadow: 0 -6px 20px rgba(0,0,0,0.15);
  z-index: 250;
}
.btn-panel-active { background: #fff !important; color: var(--teal) !important; }

#btn-spot, #btn-model {
  flex: 1; min-width: 0; height: 42px;
  padding: 0 12px; border-radius: 23px; border: none;
  background: rgba(0,0,0,0.22); color: #fff;
  cursor: pointer; font-size: 0.82rem; font-weight: 700;
  white-space: nowrap; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .15s;
}
#btn-spot span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#btn-spot:active, #btn-model:active { background: rgba(0,0,0,0.38); }

#btn-burger {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.22); color: #fff;
  cursor: pointer; font-size: 1rem; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s;
}
#btn-burger:active { background: rgba(0,0,0,0.38); }

/* ── Burger / display panel ── */
#burger-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  z-index: 199; display: none;
}
#burger-overlay.visible { display: block; }

#burger-panel {
  position: fixed; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: #fff; border-radius: 20px 20px 0 0; overflow: hidden;
  box-shadow: none;
  z-index: 200;
  transform: translateY(100%); transition: transform .3s ease;
}
#burger-panel.visible { transform: translateY(0); box-shadow: 0 -4px 24px rgba(0,0,0,.15); }

.burger-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 12px auto 0;
}
.sheet-header {
  background: var(--teal); flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 16px 12px; gap: 6px;
}
.sheet-header .burger-handle { background: rgba(255,255,255,0.4); margin: 0; }
.sheet-header-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
}
.sheet-spacer { width: 36px; flex-shrink: 0; }
.sheet-title {
  flex: 1; margin: 0; font-size: 1.05rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-sheet-close {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: rgba(0,0,0,0.22); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.burger-content { padding: 12px 0 4px; }
.burger-section-title {
  font-size: 0.9rem; font-weight: 700; color: var(--text); margin: 10px 0 4px;
  text-align: center;
}
.burger-group { margin-bottom: 6px; }
.burger-col-item { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); }
.burger-col-item:last-child { border-bottom: none; }
.burger-drag-handle {
  display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 1rem; cursor: grab; touch-action: none;
  width: 26px; height: 26px; flex-shrink: 0; margin-right: 6px;
}
.burger-drag-handle:active { cursor: grabbing; }
.burger-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 20px;
}
.burger-label { font-size: 0.9rem; font-weight: 500; color: var(--text); flex: 1; }
.burger-sublabel { font-size: 0.7rem; font-weight: 400; color: #aaa; margin-right: 10px; }
.burger-suboptions {
  position: relative; margin-left: 48px; margin-top: -4px; margin-bottom: 6px;
  padding-left: 16px; background: none;
  transition: opacity .2s;
}
.burger-suboptions::before {
  content: ''; position: absolute;
  left: -17px; top: -8px;
  width: 28px; height: 28px;
  border-left: 1.5px solid #ccc;
  border-bottom: 1.5px solid #ccc;
  border-bottom-left-radius: 4px;
}
.burger-suboptions.disabled { opacity: 0.35; pointer-events: none; }
.burger-suboptions .burger-item { padding: 4px 20px 4px 0; }
.burger-suboptions .burger-label { font-size: 0.75rem; }
.burger-group + .burger-section-title {
  border-top: 1px solid var(--teal);
  margin-left: -20px; margin-right: -20px;
  padding-left: 20px; padding-right: 20px;
  padding-top: 14px; margin-top: 4px;
}

/* Toggle switch */
.toggle-switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ddd; border-radius: 26px; cursor: pointer; transition: background .2s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch input:checked + .toggle-slider { background: var(--teal); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Segmented control */
.seg-control {
  display: flex; border: 1.5px solid var(--border); border-radius: 8px;
  overflow: hidden; flex-shrink: 0;
}
.seg-control button {
  padding: 6px 14px; border: none; background: #fff;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  color: var(--text-muted); transition: background .1s, color .1s;
  font-family: inherit;
}
.seg-control button + button { border-left: 1.5px solid var(--border); }
.seg-control button.active { background: var(--teal); color: #fff; }

/* Display visibility rules */
#app.hide-time .cell-time,
#app.hide-time .ch-time { display: none; }
#app.hide-wind .cell-wind,
#app.hide-wind .ch-wind { display: none; }
#app.hide-gust .cell-gust,
#app.hide-gust .ch-gust { display: none; }

#app.hide-dir .cell-dir,
#app.hide-dir .ch-dir { display: none; }
#app.hide-dir-letters .dir-cardinal { display: none; }
#app.hide-dir-deg .dir-deg { display: none; }

#app.hide-tide .cell-tide,
#app.hide-tide .ch-tide,
#app.hide-tide #tide-svg { display: none; }

/* ── Spot meta (name + refresh) ── */
#spot-meta {
  padding: 8px 16px 4px;
  display: flex; align-items: baseline; justify-content: space-between;
}
#spot-name { font-size: 1.15rem; font-weight: 800; color: var(--text); }
#last-refresh { font-size: 0.75rem; color: var(--text-muted); }

/* ── Timeline ── */
#timeline-wrap {
  flex: 1; overflow-y: auto; position: relative;
  padding: 0 0 calc(62px + env(safe-area-inset-bottom, 0px));
  scroll-behavior: smooth;
}
#timeline { display: flex; flex-direction: column; position: relative; }

/* Tide SVG overlay — repositionné en JS sur .cell-tide */
#tide-svg {
  position: absolute; top: 0; left: 0;
  pointer-events: none; z-index: 2; overflow: visible;
}

/* ── Zone separator ── */
.zone-sep {
  height: 1px; background: var(--border);
  margin: 0;
}

/* ── Column headers — élément fixe du layout, hors du scroll ── */
#col-headers {
  display: flex; align-items: stretch;
  padding: 0 8px 0 0; gap: 4px;
  background: var(--teal); flex-shrink: 0;
}
#col-headers > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 13px 0 12px; gap: 1px;
}
.ch-main {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: rgba(255,255,255,0.85); line-height: 1;
}
.ch-unit {
  font-size: 0.68rem; font-weight: 400; color: rgba(255,255,255,0.6);
  line-height: 1; min-height: 0.68rem;
}
.ch-wind  { flex: 1 0 0; }
.ch-gust  { flex: 1 0 0; }
.ch-dir   { flex: 1 0 0; }
.ch-tide  { flex: 1 0 0; }
.ch-temp  { flex: 1 0 0; }
.ch-time  { flex: 1 0 0; }

/* ── Wind row — column layout ── */
.wind-row {
  display: flex; align-items: center;
  min-height: var(--row-h); position: relative;
  padding: 0 8px 0 0; gap: 4px;
  flex-shrink: 0; background: #fff;
  border-bottom: 1px solid var(--border);
}
.wind-row.is-live { background: #fde8ee; border-bottom: none; }
.zone-sep-live { background: var(--live-red); }
.wind-row:has(+ .zone-sep-live) { border-bottom: none; }
.wind-row.is-live + .zone-sep { background: var(--live-red); }

/* Zone icon in left margin */
.zone-label {
  position: absolute; left: 0; top: 0; bottom: 0; width: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  writing-mode: vertical-rl; text-orientation: mixed;
  opacity: 0;
}
.zone-label.visible { opacity: 1; }

/* Coloured cells — wind & gust only */
.cell-wind, .cell-gust {
  flex: 1 0 0; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Direction cell — arrow + cardinal stacked */
.cell-dir {
  flex: 1 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; min-width: 0;
}
.cell-dir .dir-arrow { font-size: 14px; color: rgba(0,0,0,0.5); }
#app.hide-dir-letters:not(.hide-dir-deg) .cell-dir .dir-arrow,
#app:not(.hide-dir-letters).hide-dir-deg .cell-dir .dir-arrow { font-size: 20px; }
#app.hide-dir-letters.hide-dir-deg .cell-dir .dir-arrow { font-size: 28px; }
.cell-dir .dir-cardinal,
.cell-dir .dir-deg { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* Tide placeholder column — SVG overlay se positionne dessus */
.cell-tide {
  flex: 1 0 0;
}

/* Météo cell */
.cell-meteo {
  flex: 1 0 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.cell-meteo i { font-size: 1rem; }
#app.hide-temp-value .cell-meteo i { font-size: 1.4rem; }
.meteo-temp {
  font-size: 0.78rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.wi-sun        { color: #f5a623; }
.wi-moon       { color: #7a8fa6; }
.wi-cloud-sun  { color: #f5a623; }
.wi-cloud      { color: #8a8a8a; }
.wi-fog        { color: #aaa; }
.wi-rain-light { color: #74a9d4; }
.wi-rain       { color: #1a6eb5; }
.wi-rain-heavy { color: #0e4d8a; }
.wi-snow       { color: #74b9e8; }
.wi-snow-heavy { color: #4a9fd4; }
.wi-freeze     { color: #74b9e8; }
.wi-thunder    { color: #e0a020; }
.cell-time {
  flex: 1 0 0; text-align: center;
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Model badge — absolute on first forecast row */
.model-badge {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 2px 7px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 0.65rem; font-weight: 700; color: var(--text-muted);
  background: #fff; cursor: pointer; white-space: nowrap;
}
.model-badge:active { background: var(--sand-dark); }

/* Live indicator (badge + time) — même largeur que cell-temp + cell-time */
.live-indicator {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  width: calc(2.6rem + 4px + 2.8rem); flex-shrink: 0;
}
.live-badge {
  padding: 3px 8px; border-radius: 10px; background: var(--live-red);
  font-size: 0.75rem; font-weight: 700; color: #fff; flex-shrink: 0;
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
}

/* Day label row — sticky sous les col-headers */
.day-sep-sentinel { height: 1px; pointer-events: none; flex-shrink: 0; }
.day-sep {
  position: sticky; top: 0; z-index: 5;
  padding: 5px 16px 5px 12px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
  background: var(--sand-dark); flex-shrink: 0;
  transition: box-shadow .15s;
}
.day-sep.is-stuck { box-shadow: 0 2px 8px rgba(0,0,0,0.10); }

/* Gust label in wind row */
.row-gust {
  font-size: 0.78rem; color: var(--text-muted); margin-left: 4px;
  font-variant-numeric: tabular-nums; align-self: flex-end; padding-bottom: 5px;
}

/* ── Empty state (no spots) ── */
#empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 60px 24px; text-align: center; flex: 1;
}
#empty-state i { font-size: 2.5rem; color: var(--border); }
#empty-state p { font-size: 1rem; color: var(--text-muted); margin: 0; }
#btn-add-first-spot {
  padding: 13px 28px; background: var(--teal); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1rem;
  font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px;
}

/* ── Data warning banner (points 2 & 3) ── */
.no-station-notice {
  padding: 10px 14px; background: #f0f4ff;
  font-size: 0.82rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.no-station-notice i { color: var(--teal); }
.no-station-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--teal); font-weight: 600; font-size: inherit; text-decoration: underline;
}

.data-warnings {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px; background: #fff8e8;
  border-left: 3px solid var(--warn);
  flex-shrink: 0;
}
.data-warning-item {
  font-size: 0.78rem; color: var(--warn); font-weight: 600;
}
.data-warning-stale {
  font-size: 0.78rem; color: var(--text-muted); margin-left: auto;
}

/* ── Loading / error ── */
#loading { display: flex; align-items: center; justify-content: center;
  height: 200px; color: var(--text-muted); font-size: 0.9rem; gap: 10px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#error-msg { padding: 24px; color: var(--coral); font-size: 0.9rem; text-align: center; display: none; }

/* ── Spot & Model bottom panels ── */
#spot-overlay, #model-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  z-index: 199; display: none;
}
#spot-overlay.visible, #model-overlay.visible { display: block; }

#model-dropdown, #spot-dropdown {
  position: fixed; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: #fff; border-radius: 20px 20px 0 0; overflow: hidden;
  box-shadow: none;
  z-index: 200; display: block;
  transform: translateY(100%); transition: transform .3s ease;
}
#model-dropdown.visible, #spot-dropdown.visible { transform: translateY(0); box-shadow: 0 -4px 24px rgba(0,0,0,.15); }

/* .panel-title replaced by .sheet-title inside .sheet-header */
.model-option, .spot-option {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.model-option { padding: 14px 20px 14px 44px; }
.spot-option  { padding: 14px 20px 14px 10px; gap: 8px; }
.model-option { padding: 14px 20px 14px 10px; gap: 8px; }
.model-option:last-child, .spot-option:last-child { border-bottom: none; }
.model-option:active, .spot-option:active { background: var(--sand); }
.so-drag-handle, .mo-drag-handle {
  display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 1rem; cursor: grab; touch-action: none;
  width: 26px; height: 26px; flex-shrink: 0;
}
.so-drag-handle:active, .mo-drag-handle:active { cursor: grabbing; }
.so-check, .mo-check { color: var(--teal); font-size: 0.85rem; opacity: 0; flex-shrink: 0; width: 14px; }
.spot-option.selected .so-check, .model-option.selected .mo-check { opacity: 1; }
.model-option .mo-label { font-weight: 600; font-size: 0.9rem; flex: 1; }
.model-option .mo-range {
  display: flex; align-items: center; gap: 2px;
  font-size: 0.78rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.mo-col  { display: flex; align-items: center; gap: 2px; }
.mo-days { min-width: 2ch; text-align: right; }
.mo-res  { min-width: 4ch; text-align: right; }
.mo-sep  { margin: 0 6px; }
.spot-option .so-label { font-size: 0.9rem; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 7px; }
.so-warn-icon { font-size: 1rem; color: var(--warn); flex-shrink: 0; }
.so-coords {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
  width: 110px;
}
.so-coords i { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }
.so-coords-vals { display: flex; flex-direction: row; gap: 4px; white-space: nowrap; }
.so-coords-missing { color: var(--warn); }
.so-station {
  font-size: 0.78rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums;
  width: 110px; flex-shrink: 0; justify-content: flex-start;
}
.holfuy-icon {
  width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  filter: brightness(0) invert(1) brightness(0.54);
}
.holfuy-icon-warn {
  filter: brightness(0) invert(50%) sepia(1) saturate(5) brightness(0.935);
}
.so-station-missing { color: var(--warn); }

.so-right { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.so-edit-btn, .mo-hide-btn {
  background: rgba(0,0,0,0.32); color: #fff; border: none; cursor: pointer;
  border-radius: 50%; width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}
.so-edit-btn:active, .mo-hide-btn:active { background: rgba(0,0,0,0.5); }

/* ── Map picker modal ── */
#map-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .3s ease;
}
#map-spot-fields {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 14px 12px; background: var(--sand);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  overflow: visible;
}
#map-name-input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; background: #fff; outline: none;
}
#map-name-input:focus { border-color: var(--teal); }
#map-station-wrap { width: 100%; position: relative; }
#map-station-wrap .station-results { z-index: 1100; }
#map-modal.visible { transform: translateY(0); }
#map-hint {
  padding: 10px 14px; background: #f0f7f6; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
}
#map-hint p {
  margin: 0; font-size: 0.8rem; color: var(--text-muted);
  display: flex; align-items: flex-start; gap: 7px; line-height: 1.4;
}
#map-hint i { color: var(--teal); flex-shrink: 0; margin-top: 1px; }
.map-hint-required { color: var(--coral); font-weight: 700; }
#map-hint.hidden { display: none; }
#map-container { flex: 1; min-height: 0; }
#map-coord-inputs {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 0 4px;
}
#map-clear-pin {
  width: 34px; height: 34px; flex-shrink: 0; border: 1.5px solid var(--border);
  background: #fff; border-radius: 8px; cursor: pointer; color: var(--text-muted);
  font-size: 0.9rem; display: none; align-items: center; justify-content: center;
}
#map-clear-pin.visible { display: flex; }
#map-coord-inputs input {
  flex: 1; min-width: 0; height: 38px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.85rem; background: #fff; outline: none;
  font-variant-numeric: tabular-nums;
}
#map-coord-inputs input.invalid { border-color: var(--coral); background: #fff5f5; }
#map-coord-error {
  font-size: 0.75rem; color: var(--coral); display: none;
}
#map-coord-error.visible { display: block; }
#map-coord-revert {
  background: none; border: none; color: var(--coral);
  text-decoration: underline; cursor: pointer; font-size: 0.75rem; padding: 0;
}
#map-container { flex: 1; min-height: 0; }
.btn-map-pick {
  width: 36px; height: 36px; border: none; background: var(--teal);
  border-radius: 50%; cursor: pointer; font-size: 0.9rem; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; color: #fff;
}
.btn-map-pick.field-incomplete {
  background: var(--warn) !important; border: none !important; color: #fff !important;
}
/* ── Station picker (custom combobox) ── */
.station-picker { position: relative; width: 100%; }
.station-search-icon {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.75rem; pointer-events: none; z-index: 1;
}
.station-search {
  width: 100%; height: 36px; padding: 0 30px 0 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s;
}
.station-search:focus { border-color: var(--teal); }
.station-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 400;
  background: #fff; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.14);
  max-height: 210px; overflow-y: auto; display: none;
}
.station-results.open { display: block; }
.station-result-item {
  padding: 11px 14px; font-size: 0.88rem; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background .08s;
  color: var(--text);
}
.station-result-item:last-child { border-bottom: none; }
.station-result-item:hover { background: var(--sand); }
.station-result-item.is-selected { color: var(--teal); font-weight: 700; }
.station-result-item.is-none { color: var(--text-muted); font-style: italic; }

/* Display visibility rules */
#app.hide-temp .cell-meteo,
#app.hide-temp .ch-temp { display: none; }

/* ── Station cluster markers ── */
.leaflet-div-icon.spot-marker,
.leaflet-div-icon.smm-marker {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}
.leaflet-div-icon.smm-marker svg,
.leaflet-div-icon.spot-marker svg {
  width: 30px; height: 41px; overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
