* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: #ffffff;
  color: var(--ink);
  overscroll-behavior-y: none;
  /* Craft: crisp, optically-tuned text (Apple §15) */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;   /* body sits near 0, a hair tight */
}
:root {
  color-scheme: light;
  --ocean: #ffffff;
  --deep: #ffffff;
  --deeper: #f2f2f7;             /* Apple grouped background */
  --foam: #1c1c1e;              /* softer than pure black — premium */
  --sail: #1c1c1e;
  --ink: #1c1c1e;
  --rope: #1d439d;
  --sunset: #2f5bd0;
  --green: #4ade80;
  --red: #dc2626;
  --amber: #b45309;
  --text-dim: #494c55;
  --text-mute: #86868b;         /* Apple tertiary label */
  --border: rgba(0,0,0,0.07);   /* hairline separators */
  --border-strong: rgba(0,0,0,0.13);
  --card: rgba(0,0,0,0.035);
  --card-hover: rgba(0,0,0,0.06);
  /* Soft, layered elevation — never a single hard drop (Apple §12) */
  --shadow: 0 1px 2px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.10);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 2px 8px rgba(0,0,0,0.08), 0 18px 48px rgba(0,0,0,0.18);
  /* Accent tints */
  --accent-soft: rgba(29, 67, 157, 0.10);
  --accent-soft-hover: rgba(29, 67, 157, 0.16);
  /* Motion: fast, natural, interruptible-feeling (Apple §1,§4) */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);       /* decelerate — enters */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* gentle overshoot for momentum */
  --dur-press: 120ms;
  --dur-fast: 200ms;
  --dur-base: 320ms;
  /* Consistent radius scale */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  /* Liquid Glass — the translucent floating material (Apple WWDC 2025).
     Blur + saturate + a slight brightness lift so glass reads as glass
     even over plain backgrounds; a bright edge catches the light. */
  --glass-bg: rgba(255,255,255,0.55);
  --glass-bg-strong: rgba(255,255,255,0.68);
  --glass-blur: blur(18px) saturate(180%) brightness(1.06);
  --glass-blur-strong: blur(30px) saturate(190%) brightness(1.06);
  --glass-edge: rgba(255,255,255,0.6);
  --glass-hi: inset 0 1px 0 rgba(255,255,255,0.75);   /* specular top edge */
  --glass-lo: inset 0 -0.5px 0 rgba(255,255,255,0.22);
  --glass-ambient: 0 8px 28px rgba(0,0,0,0.12);
}

/* ===== Login Screen ===== */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; }

#login-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #ffffff 0%, #f0f0f0 100%);
}
#login-screen .logo-wrap {
  text-align: center;
  margin-bottom: 48px;
}
#login-screen .login-logo {
  display: block;
  width: 240px;
  max-width: 70vw;
  height: auto;
  margin: 0 auto 12px;
  filter: drop-shadow(0 6px 16px rgba(29, 67, 157, 0.22));
}
#login-screen .tagline {
  margin: 4px 0 0 0;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--rope);
  text-transform: uppercase;
}
#login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#login-form input {
  background: rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  color: var(--sail);
  font-size: 17px;
  padding: 16px 18px;
  border-radius: 12px;
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}
#login-form input:focus { border-color: var(--rope); }
#login-form button {
  background: var(--rope);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 1px;
}
#login-error {
  color: var(--red);
  text-align: center;
  font-size: 14px;
  min-height: 18px;
  margin-top: 8px;
}
.login-footer {
  position: absolute;
  bottom: 24px;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 2px;
}
/* Cat dab loading animation */
#cat-dab-container {
  display: none;
  text-align: center;
  margin-bottom: 40px;
}
.cat-dab-label {
  margin: 8px 0 0 0;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--rope);
  text-transform: uppercase;
}
@keyframes cat-bounce {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  25%       { transform: translateY(-12px) rotate(-3deg); }
  50%       { transform: translateY(-16px) rotate(0deg); }
  75%       { transform: translateY(-8px) rotate(3deg); }
}
.cat-dab-svg {
  display: block;
  margin: 0 auto;
  animation: cat-bounce 0.7s ease-in-out infinite;
  filter: drop-shadow(0 4px 18px rgba(29, 67, 157, 0.45));
}

/* ===== App Screen ===== */
#app-screen {
  flex-direction: column;
  width: 100%;
  background: var(--deep);
}

.app-header {
  position: sticky;
  top: 0;
  /* Over Leaflet's interne lag (opp til ~800) — ellers vil kart-thumbnails
     ligge over header når man scroller */
  z-index: 850;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: env(safe-area-inset-top) 16px 0 16px;
}
.app-header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
}
.header-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--sail);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 4px;
  flex: 0 0 auto;
}
.header-logo-btn {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.header-logo-img { height: 24px; width: auto; display: block; }
.header-sep {
  width: 1px;
  height: 22px;
  background: var(--border-strong);
  flex: 0 0 auto;
  margin: 0 10px;
}
body.view-dashboard .header-sep { display: none; }
.app-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}
.alert-banner {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin: 12px 16px 0 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.alert-banner .alert-icon { font-size: 16px; }

main#content {
  flex: 1;
  padding: 16px;
  /* Klarer den faste bunnmenyen + hjemindikatoren (safe-area) slik at
     innhold nederst (f.eks. oppsummeringen i ruteplan) ikke kuttes av. */
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

/* ===== Tab Bar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom)) 0;
  /* Over Leaflet's interne z-indexer */
  z-index: 850;
}
.tab-bar button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.15s;
  font-weight: 500;
}
.tab-bar button .tab-icon {
  font-size: 22px;
  line-height: 1;
}
.tab-bar button > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}
.tab-bar button.active { color: var(--rope); }

