/* ==========================================================================
   FleetView — Design System
   Dark-mode nativa, mobile-first. Ispirazione: Linear / Notion / Vercel.
   Nessun framework: variabili CSS + componenti minimali.
   ========================================================================== */
:root {
  /* Brand La Maggiore — oro #ffca39 + antracite neutro */
  --bg: #121316;
  --bg-1: #17181b;
  --bg-2: #1e2023;
  --bg-3: #26282c;
  --panel: #191a1d;
  --border: #2d2f34;
  --border-soft: #232529;
  --text: #ededed;
  --text-dim: #a4a6aa;
  --text-faint: #6e7075;
  --accent: #ffca39;          /* oro del chevron La Maggiore */
  --accent-ink: #1a1a1a;      /* testo scuro sopra il gold */
  --accent-soft: #34301d;     /* tint oro scuro per active/hover */
  --green: #34d399;
  --green-soft: #10241d;
  --amber: #ff9e2c;           /* arancio (distinto dal gold) per "manutenzione/critico" */
  --amber-soft: #2e2412;
  --red: #f87171;
  --red-soft: #2a1618;
  --violet: #c9a24b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 8px 30px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.28);
  --shadow-lg: 0 18px 50px -12px rgba(0,0,0,.6);
  --shadow-gold: 0 8px 26px -8px rgba(255,202,57,.45);
  --ease: cubic-bezier(.22,.7,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --sidebar-w: 244px;
}
[data-theme="light"] {
  --bg: #f5f5f4; --bg-1: #fff; --bg-2: #fff; --bg-3: #efeeec;
  --panel: #ffffff; --border: #e4e2de; --border-soft: #efeeec;
  --text: #1a1a1a; --text-dim: #5c5b57; --text-faint: #93918b;
  --accent: #ffca39; --accent-ink: #1a1a1a;
  --accent-soft: #fdf3d6; --shadow: 0 6px 24px rgba(30,28,20,.08);
  --green-soft:#e6f7ef; --amber-soft:#fdefdc; --red-soft:#fdeaea; --violet:#a9862f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.ico { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.stat .k .ico { width: 16px; height: 16px; }
.list-row .ic .ico { width: 18px; height: 18px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout ---------- */
#app { display: flex; height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-1);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 14px 12px; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 8px; background: var(--bg-3);
  display: grid; place-items: center; flex-shrink: 0;
}
.brand .logo svg { width: 20px; height: 20px; }
.brand b { font-size: 16px; letter-spacing: -.02em; }
.brand span { color: var(--text-faint); font-size: 11px; display: block; margin-top: -3px; }

.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--radius-sm); color: var(--text-dim); cursor: pointer;
  font-weight: 500; border: none; background: none; width: 100%; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px;
  font-weight: 700; padding: 1px 7px; border-radius: 10px;
}
.nav-spacer { flex: 1; }
.nav-foot { border-top: 1px solid var(--border-soft); padding-top: 8px; }
.userchip { display: flex; align-items: center; gap: 9px; padding: 8px 10px; font-size: 13px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--bg-3);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--accent);
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 58px; flex-shrink: 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--bg-1);
}
.topbar h1 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 11px;
}
.search input { flex: 1; background: none; border: none; outline: none; }
.search .kbd { color: var(--text-faint); font-size: 11px; border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; }
.content { flex: 1; overflow-y: auto; padding: 22px; }
.content.narrow { max-width: 1180px; margin: 0 auto; width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); cursor: pointer; font-weight: 550;
  transition: background .12s, border-color .12s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--bg-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.stat .k { font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 30px; font-weight: 720; letter-spacing: -.02em; margin-top: 6px; }
.stat .v small { font-size: 13px; color: var(--text-faint); font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green);} .dot.amber{background:var(--amber);} .dot.red{background:var(--red);}
.dot.blue{background:var(--accent);} .dot.violet{background:var(--violet);}

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 650; margin: 4px 0 2px; }

