/* ==========================================================================
   Lifevest – soccorso in mare
   Palette da carta nautica: fondali blu, carta chiara, arancio internazionale
   (il colore dei giubbotti SOLAS) riservato alle azioni di emergenza.
   ========================================================================== */

@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --navy: #0D2B45;        /* abisso: testo e intestazioni */
  --sea: #1E5A80;         /* fondale: azioni secondarie, link */
  --sea-soft: #D3E5EF;
  --chart: #E6F0F5;       /* acque basse della carta nautica */
  --paper: #F6F9FA;
  --white: #FFFFFF;
  --line: #CDDBE3;
  --muted: #5B7383;
  --orange: #FF5A1A;      /* arancio internazionale: solo emergenza */
  --orange-deep: #E0470A;
  --orange-soft: #FFE6DB;
  --green: #12805A;       /* luce di dritta: disponibile, concluso */
  --green-soft: #DCF1E8;
  --red: #C42638;         /* luce di sinistra: in attesa, allarme */
  --red-soft: #FBE1E4;
  --amber: #A86A0B;
  --amber-soft: #FBEFD9;
  --teal: #0B7480;
  --teal-soft: #D6EEF0;

  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(13, 43, 69, .08), 0 4px 14px rgba(13, 43, 69, .06);
  --tabbar-h: 64px;
  --topbar-h: 56px;
  --focus: 0 0 0 3px rgba(30, 90, 128, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--navy);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--sea); text-underline-offset: 2px; }