/* ===== Dashboard (landingsside) ===== */
body.view-dashboard .tab-bar { display: none; }
body.view-dashboard main#content { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dash-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px 16px;
  cursor: pointer;
  overflow: hidden;
}
.dash-card:active { background: var(--card-hover); }
.dash-card-wide { grid-column: 1 / -1; }
.dash-jump {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(29, 67, 157, 0.10);
  color: var(--rope);
  font-size: 15px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dash-card-label { font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.dash-stat-big { font-size: 40px; font-weight: 800; color: var(--sail); line-height: 1.05; margin-top: 8px; }
.dash-stat-big .dash-unit { font-size: 17px; font-weight: 700; margin-left: 3px; color: var(--text-dim); }
.dash-card-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.dash-todos { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.dash-todo { display: flex; align-items: center; gap: 8px; }
.dash-todo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-mute); flex: 0 0 auto; }
.dash-todo-dot.crit-red { background: #f87171; }
.dash-todo-dot.crit-amber { background: #fbbf24; }
.dash-todo-dot.crit-green { background: #4ade80; }
.dash-todo-dot.crit-blue { background: #818cf8; }
.dash-todo-title { font-size: 14px; color: var(--sail); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-empty { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.dash-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 2px 12px;
  color: var(--text-dim); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.dash-divider::before, .dash-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-strong);
}
.dash-menu { display: flex; flex-direction: column; gap: 8px; }
.dash-menu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.dash-menu-item:active { background: var(--card-hover); }
.dash-menu-icon { font-size: 20px; flex: 0 0 auto; width: 24px; text-align: center; }
.dash-menu-label { flex: 1; font-size: 15px; font-weight: 600; color: var(--sail); }
.dash-menu-arrow { color: var(--text-mute); font-size: 20px; }

/* Siste etappe — kartutklipp mellom de to kort-radene. Kartet fyller hele
   kortet; høyden synkes mot to-do-kortet i JS (dash-map-card.style.height). */
.dash-map-card { padding: 0; min-height: 120px; }
.dash-map-card .dash-jump { z-index: 900; }   /* over Leaflet-lagene */
@keyframes dash-spin { to { transform: rotate(360deg); } }
.dash-map { position: absolute; inset: 0; border-radius: 16px; overflow: hidden; }
.dash-map .leaflet-container { background: var(--card); }
/* Etappe-lengden oppe i venstre hjørne: stort tall, ingen bakgrunn, med
   forklaring under i liten tekst. Hvit «glød» gjør tallet lesbart over kartet. */
.dash-map-badge {
  position: absolute; left: 12px; top: 9px; z-index: 900; pointer-events: none;
  text-shadow: 0 1px 3px rgba(255,255,255,0.95), 0 0 2px rgba(255,255,255,0.95);
}
.dash-map-badge-val { font-size: 30px; font-weight: 800; line-height: 1; color: var(--sail); }
.dash-map-badge-val .dash-unit { font-size: 15px; font-weight: 700; margin-left: 2px; color: var(--text-dim); }
.dash-map-badge-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin-top: 1px; }
.dash-map-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 16px; font-size: 13px; color: var(--text-dim);
}
/* Alltid synlige stedsnavn ved siden av punktene — ingen bakgrunn, bare tekst
   med hvit glød for lesbarhet. Nåværende posisjon vises i grønt. */
.leaflet-tooltip.dash-map-tip {
  background: transparent; border: none; box-shadow: none; padding: 0;
  color: var(--sail); font-size: 11px; font-weight: 700; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(255,255,255,0.95), 0 0 2px rgba(255,255,255,0.95), 0 0 5px rgba(255,255,255,0.9);
}
.leaflet-tooltip.dash-map-tip.is-now { color: #16a34a; }
.leaflet-tooltip.dash-map-tip::before { display: none; }   /* skjul pil-spissen */

/* Dashboard: vind-oppsummering (bred skive + stor farget forhold-tekst) */
.dash-wind-body { margin-top: 2px; }
.dash-wind-loading, .dash-wind-empty { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.dash-wind-row { display: flex; align-items: center; gap: 6px; }
.dash-wind-dial { flex: 0 0 auto; width: 132px; margin: -6px 0; }
.dash-wind-dial .vv-dial { width: 100%; max-width: none; height: auto; display: block; }
.dash-wind-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-wind-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mute); }
.dash-wind-cond { font-size: 22px; font-weight: 800; line-height: 1.1; }
.dash-wind-dir2 { font-size: 13.5px; color: var(--text-dim); margin-top: 7px; }
.dash-wind-dir2 b { color: var(--sail); }
.vv-cond-text-vgood { color: #15803d; }
.vv-cond-text-good { color: #16a34a; }
.vv-cond-text-ok { color: #b45309; }
.vv-cond-text-bad { color: #b91c1c; }
.vv-cond-text-vbad { color: #7f1d1d; }

/* ===== Cards & Components ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}
.card-action {
  font-size: 13px;
  color: var(--rope);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

.btn {
  background: var(--rope);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.3px;
}
.btn-secondary {
  background: rgba(0,0,0,0.08);
  color: var(--sail);
  border: 1px solid var(--border);
}
.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: #b91c1c;
  border: 1px solid rgba(248, 113, 113, 0.4);
}
.btn-success {
  background: var(--green);
  color: #052e16;
}
.btn-row {
  display: flex;
  gap: 8px;
}
.btn-row .btn { flex: 1; }

input.field, select.field, textarea.field {
  width: 100%;
  min-width: 0;
  background: rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  color: var(--sail);
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
/* iOS rendrer datetime-local med native styling som ikke alltid følger
   width:100% — tvinger frem en konsistent layout. */
input.field[type="datetime-local"] {
  appearance: none;
  -webkit-appearance: none;
  min-height: 48px;
  text-align: left;
  display: block;
}
input.field:focus, select.field:focus, textarea.field:focus { border-color: var(--rope); }
textarea.field { resize: vertical; min-height: 70px; }
select.field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
select.field option,
select option {
  background-color: #ffffff;
  color: #000000;
}
.field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}
.field-group { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== Motor Page ===== */
.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-mute);
}
.section-label::before,
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-label:first-child { margin-top: 4px; }
.gauge-wrap {
  text-align: center;
  padding: 30px 0 22px;
  overflow: visible;
}
.gauge {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}
.gauge svg { transform: rotate(-90deg); }
.gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-pct {
  font-size: 48px;
  font-weight: 200;
  letter-spacing: -1px;
}
.gauge-pct .unit { font-size: 22px; color: var(--text-dim); margin-left: 2px; }
.gauge-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 600;
}
.stat-value {
  font-size: 22px;
  font-weight: 400;
}
.stat-value .small { font-size: 13px; color: var(--text-dim); margin-left: 2px; }

/* High case: tekstetikett som flyter rett utenfor den røde streken på måleren */
.high-tick-label {
  position: absolute;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.1;
}
.high-tick-label .htl-main {
  font-size: 14px;
  font-weight: 600;
  color: #ef4444;
  font-variant-numeric: tabular-nums;
}
.high-tick-label .htl-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.high-case-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  font-size: 12px;
  color: var(--text-dim);
}
.high-case-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.card-hero {
  background: var(--deeper);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(0,0,0,0.06);
}
.card-hero .stat {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.08);
}

.fill-list { margin-top: 12px; }
.fill-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px;
  opacity: 0.6;
}
.fill-item:last-child { border-bottom: none; }
.fill-item .fill-when { color: var(--text-mute); font-size: 12px; }
.fill-item .fill-detail { font-weight: 400; color: var(--text-dim); }
.fill-item .fill-rate { color: var(--text-mute); font-size: 12px; }
.fill-item-row { display: flex; flex-direction: column; gap: 2px; }
.fill-delete {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  align-self: center;
}
.fill-item--tappable { cursor: pointer; align-items: center; transition: opacity 0.15s; }
.fill-item--tappable:active { opacity: 0.4; }
.fill-item .fill-chev {
  color: var(--text-mute);
  font-size: 20px;
  align-self: center;
  padding-left: 8px;
  flex-shrink: 0;
}
.fill-item--outlier .fill-detail,
.fill-item--outlier .fill-when {
  text-decoration: line-through;
  opacity: 0.7;
}
.fill-item--outlier .outlier-badge,
.fill-item--outlier .fill-chev { text-decoration: none; }
.outlier-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}
.outlier-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  cursor: pointer;
}
.outlier-toggle input { margin-top: 2px; width: 18px; height: 18px; flex-shrink: 0; }
.outlier-toggle-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.outlier-toggle-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; line-height: 1.4; }

/* ===== Motor: fane-veksler (Drivstoff / Reservelager) ===== */
.motor-toggle {
  display: flex;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin: 4px 0 8px;
}
.motor-toggle-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, color 0.15s;
}
.motor-toggle-btn.active { background: var(--rope); color: #fff; }
/* Når fane-raden har mange faner (f.eks. Service), la den scrolle horisontalt
   i stedet for å presse knappene sammen. */
.motor-toggle--scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.motor-toggle--scroll::-webkit-scrollbar { display: none; }
.motor-toggle--scroll .motor-toggle-btn { flex: 0 0 auto; white-space: nowrap; padding-left: 14px; padding-right: 14px; }
/* «Rediger faner»-knappen sist i fane-raden */
.motor-toggle-edit { padding-left: 12px; padding-right: 12px; opacity: 0.75; }
/* Rader i fane-redigereren */
.svc-edit-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.svc-edit-row .svc-row-label { flex: 1; min-width: 0; }
.svc-edit-row .svc-row-int { flex: 0 0 84px; width: 84px; text-align: right; }
.svc-edit-row.is-hidden { opacity: 0.5; }
.svc-row-del {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--card); color: var(--text-dim);
  font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ===== Reservelager ===== */
.reserve-total { text-align: center; padding: 8px 0 4px; }
.reserve-total-liters {
  font-size: 44px;
  font-weight: 200;
  letter-spacing: -1px;
  line-height: 1;
}
.reserve-total-liters .unit { font-size: 20px; color: var(--text-dim); margin-left: 4px; }
.reserve-total-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.5px;
}
.reserve-bar {
  margin-top: 14px;
  height: 10px;
  background: rgba(0,0,0,0.08);
  border-radius: 8px;
  overflow: hidden;
}
.reserve-bar-fill { height: 100%; border-radius: 8px; transition: width 0.3s, background 0.3s; }

/* Størrelsesgruppe med tydelig skille mellom hver kannestørrelse. */
.tank-group { margin-top: 16px; }
.tank-group + .tank-group {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}
.tank-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.tank-group-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
}
.tank-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 14px 10px;
}
.tank-row > .tank {
  flex: 0 0 calc((100% - (var(--cols) - 1) * 10px) / var(--cols));
  max-width: calc((100% - (var(--cols) - 1) * 10px) / var(--cols));
}
.tank {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.tank-cap {
  width: 40%;
  height: 8px;
  background: var(--border-strong);
  border-radius: 5px 5px 0 0;
  position: relative;
  z-index: 2;
  margin-bottom: -2px;
}
.tank-edit {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 4;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tank-body {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: rgba(0,0,0,0.05);
  border: 2px solid var(--border-strong);
  border-radius: 10px 10px 12px 12px;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}
.tank-body:active { transform: scale(0.97); }
.tank-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  transition: height 0.25s ease, background 0.25s;
}
.tank-reading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(255,255,255,0.75);
  pointer-events: none;
}
.tank-reading .tank-unit { font-size: 13px; color: var(--text-dim); margin-left: 2px; align-self: center; }

/* ===== Check-in/out ===== */
.status-card {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.12), rgba(74, 222, 128, 0.04));
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.status-card.checked-in {
  background: linear-gradient(135deg, rgba(232, 149, 84, 0.15), rgba(232, 149, 84, 0.04));
  border-color: rgba(232, 149, 84, 0.4);
}
.status-card.warning {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.15), rgba(248, 113, 113, 0.04));
  border-color: rgba(248, 113, 113, 0.4);
}
.status-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}
.status-state {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
}
.status-detail {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.checklist-item.done {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.3);
}
.checkbox {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-strong);
  border-radius: 7px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: transparent;
  transition: all 0.15s;
}
.checklist-item.done .checkbox {
  background: var(--green);
  border-color: var(--green);
  color: #052e16;
}
.checklist-text {
  flex: 1;
  font-size: 15px;
}
.checklist-item.done .checklist-text {
  color: var(--text-dim);
}
.checklist-item.missing {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.08);
  animation: shake 0.4s ease-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.checklist-summary {
  font-size: 13px;
  color: var(--text-dim);
  padding: 10px 12px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
}

