/* Boat Trip Planner — shared styles (trip.php, admin.php) */
:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --ink: #0f1f33;
  --muted: #5d6d82;
  --line: #dde4ec;
  --navy: #0b2545;
  --sea: #1d5fa8;
  --sea-soft: #e3eefb;
  --accent: #f08a24;
  --accent-soft: #fdf0e2;
  --ok: #1f9d6b;
  --danger: #d64545;
  --danger-soft: #fbe9e9;
  --shadow: 0 1px 2px rgba(15,31,51,.06), 0 4px 16px rgba(15,31,51,.08);
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="night"] {
  --bg: #070d16;
  --panel: #0f1824;
  --panel-2: #142030;
  --ink: #e6edf5;
  --muted: #8c9bb0;
  --line: #223247;
  --navy: #050b14;
  --sea: #5aa2ee;
  --sea-soft: #13263d;
  --accent: #ff9d45;
  --accent-soft: #33220f;
  --danger-soft: #3a1717;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select { font: inherit; color: inherit; }

#app { display: flex; height: 100vh; height: 100dvh; }

/* ---------- Sidebar ---------- */
#sidebar {
  width: 380px;
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(135deg, #0b2545 0%, #13427a 100%);
  color: #fff;
}
.brand svg { flex: none; }
.brand h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.brand small { display: block; opacity: .7; font-size: 12px; font-weight: 500; }
.brand .spacer { flex: 1; }
.brand .icon-btn { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.brand .icon-btn:hover { background: rgba(255,255,255,.18); }

.scroll { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.card h2 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* ---------- Controls ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=number], input[type=search], input[type=datetime-local], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
input:focus, select:focus { border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-soft); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--sea); border-color: var(--sea); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
[data-theme="night"] .btn.primary { color: #06121f; }
.btn.danger { color: var(--danger); }
.btn.danger.confirm { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--muted);
}
.icon-btn:hover { color: var(--ink); background: var(--panel-2); }
.icon-btn.small { width: 24px; height: 24px; font-size: 13px; border-radius: 6px; }

.pill {
  font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0;
  padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line);
}
.pill.dirty { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.saved { background: rgba(31,157,107,.12); color: var(--ok); border-color: transparent; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  background: var(--panel-2); border-radius: 10px; padding: 10px 12px;
  border: 1px solid var(--line);
}
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .value small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px; }

/* ---------- Itinerary ---------- */
.itinerary { list-style: none; margin: 0; padding: 0; }
.wp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 6px; border-radius: 8px;
}
.wp-row:hover { background: var(--panel-2); }
.wp-row.flash { animation: flash 1s ease; }
@keyframes flash { 0%,40% { background: var(--accent-soft); } 100% { background: transparent; } }
.wp-badge {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sea); color: #fff; font-size: 11.5px; font-weight: 700;
}
.wp-badge.start { background: var(--ok); }
.wp-badge.end { background: var(--accent); }
.wp-coords { flex: 1; font-family: var(--mono); font-size: 12.5px; cursor: pointer; min-width: 0; }
.wp-coords span { display: block; }
.wp-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wp-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.wp-wind { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wp-wind b { color: var(--ink); font-weight: 700; }
.wp-wind small { font-size: 10.5px; }
.wp-wind.muted { font-style: italic; }
.wind-mini { width: 15px; height: 15px; flex: none; fill: var(--c, var(--sea)); stroke: rgba(0,0,0,.45); stroke-width: 1; }
.wind-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 6px 8px; }
.wp-wind-badge {
  position: absolute; left: 24px; top: 3px; display: flex; align-items: center; gap: 2px;
  background: rgba(15,31,51,.85); color: #fff; font: 700 10.5px/1 Inter, sans-serif;
  padding: 2px 6px 2px 3px; border-radius: 10px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.wp-wind-badge .wind-mini { width: 13px; height: 13px; stroke: rgba(0,0,0,.6); }
.wp-row .icon-btn { opacity: 0; transition: opacity .15s; }
.wp-row:hover .icon-btn, .wp-row:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .wp-row .icon-btn { opacity: 1; } }