a:hover { color: var(--navy); }
h1, h2, h3 { font-family: var(--font-cond); font-weight: 700; line-height: 1.12; margin: 0 0 .4em; letter-spacing: .005em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.mono-coord { font-family: var(--font-cond); font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

.icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 30px; height: 30px; }

/* --------------------------------------------------------------------------
   Marchio
   -------------------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; }
.brand-mark { width: 26px; height: 26px; }
.wordmark { font-family: var(--font-cond); font-size: 1.32rem; letter-spacing: .06em; line-height: 1; }
.wordmark .w-life { font-weight: 500; }
.wordmark .w-vest { font-weight: 700; }

/* --------------------------------------------------------------------------
   Pulsanti
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--navy); --btn-fg: #fff; --btn-bd: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: 600 1rem/1.1 var(--font);
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1.5px solid var(--btn-bd); border-radius: var(--r-md);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { --btn-bg: #163B5D; --btn-bd: #163B5D; color: var(--btn-fg); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--navy); --btn-bd: var(--line); }
.btn-ghost:hover { --btn-bg: var(--chart); --btn-bd: var(--sea-soft); --btn-fg: var(--navy); }
.btn-sea { --btn-bg: var(--sea); --btn-bd: var(--sea); }
.btn-sea:hover { --btn-bg: #174A6B; --btn-bd: #174A6B; }
.btn-go { --btn-bg: var(--green); --btn-bd: var(--green); }
.btn-go:hover { --btn-bg: #0E6A4A; --btn-bd: #0E6A4A; }
.btn-danger { --btn-bg: transparent; --btn-fg: var(--red); --btn-bd: #E9B3BA; }
.btn-danger:hover { --btn-bg: var(--red-soft); --btn-bd: var(--red); --btn-fg: var(--red); }
.btn-orange { --btn-bg: var(--orange); --btn-bd: var(--orange); }
.btn-orange:hover { --btn-bg: var(--orange-deep); --btn-bd: var(--orange-deep); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .9rem; border-radius: var(--r-sm); }
.btn-lg { min-height: 56px; font-size: 1.1rem; padding: 14px 22px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .btn { flex: 1 1 auto; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--sea); text-decoration: underline; cursor: pointer; }

/* Il pulsante SOS: l'elemento che deve vedersi anche sotto il sole. */
.btn-sos {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 68px; padding: 14px 20px;
  font: 700 1.3rem/1 var(--font-cond); letter-spacing: .02em;
  color: #fff; background: var(--orange);
  border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 0 0 5px var(--orange-soft), 0 8px 22px rgba(224, 71, 10, .32);
  transition: background-color .15s, transform .1s;
}
.btn-sos:hover:not(:disabled) { background: var(--orange-deep); }
.btn-sos:active:not(:disabled) { transform: scale(.985); }
.btn-sos:disabled { background: #F2B79C; box-shadow: 0 0 0 5px #FBEDE6; cursor: not-allowed; }
.btn-sos .ring { width: 34px; height: 34px; }

/* --------------------------------------------------------------------------
   Badge di stato
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; line-height: 1.35; white-space: nowrap;
  color: var(--navy); background: var(--chart);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tone-alert { color: var(--red); background: var(--red-soft); }
.tone-warn { color: var(--amber); background: var(--amber-soft); }
.tone-info { color: var(--sea); background: var(--sea-soft); }
.tone-onsite { color: var(--teal); background: var(--teal-soft); }
.tone-ok { color: var(--green); background: var(--green-soft); }
.tone-muted { color: var(--muted); background: #E9EEF1; }

/* --------------------------------------------------------------------------
   Messaggi
   -------------------------------------------------------------------------- */
.flash { margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--r-md); font-weight: 500; display: flex; gap: 10px; align-items: flex-start; }
.flash-ok { background: var(--green-soft); color: #0B5C40; }
.flash-error { background: var(--red-soft); color: #8F1A28; }
.flash ul { margin: 0; padding-left: 18px; }
.notice { padding: 12px 14px; border-radius: var(--r-md); background: var(--chart); color: var(--navy); }
.notice-warn { background: var(--amber-soft); color: #6E4506; }

.toast-wrap { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000; display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: var(--navy); color: #fff; box-shadow: var(--shadow); font-weight: 500; animation: toast-in .2s ease-out; }
.toast.is-error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-weight: 600; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--muted); }
.field .error { font-size: .85rem; color: var(--red); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font: 400 1rem/1.3 var(--font); color: var(--navy);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: none; border-color: var(--sea); box-shadow: var(--focus); }
.input.is-invalid { border-color: var(--red); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--sea); }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { font-family: var(--font-cond); font-weight: 700; font-size: 1.15rem; margin-bottom: 10px; padding: 0; }

/* --------------------------------------------------------------------------
   Layout mobile (cliente e soccorritore)
   -------------------------------------------------------------------------- */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 1100;
  height: var(--topbar-h); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--navy); color: #fff;
}
.topbar-meta { font-size: .9rem; color: #BFD3E1; text-align: right; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-meta strong { color: #fff; font-weight: 600; }
.app-main { max-width: 680px; margin: 0 auto; }
.page { padding: 20px 16px 28px; }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-title h1 { margin: 0; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 1100;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  background: #fff; border-top: 1px solid var(--line);
}
.tabbar-inner { display: flex; width: 100%; max-width: 680px; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: 600 .78rem/1 var(--font); color: var(--muted); text-decoration: none;
  background: none; border: 0; cursor: pointer;
}
.tab .icon { width: 24px; height: 24px; }
.tab.is-active { color: var(--navy); }
.tab.is-active .icon { color: var(--orange); }
.tab form { display: contents; }

/* Mappe */
.map { width: 100%; background: var(--chart); }
.map-sos { height: 36vh; min-height: 220px; }
.map-track { height: 46vh; min-height: 260px; }
.map-inline { height: 260px; border-radius: var(--r-md); border: 1px solid var(--line); }
.map-wrap { position: relative; }
.map-overlay {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 500;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .95); box-shadow: var(--shadow);
  font-size: .92rem;
}
.map-overlay .icon { color: var(--sea); }
.map-overlay.is-ok .icon { color: var(--green); }
.map-overlay.is-error { background: #FFF5F6; }
.map-overlay.is-error .icon { color: var(--red); }

/* Foglio sotto la mappa */
.sheet {
  position: relative; margin-top: -14px; z-index: 600;
  padding: 22px 16px 28px;
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.lead { color: var(--muted); font-size: 1.02rem; margin-bottom: 18px; }

/* Scelta del servizio */
.services { display: grid; gap: 8px; }
@media (min-width: 560px) { .services { grid-template-columns: 1fr 1fr; } }
.service-option { position: relative; display: block; cursor: pointer; }
.service-option input { position: absolute; opacity: 0; pointer-events: none; }
.service-card {
  display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; align-items: start;
  height: 100%; padding: 12px 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s, background-color .15s;
}
.service-card .icon { grid-row: span 2; width: 40px; height: 40px; padding: 8px; border-radius: 50%; background: var(--chart); color: var(--sea); }
.service-card strong { font-weight: 600; line-height: 1.2; }
.service-card span { font-size: .86rem; color: var(--muted); line-height: 1.3; }
.service-option:hover .service-card { border-color: var(--sea-soft); }
.service-option input:checked + .service-card { border-color: var(--orange); background: #FFF8F4; box-shadow: inset 0 0 0 1px var(--orange); }
.service-option input:checked + .service-card .icon { background: var(--orange); color: #fff; }
.service-option input:focus-visible + .service-card { box-shadow: var(--focus); }

.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.stepper button { width: 46px; height: 46px; border: 0; background: none; font: 600 1.4rem/1 var(--font); color: var(--navy); cursor: pointer; }
.stepper button:hover { background: var(--chart); }
.stepper input { width: 48px; height: 46px; border: 0; text-align: center; font: 700 1.2rem/1 var(--font-cond); color: var(--navy); background: none; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }

.sos-bar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  z-index: 700; margin: 22px -16px -28px; padding: 14px 16px 18px;
  background: linear-gradient(to top, var(--paper) 78%, rgba(246, 249, 250, 0));
}
.sos-hint { margin: 10px 0 0; text-align: center; font-size: .9rem; color: var(--muted); }

.demo-tools { margin-top: 6px; padding: 12px 14px; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: #fff; }
.demo-tools summary { cursor: pointer; font-weight: 600; color: var(--sea); }
.demo-tools[open] summary { margin-bottom: 10px; }

/* Tracciamento */
.track-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.track-head .code { font-family: var(--font-cond); font-weight: 600; color: var(--muted); letter-spacing: .03em; }
.eta { display: flex; align-items: flex-end; gap: 18px; margin: 4px 0 18px; }
.eta-value { font-family: var(--font-cond); font-weight: 700; font-size: 4rem; line-height: .85; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.eta-unit { font-family: var(--font-cond); font-weight: 600; font-size: 1.3rem; margin-left: 4px; }
.eta-side { padding-bottom: 4px; color: var(--muted); font-size: .95rem; line-height: 1.3; }
.eta-side strong { display: block; color: var(--navy); font-family: var(--font-cond); font-size: 1.25rem; }
.searching { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--red-soft); color: #8F1A28; font-weight: 500; margin-bottom: 18px; }

.steps { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: step; }
.steps li { position: relative; display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 7px 0; color: var(--muted); }
.steps li::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font: 700 .9rem/1 var(--font-cond); background: #fff; border: 1.5px solid var(--line); color: var(--muted);
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 37px; bottom: -7px; width: 2px; background: var(--line); }
.steps li.is-done { color: var(--navy); }
.steps li.is-done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
.steps li.is-done::after { background: var(--green); }
.steps li.is-current { color: var(--navy); font-weight: 600; }
.steps li.is-current::before { background: var(--navy); border-color: var(--navy); color: #fff; }
.steps time { font-size: .88rem; font-variant-numeric: tabular-nums; }

.unit-card { display: grid; gap: 12px; padding: 16px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.unit-card-head { display: flex; gap: 12px; align-items: center; }
.unit-card-head .icon { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--navy); color: #fff; }
.unit-card-head strong { display: block; font-family: var(--font-cond); font-size: 1.2rem; line-height: 1.1; }

.claim { padding: 14px 16px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--chart); border-left: 4px solid var(--sea); }
.claim strong { display: block; margin-bottom: 2px; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 50px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }
details.panel-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.panel-details summary { cursor: pointer; font-weight: 600; color: var(--sea); }
details.panel-details[open] summary { margin-bottom: 8px; }

.position-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); margin-bottom: 16px; }
.position-line .icon { color: var(--orange); margin-top: 2px; }

/* Liste */
.rows { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.rows > li { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.row-link { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-decoration: none; color: inherit; }
.row-link:hover strong { text-decoration: underline; }
.row-sub { font-size: .88rem; color: var(--muted); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); background: #fff; border: 1.5px dashed var(--line); border-radius: var(--r-md); }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--sea); }
.empty strong { display: block; color: var(--navy); font-size: 1.05rem; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Soccorritore
   -------------------------------------------------------------------------- */
.unit-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: #fff; border-bottom: 1px solid var(--line); }
.unit-head h1 { font-size: 1.45rem; margin: 0; }
.unit-head .row-sub { margin-top: 2px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--chart); }
.segmented button { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 999px; background: none; font: 600 .88rem/1 var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button.is-on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.segmented button.is-on.ok { color: var(--green); }
.segmented button:disabled { cursor: not-allowed; opacity: .6; }

.alert-band {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; color: #fff; background: var(--orange);
  font: 700 1.2rem/1.1 var(--font-cond);
}
.alert-band .icon { width: 28px; height: 28px; }
.alert-band.is-new { animation: band-flash 1s ease-in-out 3; }
@keyframes band-flash { 50% { background: var(--orange-deep); } }

.mission { padding: 18px 16px 8px; }
.mission-service { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.mission-service .icon { width: 46px; height: 46px; padding: 10px; border-radius: 50%; background: var(--orange); color: #fff; }
.mission-service h2 { margin: 0; }
.nav-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0 0 16px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.nav-figures div { padding: 10px 12px; background: #fff; }
.nav-figures dt { font-size: .8rem; color: var(--muted); }
.nav-figures dd { margin: 2px 0 0; font: 700 1.45rem/1.05 var(--font-cond); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 16px; }
.facts dt { color: var(--muted); font-size: .92rem; }
.facts dd { margin: 0; font-weight: 500; }
.action-stack { display: grid; gap: 10px; margin: 16px 0; }

.gps-share { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin: 0 16px 12px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); font-size: .92rem; }
.gps-share .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.gps-share.is-on .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

/* --------------------------------------------------------------------------
   Marker Leaflet
   -------------------------------------------------------------------------- */
.mk { background: none; border: 0; }
.mk-boat .mk-dot { position: absolute; inset: 7px; border-radius: 50%; background: var(--orange); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mk-boat .mk-pulse { position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 90, 26, .35); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
.mk-unit .mk-hull {
  position: absolute; inset: 0; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--green); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.mk-unit.mk-in_missione .mk-hull { background: var(--amber); }
.mk-unit.mk-fuori_servizio .mk-hull { background: #8A9BA7; }
.mk-unit.mk-mission .mk-hull { background: var(--navy); }
.mk-label {
  position: absolute; left: 26px; top: 50%; transform: translateY(-50%);
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
  font: 600 .78rem/1.3 var(--font); color: var(--navy); background: rgba(255,255,255,.95); box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.mk-req span { position: absolute; inset: 0; border-radius: 3px; transform: rotate(45deg); background: var(--red); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mk-req.mk-r-assegnata span { background: var(--amber); }
.mk-req.mk-r-in_navigazione span { background: var(--sea); }
.mk-req.mk-r-sul_posto span { background: var(--teal); }
.mk-port { border-radius: 50%; background: #fff; border: 2px solid var(--sea); }
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content { font-size: .92rem; line-height: 1.35; }
.leaflet-popup-content strong { font-family: var(--font-cond); font-size: 1.05rem; }

@media (prefers-reduced-motion: reduce) {
  .mk-boat .mk-pulse, .alert-band.is-new, .toast { animation: none; }
}

/* --------------------------------------------------------------------------
   Accesso
   -------------------------------------------------------------------------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .auth { grid-template-columns: minmax(380px, 1.05fr) minmax(420px, 1fr); } }
.auth-aside { position: relative; display: none; padding: 48px; color: #fff; background: var(--navy); overflow: hidden; }
@media (min-width: 900px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside .contours { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.auth-aside > * { position: relative; }
.auth-aside h2 { font-size: 2.6rem; max-width: 12ch; margin-bottom: 14px; }
.auth-aside p { max-width: 40ch; color: #C4D6E3; font-size: 1.05rem; }
.auth-services { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 420px; }
.auth-services li { display: flex; gap: 12px; align-items: center; color: #DCE8F0; }
.auth-services .icon { color: var(--orange); }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 420px; margin: 0 auto; }
.auth-box .brand { margin-bottom: 30px; color: var(--navy); }
.auth-box h1 { font-size: 2rem; }
.auth-switch { margin-top: 18px; color: var(--muted); }
.demo-accounts { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-accounts h2 { font-size: 1.1rem; margin-bottom: 4px; }
.demo-accounts .btn { justify-content: flex-start; text-align: left; }
.demo-accounts .btn span { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------------------
   Area amministratore
   -------------------------------------------------------------------------- */
.admin { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .admin { grid-template-columns: 236px 1fr; } }
.admin-side { display: flex; flex-direction: column; gap: 22px; padding: 18px 14px; background: var(--navy); color: #fff; }
@media (min-width: 1000px) { .admin-side { position: sticky; top: 0; height: 100dvh; } }
.admin-side .brand { padding: 4px 8px; }
.admin-side .brand small { display: block; font-size: .78rem; color: #9DB7C9; letter-spacing: .02em; margin-top: 3px; }
.side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
@media (min-width: 1000px) { .side-nav { flex-direction: column; flex-wrap: nowrap; } }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); color: #C4D6E3; text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.is-active { background: rgba(255,255,255,.12); color: #fff; }
.side-nav a.is-active .icon { color: var(--orange); }
.side-nav .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--red); color: #fff; font-size: .78rem; font-weight: 700; text-align: center; }
.side-foot { margin-top: auto; display: none; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .9rem; color: #C4D6E3; }
@media (min-width: 1000px) { .side-foot { display: block; } }
.side-foot .link-btn { color: #fff; }
.admin-main { min-width: 0; padding: 22px 18px 40px; }
@media (min-width: 1000px) { .admin-main { padding: 26px 30px 48px; } }
.admin-main .flash { margin: 0 0 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 1.9rem; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 12px 16px; background: #fff; }
.kpi dt { font-size: .86rem; color: var(--muted); }
.kpi dd { margin: 2px 0 0; font: 700 2rem/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.kpi.is-alert dd { color: var(--red); }

.ops { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1200px) { .ops { grid-template-columns: minmax(0, 1fr) 400px; } }
.ops-map { height: 62vh; min-height: 380px; border-radius: var(--r-md); border: 1px solid var(--line); }
.ops-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: .85rem; color: var(--muted); }
.ops-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ops-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

.queue h2 { font-size: 1.2rem; display: flex; justify-content: space-between; align-items: baseline; }
.queue-item { display: grid; gap: 6px; padding: 12px 14px; border-left: 4px solid var(--line); background: #fff; text-decoration: none; color: inherit; }
.queue-item + .queue-item { border-top: 1px solid var(--line); }
.queue-item.st-nuova { border-left-color: var(--red); }
.queue-item.st-assegnata { border-left-color: var(--amber); }
.queue-item.st-in_navigazione { border-left-color: var(--sea); }
.queue-item.st-sul_posto { border-left-color: var(--teal); }
.queue-item:hover { background: #FAFCFD; }
.queue-item .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.queue-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.stats-line { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; font-size: .9rem; color: var(--muted); }
.stats-line strong { color: var(--navy); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
table.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-weight: 600; font-size: .85rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFCFD; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FAFCFD; }
.table .t-main { font-weight: 600; }
.t-sub { display: block; font-size: .84rem; color: var(--muted); font-weight: 400; }
.svc-icons { display: flex; gap: 4px; }
.svc-icons .icon { width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: var(--chart); color: var(--sea); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 170px; }
.filters .input { min-height: 40px; padding: 7px 10px; }

.two-col { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.box { padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.box + .box { margin-top: 18px; }
.box h2 { font-size: 1.2rem; }
.form-narrow { max-width: 760px; }
.cap-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 16px; }
.pagination a, .pagination span { min-width: 38px; padding: 7px 11px; border-radius: var(--r-sm); border: 1px solid var(--line); text-align: center; text-decoration: none; background: #fff; color: var(--navy); font-size: .92rem; }
.pagination .is-current { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagination .is-disabled { color: var(--muted); opacity: .6; }

.code-block { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: var(--chart); padding: 12px 14px; border-radius: var(--r-sm); white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
@media (min-width: 1000px) { .mobile-only { display: none !important; } }
.queue .kpis { grid-template-columns: repeat(2, 1fr); }
.auth-box .flash { margin: 0 0 16px; }
.table .link-btn { white-space: nowrap; }