/* ===== Activity ===== */
.activity-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}
.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.activity-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.activity-type .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.activity-type .dot.in { background: var(--green); }
.activity-type .dot.out { background: var(--sunset); }
.activity-when {
  font-size: 12px;
  color: var(--text-dim);
}
.activity-member { font-size: 13px; color: var(--text-dim); }
.activity-note {
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  color: var(--text-dim);
  line-height: 1.45;
}
.activity-note .note-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Trip items — løftede kort med 3D-skygge for tydelig separasjon */
.trip-item {
  background: linear-gradient(180deg, rgba(0,0,0,0.07) 0%, rgba(0,0,0,0.04) 100%);
  border: 1px solid rgba(0,0,0,0.12);
  border-top-color: rgba(0,0,0,0.18);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow:
    0 6px 14px rgba(0,0,0,0.35),
    0 2px 4px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(0,0,0,0.06);
  /* iOS tap feedback */
  -webkit-tap-highlight-color: rgba(29, 67, 157, 0.15);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.trip-item:active {
  transform: translateY(1px);
  box-shadow:
    0 3px 8px rgba(0,0,0,0.3),
    0 1px 2px rgba(0,0,0,0.2);
}
.trip-item.trip-open {
  border-left: 3px solid var(--sunset);
  background: linear-gradient(180deg, rgba(232, 149, 84, 0.12) 0%, rgba(0,0,0,0.04) 100%);
}
.trip-item.trip-orphan {
  border-left: 3px solid var(--red);
}
.trip-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.trip-title {
  font-family: Georgia, "Times New Roman", "Iowan Old Style", serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--sail);
  line-height: 1.2;
}
.trip-subtitle {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 4px;
  letter-spacing: 0.3px;
}
.trip-edit-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,0.08);
  display: flex;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--rope);
  font-weight: 500;
  letter-spacing: 0.3px;
}
.trip-item:active .trip-edit-footer {
  color: var(--sunset);
}
.trip-duration {
  font-size: 12px;
  color: var(--rope);
  background: rgba(29, 67, 157, 0.12);
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  font-weight: 500;
}
.trip-duration.warn {
  color: #b91c1c;
  background: rgba(248, 113, 113, 0.15);
}
.trip-checklists {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mini-pill {
  font-size: 11px;
  background: rgba(0,0,0,0.06);
  padding: 3px 9px;
  border-radius: 10px;
  color: var(--text-dim);
}

/* Filter row labels */
.filter-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-mute);
  font-weight: 600;
  margin: 4px 0 6px 4px;
}

/* ===== To-do ===== */
.todo-item {
  background: linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.03) 100%);
  border: 1px solid rgba(0,0,0,0.10);
  border-top-color: rgba(0,0,0,0.16);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  box-shadow:
    0 4px 10px rgba(0,0,0,0.25),
    0 1px 2px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(0,0,0,0.05);
  -webkit-tap-highlight-color: rgba(29, 67, 157, 0.15);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.todo-item:active {
  transform: translateY(1px);
  box-shadow:
    0 2px 5px rgba(0,0,0,0.25),
    0 1px 2px rgba(0,0,0,0.15);
}
.todo-item.done { opacity: 0.55; }
.todo-check {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: transparent;
  margin-top: 1px;
}
.todo-item.done .todo-check {
  background: var(--green);
  border-color: var(--green);
  color: #052e16;
}
.todo-body { flex: 1; min-width: 0; }
.todo-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
  word-break: break-word;
}
.todo-item.done .todo-title { text-decoration: line-through; color: var(--text-dim); }
.todo-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  margin-top: 4px;
}
.tag {
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.tag.crit-high, .tag.crit-red { background: rgba(248, 113, 113, 0.2); color: #b91c1c; }
.tag.crit-med, .tag.crit-amber { background: rgba(251, 191, 36, 0.2); color: #92400e; }
.tag.crit-low, .tag.crit-green { background: rgba(74, 222, 128, 0.18); color: #166534; }
.tag.crit-blue { background: rgba(129, 140, 248, 0.22); color: #3730a3; }
.crit-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.crit-color-dot.red { background: #f87171; }
.crit-color-dot.amber { background: #fbbf24; }
.crit-color-dot.green { background: #4ade80; }
.crit-color-dot.blue { background: #818cf8; }
.todo-note {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  word-break: break-word;
}
.todo-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-self: flex-start;
}
.todo-actions button {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.empty {
  text-align: center;
  color: var(--text-mute);
  padding: 40px 20px;
  font-size: 14px;
}

/* ===== Filter chips ===== */
.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  background: rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.chip.active {
  background: var(--rope);
  color: #fff;
  border-color: var(--rope);
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: flex-end;
  justify-content: center;
  /* Må ligge over Leaflet's interne z-indexer (opp til ~800) */
  z-index: 900;
  padding: 0;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--deep);
  border-top: 1px solid var(--border-strong);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)) 16px;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

/* Settings */
.settings-section {
  margin-bottom: 20px;
}
.settings-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 0 0 10px 4px;
  font-weight: 600;
}
.item-list-edit {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}
.menu-group-label {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 14px 2px 6px;
}
#menu-edit > .menu-group-label:first-child { margin-top: 2px; }
#menu-edit .item-list-edit { margin-bottom: 4px; }
.menu-group-name-input {
  width: 100%;
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  color: var(--sail);
  font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 10px;
  border-radius: 8px;
  outline: none;
}
.menu-group-name-input:focus { border-color: var(--rope); background: rgba(0,0,0,0.08); }
.item-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
}
.item-edit-row input {
  flex: 1;
  background: rgba(0,0,0,0.04);
  border: 1px solid transparent;
  color: var(--sail);
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 8px;
  outline: none;
}
.item-edit-row input:focus { border-color: var(--rope); background: rgba(0,0,0,0.08); }
.item-edit-row .remove-btn {
  background: transparent;
  border: none;
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.add-item-btn {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-dim);
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.reorder-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.reorder-btn {
  background: rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 20px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}
.reorder-btn:active { background: rgba(29, 67, 157, 0.2); color: var(--rope); }
.reorder-btn:disabled { opacity: 0.2; cursor: default; }

.hint {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 6px;
  line-height: 1.4;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ocean);
  color: var(--sail);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 1300;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  border: 1px solid var(--border-strong);
}
.toast.show { opacity: 1; }

/* ===== Lagrings-status (Lagrer… / Lagret / feil) ===== */
.save-status {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: min(92vw, 460px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--ocean);
  color: var(--ink);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-strong);
  z-index: 1400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.save-status.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.save-status.saved { color: #16a34a; border-color: rgba(22,163,74,0.45); }
.save-status.error {
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: 10px;
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--red);
  color: #fff;
  border-color: rgba(0,0,0,0.15);
  font-weight: 700;
  pointer-events: auto;
}
.save-status .spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.18);
  border-top-color: var(--sunset);
  animation: save-spin 0.7s linear infinite;
  flex: none;
}
@keyframes save-spin { to { transform: rotate(360deg); } }
.save-status .ss-sub { font-weight: 500; font-size: 12.5px; opacity: 0.95; }
.save-status .ss-diag {
  font-weight: 400;
  font-size: 11px;
  opacity: 0.8;
  word-break: break-word;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.save-status .ss-retry {
  align-self: center;
  background: #fff;
  color: var(--red);
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.save-status .ss-retry:active { opacity: 0.85; }

/* ===== Menu toggle button (header) ===== */
.menu-toggle {
  background: transparent;
  border: none;
  color: var(--sail);
  font-size: 22px;
  cursor: pointer;
  padding: 6px 10px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
}
.menu-toggle:active { background: rgba(0,0,0,0.08); }
.menu-toggle .menu-toggle-label {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ===== Side menu (slides in from left) ===== */
.side-menu-backdrop {
  position: fixed;
  inset: 0;
  /* Lett dim, ikke en grå vegg — så glass-menyen leser som glass og appen
     bak skinner gjennom i stedet for å bli grå. */
  background: rgba(0,0,0,0.22);
  display: none;
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.2s;
}
.side-menu-backdrop.active { display: block; opacity: 1; }
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 78%;
  max-width: 320px;
  background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
  border-right: 1px solid var(--border-strong);
  z-index: 1101;
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
}
.side-menu.active { transform: translateX(0); }
.side-menu-header {
  padding: 18px 18px 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.side-menu-header .boat-icon {
  width: 36px;
  height: 36px;
}
.side-menu-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 2px;
}
.side-menu-header .sub {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--rope);
  text-transform: uppercase;
  margin-top: 2px;
}
.side-menu-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 26px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.side-menu-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 24px 10px;
}
.side-menu-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-mute);
  font-weight: 600;
  margin: 14px 10px 6px;
}
.side-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--foam);
  padding: 13px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  text-align: left;
  font-family: inherit;
}
.side-menu-item:active { background: rgba(0,0,0,0.05); }
.side-menu-item.active {
  background: rgba(29, 67, 157, 0.15);
  color: var(--rope);
}
.side-menu-item .side-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}
.side-menu-item .side-badge {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(0,0,0,0.08);
  color: var(--text-dim);
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 600;
}