/* ---------- Vehicle list ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-1); color: var(--text-dim); cursor: pointer; font-size: 13px; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

.vgrid { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.vcard {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color .12s, transform .08s;
}
.vcard:hover { border-color: var(--accent); transform: translateY(-2px); }
.vcard .thumb {
  height: 128px; background: var(--bg-3); position: relative; display: grid; place-items: center;
  background-size: cover; background-position: center;
}
.vcard .thumb .ph { font-size: 34px; opacity: .25; }
.vcard .badge-cat {
  position: absolute; top: 9px; left: 9px; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 6px; backdrop-filter: blur(4px);
}
.vcard .stato-pill { position: absolute; top: 9px; right: 9px; }
.vcard .soglia-tri {
  position: absolute; bottom: 9px; left: 9px; z-index: 3; color: #1a1a1a;
  font-size: 11.5px; font-weight: 800; padding: 3px 8px 3px 7px; border-radius: 7px;
  box-shadow: 0 2px 7px rgba(0,0,0,.35); display: inline-flex; align-items: center; gap: 4px;
}
.vcard .body { padding: 12px 13px; }
.vcard .name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.vcard .plate {
  display: inline-block; margin-top: 5px; font-family: ui-monospace, monospace;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 7px; font-size: 12.5px; letter-spacing: .04em;
}
.vcard .meta { color: var(--text-dim); font-size: 12.5px; margin-top: 8px; display: flex;
  justify-content: space-between; }
.tagrow { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--bg-3);
  color: var(--text-dim); border: 1px solid var(--border-soft); }

.pill { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.pill.disponibile { background: var(--green-soft); color: var(--green); }
.pill.manutenzione { background: var(--amber-soft); color: var(--amber); }
.pill.fuori_servizio { background: var(--red-soft); color: var(--red); }

/* ---------- Vehicle detail ---------- */
.vhead { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.vhead .photo {
  width: 210px; height: 150px; border-radius: var(--radius); background: var(--bg-3);
  background-size: cover; background-position: center; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--border);
}
.vhead .info { flex: 1; min-width: 240px; }
.vhead h1 { font-size: 26px; letter-spacing: -.02em; }
.vhead .sub { color: var(--text-dim); margin-top: 3px; }
.vhead .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
  overflow-x: auto; }