.leg-row {
  display: flex; align-items: center; gap: 10px;
  margin-left: 17px; padding: 6px 6px 6px 18px;
  border-left: 2px dashed var(--line);
  cursor: pointer; border-radius: 0 8px 8px 0;
  font-size: 12.5px; color: var(--muted);
}
.leg-row:hover { background: var(--panel-2); }
.leg-row.selected { background: var(--accent-soft); border-left-color: var(--accent); color: var(--ink); }
.leg-row .leg-data { flex: 1; display: flex; gap: 12px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.leg-row b { color: var(--ink); font-weight: 600; }
.leg-row .icon-btn { opacity: 0; }
.leg-row:hover .icon-btn, .leg-row.selected .icon-btn { opacity: 1; }
@media (hover: none) { .leg-row .icon-btn { opacity: 1; } }

.empty {
  text-align: center; color: var(--muted); padding: 18px 8px 8px;
}
.empty svg { opacity: .5; margin-bottom: 6px; }
.empty p { margin: 4px 0; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); }

/* ---------- Saved routes ---------- */
.routes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.route-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line);
  cursor: pointer; background: var(--panel);
}
.route-item:hover { border-color: var(--sea); }
.route-item.active { border-color: var(--sea); background: var(--sea-soft); }
.route-item .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-item .meta { font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.route-item .dir { display: flex; flex-direction: column; gap: 3px; }
.route-item .dir .icon-btn { width: 30px; height: 30px; padding: 0; color: var(--sea); border-color: var(--sea); }
.route-item .dir [data-dir="rev"] svg { transform: scaleX(-1); }
.route-item .dir .icon-btn:hover { background: var(--sea); color: #fff; }

details.card summary {
  cursor: pointer; list-style: none;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600;
  display: flex; justify-content: space-between;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: '▸'; transition: transform .15s; }
details.card[open] summary::after { transform: rotate(90deg); }
details.card[open] summary { margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

/* ---------- Map ---------- */
#map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #aad3df; }
[data-theme="night"] #map .leaflet-tile-pane { filter: brightness(.65) contrast(1.1) saturate(.8); }

.leaflet-container { font-family: inherit; }
.leaflet-bar a, .map-btn {
  width: 36px !important; height: 36px !important; line-height: 36px !important;
  font-size: 17px;
}
.map-btn { display: flex !important; align-items: center; justify-content: center; cursor: pointer; color: #0f1f33 !important; }
.map-btn.on { background: #e3eefb !important; color: #1d5fa8 !important; }
.leaflet-control-layers { border-radius: 10px !important; }
.leaflet-control-layers-toggle { width: 40px !important; height: 40px !important; }

.wp-icon { background: none; border: none; }
.wp-pin {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sea); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font: 700 11.5px/1 Inter, sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  cursor: grab;
}
.wp-pin.start { background: var(--ok); }
.wp-pin.end { background: var(--accent); }

.leg-label { background: none; border: none; }
.leg-label div {
  display: inline-block; transform: translate(-50%, -50%);
  background: rgba(11,37,69,.85); color: #fff;
  font: 600 11px/1 Inter, sans-serif; padding: 4px 7px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.leg-label.selected div { background: var(--accent); }

.cursor-pos {
  background: rgba(255,255,255,.9); padding: 4px 8px; border-radius: 6px;
  font: 500 11.5px/1.3 var(--mono); color: #0f1f33; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.leaflet-popup-content .btn { background: #fff; color: #0f1f33; border-color: #dde4ec; }
.leaflet-popup-content .btn:hover { background: #f6f8fb; }
.leg-popup { min-width: 180px; font-size: 13px; }
.leg-popup h3 { margin: 0 0 6px; font-size: 13px; }
.leg-popup table { border-collapse: collapse; width: 100%; margin-bottom: 8px; }
.leg-popup td { padding: 2px 0; }
.leg-popup td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Compass ---------- */
#compass {
  position: absolute; right: 16px; bottom: 48px;
  width: 170px; height: 170px; z-index: 900;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.92) 62%, rgba(255,255,255,.75) 72%);
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
  touch-action: none; user-select: none; cursor: grab;
}
#compass.dragging { cursor: grabbing; }
#compass img { width: 100%; height: 100%; pointer-events: none; display: block; }
#compass .needle {
  position: absolute; inset: 0; pointer-events: none;
  transition: transform .45s cubic-bezier(.3,1.4,.5,1), opacity .2s;
}
#compass .needle.idle { opacity: 0; }
#compass .readout {
  position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%);
  background: var(--navy); color: #fff; border-radius: 999px;
  padding: 3px 10px; font: 600 12px/1.2 var(--mono); white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
#compass[hidden] { display: none; }

/* ---------- Toasts ---------- */
#toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 2000; pointer-events: none;
  padding-top: env(safe-area-inset-top);
}
.toast {
  background: #0f1f33; color: #fff; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .2s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  #app { flex-direction: column-reverse; }
  #map-wrap { flex: 0 0 56vh; flex: 0 0 56dvh; }
  #sidebar { width: 100%; flex: 1 1 auto; border-right: none; border-top: 1px solid var(--line); }
  .brand { padding-top: 10px; padding-bottom: 10px; }
  .scroll { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  #compass { width: 104px; height: 104px; right: 10px; bottom: 56px; }
  #compass .readout { font-size: 11px; padding: 2px 8px; }
  .leaflet-control-attribution { font-size: 9px; }
}

[hidden] { display: none !important; }
.brand h1, .brand small { white-space: nowrap; }
.routes-tools select { flex: 0 0 auto; width: auto; }
.dep-row { gap: 6px; }
.dep-row #departure-day { flex: 1.7; }
.dep-row #departure-time { flex: 1; }
.dep-row select { padding-inline: 8px; }
.brand-home { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; border-radius: 8px; }
.brand-home:hover h1 { text-decoration: underline; text-underline-offset: 3px; }
.brand-home:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.brand-home > div { min-width: 0; overflow: hidden; }
.brand h1 { overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; }
.account-btn .who { max-width: 80px; }
.wind-arrow small { font-weight: 600; opacity: .85; }
.account-btn { white-space: nowrap; flex: none; }

/* ---------- Accounts ---------- */
input[type=email], input[type=password] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.account-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px 0 4px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1);
  color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; max-width: 150px;
}
.account-btn.anon { padding: 0 14px; background: var(--accent); border-color: var(--accent); }
.account-btn:hover { filter: brightness(1.1); }
.account-btn .avatar {
  width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.account-btn .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { position: relative; }
#account-menu {
  position: absolute; right: 12px; top: calc(100% - 6px); z-index: 1500;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 12px; min-width: 220px;
}
#account-menu .email { color: var(--muted); font-size: 12px; margin-bottom: 10px; word-break: break-all; }
#account-menu .btn { width: 100%; margin-top: 6px; }