/* ===== Under construction view ===== */
.uc-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  min-height: 60vh;
}
.uc-svg {
  width: 180px;
  height: 180px;
  margin-bottom: 24px;
  opacity: 0.85;
}
.uc-title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--sail);
}
.uc-sub {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 320px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.uc-tag {
  display: inline-block;
  background: rgba(29, 67, 157, 0.15);
  color: var(--rope);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 12px;
  font-weight: 600;
}

/* ===== Photo upload + thumbs ===== */
.photo-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* iOS-vennlig "hidden" — input forblir i DOM-en (slik at .click() fungerer
   pålitelig) men er visuelt skjult. display:none kan hindre iOS i å åpne
   action sheet. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.photo-upload-btn {
  background: rgba(0,0,0,0.04);
  border: 1px dashed var(--border-strong);
  color: var(--text-dim);
  padding: 14px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 140px;
  justify-content: center;
  font-family: inherit;
}
.photo-upload-btn:active { background: rgba(0,0,0,0.08); }
.photo-thumb {
  position: relative;
  width: 86px;
  height: 86px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.photo-thumb .photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
/* Trip-media rad: kart + bilder side-by-side, lik størrelse, horisontal scroll */
.trip-media {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.trip-media::-webkit-scrollbar { display: none; }
.trip-media .trip-media-item {
  width: 110px;
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
  /* Lås Leaflet's interne z-indexer (200-700) inne i thumbnailen
     slik at de ikke "lekker" over modaler og andre overlay-elementer */
  isolation: isolate;
  position: relative;
  z-index: 0;
}
.trip-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.trip-media .trip-map-thumb {
  width: 110px;
  height: 110px;
  cursor: pointer;
  position: relative;
}
.trip-media .trip-map-thumb .leaflet-container {
  width: 100%;
  height: 100%;
  /* La klikk passere gjennom kartet til thumbnail-wrapperen (åpner fullskjerm) */
  pointer-events: none;
}
.trip-media .trip-map-thumb::after {
  content: '⤢';
  position: absolute;
  top: 4px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  line-height: 1;
}

/* Fullscreen map modal (header-bar + stor interaktiv map) */
.map-fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1200;
  display: none;
  flex-direction: column;
}
.map-fullscreen.active { display: flex; }
.map-fullscreen .map-fullscreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--deep);
  border-bottom: 1px solid var(--border-strong);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px 16px;
  z-index: 99998;
}
.map-fullscreen .map-fullscreen-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--sail);
}
.map-fullscreen .map-fullscreen-inner {
  flex: 1;
  width: 100%;
  overflow: hidden;
}
.map-fullscreen .map-fullscreen-close {
  background: var(--rope);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.map-fullscreen .map-fullscreen-close:active {
  background: var(--sunset);
}
.todo-photo-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.todo-photo-row::-webkit-scrollbar { display: none; }
.todo-photo-row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--border);
}

/* ===== Lightbox (full-screen image viewer) ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

/* ===== Map containers ===== */
.map-container {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  margin-top: 10px;
}
.map-container.edit {
  height: 240px;
}

.trip-map {
  width: 100%;
  height: 180px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-top: 10px;
}
/* Override Leaflet defaults to match theme */
.leaflet-container {
  background: #e2e2e2 !important;
  font-family: inherit;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--deep) !important;
  color: var(--sail) !important;
  border: 1px solid var(--border-strong);
}
.leaflet-control-attribution {
  background: rgba(0,0,0,0.5) !important;
  color: var(--text-dim) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--rope) !important; }
.location-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.location-row .loc-coord {
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.location-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.location-actions button {
  flex: 1;
  background: rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  color: var(--foam);
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.location-actions button:active { background: rgba(0,0,0,0.12); }
.location-actions button.primary {
  background: rgba(29, 67, 157, 0.18);
  color: var(--rope);
  border-color: rgba(29, 67, 157, 0.35);
}

/* Tab bar: dynamic column support */
.tab-bar.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Seilturer (automatisk rutelogg) ===== */
.voyage-wrap { display: flex; flex-direction: column; min-height: 340px; }
.voyage-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.voyage-status { font-size: 12px; color: var(--text-dim); flex: 1 1 160px; min-width: 160px; }
.voyage-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.voyage-btn {
  background: rgba(29, 67, 157, 0.18);
  color: var(--rope);
  border: 1px solid rgba(29, 67, 157, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block;
}
.voyage-btn:active { background: rgba(29, 67, 157, 0.30); }
.voyage-btn.ghost { background: transparent; }
.voyage-btn:disabled { opacity: 0.6; cursor: default; }
.voyage-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 10px;
}
.vstat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 8px; text-align: center;
}
.vstat-num { font-size: 22px; font-weight: 700; color: var(--sail); line-height: 1.1; }
.vstat-lbl { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.voyage-map {
  width: 100%;
  height: min(52dvh, 460px);
  min-height: 260px;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border-strong);
}
.voyage-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  font-size: 11px; color: var(--text-dim);
  padding: 10px 2px calc(6px + env(safe-area-inset-bottom)) 2px;
}
.voyage-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.voyage-legend .line {
  width: 20px; height: 0; display: inline-block;
  border-top: 3px dashed var(--sunset);
}
.voyage-daytag {
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
  transform: translateX(-50%);
}
.voyage-boat {
  font-size: 24px; line-height: 1; text-align: center;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}
.voyage-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 50px 24px; gap: 10px;
}
.voyage-empty-icon { font-size: 44px; }
.voyage-empty-title { font-size: 17px; font-weight: 700; color: var(--sail); }
.voyage-empty-sub {
  font-size: 13px; color: var(--text-dim);
  max-width: 320px; line-height: 1.5; margin-bottom: 8px;
}

