/* Bonasea — theming + layout */
:root {
  /* Bonasea design manual — tokens. Legacy variable names below stay as aliases
     so screens not yet redesigned pick up the new palette automatically. */
  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 22px;          /* card */
  --radius-sm: 14px;       /* row / field / button */
  --radius-row: 16px;      /* day row */
  --radius-tile: 18px;     /* instrument tile */
  --tr: .18s ease;
  /* water & gold scales (theme-independent) */
  --pale: #D9E7EC; --soft: #A9CFDC; --sky: #BEDDE8; --bright: #5FA9C4; --vivid: #1C7E9C; --mid: #15586F; --deep: #124E64;
  --gold: #EFA436; --gold-light: #F8CE7B; --gold-pale: #F4D399; --gold-cream: #FDF0D6; --gold-sand: #F8D389;
  --gold-ink: #5A3A05; --gold-ink-strong: #3D2703; --gold-label: #7A5205;
  --grad-gold: linear-gradient(120deg, #F8CE7B, #EFA436);
  --grad-best: linear-gradient(120deg, #FDF0D6, #F8D389);
  --score-track: linear-gradient(90deg, #D9E7EC, #A9CFDC, #5FA9C4, #F4D399, #EFA436);
}
[data-resolved-theme="light"] {
  --sand: #F7F3EA; --surface: #FFFFFF; --inset: #F2F6F7; --chip: #EDF2F4;
  --ink: #08303F; --body: #0C3A4E; --muted: #3D6273; --faint: #4F6B78;
  --line: rgba(12,58,78,.10); --line-strong: rgba(12,58,78,.20);
  --shadow-card: 0 8px 26px rgba(9,52,70,.07); --shadow-row: 0 4px 14px rgba(9,52,70,.05); --shadow-sheet: 0 -14px 40px rgba(9,52,70,.22);
  --tabbar-bg: rgba(247,243,234,.94);
  --on-gold: var(--gold-ink-strong);
  /* legacy aliases */
  --bg: var(--sand); --bg-grad: none; --surface-2: var(--inset); --border: var(--line);
  --text: var(--ink); --text-2: var(--faint);
  --accent: var(--mid); --accent-2: var(--gold); --accent-soft: var(--gold-cream);
  --ok: var(--gold); --ok-soft: var(--gold-cream); --warn: var(--bright); --warn-soft: #E7F1F5;
  --bad: var(--soft); --bad-soft: #EEF4F7; --danger: var(--gold-label); --danger-soft: var(--gold-cream);
  --chip-na: var(--chip); --shadow: var(--shadow-card);
}
[data-resolved-theme="dark"] {
  --sand: #061F2A; --surface: #0C3A4E; --inset: #0A2E3D; --chip: rgba(234,244,247,.10);
  --ink: #EAF4F7; --body: #FFFFFF; --muted: rgba(234,244,247,.72); --faint: rgba(234,244,247,.60);
  --line: rgba(255,255,255,.12); --line-strong: rgba(255,255,255,.22);
  --shadow-card: 0 8px 26px rgba(0,0,0,.35); --shadow-row: 0 4px 14px rgba(0,0,0,.30); --shadow-sheet: 0 -14px 40px rgba(0,0,0,.50);
  --tabbar-bg: rgba(6,31,42,.94);
  --grad-gold: linear-gradient(120deg, #8A6220, #C98A2A);
  --grad-best: linear-gradient(120deg, #4A3410, #7A5620);
  --on-gold: #FDF0D6;
  --bg: var(--sand); --bg-grad: none; --surface-2: var(--inset); --border: var(--line);
  --text: var(--ink); --text-2: var(--faint);
  --accent: var(--bright); --accent-2: var(--gold-light); --accent-soft: rgba(239,164,54,.16);
  --ok: var(--gold-light); --ok-soft: rgba(239,164,54,.16); --warn: var(--bright); --warn-soft: rgba(95,169,196,.18);
  --bad: var(--soft); --bad-soft: rgba(169,207,220,.14); --danger: var(--gold-light); --danger-soft: rgba(239,164,54,.16);
  --chip-na: var(--chip); --shadow: var(--shadow-card);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 .5em; letter-spacing: -0.03em; font-weight: 600; }
button { font-family: inherit; }
/* type roles (design manual §3) */
.overline { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.row-meta { font-size: 10px; line-height: 1.2; color: var(--faint); }
.score { font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
.login-card {
  width: 360px; max-width: 100%;
  background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 34px 30px; text-align: center;
}
.login-logo { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 6px 18px -6px rgba(9,52,70,.35); }
.login-card h1 { font-size: 30px; letter-spacing: -0.04em; margin: 6px 0 2px; }
.login-sub { color: var(--text-2); margin: 0 0 22px; font-size: 13.5px; }
.login-err { color: var(--danger); font-size: 13px; margin-bottom: 10px; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex-shrink: 0; padding: calc(22px + env(safe-area-inset-top, 0px)) 14px 22px;
  display: flex; flex-direction: column; gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--sand);
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px; font-weight: 600; font-size: 19px; letter-spacing: -0.03em; color: var(--ink); }
.brand-name { color: var(--ink); }
.brand-icon { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--faint); font-size: 14px; font-weight: 400; cursor: pointer;
  transition: background var(--tr), color var(--tr); text-align: left;
}
.nav-btn:hover { background: var(--chip); color: var(--body); }
.nav-btn.active { background: var(--surface); color: var(--body); font-weight: 600; box-shadow: var(--shadow-row); }
.nav-btn:active { transform: scale(.98); }
.nav-ico { display: inline-flex; width: 18px; height: 18px; }
.nav-ico svg { width: 18px; height: 18px; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.theme-toggle { background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 16px; color: var(--ink); }
.whoami { color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; padding: calc(26px + env(safe-area-inset-top, 0px)) 30px 60px; max-width: 1440px; min-width: 0; }
.view > .page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.04em; flex: 1; color: var(--ink); }
.ed-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-sub { color: var(--faint); font-size: 13px; margin: -12px 0 18px; }

/* ---------- controls ---------- */
.btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--body);
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 600; line-height: 18px;
  cursor: pointer; transition: filter var(--tr), background var(--tr), transform .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--body); color: var(--sand); border-color: transparent; }
.btn-cta { height: 52px; font-size: 15px; border-radius: 999px; }
/* icons are authored with brand-colored strokes/fills for light backgrounds —
   on a btn-primary's gradient they must go solid white like the button text */
.btn-primary svg { stroke: currentColor; }
.btn-primary svg [stroke]:not([stroke="none"]) { stroke: currentColor; }
.btn-primary svg [fill]:not([fill="none"]):not([fill^="url"]) { fill: currentColor; }
.btn-ghost { background: none; border: none; color: var(--vivid); }
.btn-danger { background: transparent; color: var(--gold-label); border-color: var(--line-strong); }
[data-resolved-theme="dark"] .btn-danger { color: var(--gold-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; line-height: 16px; }
.btn-block { width: 100%; margin-top: 8px; }
.field { text-align: left; margin-bottom: 12px; }
.field label {
  display: block; font-size: 10px; font-weight: 600; color: var(--faint);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.12em;
}
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--inset); color: var(--ink); font-size: 14px; font-family: inherit;
}
.field select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234F6B78' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field input:focus, .field select:focus { outline: 2px solid var(--bright); border-color: transparent; }
.fields-row { display: flex; gap: 10px; }
.fields-row .field { flex: 1; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px 18px; margin-bottom: 14px;
}
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.route-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.route-actions .btn { flex: 1; min-width: 96px; height: 38px; }
.route-stats { color: var(--faint); font-size: 12px; margin-top: 6px; }
.nav-route-card { cursor: pointer; padding: 13px 16px; margin-bottom: 10px; border: 1.5px solid transparent; transition: border-color var(--tr), background var(--tr); }
.nav-route-card.sel { border-color: var(--gold); background: var(--grad-best); }
.nav-route-card .route-stats { margin-top: 3px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--muted); }
.badge.band-9, .badge.band-8, .badge.band-7, .badge.band-6, .badge.band-5 { font-weight: 700; }
.badge-day, .badge-multi { background: var(--chip); color: var(--muted); }