/* Locked (members-only) features */
.lockable { position: relative; }
.lockable.is-locked > :not(.unlock) { opacity: .35; pointer-events: none; filter: blur(.5px); user-select: none; }
.unlock { display: none; }
.lockable.is-locked > .unlock {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  position: absolute; inset: 0; width: 100%;
  background: transparent; border: none; cursor: pointer;
  color: var(--sea); font-weight: 700; font-size: 13px; text-align: center; padding: 8px;
}
.unlock span {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px;
}
.unlock:hover span { border-color: var(--sea); }
.lock-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(7,18,33,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: var(--panel); color: var(--ink); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; padding: 22px; position: relative;
  animation: toast-in .2s ease;
}
.modal-card h2 { margin: 0 0 4px; font-size: 20px; }
.modal-card .lead { color: var(--muted); margin: 0 0 16px; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.perks { list-style: none; padding: 12px 14px; margin: 0 0 16px; background: var(--sea-soft); border-radius: 10px; display: grid; gap: 4px; font-size: 13px; }
.perks li::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.tabs button { border: none; background: none; padding: 8px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#auth-form { display: grid; gap: 12px; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; }
#auth-password { font-family: var(--mono); }
.pw-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pw-tools .btn { padding: 6px 10px; font-size: 12px; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; margin: 0; font-size: 13px; }
.form-note { color: var(--muted); font-size: 12px; margin: 0; }
#auth-submit { width: 100%; padding: 11px; }

/* Boat settings */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.segmented label {
  display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-weight: 600; background: var(--panel-2);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--sea); }
.segmented label:has(input:checked) { border-color: var(--sea); background: var(--sea-soft); }
.segmented label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--sea-soft); }
.stack { display: grid; gap: 10px; }
.home-pos { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- Weather overlays ---------- */
.clouds-tiles { filter: grayscale(1) brightness(.5) contrast(1.5); }
/* EMODnet draws white contours with dark labels: invert to dark lines with light labels */
.depth-tiles { filter: invert(1) sepia(.5) hue-rotate(180deg) saturate(3); opacity: .8; }
.wind-icon { background: none; border: none; }
.wind-arrow { display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%); pointer-events: none; }
.wind-arrow svg { width: 30px; height: 30px; fill: var(--c); stroke: rgba(0,0,0,.55); stroke-width: .8; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.wind-arrow span {
  font: 700 10.5px/1 Inter, sans-serif; color: #fff; background: rgba(15,31,51,.78);
  padding: 2px 4px; border-radius: 4px; margin-top: 1px; white-space: nowrap;
}
.wind-legend {
  background: rgba(255,255,255,.94); border-radius: 8px; padding: 6px 8px; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  font: 600 11px/1.3 Inter, sans-serif; color: #0f1f33;
}
.wind-legend .chips { display: flex; gap: 3px; margin-top: 4px; }
.wind-legend .chips span { padding: 2px 5px; border-radius: 4px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.4); }