/* ===== Vår reise — havneliste + kart-markører ===== */
.reise-list {
  display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.reise-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.reise-card:active { background: rgba(0,0,0,0.04); }
.reise-card-badge {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--rope); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.reise-card-body { flex: 1; min-width: 0; }
.reise-card-name { font-size: 15px; font-weight: 700; color: var(--sail); word-break: break-word; }
.reise-card-meta { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.reise-card-thumbs { display: flex; gap: 5px; margin-top: 6px; align-items: center; }
.reise-card-thumb { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; border: 1px solid var(--border); }
.reise-card-more { font-size: 12px; color: var(--text-dim); }
.reise-card-add {
  flex: 0 0 auto; background: rgba(29,67,157,0.18);
  border: 1px solid rgba(29,67,157,0.35);
  border-radius: 999px; width: 38px; height: 38px; font-size: 18px; cursor: pointer;
}
.reise-card-add:active { background: rgba(29,67,157,0.30); }

/* Kart-markører */
.reise-pin {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2f5bd0; border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.reise-pin-num { color: #fff; font-size: 13px; font-weight: 700; }
.reise-goal { line-height: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.reise-thumb {
  position: relative; width: 52px; height: 52px; border-radius: 10px;
  background: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.reise-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.reise-thumb.stacked::before,
.reise-thumb.stacked::after {
  content: ''; position: absolute; inset: 0; border-radius: 10px;
  background: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4); z-index: -1;
}
.reise-thumb.stacked::before { transform: rotate(-6deg) translate(-2px, 2px); }
.reise-thumb.stacked::after  { transform: rotate(5deg) translate(2px, 2px); }
.reise-thumb-beer {
  position: absolute; left: -6px; top: -8px; font-size: 15px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.reise-thumb-count {
  position: absolute; right: -6px; bottom: -6px;
  background: #2f5bd0; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
}

/* Havn-modal */
.reise-port-meta { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.5; }
.reise-beers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.reise-beer { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.reise-beer-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.reise-beer-name { font-size: 14px; font-weight: 700; color: var(--sail); }
.reise-beer-meta { font-size: 11px; color: var(--text-dim); }
.reise-beer-note { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.reise-beer-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reise-beer-thumb { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); cursor: pointer; }
.reise-beer-del { margin-top: 8px; background: none; border: none; color: var(--red); font-size: 12px; cursor: pointer; padding: 0; }
.reise-beer.book .reise-beer-name { color: var(--rope); }
.reise-beer-stars { margin-top: 4px; }
/* Seksjonsoverskrift inne i havn-modalen (Øl / Bøker) */
.reise-section-label { font-size: 13px; font-weight: 700; color: var(--sail); margin: 4px 0 8px; }

/* Stjernerangering — visning (skrivebeskyttet) og velger (interaktiv) */
.star-rating { color: #f5a623; font-size: 14px; letter-spacing: 2px; white-space: nowrap; }
.star-picker { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.star-btn {
  background: none; border: none; padding: 0 2px; line-height: 1;
  font-size: 28px; cursor: pointer; color: var(--border-strong);
}
.star-btn.on { color: #f5a623; }
.star-clear {
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--text-mute); font-size: 12px; margin-left: 8px; text-decoration: underline;
}

/* Handlingsknapper på havnekortet (registrer øl / bok) */
.reise-card-actions { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.reise-card-add.book {
  background: rgba(150,110,60,0.16); border-color: rgba(150,110,60,0.35);
}
.reise-card-add.book:active { background: rgba(150,110,60,0.30); }

/* «Hva skjer i byen?» — LLM-research per havn */
.cityguide-refresh {
  float: right; background: none; border: none; color: var(--rope);
  font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1;
}
.cityguide-summary { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin: 2px 0 8px; }
.cityguide-group-label {
  font-size: 12px; font-weight: 700; color: var(--sail);
  text-transform: uppercase; letter-spacing: 0.03em; margin: 12px 0 6px;
}
.cityguide-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 11px; margin-bottom: 7px;
}
.cityguide-item-title { font-size: 14px; font-weight: 700; color: var(--sail); word-break: break-word; }
.cityguide-item-title a { color: var(--rope); text-decoration: none; }
.cityguide-item-meta { font-size: 12px; color: var(--text-mute); margin-top: 1px; }
.cityguide-item-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }
.cityguide-foot { font-size: 11px; color: var(--text-dim); text-align: center; margin-top: 8px; }
.cityguide-refresh-link { background: none; border: none; color: var(--rope); font-size: 11px; cursor: pointer; padding: 0; text-decoration: underline; }
.cityguide-loading { text-align: center; padding: 26px 8px 20px; }
.cityguide-spin { font-size: 30px; display: inline-block; animation: dash-spin 1.4s linear infinite; }
.cityguide-loading-title { font-size: 14px; font-weight: 700; color: var(--sail); margin-top: 12px; }
.cityguide-loading .hint { margin-top: 8px; }
/* Sirkelen er lik de andre hjørneknappene (.dash-jump). Selve staven får en liten
   skygge så den er godt synlig mot kartet uten å endre sirkelen. */
.dash-city-wand { font-size: 16px; }
.dash-city-wand .wand-glyph { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55)); }

.reise-leg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 2px 0 2px 14px;
  border-left: 2px dashed var(--border-strong);
  cursor: pointer;
}
.reise-leg-row:active { opacity: 0.65; }
.reise-leg-row-icon { font-size: 14px; }
.reise-leg-row-text { flex: 1; font-size: 12px; color: var(--text-dim); }
.reise-leg-row-nm { font-size: 12px; font-weight: 600; color: var(--rope); white-space: nowrap; }
.reise-leg-route { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.reise-leg-status { font-size: 12px; color: var(--text-mute); font-weight: 600; }
.reise-leg-status.ok { color: var(--green); }

/* ===== Vår reise — milepæler ===== */
.milestone-section { margin-top: 18px; }
.milestone-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.milestone-head-title { font-size: 15px; font-weight: 700; color: var(--sail); }
.milestone-empty {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  background: var(--card); border: 1px dashed var(--border-strong);
  border-radius: 12px; padding: 14px;
}
.milestone-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
}
.milestone-card:active { background: rgba(0,0,0,0.03); }
.milestone-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.milestone-name { font-size: 15px; font-weight: 700; color: var(--sail); word-break: break-word; }
.milestone-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.milestone-date { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.milestone-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.milestone-bar { height: 8px; border-radius: 6px; background: rgba(0,0,0,0.08); overflow: hidden; margin: 10px 0 8px; }
.milestone-bar-fill { height: 100%; background: var(--rope); border-radius: 6px; min-width: 2px; }
.milestone-line { font-size: 13px; font-weight: 600; color: var(--sail); margin-bottom: 8px; }
.milestone-eta { font-size: 13px; font-weight: 600; color: var(--text-dim); margin: -2px 0 8px; }
.milestone-eta.ok { color: #15803d; }
.milestone-eta.late { color: #b91c1c; }
.milestone-compare { display: flex; flex-direction: column; gap: 4px; }
.milestone-compare + .milestone-compare { margin-top: 8px; }
.milestone-crow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.milestone-crow .lbl { color: var(--text-dim); }
.milestone-crow .val { font-weight: 700; color: var(--sail); white-space: nowrap; }
.milestone-crow .val.milestone-val-need { color: var(--rope); }
.milestone-verdict {
  margin-top: 10px; font-size: 13px; font-weight: 700;
  padding: 6px 10px; border-radius: 8px; text-align: center;
}
.milestone-verdict.ahead { background: rgba(74,222,128,0.16); color: #15803d; }
.milestone-verdict.behind { background: rgba(248,113,113,0.16); color: #b91c1c; }
.milestone-verdict.done { background: rgba(74,222,128,0.20); color: #15803d; }
.milestone-warn { font-size: 12px; color: var(--red); margin-top: 6px; }
.milestone-gpx-status { font-size: 12px; font-weight: 600; margin-top: 8px; }
.eta-tool-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin-top: 12px; padding: 12px 14px;
  background: var(--rope); color: #fff; border: none; border-radius: 12px;
  cursor: pointer; text-align: left; font-family: inherit;
  box-shadow: 0 1px 5px rgba(29, 67, 157, 0.30);
}
.eta-tool-btn:active { filter: brightness(0.94); }
.eta-tool-ic { font-size: 22px; line-height: 1; flex: 0 0 auto; }
.eta-tool-tx { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.eta-tool-title { font-size: 15px; font-weight: 700; }
.eta-tool-sub { font-size: 12px; opacity: 0.85; margin-top: 1px; }
.eta-tool-arrow { font-size: 24px; opacity: 0.8; flex: 0 0 auto; }

/* Strekninger: kort-varianter og «n.a»-verdi */
.milestone-crow .val.na { color: var(--text-mute); font-weight: 600; }
.milestone-crow .lbl .ms-note { color: var(--text-mute); font-weight: 400; font-size: 11px; }
.milestone-card.upcoming { opacity: 0.72; }
.milestone-card.reached { background: rgba(74,222,128,0.07); border-color: rgba(74,222,128,0.35); }

/* Havkrysninger i etappe-modalen: liste over strekninger som trekkes ut av
   «nødvendig snitt»-beregningen (se milestoneCrossingTotals). */
.crossing-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px;
}
.crossing-info { font-size: 13px; color: var(--sail); line-height: 1.4; }
.crossing-remove {
  background: transparent; border: none; color: var(--text-mute);
  font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; flex: 0 0 auto;
}
.crossing-empty { font-size: 12px; color: var(--text-mute); margin-bottom: 6px; }

/* ===== Vår reise — totaloversikt (dashboard over kartet) ===== */
.route-overview {
  background: linear-gradient(135deg, rgba(29,67,157,0.10), rgba(47,91,208,0.05));
  border: 1px solid rgba(29,67,157,0.28);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
}
.rov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rov-title { font-size: 14px; font-weight: 700; color: var(--sail); }
.rov-chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: rgba(0,0,0,0.06); color: var(--text-dim);
}
.rov-chip.ok, .rov-chip.done { background: rgba(74,222,128,0.18); color: #15803d; }
.rov-chip.late { background: rgba(248,113,113,0.18); color: #b91c1c; }
.rov-big { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 8px; flex-wrap: wrap; }
.rov-done { font-size: 26px; font-weight: 800; color: var(--rope); line-height: 1; }
.rov-total { font-size: 15px; font-weight: 600; color: var(--text-dim); }
.rov-pct { margin-left: auto; font-size: 15px; font-weight: 800; color: var(--sail); }
.rov-bar {
  display: flex; gap: 2px; height: 12px; border-radius: 7px; overflow: hidden;
  background: rgba(0,0,0,0.08); margin-bottom: 10px;
}
.rov-seg { position: relative; background: rgba(0,0,0,0.06); min-width: 2px; }
.rov-seg-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0; opacity: 0.95; }
.rov-minis {
  display: grid; gap: 8px;
  grid-auto-flow: column;                 /* fyll kolonne for kolonne: */
  grid-template-rows: repeat(2, 1fr);     /* dager/havner | snitt/snitt | øl/bøker */
  grid-auto-columns: 1fr;
}
.rov-mini {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 4px; text-align: center;
}
.rov-mini-num { font-size: 16px; font-weight: 700; color: var(--sail); line-height: 1.1; }
.rov-mini-lbl { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.rov-eta { font-size: 12px; color: var(--text-dim); }
.rov-eta b { color: var(--sail); }

/* Distanse per land — sortert liste med andelslinjer per land. */
.cdist-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cdist-row { display: flex; align-items: center; gap: 8px; }
.cdist-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; }
.cdist-name { flex: 0 0 auto; min-width: 84px; font-size: 13px; font-weight: 700; color: var(--sail); }
.cdist-track {
  flex: 1 1 auto; height: 10px; border-radius: 6px; overflow: hidden;
  background: rgba(0,0,0,0.08);
}
.cdist-fill { display: block; height: 100%; border-radius: 6px; opacity: 0.95; min-width: 2px; }
.cdist-nm { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--rope); white-space: nowrap; text-align: right; min-width: 58px; }
.cdist-pct { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--text-dim); white-space: nowrap; text-align: right; min-width: 34px; }
.cdist-note { font-size: 11px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }

/* ===== Estimert ankomst — pop-up-verktøy ===== */
.eta-modes { display: flex; gap: 8px; margin-bottom: 12px; }
.eta-speedrow { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--text-dim); }
.eta-speed-total b { color: var(--sail); }
.eta-speed-own { display: flex; align-items: center; gap: 6px; }
.eta-speed-own input {
  width: 72px; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: 13px; background: var(--card); color: var(--sail);
}
.eta-instruction { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.eta-map {
  width: 100%; height: min(44dvh, 360px); min-height: 230px;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong);
}
.eta-result { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.eta-res-head { font-size: 13px; color: var(--sail); font-weight: 600; }
.eta-dist { font-size: 26px; font-weight: 800; color: var(--rope); line-height: 1.1; }
.eta-dist-unit { font-size: 13px; font-weight: 600; color: var(--text-dim); margin-left: 6px; }
.eta-res-sub { font-size: 12px; color: var(--text-dim); margin: -2px 0 2px; }
.eta-mark-tip {
  background: var(--rope); color: #fff; border: none; font-weight: 700;
  font-size: 12px; padding: 3px 8px; border-radius: 7px; box-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.eta-mark-tip.leaflet-tooltip-top::before { border-top-color: var(--rope); }
.eta-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  font-size: 13px; padding: 8px 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.eta-row .eta-val { font-weight: 700; color: var(--sail); text-align: right; white-space: nowrap; }
.eta-row .eta-sp { color: var(--text-mute); font-weight: 400; }
.eta-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.eta-hint { font-size: 12px; color: var(--text-mute); }

/* ===== Vær og vind ===== */
.vv-wrap { display: flex; flex-direction: column; gap: 14px; position: relative; }
.vv-refresh-top {
  position: absolute; top: 11px; right: 11px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border-strong); color: var(--rope);
  font-size: 18px; font-weight: 700; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.vv-refresh-top:active { filter: brightness(0.94); }
/* Samlet boks øverst: ren hvit bakgrunn, stor farget forhold-tekst, ingen skygge. */
.vv-head {
  background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.vv-head-mode { font-size: 15px; font-weight: 800; color: var(--sail); margin-top: 11px; }

/* Tids-slider */
.vv-timebar { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 11px 14px 13px; }
.vv-time-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.vv-time-cap { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mute); }
.vv-time-readout { font-size: 15px; font-weight: 800; color: var(--rope); }
.vv-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; background: var(--border-strong); outline: none; margin: 0; }
.vv-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--rope); border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.35); cursor: pointer; }
.vv-slider::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--rope); border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.35); cursor: pointer; }
.vv-head-meta { font-size: 12px; color: var(--text-mute); margin-top: 3px; line-height: 1.5; }
.vv-head-meta b { color: var(--text-dim); font-weight: 700; }

.vv-summary-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mute); padding-right: 42px; }
.vv-summary-main { font-size: 27px; font-weight: 800; margin-top: 1px; line-height: 1.1; padding-right: 42px; }
.vv-summary-main.vv-cond-text-na { color: var(--sail); }
.vv-summary-sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