/* ---------- comfort table ---------- */
.comfort-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.comfort-table th, .comfort-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.comfort-table th { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.dot-high { background: var(--gold); } .dot-medium { background: var(--bright); }
.dot-low { background: var(--soft); } .dot-discomfort { background: var(--pale); }

/* ---------- route editor ---------- */
.editor-layout { display: grid; grid-template-columns: 1fr 480px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .editor-layout { grid-template-columns: 1fr; } }
#editor-map { height: calc(100vh - 190px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 1; }
.wp-list { display: flex; flex-direction: column; gap: 7px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.wp-item {
  display: flex; align-items: center; gap: 7px; padding: 8px 9px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
}
.wp-item.drag-over { outline: 2px solid var(--accent); outline-offset: -2px; }
.wp-item.wp-auto { opacity: 0.62; }
.wp-drag { cursor: grab; color: var(--text-2); font-size: 15px; user-select: none; padding: 2px 1px; }
.wp-drag:active { cursor: grabbing; }
.wp-item .wp-idx { font-weight: 700; color: var(--accent); min-width: 40px; white-space: nowrap; }
.wp-item .wp-min { color: var(--text-2); font-size: 11px; }
.wp-item input[type="text"] {
  flex: 1; min-width: 70px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font-size: 13px; padding: 4px 7px;
}
.wp-item input[type="text"]:focus { outline: 2px solid var(--accent); border-color: transparent; }
@media (max-width: 520px) {
  .wp-item { flex-wrap: wrap; }
  .wp-item input[type="text"] { min-width: 120px; }
}
.wp-item select, .wp-item input[type="number"] {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 3px 5px; font-size: 12px;
}
.wp-item input[type="number"] { width: 56px; }
.wp-item .wp-ctl { display: flex; gap: 3px; }
.wp-item .wp-ctl button { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--text-2); padding: 2px 4px; }
.wp-item .wp-ctl button:hover { color: var(--text); }
.editor-stats { display: flex; gap: 16px; color: var(--text-2); font-size: 13px; margin-top: 10px; flex-wrap: wrap; }
.editor-stats b { color: var(--text); }

/* ---------- outlook ---------- */
.day-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.day-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: transform var(--tr), border-color var(--tr); position: relative;
}
.day-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.day-card.best-day::after {
  content: ""; position: absolute; top: 10px; right: 12px; width: 16px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23EFA436' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 l2.5 5 5.5 0.8 -4 3.9 0.9 5.5 -4.9 -2.6 -4.9 2.6 0.9 -5.5 -4 -3.9 5.5 -0.8 Z' stroke='%23EFA436'/%3E%3C/svg%3E") no-repeat center / contain;
}
.dc-date { font-weight: 700; font-size: 14px; }
.dc-score { font-size: 30px; font-weight: 700; margin: 4px 0 2px; }
.dc-gauge { text-align: center; margin: 4px 0 6px; }
.gauge { width: 116px; height: auto; }
.dc-meta { color: var(--text-2); font-size: 12.5px; line-height: 1.55; }
.dc-meta b { color: var(--text); font-weight: 600; }
@media (max-width: 520px) {
  .day-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .day-card { padding: 9px 10px; }
  .dc-date { font-size: 12px; }
  .day-card .gauge { width: 100%; }
  .dc-gauge { margin: 2px 0 4px; }
  .day-card .badge { font-size: 10px; padding: 2px 8px; }
  .dc-meta { font-size: 11px; line-height: 1.45; margin-top: 6px !important; }
}


.hour-table-wrap { overflow-x: auto; }
.hour-table { border-collapse: collapse; font-size: 12.5px; white-space: nowrap; width: 100%; }
.hour-table th, .hour-table td { padding: 5px 9px; border-bottom: 1px solid var(--border); text-align: right; }
.hour-table th:first-child, .hour-table td:first-child { text-align: left; }
.hour-table th { color: var(--text-2); font-size: 11px; text-transform: uppercase; }
.hour-table tbody tr:hover td, .hour-table tr:hover td { background: var(--surface-2); cursor: default; }