.tab { padding: 10px 14px; cursor: pointer; color: var(--text-dim); border-bottom: 2px solid transparent;
  white-space: nowrap; font-weight: 550; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px;
  background: var(--border-soft); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kv .row { background: var(--panel); padding: 12px 14px; }
.kv .row .l { font-size: 12px; color: var(--text-faint); }
.kv .row .v { font-weight: 550; margin-top: 2px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px 0; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.tl-item .t { font-weight: 600; }
.tl-item .d { color: var(--text-faint); font-size: 12px; }

.list-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 9px;
}
.list-row .ic { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-3);
  display: grid; place-items: center; flex-shrink: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { color: var(--text-dim); font-size: 13px; }
.list-row .r { text-align: right; color: var(--text-dim); font-size: 13px; white-space: nowrap; }

/* alert severity accents */
.sev-scaduto { border-left: 3px solid var(--red); }
.sev-critico { border-left: 3px solid var(--amber); }
.sev-avviso  { border-left: 3px solid var(--accent); }
.badge-days { font-weight: 700; }
.badge-days.scaduto { color: var(--red); } .badge-days.critico{color:var(--amber);} .badge-days.avviso{color:var(--accent);}

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 5px; font-weight: 550; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; outline: none; transition: border-color .12s;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 72px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-grid.full { grid-template-columns: 1fr; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(4,6,10,.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 60;
  overflow-y: auto;
}
.modal {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 640px; box-shadow: var(--shadow); animation: pop .16s ease;
}
.modal.wide { max-width: 860px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .mhead { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal .mhead h2 { font-size: 17px; }
.modal .mbody { padding: 20px; }
.modal .mfoot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex;
  justify-content: flex-end; gap: 10px; }

/* ---------- Segmented (create modes) ---------- */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.seg {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 14px; text-align: center;
  cursor: pointer; background: var(--bg-1); transition: border-color .12s, background .12s;
}
.seg:hover { border-color: var(--accent); }
.seg.active { border-color: var(--accent); background: var(--accent-soft); }
.seg .big { font-size: 26px; }
.seg .lab { font-weight: 600; margin-top: 6px; }
.seg .desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* ---------- Login ---------- */
.login-wrap { display: grid; place-items: center; height: 100vh; width: 100vw; }
.login-card { width: 340px; }
.login-card .brand { justify-content: center; padding-bottom: 22px; }
/* logo adattivo al tema */
.lm-dark, .lm-light { display: inline-block; vertical-align: middle; }
[data-theme="dark"] .lm-light { display: none; }
[data-theme="light"] .lm-dark { display: none; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--text-faint); padding: 50px 20px; }
.empty .big { font-size: 40px; opacity: .3; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column;
  gap: 8px; z-index: 90; }
.toast { background: var(--bg-3); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow); animation: pop .15s; min-width: 220px; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.conf-badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.conf-hi { background: var(--green-soft); color: var(--green); }
.conf-lo { background: var(--amber-soft); color: var(--amber); }
.mobile-nav { display: none; }

/* ---------- Responsive / mobile-first ---------- */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .sidebar { display: none; }
  .main { padding-bottom: 62px; }
  .topbar { padding: 0 14px; height: 54px; }
  .topbar h1 { display: none; }
  .content { padding: 14px; }
  .vhead .photo { width: 100%; height: 190px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
    background: var(--bg-1); border-top: 1px solid var(--border); z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav button {
    flex: 1; background: none; border: none; color: var(--text-faint); display: flex;
    flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; cursor: pointer;
  }
  .mobile-nav button.active { color: var(--accent); }
  .mobile-nav button .ico { width: 21px; height: 21px; }
  .fab {
    position: fixed; right: 16px; bottom: 74px; width: 54px; height: 54px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); border: none; font-size: 26px; box-shadow: var(--shadow);
    z-index: 55; display: grid; place-items: center; cursor: pointer;
  }
  .segmented { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .btn { padding: 10px 15px; }
}
@media (min-width: 861px) { .fab { display: none; } }

/* ==========================================================================
   POLISH LAYER — micro-interazioni, profondità, animazioni (senior pass)
   ========================================================================== */

/* --- motion base & accessibilità --- */
* { transition-timing-function: var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .chip:focus-visible { outline-offset: 3px; }

/* --- entrata a comparsa con stagger --- */
@keyframes fvIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.vgrid > *, .stats > *, #tabbody .list-row, #tabbody .card, .timeline .tl-item {
  animation: fvIn .45s var(--ease) both;
}
.vgrid > *:nth-child(1){animation-delay:.02s} .vgrid > *:nth-child(2){animation-delay:.06s}
.vgrid > *:nth-child(3){animation-delay:.10s} .vgrid > *:nth-child(4){animation-delay:.14s}
.vgrid > *:nth-child(5){animation-delay:.18s} .vgrid > *:nth-child(6){animation-delay:.22s}
.vgrid > *:nth-child(7){animation-delay:.26s} .vgrid > *:nth-child(8){animation-delay:.30s}
.stats > *:nth-child(2){animation-delay:.05s} .stats > *:nth-child(3){animation-delay:.10s}
.stats > *:nth-child(4){animation-delay:.15s} .stats > *:nth-child(5){animation-delay:.20s}
#tabbody { animation: fvIn .35s var(--ease) both; }

/* --- Buttons: gradiente, profondità, pressione --- */
.btn { border-radius: 10px; transition: background .16s var(--ease), border-color .16s var(--ease),
  transform .12s var(--ease), box-shadow .16s var(--ease), color .16s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  background: linear-gradient(180deg, #ffd45c, var(--accent));
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, var(--shadow-sm);
}
.btn.primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, var(--shadow-gold); filter: none; }
.btn.sm { border-radius: 8px; }

/* --- Card generica: profondità morbida + hover --- */
.card { box-shadow: var(--shadow-sm); transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }

/* --- Vehicle cards: hero, scrim, hover cinematografico --- */
.vcard { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease); }
.vcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.vcard .thumb { transition: filter .25s var(--ease); }
.vcard .thumb::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.45), rgba(0,0,0,0) 55%); pointer-events: none; }
.vcard:hover .thumb { filter: brightness(1.06) saturate(1.05); }
.vcard .badge-cat { background: rgba(10,10,12,.6); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(6px); font-weight: 600; letter-spacing: .01em; }
.vcard .name { transition: color .16s; }
.vcard:hover .name { color: var(--accent); }
.vcard .plate { box-shadow: var(--shadow-sm); }
[data-theme="light"] .vcard .badge-cat { color: #fff; }

/* --- Stat cards: gradiente sottile, barra accento, numeri vivi --- */
.stat { position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: 0; transition: opacity .2s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat:hover::before { opacity: 1; }
.stat .v { background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 68%, transparent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .v[data-count] { font-variant-numeric: tabular-nums; }

/* --- Pills & dots: rifiniture + pulsazione per criticità --- */
.pill { border: 1px solid transparent; box-shadow: var(--shadow-sm); backdrop-filter: blur(3px); }
.pill.disponibile { border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.pill.manutenzione { border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.pill.fuori_servizio { border-color: color-mix(in srgb, var(--red) 30%, transparent); }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,.5); } 50% { box-shadow: 0 0 0 5px rgba(248,113,113,0); } }
.dot.red { animation: pulseDot 1.8s infinite; }

/* --- Alert / list rows: accenti e hover scorrevole --- */
.list-row { border-radius: 12px; transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s, background .16s; }
.list-row[data-vehicle]:hover, .list-row[style*="cursor:pointer"]:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); border-color: var(--accent); }
.list-row .ic { transition: transform .18s var(--ease-spring), background .18s; }
.list-row:hover .ic { transform: scale(1.08); }
.sev-scaduto { background: linear-gradient(90deg, color-mix(in srgb, var(--red) 8%, transparent), transparent 40%); }
.sev-critico { background: linear-gradient(90deg, color-mix(in srgb, var(--amber) 8%, transparent), transparent 40%); }
.badge-days { letter-spacing: .01em; }