.vv-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.vv-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.vv-card.wide { grid-column: 1 / -1; }
.vv-card-lbl {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.vv-card-val { font-size: 26px; font-weight: 800; color: var(--sail); line-height: 1.05; }
.vv-card-val.sm { font-size: 19px; }
.vv-card-val .vv-unit { font-size: 14px; font-weight: 700; color: var(--text-dim); margin-left: 3px; }
.vv-card-sub { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.vv-card-sub.center { text-align: center; }
.vv-card-sub b { color: var(--sail); }

/* Modus-chip + kart */
.vv-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.vv-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 999px;
}
.vv-chip.today { background: rgba(29,67,157,0.14); color: var(--rope); }
.vv-chip.ahead { background: rgba(180,83,9,0.15); color: var(--amber); }
.vv-mapwrap { position: relative; }
.vv-map {
  width: 100%; height: min(42dvh, 320px); min-height: 220px;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--border-strong);
}
/* Demp kartflisene (grått/hvitt) så vind-/kursvektorene trer tydeligere fram. */
.vv-map .leaflet-tile-pane { filter: grayscale(1) brightness(1.07) contrast(0.92); }
/* Animert vindfelt-lag (ligger i eget Leaflet-pane under rute/markører). */
.vv-flow { position: absolute; top: 0; left: 0; pointer-events: none; }
.vv-dial-overlay {
  position: absolute; top: 8px; right: 8px; z-index: 650;
  width: 128px; padding: 5px; border-radius: 12px;
  background: rgba(255,255,255,0.9); box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  pointer-events: none;
}
.vv-mapinfo { margin-top: -2px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vv-windline { font-size: 13px; color: var(--text-dim); }
.vv-windline b { color: var(--sail); }
.vv-maplegend { font-size: 11.5px; color: var(--text-mute); text-align: center; }
.vv-lg { display: inline-block; vertical-align: middle; border-radius: 2px; }
.vv-lg-course { width: 20px; height: 4px; background: #dc2626; }
.vv-lg-wind { width: 12px; height: 12px; background: #7c3aed; clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%); }

/* Vindskive */
.vv-dial { width: 100%; max-width: 260px; height: auto; display: block; }
.vv-dial-overlay .vv-dial { max-width: none; }

/* Vindstyrke-bar */
.vv-bar { position: relative; margin: 8px 0 4px; padding-top: 10px; }
.vv-bar-track { display: flex; height: 12px; border-radius: 6px; overflow: hidden; }
.vv-bar-track > div { height: 100%; }
.vv-bar-ptr {
  position: absolute; top: 0; width: 0; height: 0; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 8px solid var(--sail);
}
.vv-bar-scale { position: relative; height: 14px; margin-top: 3px; }
.vv-bar-scale span { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--text-mute); font-weight: 600; }

/* Kategori-merke (god/advarsel/dårlig) */
.vv-cat { font-weight: 800; }
.vv-cat.good { color: #15803d; }
.vv-cat.warn { color: var(--amber); }
.vv-cat.bad { color: #b91c1c; }

/* Bølge-illustrasjon */
.vv-wave { width: 100%; height: 74px; display: block; border-radius: 10px; background: linear-gradient(180deg, rgba(29,67,157,0.04), rgba(29,67,157,0.10)); }
.vv-wave-none { font-size: 12px; color: var(--text-mute); line-height: 1.5; }

/* Nedbør-visuelt */
.vv-rain-visual { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.vv-rain-sky { font-size: 34px; line-height: 1; }
.vv-rain-drops { font-size: 18px; letter-spacing: 2px; }

/* Kartmarkører A/B */
.vv-mark {
  width: 22px; height: 22px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.vv-mark-a { background: #16a34a; }
.vv-mark-b { background: #dc2626; }
.vv-mark-drag { cursor: grab; box-shadow: 0 0 0 3px rgba(220,38,38,0.28), 0 1px 4px rgba(0,0,0,0.4); }
.vv-mark-drag:active { cursor: grabbing; }
.vv-windline .vv-drag-hint { color: var(--rope); font-weight: 700; white-space: nowrap; }
.vv-route-ctrl { display: inline-flex; flex-wrap: wrap; gap: 6px; flex: 0 0 auto; }
.vv-rbtn {
  background: var(--card); color: var(--sail); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 6px 10px; font-size: 12.5px; font-weight: 700;
  font-family: inherit; cursor: pointer; white-space: nowrap;
}
.vv-rbtn:active { filter: brightness(0.95); }
.vv-rbtn.primary { background: var(--rope); color: #fff; border-color: var(--rope); }
.vv-plus { font-size: 16px; font-weight: 800; line-height: 0; }
.vv-rbtn.danger { color: var(--red); border-color: rgba(220,38,38,0.4); }

.vv-note {
  font-size: 12px; color: var(--text-mute); line-height: 1.5;
  padding: 2px 2px 0;
}
.vv-note a { color: var(--rope); }
.vv-refresh {
  align-self: flex-start; margin-top: 2px;
  background: rgba(29,67,157,0.14); color: var(--rope); border: none;
  font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 10px;
  cursor: pointer; font-family: inherit;
}
.vv-refresh:active { filter: brightness(0.94); }
.vv-state {
  text-align: center; padding: 30px 18px; color: var(--text-dim);
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.vv-state-icon { font-size: 34px; margin-bottom: 10px; }
.vv-state-title { font-size: 15px; font-weight: 700; color: var(--sail); margin-bottom: 6px; }
.vv-state-sub { font-size: 13px; line-height: 1.5; }

.backup-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
}
.backup-meta { flex: 1; min-width: 0; }
.backup-when { font-size: 14px; font-weight: 600; color: var(--sail); }
.backup-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.backup-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.backup-btn {
  background: rgba(29, 67, 157, 0.14); color: var(--rope);
  border: 1px solid rgba(29, 67, 157, 0.30); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.backup-btn.danger { background: transparent; color: var(--red); border-color: rgba(220,38,38,0.35); }

/* ===== Handleliste: Matvarer (iPhone Påminnelser-style) ===== */
.grocery-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.07) 0%, rgba(0,0,0,0.04) 100%);
  border: 1px solid rgba(0,0,0,0.10);
  border-top-color: rgba(0,0,0,0.18);
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.grocery-plus {
  font-size: 22px;
  color: var(--rope);
  font-weight: 300;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.grocery-add-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--sail);
  font-family: inherit;
  padding: 4px 0;
}
.grocery-add-input::placeholder { color: var(--text-mute); }
.grocery-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.grocery-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(29, 67, 157, 0.1);
}
.grocery-item:last-child { border-bottom: none; }
.grocery-item:active { background: rgba(0,0,0,0.04); }
.grocery-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-mute);
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
}
.grocery-item.done .grocery-check {
  background: var(--green);
  border-color: var(--green);
}
.grocery-item.done .grocery-check::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #052e16;
  font-size: 14px;
  font-weight: 700;
}
.grocery-text {
  flex: 1;
  font-size: 16px;
  word-break: break-word;
  cursor: text;
  padding: 2px 0;
}
.grocery-item.done .grocery-text {
  text-decoration: line-through;
  color: var(--text-dim);
}
.grocery-edit-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: 1px solid var(--rope);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 16px;
  color: var(--sail);
  font-family: inherit;
}
.grocery-remove {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  margin-left: auto;
}

/* ===== Lenke-tag i shopping items ===== */
.shop-link {
  color: var(--rope);
  text-decoration: none;
}
.shop-link:active { color: var(--sunset); }

/* ===== Kvitteringer ===== */
.receipt-item {
  display: flex;
  gap: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.03) 100%);
  border: 1px solid rgba(0,0,0,0.10);
  border-top-color: rgba(0,0,0,0.16);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow:
    0 4px 10px rgba(0,0,0,0.25),
    0 1px 2px rgba(0,0,0,0.2);
  -webkit-tap-highlight-color: rgba(29, 67, 157, 0.15);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.receipt-item:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}