/* ---------- Waypoint names, signal, warnings ---------- */
/* Waypoint row: name, time and buttons on top; coordinates, wind and waves below */
.itinerary .wp-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; column-gap: 8px; row-gap: 1px; align-items: center; }
.wp-row .wp-badge { grid-row: 1 / span 2; align-self: start; margin-top: 2px; }
.itinerary .wp-row > .wp-name { grid-column: 2; grid-row: 1; }
.itinerary .wp-row > :nth-child(3) { grid-column: 3; grid-row: 1; }
.itinerary .wp-row > .wp-actions { grid-column: 4; grid-row: 1; }
.wp-sub { grid-row: 2; grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; min-width: 0; }
.wp-sub .wp-coords { flex: none; font-size: 11.5px; color: var(--muted); }
.wp-name {
  border: 1px solid transparent; background: transparent; padding: 1px 4px; margin-left: -5px;
  border-radius: 6px; font: 600 13px/1.3 Inter, system-ui, sans-serif; color: var(--ink); width: 100%; min-width: 0;
}
.wp-name::placeholder { color: var(--muted); font-weight: 500; opacity: .7; }
.wp-name:hover { border-color: var(--line); }
.wp-name:focus { border-color: var(--sea); background: var(--panel); outline: none; box-shadow: 0 0 0 3px var(--sea-soft); }
.wp-actions { display: flex; gap: 4px; flex: none; }
.wp-row .wp-actions .icon-btn { opacity: 0; transition: opacity .15s; }
.wp-row:hover .wp-actions .icon-btn, .wp-row:focus-within .wp-actions .icon-btn { opacity: 1; }
@media (hover: none) { .wp-row .wp-actions .icon-btn { opacity: 1; } }
.wp-tip { font: 600 11.5px/1.2 Inter, sans-serif; padding: 2px 7px; border-radius: 6px; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; flex: none; }
.dot.go, .cond.go::before { background: var(--ok); }
.dot.caution, .cond.caution::before { background: #d9a400; }
.dot.nogo, .cond.nogo::before { background: var(--danger); }
.cond { display: inline-flex; align-items: center; gap: 7px; }
.cond::before { content: ''; width: 12px; height: 12px; border-radius: 50%; }
.cond.nogo { color: var(--danger); }
.stat.bad { border-color: var(--danger); background: var(--danger-soft); }
.stat.bad .value { color: var(--danger); }

.warnings { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.warnings li { padding: 8px 10px 8px 32px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; position: relative; }
.warnings li::before { position: absolute; left: 10px; top: 7px; font-size: 14px; }
.warnings li.bad { background: var(--danger-soft); color: var(--danger); }
.warnings li.bad::before { content: '⚠'; }
.warnings li.warn { background: var(--accent-soft); color: #9a5a12; }
.warnings li.warn::before { content: '●'; color: #d9a400; }
[data-theme="night"] .warnings li.warn { color: var(--accent); }

.leg-row.land { border-left-color: var(--danger); }
.land-flag { color: var(--danger); font-weight: 700; }

/* ---------- Spots ---------- */
.spots .route-item { gap: 6px; }
.spots .route-item .name { cursor: pointer; }
.spot-icon { background: none; border: none; }
.spot-icon div {
  width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
#share-url { font-family: var(--mono); font-size: 12.5px; }
.modal-card .pw-tools .btn { text-decoration: none; }

/* ---------- Print / PDF ---------- */
#print-sheet { display: none; }
body.printing #sidebar, body.printing .leaflet-control-container, body.printing #compass,
body.printing #toasts, body.printing .modal { display: none !important; }
body.printing #app { display: flex; flex-direction: column; height: auto; }
body.printing #map-wrap { flex: none; width: 180mm; height: 190mm; margin: 0 auto; border: 1px solid #ccc; }
body.printing #print-sheet { display: contents; }
body.printing .print-head { order: -1; }
body.printing { background: #fff; display: flex; flex-direction: column; height: auto; }

.print-head { width: 180mm; margin: 0 auto 6mm; color: #0f1f33; }
.print-head h1 { font-size: 20pt; margin: 0; }
.print-head p { margin: 1mm 0 4mm; color: #5d6d82; font-size: 9pt; }
.print-kpis { display: flex; flex-wrap: wrap; gap: 2mm; }
.print-kpis div { border: 1px solid #dde4ec; border-radius: 2mm; padding: 2mm 3mm; min-width: 22mm; }
.print-kpis span { display: block; font-size: 7pt; text-transform: uppercase; letter-spacing: .05em; color: #5d6d82; }
.print-kpis b { font-size: 11pt; }
.print-body { width: 180mm; margin: 5mm auto 0; color: #0f1f33; font-size: 9pt; }
.print-body table { width: 100%; border-collapse: collapse; }
.print-body th { text-align: left; font-size: 7pt; text-transform: uppercase; color: #5d6d82; border-bottom: 1px solid #0f1f33; padding: 1.5mm 1mm; }
.print-body td { padding: 1.2mm 1mm; vertical-align: top; }
.print-body tr.wp td { border-top: 1px solid #dde4ec; }
.print-body tr.leg td { color: #5d6d82; font-size: 8.5pt; }
.print-body .mono { font-family: var(--mono); font-size: 8pt; color: #5d6d82; }
.print-warn { margin: 0 0 4mm; padding: 2mm 3mm 2mm 7mm; border: 1px solid #d64545; border-radius: 2mm; color: #b83232; }
.print-note { margin-top: 5mm; font-size: 7.5pt; color: #5d6d82; }

@media print {
  @page { size: A4 portrait; margin: 12mm 15mm; }
  html, body { height: auto; }
  .print-body tr { break-inside: avoid; }
  #map-wrap { break-inside: avoid; }
}

/* Waves always in blue, fuel always in red */
.wave { color: var(--sea); font-weight: 600; }
.fuel { color: var(--danger); font-weight: 600; }
.leg-row .leg-data .fuel { font-weight: 700; }
.print-body .wave { color: #1d5fa8; }
.print-body .fuel, .print-kpis .fuel { color: #c0392b; }
/* Depth at each waypoint; amber when shallow */
.depth { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.depth.shallow { color: #b07d00; font-weight: 600; }
.depth.nogo { color: var(--danger); font-weight: 700; }
.depth .sig { margin-right: 4px; }
.field-hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.field-hint .sig { font-size: 10.5px; }
/* Departure (day + time) gets the full width under the speed */
.lockable[data-lock="eta"] { grid-column: 1 / -1; }

/* Settings, export & boat: one collapsible card in three parts */
#settings-card h3.sub {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700;
  margin: 16px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
#settings-card h3.sub:first-of-type { margin-top: 2px; }
.boat-block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 2px; }
.boat-block .lock-badge { text-transform: none; letter-spacing: 0; }

/* Traffic light on each waypoint: a coloured label, easy to spot */
.sig {
  display: inline-block; font: 700 10.5px/1 Inter, system-ui, sans-serif; color: #fff;
  padding: 3px 7px; border-radius: 999px; margin-right: 5px; letter-spacing: .02em;
}
.sig.go { background: var(--ok); }
.sig.caution { background: #d9a400; color: #2b2100; }
.sig.nogo { background: var(--danger); }

.limits-legend { display: grid; gap: 3px; font-size: 12px; color: var(--muted); margin-top: -4px; }
.limits-legend span { display: flex; align-items: center; gap: 4px; }
.limits-legend b { color: var(--ink); margin-right: 2px; }
.limits-legend .dot { width: 10px; height: 10px; }
.limits-legend small { font-size: 11px; opacity: .85; }
#boat-form .grid2 { align-items: end; }
