/* Registro Battipista
   Layout: app a schede (Mezzi · Registro · Mappa · Quadro · Gestione). Telefono: barra in basso, schede mezzo a colonna;
   computer: schede in alto, mezzi affiancati. Il mezzo è il protagonista: illustrazione animata quando lavora.
   Tono: strumento di lavoro alpino, sobrio e leggibile di notte in cabina. Titoli in Barlow Condensed (maiuscole
   solo nelle etichette), numeri tabulari, colori di stato riservati allo stato. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(/fonts/Barlow-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/fonts/Barlow-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(/fonts/Barlow-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/fonts/Barlow-700.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/BarlowCondensed-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/BarlowCondensed-700.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(/fonts/BarlowCondensed-800.woff2) format("woff2"); }

/* ---------- Token: giorno (neve al sole) ---------- */
:root {
  --bg: #f2f4f7;
  --bg-2: #e7ebf0;
  --surface: #ffffff;
  --raised: #f5f7fa;
  --line: #e0e5eb;
  --line-2: #cbd3dd;
  --ink: #0e1621;
  --ink-2: #374353;
  --muted: #627080;
  --accent: #1c5fd0;
  --accent-ink: #ffffff;
  --accent-soft: #e4edfc;
  --go: #12844e; --go-ink: #ffffff; --go-soft: #d8f2e4;
  --stop: #c2410c; --stop-ink: #ffffff;
  --warn: #b45309; --warn-soft: #fdecd3;
  --bad: #c4291c; --bad-soft: #fbe0dd;
  --m1: #e0412f; --m2: #e59a00; --m3: #0e93a8; --m4: #7b4fd6; --m5: #5f8a1f; --m6: #d03f8e; --m7: #8c5a2b; --m8: #4b5a6b;
  --sky-1: #cfe3f5; --sky-2: #eef5fb;
  --ground: #ffffff; --ground-line: #c9d6e3; --ground-shadow: #dbe5ef; --hill: #c3d4e6;
  --metal: #2a3443; --metal-2: #4a5668; --glass: #9fd0f2; --beam: #fff2b8;
  --shadow: 0 1px 2px rgb(14 22 33 / .05), 0 2px 10px rgb(14 22 33 / .04);
  --shadow-md: 0 2px 4px rgb(14 22 33 / .05), 0 10px 28px rgb(14 22 33 / .08);
  --shadow-lg: 0 24px 64px rgb(14 22 33 / .2);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --f-display: "Barlow Condensed", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 10px; --r: 14px; --r-lg: 18px;
  --tabbar-h: 64px;
  color-scheme: light;
}
/* ---------- Token: notte (battitura) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1017; --bg-2: #0f1720;
    --surface: #111a24; --raised: #16212e;
    --line: #1f2c3b; --line-2: #2c3b4f;
    --ink: #e9eff6; --ink-2: #c2cedb; --muted: #8796a9;
    --accent: #7ab8ff; --accent-ink: #06121f; --accent-soft: #132a45;
    --go: #34d399; --go-ink: #04140c; --go-soft: #0f2e22;
    --stop: #fb923c; --stop-ink: #1a0b02;
    --warn: #fbbf24; --warn-soft: #33270b;
    --bad: #f87171; --bad-soft: #3a1515;
    --m1: #ff6b55; --m2: #ffc13b; --m3: #3fd0e0; --m4: #a98cf5; --m5: #9bd34f; --m6: #ff7ab8; --m7: #d9a066; --m8: #9aa8b8;
    --sky-1: #0c1626; --sky-2: #16263c;
    --ground: #dbe6f1; --ground-line: #aebfd1; --ground-shadow: #b8c8d8; --hill: #66788f;
    --metal: #1a222d; --metal-2: #3a4657; --glass: #5aa9de; --beam: #fff4c2;
    --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 2px 10px rgb(0 0 0 / .2);
    --shadow-md: 0 2px 4px rgb(0 0 0 / .35), 0 12px 32px rgb(0 0 0 / .3);
    --shadow-lg: 0 20px 60px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 16px/1.45 var(--f-body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.08; text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: clamp(30px, 5.4vw, 40px); font-weight: 700; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.m0 { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow, .label { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.ico { display: block; flex: none; overflow: visible; }
.hint { font-size: 13px; color: var(--muted); }
.hint:empty { display: none; }
.sheet h2:focus { outline: none; }
.err { color: var(--bad); font-size: 14px; font-weight: 600; min-height: 1.2em; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.filemsg { max-width: 560px; margin: 40px auto; padding-inline: 16px; font-size: 17px; }
.filemsg h1 { margin-bottom: 12px; }
.filemsg p + p { margin-top: 10px; }

/* ---------- Controlli ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none;
  box-shadow: 0 1px 1px rgb(14 22 33 / .04);
  transition: transform .1s var(--ease), background .15s, border-color .15s, box-shadow .15s, filter .15s;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); }
.btn.primary:hover, .btn.go:hover, .btn.stop:hover, .btn.danger:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.go { background: var(--go); color: var(--go-ink); border-color: transparent; box-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 6px 16px color-mix(in srgb, var(--go) 28%, transparent); }
.btn.stop { background: var(--stop); color: var(--stop-ink); border-color: transparent; box-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 6px 16px color-mix(in srgb, var(--stop) 28%, transparent); }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn.lg { min-height: 52px; font-size: 17px; }
.btn.xl { min-height: 58px; font-size: 18px; border-radius: 14px; width: 100%; letter-spacing: .005em; }
.btn.xl svg { width: 22px; height: 22px; }
.btn.go:hover svg { transform: translateX(2px); }
.btn svg { transition: transform .2s var(--ease); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--raised); color: var(--ink); flex: none; transition: background .15s, transform .1s var(--ease); }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 22px; height: 22px; }
.link { font-weight: 700; text-decoration: none; font-size: 15px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field input, .field select, .field textarea, .export select, .search input {
  width: 100%; min-height: 48px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 10px 12px; font-size: 17px; font-weight: 500; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); }
.chip:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--line-2)); }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-checked="true"] .dot { box-shadow: 0 0 0 2px var(--ink), 0 0 0 3.5px var(--c, var(--muted)); }

/* Tessere attività */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile {
  display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 82px; padding: 10px 6px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; line-height: 1.15; text-align: center; color: var(--ink-2);
  transition: border-color .15s, background .15s, transform .08s;
}
.tile svg { width: 28px; height: 28px; color: var(--muted); transition: color .15s; }
.tile:active { transform: scale(.97); }
.tile:hover { border-color: var(--line-2); }
.tile[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: 0 0 0 1px var(--accent) inset; }
.tile[aria-checked="true"] svg { color: var(--accent); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px; }
.quick button { border: 1px dashed var(--line-2); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* ---------- Accesso ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2) 60%, var(--bg)); }
.login-art { --c: var(--m1); position: absolute; inset: auto 0 0 0; height: 46%; pointer-events: none; opacity: .9; }
.login-art svg { width: 100%; height: 100%; display: block; }
.login-card { position: relative; width: min(420px, 100%); background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: 22px; padding: 30px 26px 26px; display: grid; gap: 16px; box-shadow: var(--shadow-lg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.logo { flex: none; border-radius: 10px; box-shadow: 0 1px 2px rgb(0 0 0 / .18); }
.login-card .brand { margin-bottom: 4px; }
.login-card h1 { font-size: 30px; }

/* ---------- Struttura app ---------- */
.app { min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand-name { font-family: var(--f-display); font-weight: 600; font-size: 21px; letter-spacing: .005em; white-space: nowrap; color: var(--ink-2); }
.brand-name b { font-weight: 700; color: var(--ink); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }
.net { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 10px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); }
/* Pulsazioni: solo transform e opacity, che la scheda grafica anima da sola. Un'ombra animata andrebbe
   ridisegnata dal processore a ogni fotogramma (sul telefono rallentava tutta l'app). */
@keyframes onda { from { transform: scale(1); opacity: .55; } to { transform: scale(2.6); opacity: 0; } }
@keyframes battito { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.72); opacity: .55; } }
.net-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--go); }
.net-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--go); animation: onda 2.4s ease-out infinite; }
.net .net-off { display: none; width: 16px; height: 16px; }
.net.off { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.net.off .net-dot { display: none; }
.net.off .net-off { display: block; animation: blink 1.6s ease-in-out infinite; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); color: var(--accent-ink); font-weight: 800; font-size: 14.5px; letter-spacing: .02em; flex: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: grid; z-index: 30; }
.menu-head { padding: 10px 12px 12px; display: grid; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; border-radius: 10px; font-weight: 600; text-align: left; }
.menu button:hover { background: var(--raised); }
.menu svg { width: 20px; height: 20px; color: var(--muted); }