.receipt-thumb {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.receipt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.receipt-no-photo {
  font-size: 28px;
  color: var(--text-mute);
}
.receipt-body {
  flex: 1;
  min-width: 0;
}
.receipt-store {
  font-size: 15px;
  font-weight: 600;
  color: var(--sail);
  margin-bottom: 2px;
}
.receipt-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.receipt-when {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.3px;
}
.receipt-photo-preview {
  margin-bottom: 8px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.receipt-download-btn {
  width: 100%;
  margin-bottom: 14px;
  font-size: 13px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.receipt-download-btn:hover {
  background: var(--card);
  color: var(--sail);
}

/* ===== Viktig info (vault) ===== */
.vault-item {
  background: linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.03) 100%);
  border: 1px solid rgba(0,0,0,0.10);
  border-top-color: rgba(0,0,0,0.16);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow:
    0 4px 10px rgba(0,0,0,0.25),
    0 1px 2px rgba(0,0,0,0.2);
}
.vault-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.vault-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--sail);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-edit-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}
.vault-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.vault-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-mute);
  width: 76px;
  flex-shrink: 0;
}
.vault-value {
  flex: 1;
  min-width: 0;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--sail);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vault-icon-btn {
  background: rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 5px 9px;
  cursor: pointer;
  flex-shrink: 0;
}
.vault-icon-btn:active { background: rgba(0,0,0,0.12); }
.vault-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.vault-hint {
  font-size: 12px;
  color: var(--text-mute);
  margin: 2px 0 14px;
  line-height: 1.5;
}

/* ===== Autocomplete (used by receipt store input) ===== */
.autocomplete-wrap {
  position: relative;
}
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--ocean);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}
.autocomplete-item {
  padding: 11px 14px;
  cursor: pointer;
  font-size: 15px;
  color: var(--sail);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  -webkit-tap-highlight-color: rgba(29, 67, 157, 0.2);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item:active {
  background: rgba(29, 67, 157, 0.15);
  color: var(--rope);
}
.receipt-photo-preview img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  cursor: pointer;
}

/* ===== Settings: kollapsbare seksjoner ===== */
.settings-section.collapsible > h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 12px;
  background: rgba(0,0,0,0.04);
  border-radius: 10px;
  margin: 0 0 8px 0;
  letter-spacing: 0.8px;
  -webkit-tap-highlight-color: transparent;
}
.settings-section.collapsible > h3::after {
  content: '▾';
  color: var(--text-dim);
  font-size: 14px;
  transition: transform 0.2s;
}
.settings-section.collapsible.collapsed > h3::after {
  transform: rotate(-90deg);
}
.settings-section.collapsible.collapsed > .collapsible-body {
  display: none;
}

/* ============================================================
   ✦ PREMIUM POLISH — Apple design principles
   Materials & depth, size-specific typography, instant press
   feedback, and accessible motion. Layered on top of the base
   styles above so the refinement lives in one reviewable place.
   Ref: apple-design (WWDC "Designing Fluid Interfaces" / "UI Typography").
   ============================================================ */

/* ---- 12 · Materials & depth: translucent, saturated chrome ---- */
.app-header {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.tab-bar {
  background: rgba(255,255,255,0.80);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(0,0,0,0.07);
}

/* ---- 1 · Response: instant, continuous press feedback ----
   Touch should feel glued to the surface. Scale down on press,
   spring back on release. Applied to everything tappable. */
.btn, .dash-card, .dash-menu-item, .dash-jump, .side-menu-item,
.card-action, .header-menu-btn, .header-logo-btn, .menu-toggle,
.photo-upload-btn, .add-item-btn, .modal-close, .side-menu-close,
.chip, .tab-bar button, #login-form button, .reorder-btn {
  transition: transform var(--dur-press) var(--ease-out),
              background-color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease,
              color var(--dur-fast) ease;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active, .dash-card:active, .dash-menu-item:active, .dash-jump:active,
.side-menu-item:active, .card-action:active, .header-menu-btn:active,
.header-logo-btn:active, .photo-upload-btn:active, .add-item-btn:active,
.modal-close:active, .side-menu-close:active, #login-form button:active,
.chip:active, .add-item-btn:active {
  transform: scale(0.97);
}
.dash-jump:active, .modal-close:active, .side-menu-close:active,
.header-menu-btn:active, .header-logo-btn:active { transform: scale(0.90); }

/* Primary button: solid fill, soft accent shadow, snappy press */
.btn { box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
#login-form button, .btn:not(.btn-secondary):not(.btn-danger):not(.btn-success) {
  box-shadow: 0 1px 1px rgba(0,0,0,0.05), 0 6px 16px rgba(29,67,157,0.24);
}
.btn:active { box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* Cards: soften the tap into a lift instead of a flat colour swap */
.dash-card, .card { box-shadow: var(--shadow-sm); }
.dash-card:active { background: var(--card); transform: scale(0.985); }

/* Tab bar: the active tab's glyph gains a touch of presence */
.tab-bar button .tab-icon { transition: transform var(--dur-fast) var(--ease-spring); }
.tab-bar button.active .tab-icon { transform: scale(1.08); }
.tab-bar button:active .tab-icon { transform: scale(0.90); }

/* ---- 15 · Typography: size-specific tracking & tabular figures ----
   Large text reads too loose — pull it tight. Numerals align. */
.dash-stat-big, .dash-map-badge-val, .dash-wind-cond, .uc-title {
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
}
.dash-stat-big { line-height: 1.02; }
.app-header h2 { font-weight: 600; letter-spacing: -0.01em; }
.modal-title { letter-spacing: -0.015em; }
.gauge, .dash-stat-big, .dash-map-badge-val { font-variant-numeric: tabular-nums; }

/* ---- 12 · Modal as a real material: frosted sheet + grabber ---- */
.modal-backdrop {
  background: rgba(0,0,0,0.45);
  animation: mb-fade var(--dur-fast) ease-out;
}
@keyframes mb-fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-top: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--dur-base) var(--ease-out);
  padding-top: 24px;
}
/* Grabber handle — the universal "drag me" affordance (familiarity §16.4) */
.modal::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  width: 36px; height: 5px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.18);
  border-radius: 3px;
}
.modal { position: relative; }

/* ---- Side menu: mirror-path easing + softer material shadow ---- */
.side-menu {
  transition: transform var(--dur-base) var(--ease-out);
  box-shadow: 8px 0 40px rgba(0,0,0,0.22);
}

/* ---- Inputs: calm focus ring instead of a bare border flip ---- */
input.field:focus, select.field:focus, textarea.field:focus,
#login-form input:focus, .menu-group-name-input:focus, .item-edit-row input:focus {
  border-color: var(--rope);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---- Keyboard focus: visible, on-brand ring (craft §16.7) ---- */
:focus-visible {
  outline: 2px solid var(--rope);
  outline-offset: 2px;
}
button:focus:not(:focus-visible) { outline: none; }

/* ---- Toast / save-status: match the frosted material language ---- */
.toast {
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow-lg);
}
.save-status:not(.error) {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* ---- 14 · Reduced motion: gentle cross-fades, no vestibular motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:active, .dash-card:active, .dash-menu-item:active, .dash-jump:active,
  .tab-bar button:active .tab-icon, .tab-bar button.active .tab-icon,
  .side-menu-item:active { transform: none !important; }
  .modal { animation: mb-fade var(--dur-fast) ease !important; }
  .cat-dab-svg { animation: none !important; }
}