/* --- Category bars: riempimento animato con gradiente --- */
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.catbar-fill { transform-origin: left; animation: barGrow .85s var(--ease) both;
  background: linear-gradient(90deg, var(--accent), #ffe08a) !important; box-shadow: 0 0 12px -2px rgba(255,202,57,.5); }

/* --- Tabs: hover morbido + sottolineatura --- */
.tab { transition: color .16s, border-color .2s var(--ease); position: relative; }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: center; transition: transform .25s var(--ease); }
.tab.active::after { transform: scaleX(1); }
.tab.active { border-bottom-color: transparent; }
.tabs { position: sticky; top: 0; background: var(--bg); z-index: 5; }

/* --- KV grid & detail hero --- */
.kv { box-shadow: var(--shadow-sm); }
.kv .row { transition: background .15s; }
.kv .row:hover { background: var(--bg-2); }
.vhead .photo { border-radius: var(--radius-lg); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.vhead .photo::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.35), transparent 60%); pointer-events: none; }
.vhead h1 { background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 70%, transparent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* --- Chips --- */
.chip { transition: all .15s var(--ease); }
.chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.chip.active { box-shadow: var(--shadow-sm); }

/* --- Segmented (crea veicolo) --- */
.seg { transition: transform .16s var(--ease), border-color .16s, background .16s, box-shadow .16s; }
.seg:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.seg .big { transition: transform .2s var(--ease-spring); display: inline-block; }
.seg:hover .big { transform: scale(1.12) translateY(-2px); }

/* --- Modal & overlay: entrata scenica --- */
.overlay { animation: fadeBg .2s var(--ease) both; }
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.modal { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: modalIn .28s var(--ease-spring) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.modal .mhead h2 { letter-spacing: -.01em; }

/* --- Sidebar nav: indicatore attivo --- */
.nav-item { position: relative; transition: background .14s, color .14s; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item:hover { transform: translateX(1px); }
.nav-item .ico { transition: transform .16s var(--ease-spring); }
.nav-item:hover .ico, .nav-item.active .ico { transform: scale(1.1); color: var(--accent); }

/* --- Topbar search focus --- */
.search { transition: border-color .16s, box-shadow .16s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* --- FAB pulse-ready --- */
.fab { transition: transform .18s var(--ease-spring), box-shadow .18s; box-shadow: var(--shadow-gold), var(--shadow-sm); }
.fab:hover { transform: scale(1.08) rotate(90deg); }
.fab:active { transform: scale(.96); }

/* --- Toast: slide-in elegante --- */
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: none; } }
.toast { animation: toastIn .32s var(--ease-spring) both; border-radius: 12px; box-shadow: var(--shadow-lg);
  transition: opacity .3s, transform .3s; }

/* --- Skeleton shimmer (per i caricamenti) --- */
.skel { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 10px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px,1fr)); gap: 14px; }
.skel-card { height: 210px; }