/* Navigazione: in basso su telefono */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs a { display: grid; justify-items: center; align-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; position: relative; -webkit-tap-highlight-color: transparent; }
.tabs svg { width: 24px; height: 24px; position: relative; z-index: 1; }
.tabs a::before { content: ""; position: absolute; top: 9px; left: 50%; width: 58px; height: 32px; margin-left: -29px; border-radius: 16px; background: var(--accent-soft); opacity: 0; transform: scaleX(.5); transition: opacity .2s, transform .25s var(--ease); }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs a[aria-current="page"]::before { opacity: 1; transform: none; }
.tabs a[aria-current="page"] svg { animation: icon-pop .45s var(--ease); }

.view { max-width: 1180px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 0; display: grid; gap: 20px; }
.view:not([hidden]) { animation: view-in .25s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.lead { color: var(--ink-2); font-size: 16px; font-weight: 600; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head h2 { font-size: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.pending-bar { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 10px 16px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 15px; }
.pending-bar svg { width: 18px; height: 18px; }

/* ---------- Schede mezzo ---------- */
.fleet { display: grid; grid-template-columns: 1fr; gap: 16px; }
.cat {
  --c: var(--m1); grid-template-rows: auto 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  display: grid; box-shadow: var(--shadow); min-width: 0; position: relative;
}
.cat[data-i="1"] { --c: var(--m2); }
.cat[data-i="2"] { --c: var(--m3); }
.cat { transition: box-shadow .2s, border-color .2s; }
.cat:hover { box-shadow: var(--shadow-md); }
.cat.is-active { border-color: color-mix(in srgb, var(--go) 50%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--go) 35%, transparent), var(--shadow-md); }
.cat-art { position: relative; aspect-ratio: 16 / 7; max-width: 100%; background: linear-gradient(180deg, var(--sky-1), var(--sky-2)); overflow: hidden; }
.cat-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cat-status { position: absolute; left: 12px; top: 12px; }
.cat-timer { position: absolute; right: 12px; top: 12px; font-family: var(--f-display); font-weight: 700; font-size: 26px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .01em;
  background: color-mix(in srgb, var(--surface) 94%, transparent); padding: 7px 11px; border-radius: 10px; box-shadow: var(--shadow); }   /* niente sfocatura: sotto c'è l'illustrazione animata */
.cat-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cat-actions { margin-top: auto; }   /* pulsanti allineati in fondo anche se la scheda vicina è più alta */
.cat-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.cat-name { font-family: var(--f-display); font-weight: 700; font-size: 26px; line-height: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-name i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.cat-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-model { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-work { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--go-soft); color: var(--ink); border-left: 3px solid var(--go); }
.cat-work strong { font-size: 17px; }
.cat-work span { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.cat-work.stale { background: var(--warn-soft); border-left-color: var(--warn); }
.cat-work.idle { background: var(--raised); border-left-color: var(--line-2); }
.cat-work.idle strong { font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { display: grid; gap: 3px; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.stat b { font-family: var(--f-display); font-size: 23px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat b small { font-family: var(--f-body); font-size: 13px; font-weight: 600; color: var(--muted); }
.stat .label { font-size: 11px; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--go); }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }
.cat-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.cat-actions .btn.xl { min-height: 58px; }
.cat-actions .icon-btn { width: 58px; height: 58px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.cat-actions .icon-btn:hover svg { transform: rotate(90deg); }
.cat-actions .icon-btn svg { transition: transform .25s var(--ease); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; padding: 6px 11px 6px 9px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--ink-2); box-shadow: var(--shadow); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--accent); }
.pill.go { color: var(--go); }
.pill.go::before { animation: battito 1.6s ease-in-out infinite; }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }

/* ---------- Illustrazione gatto delle nevi (foto + animazioni) ---------- */
.sc .ground { fill: var(--ground); }
.sc .ground-shadow { fill: rgb(10 20 35 / .28); }
.sc .cord { stroke: var(--ground-line); stroke-width: 2; stroke-dasharray: 22 12; fill: none; }
.sc .fresh { fill: var(--ground); }
.sc .hill { fill: var(--hill); opacity: .7; }
.sc .star { fill: var(--ink); opacity: 0; }
.sc .beam-stop { stop-color: var(--beam); }
.sc .beam { opacity: 0; mix-blend-mode: screen; }
.sc .lamp { fill: #fffbe6; opacity: 0; }
.sc .glow { opacity: 0; }
.sc .tread { fill: none; stroke: #0b0f14; stroke-width: 5; stroke-dasharray: 4 9; stroke-linecap: round; opacity: 0; }
.sc .wheel circle { stroke: #0b0f14; stroke-width: 0; }
.sc .wheel path { stroke: #8d99a6; stroke-width: 2.6; stroke-linecap: round; opacity: 0; }
.sc .flake { fill: #ffffff; opacity: 0; }
.sc .puff { fill: var(--muted); opacity: 0; }
.sc .cable { stroke: #1f2933; stroke-width: 3.4; stroke-dasharray: 9 7; opacity: 0; }
.sc .wrench { opacity: 0; }
.sc .wrench path { fill: none; stroke: var(--warn); stroke-width: 7; stroke-linecap: round; }
.sc .alert { opacity: 0; }
.sc .photo { filter: none; }
@media (prefers-color-scheme: dark) {
  .sc .star { opacity: .55; }
  .sc .photo { filter: brightness(.92); }
  .is-active .sc .photo { filter: none; }
  .sc .cable { stroke: #c9d6e3; }
}
.is-idle .sc .photo { filter: saturate(.9); }
/* schede fuori dallo schermo: animazioni ferme (le riaccende l'IntersectionObserver di renderFleet) */
.cat.fuori-vista .sc *, .cat.fuori-vista .ico * { animation-play-state: paused !important; }
/* app ferma da un po' (vedi QUIETE_MS in app.js): illustrazioni in pausa, nessun lavoro per il processore */
body.quieto .sc *, body.quieto .ico * { animation-play-state: paused !important; }

.is-active .sc .body { animation: vibe .16s linear infinite alternate; }
.is-active .sc .tread { opacity: .55; }
.is-active .sc .tread.top { animation: tread-fwd .32s linear infinite; }
.is-active .sc .tread.bottom { animation: tread-back .32s linear infinite; }
.is-active .sc .wheel path { opacity: .3; }
.is-active .sc .wheel { animation: spin-fwd .9s linear infinite; transform-box: fill-box; transform-origin: center; }
.is-active .sc .cord { animation: cord-back .7s linear infinite; }
.is-active .sc .hills { animation: hills-back 22s linear infinite; }
.is-active .sc .beam { opacity: .5; animation: beam 2.8s ease-in-out infinite; }
.is-active .sc .lamp { opacity: 1; }
.is-active .sc .glow { animation: beacon 1.1s steps(1) infinite; }
.is-active .sc .glow.b2 { animation-delay: -.55s; }   /* i due lampeggianti si alternano */
.is-active .sc .flake.fwd { animation: flake-fwd 1s linear infinite; }
.is-active .sc .flake.back { animation: flake-back 1.2s linear infinite; }
.is-active .sc .flake:nth-of-type(2) { animation-delay: -.2s; }
.is-active .sc .flake:nth-of-type(3) { animation-delay: -.4s; }
.is-active .sc .flake:nth-of-type(4) { animation-delay: -.6s; }
.is-active .sc .flake:nth-of-type(5) { animation-delay: -.8s; }
.is-active .sc .flake:nth-of-type(6) { animation-delay: -.3s; }
.is-active .sc .puff { animation: puff 1.8s ease-out infinite; }
.is-active .sc .puff:nth-of-type(2) { animation-delay: -.6s; }
.is-active .sc .puff:nth-of-type(3) { animation-delay: -1.2s; }
.is-winch .sc .cable { opacity: .9; animation: cable 1.2s linear infinite; }
.is-maint .sc .wrench { opacity: 1; animation: wobble 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.is-down .sc .photo { filter: grayscale(.9) brightness(.8); }
.is-down .sc .alert { opacity: 1; animation: blink 1.4s ease-in-out infinite; }

@keyframes vibe { from { transform: translate(0, 0); } to { transform: translate(.4px, -.9px); } }
@keyframes tread-fwd { to { stroke-dashoffset: -13; } }
@keyframes tread-back { to { stroke-dashoffset: 13; } }
@keyframes spin-fwd { to { transform: rotate(360deg); } }
@keyframes cord-back { to { stroke-dashoffset: 34; } }
@keyframes hills-back { to { transform: translateX(-200px); } }
@keyframes beam { 0%, 100% { opacity: .42; } 50% { opacity: .6; } }
@keyframes beacon { 0% { opacity: 1; } 50% { opacity: .15; } }
@keyframes flake-fwd { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .95; } 100% { transform: translate(52px, -46px); opacity: 0; } }
@keyframes flake-back { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translate(-60px, -40px); opacity: 0; } }
@keyframes puff { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 20% { opacity: .35; } 100% { transform: translate(-22px, -52px) scale(2); opacity: 0; } }
@keyframes cable { to { stroke-dashoffset: -32; } }
@keyframes wobble { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(14deg); } }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Ultime attività / registro ---------- */
.recent, .day-list { display: grid; gap: 8px; }
.entry {
  --c: var(--m1);
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.entry:hover { border-color: var(--line-2); }
.entry[data-i="1"] { --c: var(--m2); }
.entry[data-i="2"] { --c: var(--m3); }
.entry-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: color-mix(in srgb, var(--c) 82%, var(--ink)); position: relative; }
.entry-ico svg { width: 24px; height: 24px; }
.entry.live .entry-ico::after { content: ""; position: absolute; right: -3px; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--go); border: 2px solid var(--surface); animation: battito 1.6s ease-in-out infinite; }
.entry-main { min-width: 0; display: grid; gap: 4px; }
.entry-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.entry-title strong { font-size: 16.5px; }
.entry-title .who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); font-size: 14px; }
.entry-title .who::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.entry-time { font-size: 14px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.entry-time .dur { color: var(--muted); font-weight: 600; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--raised); border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px; }
.tag b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tag.live { background: var(--go-soft); color: var(--go); font-weight: 800; border-color: transparent; }
.tag.wait { background: var(--warn-soft); color: var(--warn); font-weight: 800; border-color: transparent; }
.entry-note { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.entry-by { font-size: 13px; color: var(--muted); }
.entry-actions { display: flex; gap: 2px; }
.entry-actions button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.entry-actions button:hover { background: var(--raised); color: var(--ink); }
.entry-actions button.del:hover { color: var(--bad); }
.entry-actions svg { width: 20px; height: 20px; }
.entry.editing { outline: 2px solid var(--accent); }

.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; }
.export { display: flex; gap: 8px; align-items: center; }
.export select { width: auto; min-height: 44px; font-size: 15px; font-weight: 600; }
.day { display: grid; gap: 8px; }
.day + .day { margin-top: 14px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; position: sticky; top: calc(62px + env(safe-area-inset-top, 0px)); z-index: 5; padding: 8px 2px; background: var(--bg); }
.day-head h3 { font-size: 18px; }
.empty { border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 28px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; font-weight: 600; }
.empty svg { width: 40px; height: 40px; color: var(--muted); opacity: .6; animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px); } }

/* ---------- Quadro ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 8px; min-width: 0; box-shadow: var(--shadow); }
.kpi .label { display: flex; align-items: center; gap: 7px; }
.kpi .label svg { width: 17px; height: 17px; color: var(--accent); }
.kpi b { font-family: var(--f-display); font-weight: 700; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 16px; font-weight: 700; color: var(--muted); font-family: var(--f-body); }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mcard { --c: var(--m1); }
.mcard[data-i="1"] { --c: var(--m2); }
.mcard[data-i="2"] { --c: var(--m3); }
.mcard .cat-name { font-size: 23px; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--c); }
.chart .bar.zero { fill: var(--line); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font: 600 11px var(--f-body); }
.chart text.val { fill: var(--ink); font-weight: 700; }
.chart text.today { fill: var(--ink); font-weight: 800; }
.svc { display: grid; gap: 6px; }
.svc-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.svc-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.svc .meter { height: 10px; border-radius: 5px; }
.svc .meter i { border-radius: 5px; }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ---------- Gestione ---------- */
.setup { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.setup fieldset { --c: var(--m1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
.setup fieldset[data-i="1"] { --c: var(--m2); }
.setup fieldset[data-i="2"] { --c: var(--m3); }
.setup legend { font-family: var(--f-display); font-weight: 800; font-size: 19px; text-transform: uppercase; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.setup legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.setup .btn { grid-column: 1 / -1; justify-self: start; }
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.roles p { font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.role-tag { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.role-tag.admin { background: var(--ink); color: var(--bg); }
.role-tag.operatore { background: var(--accent-soft); color: var(--accent); }
.role-tag.lettura { background: var(--raised); color: var(--muted); border: 1px solid var(--line); }
.users { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.user-row.off { opacity: .55; }
.user-row .avatar { width: 40px; height: 40px; font-size: 14px; background: var(--raised); color: var(--ink); border: 1px solid var(--line); }
.user-row .who { min-width: 0; display: grid; }
.user-row .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .who span { font-size: 13px; color: var(--muted); }
.newuser { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.newuser .btn { grid-column: 1 / -1; justify-self: start; }
.newuser .wide { grid-column: 1 / -1; }
.newuser .span3 { grid-column: span 3; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; white-space: nowrap; }
tbody tr:hover td { background: var(--raised); }
.audit td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- Pannelli (bottom sheet su telefono) ---------- */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  width: min(560px, 100%); max-width: 100%; max-height: calc(100dvh - 24px);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
dialog.sheet::backdrop { background: rgb(4 8 14 / .55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
dialog.sheet[open] { animation: sheet-in .24s var(--ease); }
dialog.sheet[open]::backdrop { animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet-body { padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h2 { font-size: 25px; }
.endsum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.confirm .sheet-body { gap: 14px; }
.plat { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; }
.plat.here { border-color: var(--accent); background: var(--accent-soft); }
.plat h3 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.plat .tag { color: var(--accent); background: var(--surface); }
.plat ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 700;
  max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

/* ---------- Telefono ---------- */
@media (max-width: 719px) {
  /* backdrop-filter creerebbe un contenitore per la barra fissa in basso */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  /* sul telefono la sfocatura sotto la barra delle schede costa a ogni scorrimento: sfondo pieno */
  .tabs { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--surface) 98%, transparent); }
  .brand-name { font-size: 19px; }
  .net #netText { display: none; }
  .net { padding: 8px; }
  dialog.sheet { margin: auto 0 0; width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; }
  dialog.sheet[open] { animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .sheet-body::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); justify-self: center; margin: -6px 0 -4px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board, .setup, .roles { grid-template-columns: 1fr; }
  .fleet { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .newuser { grid-template-columns: 1fr 1fr; }
  .newuser .span3 { grid-column: 1 / -1; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 .field:first-child { grid-column: 1 / -1; }
  .user-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .user-row .role-tag { grid-column: 2; justify-self: start; }
  .export { width: 100%; }
  .export select { flex: 1; }
  .day-head { top: calc(62px + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 400px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat b { font-size: 21px; }
  .cat-timer { font-size: 26px; }
}

/* ---------- Computer: schede in alto, mezzi affiancati ---------- */
@media (min-width: 720px) {
  .app { padding-bottom: 40px; }
  .tabs { position: static; height: auto; padding: 4px; background: var(--raised); backdrop-filter: none; -webkit-backdrop-filter: none; border: 1px solid var(--line); border-radius: 13px; display: flex; gap: 2px; }
  .tabs a { display: flex; gap: 8px; padding: 8px 14px; border-radius: 9px; font-size: 14.5px; color: var(--ink-2); transition: background .15s, color .15s; }
  .tabs a:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); }
  .tabs svg { width: 19px; height: 19px; }
  .tabs a::before { display: none; }
  .tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(14 22 33 / .08), 0 0 0 1px var(--line); }
  .tabs a[aria-current="page"] svg { color: var(--accent); }
  .toast { bottom: 24px; }
}
@media (min-width: 1000px) {
  .fleet { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .recent { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 720px) and (max-width: 999px) {
  .fleet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .is-active .sc .beam { opacity: .5; }
  .is-active .sc .glow { opacity: 1; }
  .is-active .sc .tread { opacity: 0; }
}

/* ---------- Traccia GPS ---------- */
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--go); flex: none; }
.check > span { display: grid; gap: 2px; }
.gps-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gps-live { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; font-size: 14px; }
.gps-live .hint { flex-basis: 100%; }
.gps-live > svg { width: 20px; height: 20px; color: var(--muted); }
.gps-live.on > svg { color: var(--go); }
.linkbtn { border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 700; font-size: 14px; padding: 6px 0; margin-right: 16px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.trk { display: grid; gap: 4px; margin-top: 4px; }
.trk > svg { width: 100%; height: auto; display: block; background: var(--bg); border-radius: 10px; }   /* solo il disegno senza sfondo, non quello della mappa */
.trk-line { fill: none; stroke: var(--c, var(--accent)); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.trk-start { fill: var(--go); stroke: var(--surface); stroke-width: 2; }
.trk-end { fill: var(--bad); stroke: var(--surface); stroke-width: 2; }
.trk-scale { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.trk-txt { fill: var(--muted); font-size: 12px; font-weight: 700; font-family: var(--f-body); }
.trk-cap { font-size: 12px; color: var(--muted); }
.trk-cap .s { color: var(--go); } .trk-cap .e { color: var(--bad); }


/* ---------- Mappa della traccia ---------- */
.trk-map { height: 260px; border-radius: 10px; overflow: hidden; background: var(--bg-2); z-index: 0; }
.map-big { height: min(70vh, 640px); border-radius: 12px; overflow: hidden; background: var(--bg-2); z-index: 0; }
dialog.map-sheet { width: min(980px, 100%); }
.trk-path { stroke: var(--c, var(--accent)); }
.trk-dot-start { fill: var(--go); stroke: #fff; }
.trk-dot-end { fill: var(--bad); stroke: #fff; }
.trk-note { font-size: 12px; color: var(--warn); }
.leaflet-container { font: 500 13px/1.4 var(--f-body); }
.leaflet-control-attribution { font-size: 10px; }

/* ---------- Foto dei mezzi ---------- */
.cat-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mezzi-list { display: grid; gap: 10px; }
.mz-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-left: 5px solid var(--c, var(--m1)); border-radius: 12px; }
.mz-row.off { opacity: .55; }
.mz-thumb { width: 72px; height: 48px; border-radius: 8px; overflow: hidden; background: linear-gradient(180deg, var(--sky-1), var(--sky-2)); display: grid; place-items: center; }
.mz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mz-thumb > svg { width: 24px; height: 24px; color: var(--c, var(--ink-2)); }
.mz-row.regola .who strong { white-space: normal; overflow: visible; }
.mz-row.regola .who > span { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.mz-thumb i { width: 34px; height: 18px; border-radius: 4px; background: var(--c, var(--m1)); opacity: .8; }
.mz-row .who { min-width: 0; display: grid; }
.mz-row .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mz-row .who span { font-size: 13px; color: var(--muted); }
.foto-edit { display: grid; gap: 10px; }
.foto-prev { aspect-ratio: 16 / 7; border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, var(--sky-1), var(--sky-2)); display: grid; place-items: center; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; padding: 0; }
.foto-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-prev span { padding: 12px; }
#mz-del { justify-self: center; color: var(--bad); }

/* ---------- Mappa in tempo reale ---------- */
.live-map { height: min(62vh, 560px); min-height: 320px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); z-index: 0; }
.live-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.live-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 4px 12px; align-items: start; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.live-row:disabled { cursor: default; }
.live-row .sw { width: 14px; height: 14px; border-radius: 50%; background: var(--c); margin-top: 4px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.live-row.stale .sw { background: var(--muted); box-shadow: none; }
.live-row strong { font-size: 16px; }
.live-row span { grid-column: 2; font-size: 13px; color: var(--muted); }
.live-row .now { color: var(--go); font-weight: 700; }
.live-pin { display: flex; align-items: center; gap: 6px; transform: translate(-9px, -9px); white-space: nowrap; pointer-events: auto; }
.live-pin i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .45); flex: none; }
.live-pin b { font: 700 13px/1 var(--f-body); color: #0f1722; background: rgb(255 255 255 / .92); padding: 4px 7px; border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.live-pin.go i { animation: battito 1.6s ease-in-out infinite; }
.live-pin.stale i { background: #8b97a6; }
.live-pin.stale b { color: #5d6b7c; }

/* ---------- Icone animate ----------
   Ogni parte animabile (classe a-…) ha la sua animazione, ferma finché l'icona o un suo contenitore non è
   "attivo": icona con classe anim, attività scelta, voce in corso. Le animazioni ripartono da una posa neutra. */
.ico [class^="a-"], .ico [class*=" a-"] { animation-play-state: paused; transform-box: fill-box; transform-origin: center; }
:is(.anim, .tile[aria-checked="true"], .live-row:hover) [class^="a-"],
:is(.anim, .tile[aria-checked="true"], .live-row:hover) [class*=" a-"] { animation-play-state: running; }
.ico .a-tread  { animation: ic-dash .6s linear infinite; }
.ico .a-snow   { animation: ic-snow 1s ease-out infinite; }
.ico .a-cable  { animation: ic-cable .9s linear infinite; }
.ico .a-flake  { animation: ic-spin 6s linear infinite; }
.ico .a-drop   { animation: ic-drop 1.6s ease-in infinite; }
.ico .a-wrench { animation: ic-wobble 1.8s ease-in-out infinite; }
.ico .a-bang   { animation: ic-blink 1.2s ease-in-out infinite; }
.ico .a-pulse  { animation: ic-pulse 1.4s ease-in-out infinite; }
.ico .a-dot    { animation: ic-bounce 1.2s ease-in-out infinite; }
.ico .a-sun    { animation: ic-sun 3s ease-in-out infinite; }
.ico .a-line   { animation: ic-line 1.8s ease-in-out infinite; }
.ico .a-ring   { animation: ic-ring 1.8s ease-out infinite; }
.ico .a-bar    { animation: ic-bar 1.4s ease-in-out infinite; transform-origin: bottom; }
.ico .a-knob   { animation: ic-knob 2.4s ease-in-out infinite; }
.ico .a-spin   { animation: ic-spin 1.4s linear infinite; }
.ico .a-hand   { animation: ic-spin 8s linear infinite; transform-box: view-box; transform-origin: 12px 12px; }
.ico .a-needle { animation: ic-needle 2.4s ease-in-out infinite; transform-box: view-box; transform-origin: 12px 16px; }
.ico .a-flow   { animation: ic-flow var(--flow, 2s) ease-in-out infinite; }
.ico .a-gust   { animation: ic-gust 1.1s ease-in-out infinite; }
.ico .a-rain   { animation: ic-rain 1s linear infinite; }
.ico .a-level  { animation: ic-level 3s ease-in-out infinite; transform-origin: bottom; }
.ico.anim [class^="a-"], .ico.anim [class*=" a-"], .anim .ico [class^="a-"], .anim .ico [class*=" a-"] { animation-iteration-count: 4; }
.urg-ico .ico [class*="a-"], .pending-bar .ico [class*="a-"] { animation-iteration-count: infinite; }
.ico .a-d2 { animation-delay: -.2s; } .ico .a-d3 { animation-delay: -.4s; }
@keyframes ic-dash   { to { stroke-dashoffset: -7; } }
@keyframes ic-cable  { to { stroke-dashoffset: -7; } }
@keyframes ic-snow   { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(2.5px, -3px); opacity: 0; } }
@keyframes ic-spin   { to { transform: rotate(360deg); } }
@keyframes ic-drop   { 0% { transform: translateY(-2px); opacity: 0; } 25% { opacity: 1; } 80% { transform: translateY(1.5px); opacity: 1; } 100% { transform: translateY(2px); opacity: 0; } }
@keyframes ic-wobble { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(14deg); } }
@keyframes ic-blink  { 50% { opacity: .2; } }
@keyframes ic-pulse  { 50% { transform: scale(1.22); } }
@keyframes ic-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } }
@keyframes ic-sun    { 50% { transform: translateY(-1.5px) scale(1.12); } }
@keyframes ic-line   { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.55); } }
@keyframes ic-ring   { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes ic-bar    { 50% { transform: scaleY(.55); } }
@keyframes ic-knob   { 50% { transform: translateX(-3px); } }
@keyframes ic-needle { 0%, 100% { transform: rotate(-35deg); } 50% { transform: rotate(25deg); } }
@keyframes ic-flow   { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(2px); } }
@keyframes ic-gust   { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(2.5px); opacity: .45; } }
@keyframes ic-rain   { 0% { transform: translate(0, -2px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(-1px, 2px); opacity: 0; } }
@keyframes ic-level  { 50% { transform: scaleY(.8); } }
@keyframes icon-pop  { 0% { transform: scale(.82); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.tile svg { transition: transform .2s var(--ease), color .15s; }
.tile[aria-checked="true"] svg { transform: scale(1.08); }
.entry.live .entry-ico { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--go) 45%, transparent); }
.pending-bar svg { color: var(--warn); }

/* ---------- Scheda mezzo compatta (due per riga sul telefono) ---------- */
.cat { container: cat / inline-size; }
.cat-actions .btn { min-width: 0; white-space: nowrap; overflow: hidden; }
@container cat (max-width: 300px) {
  .cat-body { padding: 12px; gap: 10px; }
  .cat-title { flex-direction: column; align-items: flex-start; gap: 3px; }
  .cat-name { font-size: 18px; gap: 7px; }
  .cat-name i { width: 9px; height: 9px; box-shadow: none; }
  .cat-model { font-size: 12px; max-width: 100%; }
  .cat-status { left: 7px; top: 7px; }
  .pill { font-size: 9.5px; padding: 4px 7px 4px 6px; gap: 4px; letter-spacing: .05em; }
  .pill::before { width: 6px; height: 6px; }
  .cat-timer { font-size: 15px; padding: 4px 6px; right: 7px; top: 7px; border-radius: 7px; }
  .cat-work { padding: 8px 9px; gap: 2px; border-left-width: 2px; }
  .cat-work strong, .cat-work.idle strong { font-size: 13.5px; line-height: 1.25; }
  .cat-work span { font-size: 12px; line-height: 1.3; }
  .gps-live { font-size: 12px; gap: 2px 6px; }
  .gps-live > svg { width: 16px; height: 16px; }
  .gps-live .linkbtn { font-size: 12.5px; padding: 2px 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .stats .stat:nth-child(2) { display: none; }   /* "Lavoro oggi": resta nel registro e nel quadro */
  .stat { padding: 7px 8px; }
  .stat b { font-size: 17px; }
  .stat .label { font-size: 9.5px; letter-spacing: .05em; }
  .cat-actions { grid-template-columns: 1fr 1fr; gap: 6px; }   /* scheda stretta: pulsante principale sopra, + e guasto sotto */
  .cat-actions > .btn { grid-column: 1 / -1; }
  .cat-actions .icon-btn { width: auto; height: 42px; }
  .cat-actions .btn.xl { min-height: 44px; font-size: 15px; padding: 0 8px; gap: 6px; border-radius: 11px; }
  .cat-actions .btn.xl svg { width: 16px; height: 16px; }
  .cat-actions .icon-btn { width: 42px; height: 44px; border-radius: 11px; }
  .cat-actions .long { display: none; }
}

/* ---------- Meteo ---------- */
.meteo { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.wx { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 14px; align-content: start; box-shadow: var(--shadow); min-width: 0;
  background-image: linear-gradient(160deg, color-mix(in srgb, var(--sky-1) 55%, transparent), transparent 55%); }
.wx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.wx-head strong { display: block; font-family: var(--f-display); font-size: 22px; font-weight: 700; line-height: 1.1; }
.wx-head span { font-size: 13px; color: var(--muted); font-weight: 600; }
.wx-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; padding: 4px 0; }
.wx-link svg { width: 15px; height: 15px; }
.wx-now { display: flex; align-items: center; gap: 12px; }
.wx-now > svg { width: 40px; height: 40px; color: var(--accent); }
.wx-temp { font-family: var(--f-display); font-weight: 700; font-size: 52px; line-height: .95; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.wx-temp small { font-size: 24px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.wx-feel { font-size: 13px; color: var(--muted); font-weight: 600; }
.wx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wx-tile { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 2px 10px; padding: 10px 12px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); min-width: 0; }
.wx-val { display: grid; gap: 2px; min-width: 0; }
.wx-tile > svg { width: 34px; height: 34px; padding: 6px; border-radius: 10px; background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 1px var(--line); }
.wx-tile .label { font-size: 10.5px; }
.wx-tile b { font-family: var(--f-display); font-size: 22px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.wx-tile b small { font-family: var(--f-body); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.wx-dir { display: inline-flex; align-items: center; gap: 3px; font-family: var(--f-body); font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.wx-dir svg { width: 14px; height: 14px; color: var(--accent); transition: transform .6s var(--ease); }
.wx-tile.vento > svg { color: var(--accent); }
.wx-tile.raffica > svg { color: var(--ink-2); }
.wx-tile.forte { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.wx-tile.forte > svg { color: var(--warn); }
.wx-tile.forte .label { color: var(--warn); }
.wx-mini { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.wx-mini span { display: inline-flex; align-items: center; gap: 5px; }
.wx-mini svg { width: 17px; height: 17px; color: var(--muted); }
.wx-foot { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.wx-foot.vecchio { color: var(--warn); }
.wx-off { display: grid; gap: 6px; color: var(--ink-2); font-size: 14.5px; }
.wx-off b { color: var(--ink); }
@media (max-width: 400px) { .wx-temp { font-size: 46px; } .wx-tile { padding: 9px 10px; grid-template-columns: 30px minmax(0, 1fr); } .wx-tile > svg { width: 30px; height: 30px; padding: 5px; } }

/* ---------- Avvisi (in cima alla schermata Mezzi) ---------- */
.alerts { display: grid; gap: 8px; }
.alerts:empty { display: none; }
.alert { --a: var(--warn); display: grid; grid-template-columns: 40px minmax(0, 1fr) 36px; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  border-radius: var(--r); background: color-mix(in srgb, var(--a) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--a) 38%, transparent);
  box-shadow: var(--shadow); animation: view-in .3s var(--ease); }
.alert.lv-info { --a: var(--accent); }
.alert.lv-allarme { --a: var(--bad); }
.alert > svg { width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: var(--a); color: var(--surface); }
.alert.lv-allarme > svg { animation: battito 1.6s ease-in-out 6; }
@keyframes alarm { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--a) 50%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.alert-txt { display: grid; gap: 2px; min-width: 0; }
.alert-txt strong { font-size: 15.5px; line-height: 1.3; }
.alert-txt span { font-size: 13.5px; color: var(--ink-2); line-height: 1.35; }
.alert-x { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.alert-x:hover { background: color-mix(in srgb, var(--a) 16%, transparent); color: var(--ink); }
.alert-x svg { width: 18px; height: 18px; }
.lv-tag { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.lv-tag.info { background: var(--accent-soft); color: var(--accent); }
.lv-tag.allarme { background: var(--bad-soft); color: var(--bad); }
#avForm { margin-top: 4px; }

/* ---------- Cruscotto ----------
   Strumentazione a tutto schermo del mezzo in azione, sempre scura (cabina di notte). Tablet in orizzontale:
   mappa a sinistra, strumenti a destra; in verticale tutto in colonna. */
.cockpit { --k-bg: #06090e; --k-panel: #0d151f; --k-line: #1c2836; --k-ink: #eaf0f7; --k-muted: #8494a8; --k-go: #34d399; --k-warn: #fbbf24; --k-bad: #f87171; --k-acc: #7ab8ff;
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--k-bg); color: var(--k-ink); color-scheme: dark; }
.cockpit::backdrop { background: #000; }
.ck:fullscreen { background: var(--k-bg); }
.ck:-webkit-full-screen { width: 100%; height: 100%; background: var(--k-bg); }
.ck::backdrop { background: var(--k-bg); }
.ck-btn[aria-pressed=true] { background: var(--k-acc); color: var(--k-bg); }
.cockpit[open] { animation: fade-in .25s ease-out; }
.ck { height: 100%; display: grid; gap: 10px; padding: 10px max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "head head" "map gauges" "map stats" "map wx"; }
.ck-panel { background: var(--k-panel); border: 1px solid var(--k-line); border-radius: 16px; min-width: 0; min-height: 0; }
.ck .label { color: var(--k-muted); }
.ck-head { grid-area: head; display: flex; align-items: center; gap: 14px; min-width: 0; padding-top: env(safe-area-inset-top, 0px); }
.ck-id { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.ck-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent); }
.ck-id h2 { font-size: 26px; color: var(--k-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-id span { display: block; color: var(--k-muted); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ck-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--k-panel); border: 1px solid var(--k-line); font-size: 13px; font-weight: 700; color: var(--k-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ck-chip svg { width: 16px; height: 16px; }
.ck-chip.ok svg { color: var(--k-go); } .ck-chip.warn { color: var(--k-warn); border-color: color-mix(in srgb, var(--k-warn) 45%, transparent); } .ck-chip.bad { color: var(--k-bad); }
.ck-chip.clock { font-family: var(--f-display); font-size: 18px; padding: 4px 12px; }
.ck-btns { display: flex; gap: 8px; }
.ck-btn { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--k-line); background: var(--k-panel); color: var(--k-ink); display: grid; place-items: center; }
.ck-btn:hover { background: #142030; }
.ck-btn svg { width: 22px; height: 22px; }
.ck-map { grid-area: map; position: relative; overflow: hidden; }
#ckMap { position: absolute; inset: 0; background: #0b121b; }
.ck-map .leaflet-container { background: #0b121b; }
.ck-map-info { position: absolute; left: 12px; bottom: 12px; z-index: 500; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 24px); }
.ck-map-info .ck-chip { background: rgb(6 9 14 / .82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ck-follow { position: absolute; right: 12px; bottom: 12px; z-index: 500; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--k-line); background: rgb(6 9 14 / .82); color: var(--k-ink); font-weight: 700; font-size: 14px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ck-follow svg { width: 18px; height: 18px; }
.ck-follow[aria-pressed="true"] { background: var(--k-acc); color: #06121f; border-color: transparent; }
.ck-nopos { position: absolute; inset: 0; z-index: 600; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; background: rgb(6 9 14 / .72); color: var(--k-ink); font-weight: 600; }
.ck-nopos svg { width: 44px; height: 44px; color: var(--k-muted); }
.ck-gauges { grid-area: gauges; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; gap: 6px; padding: 10px 16px; }
.ck-speed { width: min(100%, 400px); }
.ck-speed svg { width: 100%; height: auto; display: block; }
.ck-speed .arc-bg { stroke: var(--k-line); } .ck-speed .arc { stroke: var(--c); transition: stroke-dasharray .6s var(--ease); }
.ck-speed .tick { stroke: var(--k-muted); } .ck-speed .tick.maj { stroke: var(--k-ink); }
.ck-speed text { fill: var(--k-muted); font: 700 11px var(--f-body); }
.ck-speed .needle { transition: transform .6s var(--ease); transform-origin: 110px 110px; }
.ck-speed .val { fill: var(--k-ink); font: 700 44px var(--f-display); }
.ck-speed .unit { fill: var(--k-muted); font: 700 12px var(--f-body); letter-spacing: .08em; }
.ck-big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; text-align: center; }
.ck-big b { display: block; font-family: var(--f-display); font-weight: 700; font-size: clamp(30px, 3.6vw, 46px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.ck-big b small { font-size: .45em; color: var(--k-muted); font-family: var(--f-body); font-weight: 700; margin-left: 3px; }
.ck-stats { grid-area: stats; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--k-line); overflow: hidden; }
.ck-stat { background: var(--k-panel); padding: 10px 14px; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 0 10px; align-items: center; }
.ck-stat > svg { grid-row: span 2; width: 24px; height: 24px; color: var(--k-acc); }
.ck-stat b { font-family: var(--f-display); font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; }
.ck-stat b small { font-family: var(--f-body); font-size: 12px; color: var(--k-muted); font-weight: 700; }
.ck-stat b .ck-arrow { width: 18px; height: 18px; color: var(--k-acc); transition: transform .6s var(--ease); }
.ck-stat.warn b { color: var(--k-warn); } .ck-stat.bad b { color: var(--k-bad); }
.ck-wx { grid-area: wx; padding: 12px 14px; display: grid; gap: 10px; }
.ck-wx-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ck-wx-head strong { font-size: 15px; } .ck-wx-head span { font-size: 12.5px; color: var(--k-muted); font-weight: 600; white-space: nowrap; }
.ck-wx-row { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: center; }
.ck-wx-t { display: flex; align-items: center; gap: 6px; font-family: var(--f-display); font-size: 38px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.ck-wx-t svg { width: 28px; height: 28px; color: var(--k-acc); }
.ck-wx-t small { font-size: 16px; color: var(--k-muted); }
.ck-wx-v { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 8px; align-items: center; }
.ck-wx-v > svg { grid-row: span 2; width: 22px; height: 22px; color: var(--k-acc); }
.ck-wx-v b { font-family: var(--f-display); font-size: 22px; font-weight: 700; line-height: 1.05; white-space: nowrap; }
.ck-wx-v b small { font-family: var(--f-body); font-size: 11.5px; color: var(--k-muted); font-weight: 700; }
.ck-wx-v .wx-dir { grid-column: 2; }
.ck-wx-v.forte b, .ck-wx-v.forte > svg, .ck-wx-v.forte .label { color: var(--k-warn); }
.ck-wx .wx-dir { color: var(--k-muted); font-size: 12px; }
.ck-al { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 700; background: color-mix(in srgb, var(--k-warn) 16%, transparent); color: var(--k-warn); }
.ck-al.allarme { background: color-mix(in srgb, var(--k-bad) 18%, transparent); color: var(--k-bad); }
.ck-al.info { background: color-mix(in srgb, var(--k-acc) 16%, transparent); color: var(--k-acc); }
.ck-al svg { width: 18px; height: 18px; flex: none; }
.ck-muted { color: var(--k-muted); font-size: 14px; font-weight: 600; }
.ck-marker { width: 34px; height: 34px; margin: -17px 0 0 -17px; position: relative; }
.ck-marker::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; background: color-mix(in srgb, var(--c) 35%, transparent); animation: ck-ping 1.8s ease-out infinite; }
.ck-marker svg { position: relative; width: 34px; height: 34px; color: var(--c); filter: drop-shadow(0 1px 3px rgb(0 0 0 / .6)); transition: transform .5s var(--ease); }
.ck-marker svg path { fill: var(--c); stroke: #fff; stroke-width: 1.6; }
@keyframes ck-ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
/* pulsante sulla scheda del mezzo in azione */
.cat-ck { position: absolute; right: 10px; bottom: 10px; z-index: 2; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: #0d151f; color: #fff; box-shadow: 0 4px 14px rgb(0 0 0 / .35), 0 0 0 3px color-mix(in srgb, var(--go) 70%, transparent); }
.cat-ck svg { width: 26px; height: 26px; }
.cat-ck:hover { transform: scale(1.06); }
@container cat (max-width: 300px) { .cat-ck { width: 36px; height: 36px; right: 6px; bottom: 6px; } .cat-ck svg { width: 20px; height: 20px; } }
/* in verticale (telefono, tablet ruotato): tutto in colonna */
@media (max-aspect-ratio: 1/1) {
  .ck { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 42vh auto auto auto; grid-template-areas: "head" "map" "gauges" "stats" "wx"; overflow-y: auto; height: auto; min-height: 100%; }
  .ck-id h2 { font-size: 21px; }
  .ck-gauges { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; }
  .ck-big { grid-template-columns: minmax(0, 1fr); text-align: left; }
  .ck-status .ck-chip:not(.clock) { display: none; }
}

/* Messaggio urgente ricevuto: a tutto schermo, sopra anche al cruscotto */
dialog.urgente { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #7f1d1d; color: #fff; color-scheme: dark; }
dialog.urgente::backdrop { background: #000; }
dialog.urgente[open] { animation: urg-flash 1.2s ease-in-out infinite alternate; }
@keyframes urg-flash { from { background: #7f1d1d; } to { background: #b91c1c; } }
.urg-body { height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.urg-ico { --a: #fff; width: 96px; height: 96px; border-radius: 50%; background: #fff; color: #b91c1c; display: grid; place-items: center; box-shadow: 0 0 0 10px rgb(255 255 255 / .18); animation: alarm 1.6s ease-in-out infinite; }
.urg-ico svg { width: 56px; height: 56px; }
.urg-sub { font-weight: 700; font-size: 15px; letter-spacing: .02em; color: rgb(255 255 255 / .85); }
dialog.urgente h2 { font-size: clamp(28px, 6vw, 44px); line-height: 1.05; text-transform: uppercase; letter-spacing: .02em; color: #fff; }
dialog.urgente h2:focus { outline: none; }
.urg-text { max-width: 34ch; font-size: clamp(22px, 4.6vw, 34px); line-height: 1.3; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.urg-more { font-size: 15px; color: rgb(255 255 255 / .85); margin: 0; }
.urg-more:empty { display: none; }
.urg-ok { min-width: min(320px, 100%); min-height: 60px; font-size: 20px; background: #fff; color: #7f1d1d; border-color: #fff; margin-top: 8px; }
.urg-ok:hover { background: #fde8e8; }
.urg-ok:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.urg-mute { color: #fff; border-color: rgb(255 255 255 / .5); }
@media (prefers-reduced-motion: reduce) { dialog.urgente[open], .urg-ico { animation: none; } }
.msg-manca { color: var(--bad) !important; }

/* Miniatura del mezzo: la foto, oppure il gatto scontornato su cielo chiaro */
.mz-thumb img.gatto { object-fit: contain; padding: 4px 3px 2px; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .25)); }
.mz-row.off .mz-thumb img, .off-card.off .mz-thumb img { filter: grayscale(1); }
.mz-thumb.sm { width: 44px; height: 30px; border-radius: 7px; }
.mz-thumb.sm img.gatto { padding: 2px; }
.mz-thumb.sm > svg { width: 18px; height: 18px; }
.mz-thumb.lg { width: 112px; height: 72px; border-radius: 10px; }

/* Officina */
.off-mezzi { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.off-pick { flex: none; display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 700; font-size: 14px; color: var(--ink); }
.off-pick[aria-pressed="true"] { border-color: var(--c, var(--accent)); box-shadow: inset 0 0 0 1px var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 8%, var(--surface)); }
.off-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; display: grid; place-items: center; }
.off-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.off-card { text-align: left; display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.off-card:hover { border-color: var(--c); }
.off-card.off { opacity: .6; }
.off-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.off-card-head .who { flex: 1; min-width: 0; display: grid; }
.off-card-head .who strong { font-family: var(--f-display); font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.off-card-head .who span { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.off-scheda { border-left: 5px solid var(--c); }
.off-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.off-grid .off-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.off-stat { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--bg); min-width: 0; }
.off-stat > svg { width: 20px; height: 20px; color: var(--muted); grid-row: span 2; }
.off-stat .label { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.off-stat b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.off-stat.warn b, .off-stat.warn > svg { color: var(--warn); }
.off-stat.bad b, .off-stat.bad > svg { color: var(--bad); }
.off-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14.5px; }
.off-dl dt { color: var(--muted); font-weight: 600; }
.off-dl dd { margin: 0; overflow-wrap: anywhere; }
.off-dl dd.warn { color: var(--warn); font-weight: 700; }
.off-dl dd.bad { color: var(--bad); font-weight: 700; }
#offList { display: grid; gap: 8px; }
.int { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 12px; background: var(--surface); }
.int.aperto { background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.int-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); }
.int-ico svg { width: 22px; height: 22px; }
.int-body { display: grid; gap: 3px; min-width: 0; }
.int-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.int-top .who { color: var(--c); font-family: var(--f-display); font-weight: 700; font-size: 15px; text-transform: uppercase; }
.int-tipo { color: var(--muted); font-weight: 700; }
.int-body > strong { font-size: 16px; line-height: 1.3; }
.int-meta, .int-by { font-size: 13px; color: var(--muted); }
.int-txt { margin: 2px 0 0; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.int-side { display: grid; gap: 6px; justify-items: end; }
.int-costo { font-size: 16px; font-variant-numeric: tabular-nums; }
.accise-vuoto { padding: 48px 20px; }
.accise-vuoto span { font-weight: 500; max-width: 46ch; }
@media (max-width: 719px) {
  .off-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .int { grid-template-columns: 36px minmax(0, 1fr); }
  .int-ico { width: 36px; height: 36px; }
  .int-side { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; }
  .off-dl { grid-template-columns: 1fr; gap: 0; }
  .off-dl dd { margin-bottom: 8px; }
  .tabs a { font-size: 10.5px; }
}
.icon-btn.guasto { color: var(--warn); }
.wxpos-map { height: min(46vh, 380px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.wxpos-pin i { display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .4); }
.wxpos-cmd { display: flex; flex-wrap: wrap; gap: 8px; }
.row-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.cat-actions .icon-btn.guasto:hover svg { transform: none; }
#v-officina .export { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 719px) {
  #v-officina .view-head { flex-wrap: wrap; }
  #v-officina .export { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
  #v-officina .export #intAdd { grid-column: 1 / -1; order: -1; }
}

/* ---------- Comprensorio 3D: sala controllo, tema scuro, mappa a tutto spazio ---------- */
.view.c3d-view { max-width: none; padding: 0; }
.view.c3d-view:not([hidden]) { animation: none; }   /* una trasformazione sulla vista sposterebbe la mappa fissa */
.c3d { --k-bg: #07101b; --k-panel: rgb(10 20 33 / .92); --k-line: #1d2d42; --k-ink: #e6eef8; --k-muted: #8ea2bb; --k-acc: #38bdf8; --k-go: #34d399; --k-warn: #fbbf24; --k-bad: #f87171;
  position: fixed; left: 0; right: 0; top: var(--c3d-top, 62px); bottom: var(--c3d-bottom, 0px); background: var(--k-bg); color: var(--k-ink); color-scheme: dark; overflow: hidden; z-index: 5; }
.c3d > .c3d-map { position: absolute; inset: 0; }   /* più specifico di .maplibregl-map, che la rimetterebbe relative */
.c3d .maplibregl-ctrl-group { background: var(--k-panel); border: 1px solid var(--k-line); box-shadow: none; }
.c3d .maplibregl-ctrl-group button { width: 36px; height: 36px; }
.c3d .maplibregl-ctrl-group button + button { border-top-color: var(--k-line); }
.c3d .maplibregl-ctrl-icon { filter: invert(.92); }
.c3d .maplibregl-ctrl-attrib { background: rgb(7 16 27 / .78); color: var(--k-muted); font-size: 11px; }
.c3d .maplibregl-ctrl-attrib a { color: #b9cbe0; }
.c3d .maplibregl-ctrl-attrib-button { filter: invert(.9); }
.c3d .maplibregl-ctrl-attrib.maplibregl-compact-show { background: rgb(7 16 27 / .94); color: var(--k-ink); border: 1px solid var(--k-line); }
.c3d .maplibregl-ctrl-attrib.maplibregl-compact-show a { color: #93c5fd; }
.c3d .maplibregl-ctrl-scale { background: rgb(7 16 27 / .7); color: var(--k-ink); border-color: var(--k-muted); }
.c3d-tools { position: absolute; top: 10px; right: 56px; display: flex; gap: 6px; z-index: 2; }
.c3d-tool { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--k-line); background: var(--k-panel); color: var(--k-ink); font-weight: 700; font-size: 13px; }
.c3d-tool:hover { border-color: var(--k-acc); }
.c3d-tool svg { width: 18px; height: 18px; }
.c3d-tool.ico { width: 36px; padding: 0; justify-content: center; }
.c3d-tool svg.specchio { transform: scaleX(-1); }
.c3d-tool svg.capovolto { transform: scaleY(-1); }
.c3d-tool[aria-pressed="true"] { background: var(--k-acc); color: #06111d; border-color: transparent; }
.c3d-sep { width: 1px; background: var(--k-line); margin: 4px 2px; }
.c3d-aiuto { position: absolute; top: 52px; right: 56px; z-index: 2; margin: 0; padding: 5px 10px; border-radius: 8px; background: rgb(7 16 27 / .75); color: var(--k-muted); font-size: 12px; pointer-events: none; }
/* schermo intero: vero (Fullscreen API) o, dove manca (iPhone), la mappa sopra tutta la pagina */
.c3d.pieno { position: fixed; top: 0 !important; bottom: 0 !important; left: 0; right: 0; z-index: 60; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.c3d:fullscreen { width: 100vw; height: 100vh; }
.c3d.pieno .c3d-tools { top: max(10px, env(safe-area-inset-top, 0px)); }
.c3d-avviso { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: min(560px, calc(100% - 32px)); padding: 10px 14px; border-radius: 10px; background: #3a2a10; border: 1px solid #a16207; color: #fde68a; font-size: 13.5px; font-weight: 600; }
.c3d-msg { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; background: rgb(7 16 27 / .82); padding: 20px; }
.c3d-msg-box { max-width: 460px; display: grid; justify-items: center; gap: 12px; text-align: center; font-size: 15px; line-height: 1.5; }
.c3d-msg-box > svg { width: 40px; height: 40px; color: var(--k-warn); }
.c3d-msg-box p { margin: 0; }
.c3d-spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--k-line); border-top-color: var(--k-acc); animation: c3d-giro 1s linear infinite; }
@keyframes c3d-giro { to { transform: rotate(360deg); } }

.c3d-panel { position: absolute; top: 10px; left: 10px; bottom: 34px; width: 360px; z-index: 2; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px; border-radius: 16px; border: 1px solid var(--k-line); background: var(--k-panel); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); scrollbar-width: thin; }
.c3d-maniglia { display: none; }
.c3d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.c3d-head .eyebrow { color: var(--k-muted); }
.c3d-head h1 { font-size: 24px; color: var(--k-ink); line-height: 1.05; }
.c3d-modo { display: flex; border: 1px solid var(--k-line); border-radius: 9px; overflow: hidden; flex: none; }
.c3d-modo button { border: 0; background: transparent; color: var(--k-muted); font-weight: 800; font-size: 12px; padding: 7px 10px; letter-spacing: .03em; }
.c3d-modo button[aria-pressed="true"] { background: var(--k-acc); color: #06111d; }
.c3d-modo button[data-modo="demo"][aria-pressed="true"] { background: var(--k-warn); }
.c3d.is-demo::after { content: "DEMO · dati simulati"; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  padding: 6px 14px; border-radius: 999px; background: var(--k-warn); color: #1c1302; font-weight: 900; font-size: 12.5px; letter-spacing: .08em; box-shadow: 0 4px 14px rgb(0 0 0 / .35); }
#c3dFlotta { display: grid; gap: 10px; }
.c3d-demo { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; border: 1px dashed #a16207; background: rgb(251 191 36 / .08); font-size: 13px; color: #fde68a; }
.c3d-demo > b { font-size: 12px; letter-spacing: .12em; }
.c3d-demo-cmd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.c3d-ritmo { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.c3d select { background: var(--k-bg); color: var(--k-ink); border: 1px solid var(--k-line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; }
.c3d .btn.sm { background: #13233a; color: var(--k-ink); border-color: var(--k-line); }
.c3d .btn.sm.primary, .c3d .btn.sm.go { background: var(--k-acc); color: #06111d; border-color: transparent; }
.c3d .btn.sm.ghost { background: transparent; }
.c3d .btn[disabled] { opacity: .45; }
.c3d-fonte, .c3d-info, .c3d-allarme { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; color: var(--k-muted); padding: 9px 11px; border-radius: 10px; background: rgb(255 255 255 / .03); border: 1px solid var(--k-line); }
.c3d-fonte svg, .c3d-info svg, .c3d-allarme svg { width: 18px; height: 18px; }
.c3d-info p { margin: 0; }
.c3d-fonte.err { color: #fecaca; border-color: #7f1d1d; }
.c3d-allarme { color: #fecaca; background: rgb(248 113 113 / .1); border-color: #7f1d1d; font-weight: 700; }
.c3d-lista { display: grid; gap: 6px; }
.c3d-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 9px 10px; border-radius: 11px; border: 1px solid var(--k-line); background: rgb(255 255 255 / .02); color: var(--k-ink); }
.c3d-row:hover { border-color: var(--c); }
.c3d-row.scelto { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.c3d-row-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); }
.c3d-row-txt { display: grid; min-width: 0; }
.c3d-row-txt b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c3d-row-txt b small { color: var(--k-muted); font-weight: 600; font-size: 11px; }
.c3d-row-txt > span { font-size: 12px; color: var(--k-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c3d-row-st { display: grid; justify-items: end; gap: 3px; }
.c3d-row-st small { font-size: 11.5px; color: var(--k-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c3d-chip { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.c3d-chip.go { background: rgb(52 211 153 / .16); color: var(--k-go); }
.c3d-chip.idle { background: rgb(56 189 248 / .14); color: var(--k-acc); }
.c3d-chip.old { background: rgb(251 191 36 / .16); color: var(--k-warn); }
.c3d-chip.none { background: rgb(255 255 255 / .06); color: var(--k-muted); }
.c3d-det { display: grid; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 7%, transparent); }
.c3d-det-head { display: grid; }
.c3d-det-head b { font-size: 16px; }
.c3d-det-head span { font-size: 12px; color: var(--k-muted); }
.c3d-det-btn { display: flex; gap: 8px; flex-wrap: wrap; }
.c3d-det-btn svg { width: 16px; height: 16px; }
.c3d-det dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; }
.c3d-det dt { color: var(--k-muted); }
.c3d-det dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.c3d-sup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.c3d-sup > div { display: grid; padding: 7px 9px; border-radius: 9px; background: rgb(255 255 255 / .04); }
.c3d-sup .label, .c3d-tot .label { color: var(--k-muted); font-size: 10.5px; }
.c3d-sup b { font-size: 15px; font-variant-numeric: tabular-nums; }
.c3d-sup b.muto { font-size: 12.5px; color: var(--k-muted); font-weight: 600; }
.c3d-tot { display: grid; gap: 3px; font-size: 13px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--k-line); }
.c3d-tot small, .c3d-legenda small { color: var(--k-muted); font-size: 11.5px; line-height: 1.4; }
.c3d-box { border: 1px solid var(--k-line); border-radius: 12px; padding: 8px 12px; }
.c3d-box summary { cursor: pointer; font-weight: 800; font-size: 13px; color: var(--k-muted); text-transform: uppercase; letter-spacing: .06em; }
.c3d-livelli { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 10px 0 4px; }
.c3d-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.c3d-check input { width: 18px; height: 18px; accent-color: var(--k-acc); }
.c3d-check.esag { grid-column: 1 / -1; }
.c3d-legenda { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 0 4px; font-size: 12.5px; }
.c3d-legenda .label { color: var(--k-muted); width: 100%; }
.c3d-leg { display: inline-flex; align-items: center; gap: 6px; }
.c3d-leg i { width: 18px; height: 4px; border-radius: 2px; box-shadow: 0 0 0 1px rgb(255 255 255 / .35); }
.c3d-leg i.imp { background: repeating-linear-gradient(90deg, #fbbf24 0 5px, transparent 5px 8px); box-shadow: none; }

/* mezzi ed etichette sul terreno */
/* il segnaposto è grande quanto il pallino, così il punto GPS cade al suo centro; l'etichetta gli sta accanto
   senza spostarlo (con pallino ed etichetta insieme il centro finiva a metà etichetta, fuori pista) */
.c3d-mk { --c: #38bdf8; position: relative; display: block; width: 22px; height: 22px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--k-ink, #e6eef8); }
.c3d-mk-punto { position: absolute; inset: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 3px solid #06111d; box-shadow: 0 0 0 2px var(--c), 0 4px 10px rgb(0 0 0 / .5); display: grid; place-items: center; }
.c3d-mk.st-movimento .c3d-mk-punto::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--c); animation: c3d-onda 1.8s ease-out infinite; }
@keyframes c3d-onda { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
.c3d-freccia { position: absolute; top: -13px; left: 50%; margin-left: -6px; width: 12px; height: 10px; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #fff; transform-origin: 6px 24px; }
.c3d-mk.st-scaduto .c3d-mk-punto { background: #64748b; box-shadow: 0 0 0 2px #94a3b8, 0 4px 10px rgb(0 0 0 / .5); }
.c3d-mk.st-scaduto .c3d-mk-lab { border-style: dashed; color: #fde68a; }
.c3d-mk.allarme .c3d-mk-punto { box-shadow: 0 0 0 2px var(--c), 0 0 0 6px rgb(248 113 113 / .6); }
.c3d-mk.scelto .c3d-mk-punto { inset: -3px; width: 28px; height: 28px; }
.c3d-mk-lab { position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); display: grid; padding: 3px 8px; border-radius: 7px; background: rgb(7 16 27 / .86); border: 1px solid var(--c); font-weight: 800; font-size: 12px; white-space: nowrap; line-height: 1.2; }
.c3d-mk-lab small { font-weight: 700; font-size: 10.5px; color: #fde68a; }
.c3d-wx { display: flex; align-items: center; gap: 3px; padding: 3px 8px 3px 4px; border-radius: 999px; border: 1px solid #7dd3fc; background: rgb(8 30 48 / .9); color: #e0f2fe; font-weight: 800; font-size: 12.5px; cursor: pointer; box-shadow: 0 3px 10px rgb(0 0 0 / .45); font-variant-numeric: tabular-nums; }
.c3d-wx svg { width: 18px; height: 18px; color: #7dd3fc; }
.c3d-wx:hover, .c3d-wx:focus-visible { background: #0c4a6e; }
.c3d-wx.spenta { border-color: #64748b; color: #94a3b8; background: rgb(15 23 34 / .9); }
.c3d-wx.spenta svg { color: #64748b; }
.c3d-popup .maplibregl-popup-content { background: rgb(7 16 27 / .96); color: #e6eef8; border: 1px solid #1d2d42; border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 30px rgb(0 0 0 / .5); }
.c3d-popup .maplibregl-popup-tip { border-top-color: rgb(7 16 27 / .96); border-bottom-color: rgb(7 16 27 / .96); }
.c3d-popup .maplibregl-popup-close-button { color: #8ea2bb; font-size: 18px; padding: 0 6px; }
.c3d-pop { display: grid; gap: 4px; min-width: 190px; font-size: 13px; }
.c3d-pop-h { display: grid; margin-bottom: 2px; }
.c3d-pop-h b { font-size: 14.5px; }
.c3d-pop-h span { color: #8ea2bb; font-size: 11.5px; }
.c3d-pop-r { display: flex; justify-content: space-between; gap: 14px; }
.c3d-pop-r span { color: #8ea2bb; }
.c3d-pop-r b { font-variant-numeric: tabular-nums; }
.c3d-pop-f { color: #8ea2bb; font-size: 11px; }
.c3d-pop-f.vecchio { color: #fbbf24; }
.c3d-lab { font-size: 11.5px; font-weight: 700; color: #dbe7f5; text-shadow: 0 1px 2px #000, 0 0 6px #000; pointer-events: none; white-space: nowrap; }
.c3d-lab small { color: #9fb3c8; font-weight: 600; }
.c3d-lab.vetta::before { content: "▲ "; color: #cbd5e1; font-size: 9px; }
.c3d-lab.luogo { font-size: 12.5px; color: #fff; font-weight: 800; letter-spacing: .02em; }
.c3d-lab.pista { padding: 1px 6px; border-radius: 5px; background: rgb(7 16 27 / .8); border-left: 3px solid var(--c); text-shadow: none; }
.c3d-lab.impianto { padding: 1px 6px; border-radius: 5px; background: rgb(66 46 6 / .85); color: #fde68a; text-shadow: none; }

@media (max-width: 719px) {
  .c3d-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 52%; border-radius: 18px 18px 0 0; padding: 6px 14px 14px; transition: transform .25s var(--ease); }
  .c3d-panel.chiuso { transform: translateY(calc(100% - 64px)); }
  .c3d-maniglia { display: grid; place-items: center; height: 22px; border: 0; background: none; flex: none; }
  .c3d-maniglia i { width: 44px; height: 5px; border-radius: 3px; background: var(--k-muted); }
  .c3d-head h1 { font-size: 20px; }
  .c3d-tools { top: 8px; right: 52px; left: 8px; justify-content: flex-start; flex-wrap: wrap; }
  .c3d-aiuto, .c3d-sep { display: none; }
  .c3d-tool span { display: none; }
  .c3d-tool { width: 36px; padding: 0; justify-content: center; }
  .c3d.is-demo::after { top: 52px; font-size: 11px; }
  .c3d .maplibregl-ctrl-bottom-left, .c3d .maplibregl-ctrl-bottom-right { bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) { .c3d-mk.st-movimento .c3d-mk-punto::after, .c3d-spin { animation: none; } }