/* ---- 14 · Reduced transparency: frost the glass into solid ---- */
@media (prefers-reduced-transparency: reduce) {
  .app-header, .tab-bar, .modal, .toast, .save-status:not(.error) {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .app-header { border-bottom: 1px solid var(--border-strong); }
  .tab-bar { border-top: 1px solid var(--border-strong); }
}

/* ---- Pointer-capable devices: subtle hover lift (desktop/trackpad) ---- */
@media (hover: hover) and (pointer: fine) {
  .dash-card:hover, .card:hover { box-shadow: var(--shadow); }
  .dash-menu-item:hover, .side-menu-item:hover { background: var(--card-hover); }
  .btn:hover { filter: brightness(1.05); }
  .tab-bar button:hover { color: var(--sail); }
}

/* ============================================================
   ✦ LIQUID GLASS — Apple's translucent floating material (WWDC 2025)
   The navigation & control layer lifts off the content on a sheet of
   glass: it blurs and brightens what's behind it, catches light on its
   top edge, and casts a soft ambient shadow. Reserved for surfaces that
   float ABOVE content — bars, sheets, the sidebar, pills and controls —
   so glass is never stacked on glass (content stays solid).
   Ref: apple-design §12 (Materials & depth).
   ============================================================ */

/* ---- Top app bar: glass, no hard divider — a soft lift instead ---- */
.app-header {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border-bottom: 0.5px solid rgba(255,255,255,0.5);
  box-shadow: var(--glass-hi), 0 1px 12px rgba(0,0,0,0.05);
}

/* ---- Tab bar: a floating glass pill (the signature Liquid Glass shape) ---- */
.tab-bar {
  left: 10px;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  padding: 8px 2px;
  border-radius: 28px;
  border: 0.5px solid var(--glass-edge);
  border-top: 0.5px solid var(--glass-edge);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  box-shadow: var(--glass-hi), var(--glass-lo), 0 10px 34px rgba(0,0,0,0.18);
  overflow: hidden;   /* clip the sheen to the pill */
}
/* Liquid sheen — light pooling along the top of the glass */
.tab-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0) 55%);
}
.tab-bar button { position: relative; z-index: 1; border-radius: 20px; }

/* ---- The dynamic droplet — a glass lozenge that flows between tabs ----
   Sits behind the active tab; slides & stretches with the finger (1:1),
   then springs home. The active tab is marked by the droplet + a darker
   label, so the whole bar no longer turns blue. */
.tab-indicator {
  position: absolute;
  left: 0;
  top: 6px;
  width: 0;
  height: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 0 0 0.5px rgba(255,255,255,0.6),
    0 3px 10px rgba(0,0,0,0.14);
  transform: translateX(0) scaleX(1);
  transform-origin: center center;
  transition: transform 0.42s var(--ease-spring);
  will-change: transform;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
}
.tab-bar.dragging .tab-indicator { transition: none; }
.tab-bar.dragging { cursor: grabbing; }
/* Active tab: emphasis via weight + ink, not colour — the droplet is the accent */
.tab-bar button.active { color: var(--ink); font-weight: 600; }

/* ---- Bottom sheet: frosted glass with a light-catching top edge + sheen ---- */
.modal {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 140px),
    var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  box-shadow: var(--glass-hi), var(--shadow-lg);
}

/* ---- Sidebar: a clear glass panel — the app shows through, not a grey wall ---- */
.side-menu {
  background: rgba(255,255,255,0.52);
  backdrop-filter: blur(34px) saturate(200%) brightness(1.08);
  -webkit-backdrop-filter: blur(34px) saturate(200%) brightness(1.08);
  border-right: 0.5px solid rgba(255,255,255,0.5);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.4), 8px 0 44px rgba(0,0,0,0.20);
}
.side-menu-header { border-bottom: 0.5px solid rgba(255,255,255,0.5); }

/* ---- Small floating controls: glass capsules & circles ---- */
.dash-jump {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 0.5px solid var(--glass-edge);
  box-shadow: var(--glass-hi), 0 2px 8px rgba(0,0,0,0.10);
  color: var(--rope);
}
.chip {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 0.5px solid var(--glass-edge);
  box-shadow: var(--glass-hi);
}
/* A pressed/prominent control is a solid tinted glass, not clear glass */
.chip.active {
  background: linear-gradient(180deg, #244aa0, #1a3d8f);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.12);
}

/* ---- Buttons: glossy tinted glass (prominent) / clear glass (secondary) ---- */
.btn:not(.btn-secondary):not(.btn-danger):not(.btn-success),
#login-form button {
  /* Rolig merkevare-navy med et hint av glans — ikke neon-blå, og en
     nøytral, myk skygge i stedet for en farget glød. */
  background: linear-gradient(180deg, #244aa0 0%, #1a3d8f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18),
              0 1px 2px rgba(0,0,0,0.12),
              0 6px 18px rgba(0,0,0,0.10);
}
.btn-secondary {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 0.5px solid var(--glass-edge);
  color: var(--sail);
  box-shadow: var(--glass-hi), 0 1px 2px rgba(0,0,0,0.05);
}

/* ---- Alert banner: red-tinted glass ---- */
.alert-banner {
  background: rgba(248,113,113,0.16);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 0.5px solid rgba(248,113,113,0.35);
  box-shadow: var(--glass-hi);
}

/* ---- Toast & save-status: frosted glass pills ---- */
.toast, .save-status:not(.error) {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 0.5px solid var(--glass-edge);
  box-shadow: var(--glass-hi), var(--shadow-lg);
}

/* ---- Full-screen map header: stays light glass so dark text reads over the map ---- */
.map-fullscreen .map-fullscreen-header {
  background: rgba(255,255,255,0.80);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border-bottom: 0.5px solid rgba(255,255,255,0.5);
  box-shadow: var(--glass-hi);
}

/* ---- Lightbox close: dark-context glass (over photos) ---- */
.lightbox-close {
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 0.5px solid rgba(255,255,255,0.3);
}

/* ---- Accessibility: solidify glass when the viewer asks for less transparency ---- */
@media (prefers-reduced-transparency: reduce) {
  .app-header, .tab-bar, .modal, .side-menu, .toast, .save-status:not(.error),
  .map-fullscreen .map-fullscreen-header {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12) !important;
  }
  .dash-jump, .chip, .btn-secondary {
    background: rgba(0,0,0,0.05) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-color: var(--border-strong) !important;
  }
  .alert-banner {
    background: rgba(248,113,113,0.15) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .tab-bar::before { display: none; }
}

/* ===== Service (vedlikeholdsplan) ===== */
/* Rund «legg til»-knapp nede til høyre, rett over bunnmenyen. */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 840; /* under bunnmenyen (850) og modaler */
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, var(--sunset) 0%, var(--rope) 100%);
  color: #fff;
  font-size: 30px; font-weight: 400; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 3px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out);
}
.fab:active { transform: scale(0.92); }
.maint-hours {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--text-dim);
  margin: 10px 4px 12px;
}
.maint-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.maint-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  --maint-color: var(--text-mute);
}
.maint-row:last-child { border-bottom: none; }
.maint-row:active { background: var(--card-hover); }
.maint-row--overdue { --maint-color: #dc2626; }
.maint-row--soon    { --maint-color: #f59e0b; }
.maint-row--ok      { --maint-color: #22c55e; }
.maint-row--never, .maint-row--none { --maint-color: var(--text-mute); }
.maint-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--maint-color, var(--text-mute));
  flex-shrink: 0;
}
.maint-row-body { flex: 1; min-width: 0; }
.maint-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.maint-row-title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.maint-row-status {
  font-size: 13px; font-weight: 700; white-space: nowrap;
  color: var(--maint-color);
}
.maint-row--ok .maint-row-status { color: #15803d; }
.maint-row--soon .maint-row-status { color: #b45309; }
.maint-row--never .maint-row-status, .maint-row--none .maint-row-status { color: var(--text-mute); font-weight: 500; }
.maint-row-sub {
  font-size: 12px; color: var(--text-dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.maint-bar {
  height: 4px; border-radius: 4px; margin-top: 7px;
  background: rgba(0,0,0,0.07); overflow: hidden;
}
.maint-bar-fill { height: 100%; border-radius: 4px; background: var(--maint-color); }
.maint-status-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.maint-status-box .maint-row-sub { white-space: normal; }
.maint-status-top { display: flex; align-items: center; gap: 8px; }
.maint-status-label { font-size: 18px; font-weight: 700; color: var(--maint-color); }
.maint-row--ok .maint-status-label { color: #15803d; }
.maint-row--soon .maint-status-label { color: #b45309; }
.maint-row--never .maint-status-label, .maint-row--none .maint-status-label { color: var(--ink); }
.maint-log {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.maint-log:active { background: var(--card-hover); }
.maint-log-top { display: flex; align-items: center; gap: 10px; }
.maint-log-date { font-weight: 600; font-size: 14px; flex: 1; }
.maint-log-hours { font-size: 13px; color: var(--text-dim); }
.maint-docs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.maint-docs img {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); cursor: pointer;
}
.maint-doc-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--accent-soft); color: var(--rope);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.maint-doc-file--edit { position: relative; padding-right: 34px; align-self: center; }
.maint-doc-file--edit .photo-remove {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.maint-row .fill-chev, .maint-log .fill-chev { color: var(--text-mute); font-size: 20px; flex-shrink: 0; }
/* Plass til den runde +-knappen under siste rad. */
.maint-list { margin-bottom: 72px; }