/* --- Empty state con vita --- */
.empty .big { animation: floaty 3.5s ease-in-out infinite; display: inline-block; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* --- Scrollbar più fine --- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

/* --- Timeline: pallino con glow --- */
.tl-item::before { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); transition: box-shadow .2s; }
.tl-item:hover::before { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }

/* --- Riduci il salto della sidebar su hover per non spostare testo --- */
.nav-item span { transition: none; }

/* ==========================================================================
   MANUTENZIONE — calendario, badge stato, toggle switch, impostazioni
   ========================================================================== */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head > div { text-align: center; font-size: 11px; font-weight: 650; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 84px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; transition: border-color .15s var(--ease), background .15s, transform .12s var(--ease); }
.cal-cell:hover { border-color: var(--accent); transform: translateY(-2px); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.empty:hover { transform: none; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-size: 12px; font-weight: 650; color: var(--text-dim); }
.cal-cell.today .cal-num { color: var(--accent); }
.cal-ord { font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.cal-ord.programmata { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.cal-ord.in_corso { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.cal-ord.completata { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.cal-ord:hover { filter: brightness(1.15); }
.cal-more { font-size: 10px; color: var(--text-faint); padding-left: 4px; }
@media (max-width: 860px) { .cal-cell { min-height: 62px; } .cal-ord { font-size: 9px; padding: 1px 4px; } }

/* badge stato manutenzione */
.man-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-left: 6px;
  vertical-align: middle; text-transform: uppercase; letter-spacing: .03em; }
.man-badge.programmata { background: var(--accent-soft); color: var(--accent); }
.man-badge.in_corso { background: var(--amber-soft); color: var(--amber); animation: pulseSoft 2s infinite; }
@keyframes pulseSoft { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
.man-card.in_corso { border-left: 3px solid var(--amber); }
.man-card.programmata { border-left: 3px solid var(--accent); }

/* toggle switch iOS-like */
.setrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.setrow:first-of-type { border-top: none; }
.setrow .t { font-weight: 550; }
.setrow .s { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 26px; cursor: pointer; transition: background .2s var(--ease); }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform .22s var(--ease-spring); box-shadow: var(--shadow-sm); }
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* --- Tabella statistiche flotta --- */
.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table thead th { position: sticky; top: 0; background: var(--bg-2);
  text-align: left; font-weight: 650; color: var(--text-faint); font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.stat-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.stat-table td.num, .stat-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stat-table tbody tr { transition: background .1s; }
.stat-table tbody tr:hover { background: var(--accent-soft); }
.stat-table tbody tr:last-child td { border-bottom: none; }

/* --- Transizione morbida al cambio vista + nav più reattiva --- */
.content.view-in { animation: viewIn .26s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.nav-item { transition: background .16s var(--ease), color .16s var(--ease), transform .08s var(--ease); }
.nav-item:active { transform: scale(.97); }
.mobile-nav button { transition: color .16s var(--ease), transform .08s var(--ease); }
.mobile-nav button:active { transform: scale(.9); }
@media (prefers-reduced-motion: reduce) {
  .content.view-in { animation: none; }
}

/* --- Card statistiche cliccabili (dashboard) --- */
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg, var(--shadow)); }
.stat.clickable:active { transform: translateY(0) scale(.99); }
.stat.clickable::after { content: "↗"; position: absolute; top: 10px; right: 12px; color: var(--text-faint);
  opacity: 0; transition: opacity .16s var(--ease); font-size: 13px; }
.stat.clickable:hover::after { opacity: .8; }

/* --- Scheda completamento anagrafica --- */
.comp-card { border: 1px solid var(--border); }
.comp-ring { width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--col) calc(var(--pct) * 1%), var(--bg-3) 0); position: relative; }
.comp-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-1); }
.comp-ring span { position: relative; font-weight: 700; font-size: 13px; }
.miss-chip { display: inline-block; background: var(--amber-soft); color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 34%, transparent); border-radius: 20px;
  padding: 3px 10px; font-size: 12.5px; }

/* --- Dropzone (trascina file) --- */
.dragzone { transition: border-color .15s var(--ease), background .15s var(--ease); }
.dragzone.dragging { border-color: var(--accent) !important; background: var(--accent-soft); }