.multi-matrix-wrap { overflow-x: auto; }
.multi-matrix { border-collapse: collapse; font-size: 13px; }
.multi-matrix th, .multi-matrix td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.multi-matrix td.mm-cell { border-radius: 8px; font-weight: 700; cursor: pointer; }
.multi-matrix td.mm-date { font-weight: 600; white-space: nowrap; text-align: left; border-radius: 10px; }
/* recommended start days: gold date cell in place (manual §6), no star, no separate section */
.multi-matrix tr.best-start td.mm-date { background: var(--grad-best); color: var(--gold-ink-strong); }
[data-resolved-theme="dark"] .multi-matrix tr.best-start td.mm-date { color: #FDF0D6; }
.multi-matrix tr.sel td.mm-date { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.leg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 2px; }
.leg-head b { font-size: 15px; font-weight: 600; color: var(--ink); }

.rel-svg { width: 22px; height: 22px; vertical-align: middle; color: var(--text-2); }
.spinner {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- sim map ---------- */
.sim-map { height: 460px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 1; }
@media (max-width: 760px) { .sim-map { height: 340px; } }
.hour-table tr.row-hl td { background: var(--accent-soft) !important; }
.stay-input {
  width: 58px; padding: 2px 5px; margin-left: 6px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2); color: var(--text); font-size: 12px; font-family: inherit;
}
.stay-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.wp-eta { display: flex; flex-direction: column; align-items: center; width: 64px; }
.wp-eta-ico { font-size: 20px; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.wp-eta-time {
  margin-top: 1px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 1px 6px; font-size: 10.5px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

/* ---------- boats ---------- */
.boat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.boat-specs { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13px; margin-bottom: 12px; }
.boat-specs b { color: var(--text); }
.boat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.catalog-results { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: -6px; margin-bottom: 12px; }
.catalog-item { padding: 8px 12px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.catalog-item:hover { background: var(--accent-soft); }
.catalog-item small { color: var(--text-2); }

/* ---------- settings links ---------- */
.settings-links { display: flex; flex-direction: column; gap: 0; }
.settings-link {
  display: flex; align-items: center; gap: 13px; width: 100%;
  background: none; border: none; border-top: 1px solid var(--line); border-radius: 0;
  padding: 14px 2px; cursor: pointer; text-align: left; color: var(--ink);
  transition: transform var(--tr);
}
.settings-link:first-child { border-top: none; padding-top: 4px; }
.settings-link:last-child { padding-bottom: 4px; }
.settings-link:active { transform: scale(0.99); }
.sl-ico { display: inline-flex; color: var(--muted); }
.sl-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sl-txt b { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.sl-txt small { color: var(--faint); font-size: 12px; }
.sl-arr { font-size: 15px; color: var(--faint); }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0 14px; }
.set-toggle-row b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.set-toggle-row small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.set-meta { color: var(--faint); font-size: 12.5px; }
.set-meta b { color: var(--ink); font-weight: 600; }
.set-meta a { color: var(--vivid); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--body); color: var(--sand); padding: 11px 22px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-card); z-index: 3000; max-width: calc(100vw - 32px);
}
[data-resolved-theme="dark"] .toast { background: var(--ink); color: #061F2A; }

/* system status-bar area (edge-to-edge WebView on Android 15+, iOS notch): content is padded below it
   (see .main/.sidebar/.login-wrap) and scrolled content gets a page-coloured scrim; the navigation HUD
   draws its map under the bar on purpose and offsets its own controls by the inset */
body:not(.navhud-active)::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px);
  background: var(--bg); z-index: 1900; pointer-events: none;
}

/* ---------- navigation mode — HUD design 1b ("Spodný panel") ---------- */
body.navhud-active .sidebar { display: none !important; }
body.navhud-active .main { padding: 0; max-width: none; }


.navhud {
  position: fixed; inset: 0; z-index: 1500;
  font-family: var(--font);
  --nh-ink: var(--ink);
}
.nh-map-wrap { position: absolute; inset: 0; z-index: 1; overflow: hidden; background: #D9E7EC; touch-action: none; }
/* oversized square so no corners show when the map is CSS-rotated (course/leg up) */
.nh-map {
  position: absolute; width: 130vmax; height: 130vmax;
  left: 50%; top: 50%; margin-left: -65vmax; margin-top: -65vmax;
  background: #D9E7EC; transition: transform .5s ease; will-change: transform;
}

.nh-card {
  position: absolute; z-index: 4;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  background: rgba(12,58,78,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-tile); padding: 10px 14px 11px;
  box-shadow: 0 6px 18px rgba(9,52,70,.16);
}
.nh-speed-card { left: 16px; min-width: 122px; }
.nh-kurz-card { right: 16px; text-align: right; min-width: 122px; }
.nh-depth-card {
  left: 16px; top: calc(env(safe-area-inset-top, 0px) + 86px);
  min-width: 92px; padding: 9px 14px 10px;
}
.nh-depth-val {
  font-weight: 600; font-size: 22px; line-height: 0.9; letter-spacing: -0.03em;
  color: var(--gold-light);              /* alarm-relevant values are always gold (manual §6) */
}

.nh-eyebrow {
  font-family: var(--font); font-weight: 600; font-size: 10px; line-height: 1;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}
.nh-card .nh-eyebrow { color: rgba(234,244,247,.72); font-size: 10px; }
.nh-baseline { margin-top: 4px; display: flex; align-items: baseline; gap: 6px; }
.nh-speed-val {
  font-weight: 600; font-size: 30px; line-height: 0.9; letter-spacing: -0.04em;
  color: #fff;
}
.nh-unit { font-weight: 600; font-size: 14px; line-height: 1; color: var(--faint); }
.nh-card .nh-unit { color: rgba(234,244,247,.6); font-size: 12px; }
.nh-kurz-row { margin-top: 4px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.nh-kurz-ico { display: inline-flex; align-items: center; }
.nh-land-card {
  right: 16px; top: calc(env(safe-area-inset-top, 0px) + 86px);
  min-width: 92px; padding: 9px 14px 10px; text-align: right;
}
/* alarm (shallow water, land closer than 300 m): the tile itself turns gold — no red anywhere (manual §11) */
.nh-card.alarm { background: var(--grad-gold); }
.nh-card.alarm .nh-depth-val, .nh-card.alarm .nh-eyebrow, .nh-card.alarm .nh-unit { color: #3D2703; }

/* free-cruise destination picker button, centred between the top cards */
.nh-dest-btn {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 20px);
  display: inline-flex; align-items: center; gap: 5px; max-width: 34vw;
  background: rgba(12,58,78,.92); color: #fff; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; padding: 8px 12px; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: 11.5px;
  white-space: nowrap; overflow: hidden;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.nh-dest-btn svg circle { stroke: #fff; }
.nh-dest-btn svg path { fill: #fff; stroke: none; }
.nh-dest-row {
  display: flex; align-items: center; gap: 9px; padding: 10px 4px;
  border-top: 1px solid var(--line); cursor: pointer;
  font-family: var(--font); font-size: 14px; color: var(--ink);
}
.nh-dest-row:hover { background: var(--line); }
.nh-dest-ic { display: inline-flex; flex: 0 0 auto; }
.nh-dest-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-dest-row small { color: var(--faint); font-size: 11px; flex: 0 0 auto; }
.nh-dest-grp {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
  margin: 10px 0 2px;
}
.nh-dest-empty { padding: 12px 4px; color: var(--faint); font-size: 13px; }
.nh-kurz-row svg { transition: transform .3s ease; }
.nh-kurz-val { font-weight: 600; font-size: 30px; line-height: 0.9; letter-spacing: -0.04em; color: #fff; }

.nh-round {
  position: absolute; z-index: 4; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: none;
  box-shadow: 0 6px 18px rgba(9,52,70,.16);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .15s ease;
}
.nh-round:active { transform: scale(0.97); }
.nh-zoom-in { right: 16px; bottom: 372px; }
.nh-zoom-out { right: 16px; bottom: 318px; }
.nh-center-btn { right: 16px; bottom: 264px; }
.nh-stop-btn { right: 16px; top: calc(env(safe-area-inset-top, 0px) + 152px); }
.nh-orient-btn { left: 16px; top: calc(env(safe-area-inset-top, 0px) + 152px); }
.nh-debug {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 163px);
  background: rgba(12,58,78,.85); color: #fff; font-size: 10.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 10px; white-space: nowrap;
}
.nh-orient-txt { font-family: var(--font); font-weight: 700; font-size: 13px; color: #08303F; letter-spacing: -0.02em; }

.nh-sheet {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 4;
  background: var(--sand); border-radius: 28px 28px 0 0;
  /* trim the bottom reserve: keep clear of the home indicator but no extra gap */
  padding: 10px 18px max(6px, calc(env(safe-area-inset-bottom, 0px) - 12px));
  box-shadow: var(--shadow-sheet);
}
.nh-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 14px; }
.nh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* grid items must be allowed to shrink, else a nowrap pump name pushes the
   column past the screen edge (broken layout on phones) */
.nh-grid > * { min-width: 0; }
@media (max-width: 500px) {
  .nh-row2 .nh-tile { padding: 9px 12px; }
}
.nh-block-wp { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer; }
.nh-row2 { margin-top: 10px; }
.nh-block { cursor: pointer; position: relative; }
.nh-block-head { display: flex; align-items: center; gap: 6px; }
/* row 1 blocks: reserve two eyebrow lines so the km values sit at equal height */
.nh-grid:not(.nh-row2) .nh-block-head { min-height: 27px; align-items: flex-start; }
.nh-val {
  margin-top: 4px; font-family: var(--font); font-weight: 600; font-size: 20px;
  line-height: 1; letter-spacing: -0.03em; color: var(--nh-ink); white-space: nowrap;
}
.nh-suffix { font-weight: 500; font-size: 12.5px; line-height: 1; color: var(--faint); letter-spacing: 0; white-space: nowrap; }
.nh-block .nh-suffix { font-size: 15px; font-weight: 600; }
/* remaining time · ETA on its own line, same size as the km value but grey */
.nh-line2 {
  margin-top: 4px; font-family: var(--font); font-weight: 600; font-size: 18px;
  line-height: 1; letter-spacing: -0.03em; color: var(--faint); white-space: nowrap;
}
.nh-sub { margin-top: 3px; font-weight: 500; font-size: 12px; line-height: 1; color: var(--faint); }
.nh-tile, .nh-block {
  background: var(--surface); border-radius: var(--radius-tile); padding: 10px 12px;
  box-shadow: var(--shadow-row);
}
.nh-tile .nh-val { font-size: 18px; }
.nh-tile .nh-baseline { margin-top: 5px; }
.nh-wind-val { font-weight: 700; font-size: 26px; line-height: 0.9; letter-spacing: -0.04em; color: var(--nh-ink); }
.nh-comfort-val { margin-top: 7px; display: flex; justify-content: flex-end; }
.nh-comfort-val span { font-weight: 700; font-size: 13px; line-height: 1; }
.nh-bar {
  margin-top: 4px; position: relative; height: 8px; border-radius: 99px;
  background: var(--score-track);
}
.nh-bar-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  border: 2.5px solid var(--ink); box-shadow: 0 2px 6px rgba(9,52,70,.25);
  transition: left .4s ease;
}
/* map markers sit on Leaflet tiles, which stay light regardless of app theme —
   pin their icon color to a fixed ink so currentColor SVGs never wash out
   against a light tile when the surrounding app is in dark mode */
.fuel-pin, .fuel-dest, .farm-pin, .anchor-pin, .fav-pin, .poi-marina, .poi-fav, .wp-eta-ico {
  color: #08303F;
}
.fuel-pin { font-size: 16px; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.farm-pin { font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.4); opacity: 0.95; }
.fuel-hl {
  width: 44px; height: 44px; border-radius: 50%; background: #fff;
  border: 3px solid #1C7E9C; display: flex; align-items: center; justify-content: center;
  font-size: 21px; box-shadow: 0 6px 18px rgba(0,0,0,.35);
  animation: fuelpulse 1.4s ease-in-out infinite;
}
.fuel-hl-route { border-color: #15586F; }
.wp-num {
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 2.5px solid #15586F; display: flex; align-items: center; justify-content: center;
  font-family: var(--font); font-weight: 700; font-size: 10.5px; color: #08303F;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.anchor-pin {
  width: 30px; height: 30px; border-radius: 50%; background: #fff;
  border: 3px solid #EFA436; display: flex; align-items: center; justify-content: center;
  font-size: 15px; box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.fuel-dest {
  width: 40px; height: 40px; border-radius: 50%; background: #fff;
  border: 3px solid #EFA436; display: flex; align-items: center; justify-content: center;
  font-size: 19px; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
@keyframes fuelpulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
/* markers stay upright when the nav map is CSS-rotated (course-up) */
#nav-map .wp-num, #nav-map .anchor-pin, #nav-map .fuel-pin,
#nav-map .fuel-dest, #nav-map .fav-pin, #nav-map .farm-pin {
  transform: rotate(var(--nhrot, 0deg));
}
.fav-pin {
  font-size: 17px; line-height: 22px; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.poi-marina, .poi-fav {
  font-size: 14px; line-height: 18px; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.4); opacity: 0.92;
}
/* permanent waypoint name labels on the route-editor map */
.leaflet-tooltip.wp-label {
  background: #fff; color: #08303F; border: 1px solid rgba(12,58,78,.12);
  border-radius: 7px; padding: 2px 7px; font-family: var(--font);
  font-weight: 700; font-size: 11.5px; box-shadow: 0 2px 6px rgba(9,52,70,.2);
  white-space: nowrap;
}
.leaflet-tooltip.wp-label::before { border-top-color: #fff; }
.hazard-pin, .osm-anchor-pin, .facility-pin {
  color: #08303F; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.hazard-pin { opacity: 0.9; }
.facility-pin { opacity: 0.9; }
.mooring-pin {
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 2.5px solid #1C7E9C; display: flex; align-items: center; justify-content: center;
  font-family: var(--font); font-weight: 700; font-size: 10px; color: #08303F;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
#nav-map .hazard-pin, #nav-map .osm-anchor-pin, #nav-map .facility-pin, #nav-map .mooring-pin {
  transform: rotate(var(--nhrot, 0deg));
}
/* marker tooltips are children of the rotated map — strip Leaflet's (rotated)
   bubble and render the label as an upright counter-rotated chip instead */
.nh-map .leaflet-tooltip {
  background: transparent; border: none; box-shadow: none; padding: 0;
}
.nh-map .leaflet-tooltip::before { display: none; }
.nh-map .leaflet-tooltip .mtip-in {
  display: inline-block; transform: rotate(var(--nhrot, 0deg));
  background: #fff; color: #08303F; padding: 3px 9px; border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,.28); font-family: var(--font);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* popups on the (possibly CSS-rotated) nav map: counter-rotate about the anchor */
.nh-map .leaflet-popup-content-wrapper {
  transform-origin: 50% calc(100% + 16px);
  transform: rotate(var(--nhrot, 0deg));
}
.nh-map .leaflet-popup-tip-container { display: none; }

.fuel-pop { font-family: var(--font); font-size: 13px; color: #08303F; }
.fuel-pop small { color: #4F6B78; display: block; margin-top: 2px; }
.fuel-pop-btns { display: flex; gap: 6px; margin-top: 9px; }

.shore-pop { font-family: var(--font); font-size: 13px; color: #08303F; line-height: 1.6; }
.shore-pop b { display: block; margin-bottom: 2px; }
.nh-split { display: flex; gap: 10px; }
.nh-split-half { flex: 1; min-width: 0; }
.nh-split-r { text-align: right; }
.nh-fuel-name {
  margin-top: 8px; font-weight: 700; font-size: 13px; line-height: 18px;
  color: var(--nh-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nh-fuel-line {
  margin-top: 3px; font-weight: 600; font-size: 12px; line-height: 1.3;
  color: var(--faint);
}
.nh-rain b { font-weight: 700; color: var(--nh-ink); }
.nh-rain {
  margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 12px; line-height: 1.3; color: var(--faint);
}
.nh-joy {
  position: absolute; z-index: 5; left: 16px; bottom: 340px;
  width: 92px; height: 92px; border-radius: 50%;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(9,52,70,.16);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: grab;
}
.nh-joy-knob {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad-gold);
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
  pointer-events: none;
}

.nh-notif {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,31,42,.45); backdrop-filter: blur(3px);
}
.nh-notif-card {
  background: var(--surface); border-radius: 22px; padding: 22px 24px; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.45);
  font-family: var(--font); color: var(--ink);
}
.nh-notif-ico { font-size: 40px; }
.nh-notif-txt b { display: block; font-size: 17px; margin-bottom: 4px; }
.nh-notif-txt span { color: var(--faint); font-size: 13.5px; }
.nh-notif-card .btn { min-width: 120px; }
.nh-fuel-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--inset); border: none; border-radius: var(--radius-sm);
  padding: 9px 12px; margin-bottom: 7px; cursor: pointer; text-align: left;
  font-family: var(--font);
}
.nh-fuel-row-ico { font-size: 17px; }
.nh-fuel-row-txt { flex: 1; min-width: 0; }
.nh-fuel-row-txt b { display: block; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-fuel-row-txt small { color: var(--faint); font-size: 12px; }
.nh-dep-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 2px;
  border-bottom: 1px solid var(--line); color: var(--ink);
  font-family: var(--font);
}
.nh-dep-when { width: 60px; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.nh-dep-when small { display: block; font-weight: 600; color: var(--faint); font-size: 11px; }
.nh-dep-meta { flex: 1; font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.nh-wx-row {
  display: flex; align-items: center; gap: 9px; padding: 5px 2px;
  font-size: 12.5px; color: var(--ink); font-family: var(--font);
}
.nh-wx-row span:nth-child(1) { width: 42px; font-weight: 700; }
/* sub-header separating comfort forecast from weather in the speed popup */
.nh-pop-subhead {
  display: flex; align-items: center; gap: 6px; margin: 12px 0 4px;
  font-weight: 700; font-size: 13px; color: var(--ink);
  border-top: 1px solid var(--line); padding-top: 10px;
}
/* comfort breakdown in the waves/wind popup */
.nh-brk { font-family: var(--font); }
.nh-brk-empty { color: var(--faint); font-size: 13px; padding: 6px 0; }
.nh-brk-head { font-size: 15px; font-weight: 700; }
.nh-brk-head b { font-size: 22px; font-weight: 700; }
.nh-brk-sub { font-size: 11.5px; color: var(--faint); margin: 2px 0 8px; }
.nh-brk-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 2px;
  border-top: 1px solid var(--line); color: var(--ink); font-size: 13px;
}
.nh-brk-ic { display: inline-flex; flex: 0 0 auto; color: var(--ink); }
.nh-brk-name { font-weight: 700; flex: 0 0 58px; }
.nh-brk-val { flex: 1; font-size: 12px; color: var(--faint); }
.nh-brk-pen { font-weight: 700; color: var(--gold-label); }
.nh-brk-ok { font-weight: 700; color: var(--vivid); }
.nh-brk-note {
  margin-top: 8px; font-size: 11.5px; color: var(--faint);
  display: flex; align-items: center; gap: 5px;
}
.nh-modal-sub { margin: 0 0 8px; font-size: 12px; color: var(--faint); }
.nh-fuel-sec {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); margin: 6px 0 6px 2px;
}
/* switch (toggle) */
.ap-switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; cursor: pointer;
}
/* nav map-layers popup: airy rows with dividers so each toggle is easy to hit */
.nh-layers-list { display: flex; flex-direction: column; }
.nh-layers-list .ap-switch-row {
  padding: 5px 2px; font-size: 13.5px;
  border-top: 1px solid var(--line);
}
.nh-layers-list .ap-switch-row:first-child { border-top: none; }
/* route type: day ⇄ multi with the switch in between */
.type-toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.type-toggle .tt-on { color: var(--text); font-weight: 700; }
.ap-switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; display: inline-block; }
.ap-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ap-knob {
  position: absolute; inset: 0; border-radius: 15px;
  background: var(--pale); transition: background .15s; pointer-events: none;
}
[data-resolved-theme="dark"] .ap-knob { background: rgba(234,244,247,.18); }
.ap-knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: left .15s;
}
.ap-switch input:checked + .ap-knob { background: var(--body); }
.ap-switch input:checked + .ap-knob::after { left: 23px; }

/* SVG group rotations use the transform ATTRIBUTE with explicit rotate(a 0 0)
   — no CSS transform/origin rules here, browsers disagree on SVG origins */
@media (min-width: 761px) {
  .nh-sheet { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: 28px 28px 0 0; }
  .nh-zoom-out { right: calc(50% - 240px + 16px); }
  .nh-zoom-in { right: calc(50% - 240px + 16px); }
  .nh-center-btn { right: calc(50% - 240px + 16px); }
}

/* ---------- print (trip timeline + map) ---------- */
.print-header { display: none; }
@media print {
  body.print-sim { background: #fff; }
  body.print-sim .sidebar, body.print-sim .toast, body.print-sim .no-print { display: none !important; }
  body.print-sim #view-outlook > *:not(.print-target) { display: none !important; }
  body.print-sim .main { padding: 0; max-width: 100%; }
  body.print-sim .print-header {
    display: block; font-weight: 700; font-size: 15px; margin: 0 0 10px;
    padding-bottom: 8px; border-bottom: 2px solid #333;
  }
  body.print-sim .print-target .card {
    box-shadow: none; border: 1px solid #bbb; break-inside: avoid; margin-bottom: 12px;
  }
  body.print-sim .hour-table { font-size: 11px; }
  body.print-sim .hour-table th, body.print-sim .hour-table td {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  body.print-sim .print-target .sim-map { height: 130mm; }
  body.print-sim .leaflet-control-container { display: none; }
  body.print-sim .tl-panel { display: block !important; }
  body.print-sim .print-target .wp-row { break-inside: avoid; }
}

/* ---------- responsive: bottom nav on mobile ---------- */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  /* tab bar (manual §5): sand at 94 % with blur, hairline on top, glyph over 11px label */
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; width: 100%;
    flex-direction: row; align-items: stretch;
    padding: 10px 20px max(10px, calc(env(safe-area-inset-bottom, 0px) - 2px));
    border-right: none; border-top: 1px solid var(--line); z-index: 2000;
    background: var(--tabbar-bg);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .brand, .whoami, .sidebar-foot { display: none; }   /* appearance lives in Settings */
  .nav { flex: 1; flex-direction: row; justify-content: space-between; gap: 0; padding: 0; }
  .nav-btn {
    flex: 1; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; font-size: 11px;
    min-width: 0; min-height: 44px; border-radius: 12px; background: none !important; box-shadow: none !important;
  }
  .nav-btn.active { color: var(--body); font-weight: 600; }
  .nav-ico, .nav-ico svg { width: 16px; height: 16px; }
  .main { padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(108px + max(0px, env(safe-area-inset-bottom, 0px) - 12px)); }
  #editor-map { height: 52vh; min-height: 320px; }
  /* route outlook header: title on its own full-width row, back left / edit right below */
  .page-head-route { row-gap: 10px; }
  .page-head-route h2 { flex: 1 1 100%; order: -1; font-size: 21px; }
  .page-head-route .btn:last-of-type { margin-left: auto; }
  /* route editor header: title row, then auto-route group, then delete/cancel/save group */
  .page-head-editor { row-gap: 10px; }
  .page-head-editor h2 { flex: 1 1 100%; }
  .page-head-editor .ed-actions { flex: 1 1 100%; }
}

/* ---------- PWA: update banner ---------- */
.sw-update {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 78px); transform: translateX(-50%);
  z-index: 9000; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px);
  background: var(--body); color: var(--sand); border-radius: 14px; padding: 10px 12px 10px 16px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); font-size: 14px; font-weight: 600;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.sw-update .btn { padding: 7px 14px; }
@media (min-width: 761px) { .sw-update { bottom: 24px; } }

/* ---------- accounts: login providers, code input, devices ---------- */
.login-providers { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.login-providers:empty { display: none; }
.btn-provider {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.btn-provider:hover { background: var(--surface-2); }
.btn-provider.apple { background: #000; color: #fff; border-color: #000; }
.btn-provider svg { width: 18px; height: 18px; flex: 0 0 auto; }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; margin: 12px 0 10px; text-transform: uppercase; letter-spacing: .1em; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-hint { color: var(--text-2); font-size: 13px; margin: 4px 0 10px; }
#login-code { text-align: center; font-size: 22px; letter-spacing: .35em; font-weight: 700; }
.acct-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.acct-row:first-child { border-top: none; }
.acct-row .acct-k { color: var(--text-2); width: 120px; flex: 0 0 auto; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.acct-row .acct-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.acct-ok { color: var(--ok); font-weight: 700; }
.sess-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.sess-row small { display: block; color: var(--text-2); font-size: 12px; }
.sess-cur { font-size: 11px; font-weight: 600; color: var(--gold-ink); background: var(--gold-sand); border-radius: 999px; padding: 3px 8px; }

.login-legal { margin: 16px 0 0; font-size: 12px; color: var(--text-2); }
.login-legal a { color: var(--text-2); }

/* map fixes: global badge + admin checkbox (v3.13) */
.ovr-badge { display:inline-block; margin-left:4px; padding:2px 8px; border-radius:999px; font-size:10.5px; font-weight:600; letter-spacing:.04em; background:var(--gold-sand); color:var(--gold-ink); vertical-align:middle; }
label.check { display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
label.check input { width:16px; height:16px; }

/* F04: results built on incomplete forecast data are visibly provisional */
.heat-day.incomplete, .dep-bar.incomplete .bar, .mm-cell.incomplete { position: relative; }
.heat-day.incomplete::after, .dep-bar.incomplete .bar::after, .mm-cell.incomplete::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(255,255,255,.45) 5px 9px);
}
.day-card.incomplete { border: 1px dashed var(--gold); }          /* text stays readable: no hatch over the card */
[data-resolved-theme="dark"] .heat-day.incomplete::after,
[data-resolved-theme="dark"] .dep-bar.incomplete .bar::after, [data-resolved-theme="dark"] .mm-cell.incomplete::after {
  background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(0,0,0,.35) 5px 9px);
}
.incomplete-note { margin-top: 6px; font-size: 11.5px; color: var(--text-2); }
.incomplete-banner { border: 1px dashed var(--gold); background: var(--gold-cream); color: var(--gold-ink); }
.nh-dep-row.incomplete .badge { outline: 2px dashed currentColor; outline-offset: 1px; }

/* F16: navigation readings that failed to refresh are dimmed, never mistaken for live */
#nav-comfort.stale, .nh-val.stale, .nh-depth-val.stale { opacity: .45; }
.nh-speed-val.stale, .nh-kurz-val.stale { opacity: .45; }   /* F17: old or imprecise GPS */

/* ================= design manual, phase B ================= */

/* ---------- dashboard "Your days" ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.screen-title { margin: 4px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -0.04em; color: var(--ink); line-height: 1.05; }
.screen-sub { margin: 6px 0 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--body); color: var(--sand);
  font: 600 14px/40px var(--font); cursor: pointer; flex: 0 0 auto; padding: 0; }
.best-banner { background: var(--grad-best); border-radius: var(--radius); padding: 14px 18px 16px; margin-bottom: 12px; cursor: pointer; color: var(--gold-ink-strong); }
.best-banner .overline { color: var(--gold-label); }
.bb-row { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.bb-day { font-size: 30px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.bb-score { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; color: var(--gold-label); }
.bb-meta { font-size: 13px; color: var(--gold-ink); margin-top: 8px; }
[data-resolved-theme="dark"] .best-banner { color: #FDF0D6; }
[data-resolved-theme="dark"] .best-banner .overline, [data-resolved-theme="dark"] .bb-meta, [data-resolved-theme="dark"] .bb-score { color: var(--gold-light); }
.dash-route { padding: 16px 16px 12px; cursor: pointer; }
.dr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dr-head b { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
/* ten-day bars: value above (best day bold) · bar (height = score, fill = band) · weekday below */
.dr-bars { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.dr-col { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.dr-val { font-size: 11px; font-weight: 500; color: var(--faint); line-height: 13px; white-space: nowrap; }
.dr-col.best .dr-val { font-size: 13px; font-weight: 700; color: var(--ink); }
.dr-bar-wrap { width: 100%; height: 64px; display: flex; align-items: flex-end; }
.dr-bar { width: 100%; max-width: 64px; border-radius: 7px; background: var(--chip); min-height: 6px; transition: height .3s ease; }   /* capped so desktop bars stay slender */
.dr-col.na .dr-bar { height: 6px !important; background: transparent; border: 1px dashed var(--line-strong); }
.dr-bar.incomplete { position: relative; overflow: hidden; }
.dr-bar.incomplete::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(255,255,255,.45) 5px 9px); }
[data-resolved-theme="dark"] .dr-bar.incomplete::after { background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(0,0,0,.35) 5px 9px); }
.dr-dow { font-size: 11px; color: var(--faint); }
@media (max-width: 360px) { .dr-val { font-size: 10px; } .dr-col.best .dr-val { font-size: 12px; } .dr-bars { gap: 4px; } }
.dash-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; }
.dash-tools .ap-switch-row { flex: 1; }
[data-resolved-theme="dark"] .ap-switch input:checked + .ap-knob::after { background: var(--sand); }   /* white pill needs a dark knob */

/* ---------- routes list (manual §6 route card) ---------- */
.route-card { padding: 16px 18px; }
.rc-head { display: flex; align-items: center; gap: 8px; }
.rc-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-meta { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.pill { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--chip); color: var(--muted); white-space: nowrap; }
.route-card .route-actions { margin-top: 14px; gap: 8px; flex-wrap: nowrap; }
.route-card .route-actions .btn { min-width: 0; padding: 0 10px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ico-gold { color: var(--gold); display: inline-flex; }
.ico-gold svg { width: 15px; height: 15px; }
.btn-text { background: none; border: none; padding: 6px 4px; color: var(--vivid); font: 600 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-text:hover { text-decoration: underline; }
[data-resolved-theme="dark"] .btn-text { color: var(--bright); }

/* ---------- navigation: route selection ---------- */
.nav-route-card { padding: 14px 16px; }
.nav-route-card .rc-title { font-size: 16px; }
.sel-check { width: 24px; height: 24px; border-radius: 50%; background: var(--body); color: var(--sand); font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.nav-route-card.sel .rc-meta { color: var(--gold-ink); }
[data-resolved-theme="dark"] .nav-route-card.sel .rc-meta { color: var(--gold-light); }
.nav-start-bar { margin-top: 14px; display: flex; flex-direction: column; align-items: center; }
.nav-start-bar .btn { width: 100%; max-width: 520px; }
@media (max-width: 760px) {
  .nav-start-bar { position: fixed; left: 0; right: 0; bottom: calc(64px + max(0px, env(safe-area-inset-bottom, 0px) - 12px)); z-index: 1450; margin: 0; padding: 10px 20px 8px;
    background: var(--tabbar-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
}

/* ---------- route detail: day rows (manual §6) ---------- */
.page-head-slim { display: flex; justify-content: space-between; align-items: center; margin: -6px -4px 6px; }
.row-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 4px 8px; }
.legend-best { font-size: 11px; color: var(--gold-label); font-weight: 600; }
[data-resolved-theme="dark"] .legend-best { color: var(--gold-light); }
.day-list { display: flex; flex-direction: column; gap: 4px; }
.day-row { display: grid; grid-template-columns: 74px 1fr 38px; gap: 10px; align-items: center; padding: 6px 12px; border-radius: var(--radius-row);
  background: var(--surface); box-shadow: var(--shadow-row); cursor: pointer; border: 1.5px solid transparent; transition: border-color var(--tr), transform var(--tr); }
.day-row:hover { transform: translateY(-1px); }
.day-row.best { background: var(--grad-best); box-shadow: none; }
.day-row.sel { border-color: var(--line-strong); }
.day-row.na { opacity: .55; cursor: default; }
.dy-date { white-space: nowrap; min-width: 0; }
.dy-date b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.dy-date small { display: block; font-size: 10px; color: var(--faint); margin-top: 1px; }
.dy-mid { min-width: 0; }
.dy-mid .row-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 7px; border-radius: 4px; background: var(--inset); overflow: hidden; margin-bottom: 4px; }
.progress .fill { height: 100%; border-radius: 4px; }
.dy-score { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; text-align: right; color: var(--ink); }
.day-row.best .dy-date small, .day-row.best .row-meta { color: var(--gold-ink); }
.day-row.best .progress { background: rgba(255,255,255,.55); }
[data-resolved-theme="dark"] .day-row.best .dy-date small, [data-resolved-theme="dark"] .day-row.best .row-meta { color: var(--gold-light); }
[data-resolved-theme="dark"] .day-row.best .progress { background: rgba(255,255,255,.14); }
.outlook-tools { margin-top: 12px; }

/* ---------- departure picker: tiles (manual §6) ---------- */
.dep-card { padding: 14px 16px; margin-top: 12px; }
.dep-bars, .dep-tiles { display: flex; gap: 7px; overflow-x: auto; padding: 10px 2px 6px; margin: 0 -2px; scrollbar-width: none; height: auto; align-items: stretch; }
.dep-bars::-webkit-scrollbar, .dep-tiles::-webkit-scrollbar { display: none; }
.dep-bar { flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 9px 0; border-radius: var(--radius-sm);
  background: var(--sand); color: var(--ink); cursor: pointer; border: 1.5px solid transparent; transition: transform var(--tr), box-shadow var(--tr); }
.dep-bar:hover { transform: translateY(-1px); }
.dep-bar.sel { background: var(--grad-gold); color: var(--on-gold); box-shadow: 0 6px 16px rgba(239,164,54,.32); }
.dep-bar.incomplete { border-color: var(--gold); border-style: dashed; }
.dep-bar .tile-score { font-size: 16px; font-weight: 700; letter-spacing: -0.03em; }
.dep-bar .tile-time { font-size: 12px; font-weight: 500; opacity: .85; }

/* ---------- trip timeline (manual §6) ---------- */
.tl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 18px 4px 10px; }
.section-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.profile-card { padding: 14px 16px; }
.pc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.profile-strip { display: flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; background: var(--inset); }
.ps-seg { display: block; min-width: 1px; }
.profile-anchors { position: relative; height: 16px; margin-top: 3px; }
.ps-anchor { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--gold-label); line-height: 16px; }
[data-resolved-theme="dark"] .ps-anchor { color: var(--gold-light); }
.profile-ends { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--faint); margin-top: 2px; }
.profile-ends span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-tabs { display: flex; background: var(--chip); border-radius: 999px; padding: 3px; margin: 12px 0 10px; }
.seg-tabs button { flex: 1; height: 34px; border: none; border-radius: 999px; background: none; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.seg-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-row); }
.wp-list-tl { display: flex; flex-direction: column; gap: 5px; }
.wp-row { display: grid; grid-template-columns: 46px 1fr 34px; gap: 10px; align-items: start; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-row); cursor: pointer; border: 1.5px solid transparent; }
.wp-row.stop { background: var(--grad-best); box-shadow: none; }
.wp-row.open { border-color: var(--line-strong); box-shadow: var(--shadow-card); }
.wp-row.minor { display: none; }
.wp-list-tl.show-all .wp-row.minor, .print-target .wp-row.minor { display: grid; }
.print-target .tl-more-btn { display: none; }
.wr-time b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.wr-time span { display: block; font-size: 12px; color: var(--muted); }
.wr-body { min-width: 0; }
.wr-name { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-row.stop .row-meta, .wp-row.stop .wr-time span { color: var(--gold-ink); }
[data-resolved-theme="dark"] .wp-row.stop .row-meta, [data-resolved-theme="dark"] .wp-row.stop .wr-time span { color: var(--gold-light); }
.wr-score { font-size: 17px; font-weight: 700; letter-spacing: -0.03em; text-align: right; color: var(--ink); }
.wp-detail { display: none; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.wp-row.open .wp-detail { display: grid; }
.wp-detail small { display: block; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.wp-detail b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.wp-detail .wp-stay { grid-column: 1 / -1; }
.wp-detail .stay-input { width: 64px; }
.wp-row.stop .wp-detail { border-top-color: rgba(90,58,5,.18); }
.tl-more-btn { align-self: center; margin-top: 4px; }
@media (min-width: 761px) { .wp-detail { grid-template-columns: repeat(6, 1fr); } }

/* ---------- phase 0: units grid, data-source line, admin error log ---------- */
.units-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 761px) { .units-grid { grid-template-columns: repeat(3, 1fr); } }
.data-meta { margin-top: 8px; font-size: 11.5px; line-height: 1.4; }
.err-row summary { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; cursor: pointer; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12.5px; list-style: none; }
.err-row summary::-webkit-details-marker { display: none; }
.err-row summary b { flex: 1 1 100%; font-weight: 600; color: var(--ink); word-break: break-word; }
.err-when { color: var(--faint); font-size: 11.5px; }
.err-row pre { font-size: 11px; white-space: pre-wrap; word-break: break-word; background: var(--inset); padding: 8px 10px; border-radius: 10px; max-height: 220px; overflow: auto; margin: 0 0 8px; color: var(--muted); }

/* ---------- phase 1: coverage card, zone pill ---------- */
.region-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.region-row:first-of-type { border-top: none; }
.region-row b { font-weight: 600; color: var(--ink); }
.region-caps { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.region-caps .pill { font-size: 10.5px; padding: 3px 8px; }
.nh-zone { position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 206px);
  background: var(--grad-gold); color: #3D2703; font-size: 11.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  white-space: nowrap; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 6px 18px rgba(9,52,70,.16); }

/* ---------- phase 2: official warnings ---------- */
.warn-card { border: 1.5px solid var(--gold); background: var(--gold-cream); color: var(--gold-ink); padding: 12px 16px; margin-bottom: 12px; }
[data-resolved-theme="dark"] .warn-card { background: rgba(239,164,54,.14); color: var(--gold-light); }
.warn-row { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-top: 1px solid rgba(90,58,5,.15); font-size: 13px; }
.warn-row:first-child { border-top: none; padding-top: 0; }
.warn-row b { font-weight: 600; } .warn-row span { font-size: 12px; opacity: .9; }
.warn-row.warn-red b { color: var(--gold-ink-strong); }
.warn-note { margin-top: 8px; font-size: 11.5px; color: var(--gold-label); }
[data-resolved-theme="dark"] .warn-note { color: var(--gold-light); }
.day-row.warned { border-color: var(--gold); border-style: dashed; }
.multi-matrix tr.warned td.mm-date { box-shadow: inset 0 0 0 1.5px var(--gold); }
/* official warning: right column under the close (×) button; an active zone pill moves below it */
.nh-warn { left: auto; right: 16px; transform: none; top: calc(env(safe-area-inset-top, 0px) + 206px); max-width: 62vw; }
.nh-warn:not(.hidden) + .nh-zone { top: calc(env(safe-area-inset-top, 0px) + 246px); }

/* ---------- v3.18: app dialogs (confirm / prompt / picker) in the navigation popup style ---------- */
.ap-modal { position: fixed; inset: 0; z-index: 5000; padding: 16px; }
.ap-modal-card { width: min(380px, 100%); max-width: none; align-items: stretch; text-align: left; gap: 10px; }
.ap-modal-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.ap-modal-text { margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.45; }
.ap-modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.nh-notif-card .ap-modal-btns .btn { min-width: 0; flex: 1; }
.ap-pick-list { display: flex; flex-direction: column; max-height: min(52vh, 420px); overflow: auto; margin: 0 -8px; }
.ap-pick-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 10px;
  border: none; border-top: 1px solid var(--line); background: none; border-radius: 0;
  font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer;
}
.ap-pick-row:first-child { border-top: none; }
.ap-pick-row:active { background: var(--inset); }
.ap-pick-row.on { font-weight: 600; }
.ap-pick-row small { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }
.ap-pick-check { color: var(--gold-label); font-weight: 700; width: 18px; text-align: right; flex: 0 0 auto; }
.ap-select {
  width: 100%; min-height: 44px; padding: 10px 32px 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--inset) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234F6B78' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); font-size: 14px; font-family: inherit; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ap-select:focus-visible { outline: 2px solid var(--bright); }
.ap-mini-map { height: 260px; border-radius: 14px; overflow: hidden; background: var(--inset); }

/* ---------- v3.18: map type + layers panel (every map) ---------- */
.leaflet-control .ap-map-btn, .ap-map-btn {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 6px 18px rgba(9,52,70,.16); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #08303F; padding: 0;
}
.ap-map-btn:active { transform: scale(0.97); }
.leaflet-container > .ap-map-modal { z-index: 1200; }
.ap-overline { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 2px 0 -4px; }
.ap-map-modal .nh-notif-card { gap: 6px; padding: 14px 16px 12px; max-height: calc(100% - 24px); overflow: auto; }
.ap-map-modal .nh-notif-card > div:first-child { font-size: 15px !important; }
.ap-map-modal .nh-notif-card .btn { margin-top: 2px; }
.ap-base-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ap-base-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--inset); color: var(--ink);
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.ap-base-tile.on { border-color: var(--gold-label); background: var(--gold-pale); }
.ap-base-tile svg { color: var(--ink); width: 18px; height: 18px; }

/* ---------- v3.18: virtual position badge + simulation speed popup ---------- */
.nh-virt {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 163px);
  background: var(--gold); color: #3A2A05; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap; box-shadow: 0 6px 18px rgba(9,52,70,.16);
}
.ap-sim-val { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); line-height: 1; }
.ap-sim-val b { font-weight: 600; }
.ap-range { width: 100%; accent-color: var(--gold-label); margin: 2px 0; }
.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-chip {
  border: 1px solid var(--line); background: var(--inset); border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
}
.ap-chip.on { background: var(--gold-pale); border-color: var(--gold-label); font-weight: 600; }

/* ---------- stage 3: tides & currents ---------- */
.tide-card .overline { margin-bottom: 6px; }
.tide-svg { width: 100%; height: auto; display: block; font-family: var(--font); }
.tide-area { fill: #5FA9C4; fill-opacity: .18; }
.tide-line { fill: none; stroke: var(--body); stroke-width: 1.8; stroke-linejoin: round; }
.tide-win { fill: var(--gold-pale); opacity: .8; }
.tide-ex circle { fill: var(--gold-label); }
.tide-ex text { font-size: 9px; font-weight: 600; fill: var(--ink); }
.tide-tick { font-size: 8.5px; fill: var(--faint); }
.tide-notes { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 13px; color: var(--ink); }
.tide-bad { color: var(--gold-label); font-weight: 600; }
.dep-bar.blocked { opacity: .5; }
.dep-bar.blocked .tile-score { text-decoration: line-through; }
.wp-gate { width: 72px; flex: 0 0 auto; }
[data-resolved-theme="dark"] .tide-area { fill: #5FA9C4; fill-opacity: .25; }

/* ---------- stage 4: week separators, share dialog ---------- */
.dr-col.wk { position: relative; }
.dr-col.wk::before { content: ""; position: absolute; left: -3px; top: 18px; bottom: 16px; border-left: 1px dashed var(--line-strong); }
.day-row.wk { margin-top: 10px; }
.day-row.wk::before { content: ""; display: block; position: absolute; left: 16px; right: 16px; top: -6px; border-top: 1px dashed var(--line-strong); }
.day-row { position: relative; }
#share-url { font-size: 13px; }

/* comfort bands (§4) — kept LAST so they win over component backgrounds (.heat-day, .badge, .mm-cell …) */
/* comfort bands (§4): fill + text colour; the numeral and label always accompany the colour */
.band-9, .heat-day.band-9, .badge.band-9, .mm-cell.band-9 { background: var(--grad-gold); color: var(--on-gold); }
.band-8, .heat-day.band-8, .badge.band-8, .mm-cell.band-8 { background: var(--gold-pale); color: var(--gold-ink); }
.band-7, .heat-day.band-7, .badge.band-7, .mm-cell.band-7 { background: var(--bright); color: #FFFFFF; }
.band-6, .heat-day.band-6, .badge.band-6, .mm-cell.band-6 { background: var(--soft); color: #08303F; }
.band-5, .heat-day.band-5, .badge.band-5, .mm-cell.band-5 { background: var(--pale); color: #08303F; }
[data-resolved-theme="dark"] .band-8, [data-resolved-theme="dark"] .heat-day.band-8, [data-resolved-theme="dark"] .badge.band-8, [data-resolved-theme="dark"] .mm-cell.band-8 { background: #C98A2A; color: #FDF0D6; }
.score-track { position: relative; height: 8px; border-radius: 5px; background: var(--score-track); }
.score-track .dot { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--ink); transform: translate(-50%, -50%); }
