:root {
  --bg: #f3f5f8; --surface: #fff; --ink: #0f1b2d; --muted: #64748b; --line: #e4e8ee;
  --navy: #0f1b2d; --navy-2: #172640; --accent: #10b5a0; --accent-d: #0b8f7e;
  --ok: #22c55e; --warn: #f97316; --check: #facc15; --crit: #ef4444; --off: #94a3b8;
  --radius: 3px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45; }
a { color: var(--accent-d); text-decoration: none; }
a:hover { text-decoration: underline; }

/* layout */
.side { position: fixed; inset: 0 auto 0 0; width: 210px; overflow-y: auto; background: var(--navy); color: #cbd5e1;
  display: flex; flex-direction: column; padding: 18px 12px; }
.brand { color: #fff; font-size: 1.35rem; font-weight: 300; padding: 4px 10px 18px; letter-spacing: .5px; }
.brand b { color: var(--accent); font-weight: 700; }
.brand:hover { text-decoration: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: #cbd5e1; padding: 8px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: var(--navy-2); text-decoration: none; }
.side nav a.on { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.badge { background: var(--crit); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; font-weight: 600; }
.side-foot { padding: 10px; font-size: .82rem; color: #8193ad; border-top: 1px solid var(--navy-2); }
.side-foot button { background: none; border: 0; color: #8193ad; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
main { margin-left: 210px; padding: 26px 32px 60px; max-width: 1180px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 1.5rem; font-weight: 650; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .9em; }

/* componenti */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.cols { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; border-left: 4px solid var(--off); }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.ok { border-left-color: var(--ok); } .stat.warn { border-left-color: var(--warn); } .stat.check { border-left-color: var(--check); }
.stat.crit { border-left-color: var(--crit); } .stat.off { border-left-color: var(--off); }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--off); border-radius: var(--radius);
  padding: 14px 16px; color: inherit; display: block; }
.vcard:hover { text-decoration: none; box-shadow: 0 2px 10px rgba(15,27,45,.08); }
.vcard.ok { border-left-color: var(--ok); } .vcard.warn { border-left-color: var(--warn); } .vcard.check { border-left-color: var(--check); }
.vcard.crit { border-left-color: var(--crit); } .vcard.off { border-left-color: var(--off); background: #f8fafc; }
.vcard .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vcard .code { font-size: 1.15rem; font-weight: 700; }
.vcard .meta { color: var(--muted); font-size: .88rem; margin-top: 2px; display: flex; justify-content: space-between; }
.vcard .why { margin-top: 8px; font-size: .82rem; color: #475569; }
.vcard .why div::before { content: "•"; margin-right: 6px; color: var(--off); }

.pill { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .6px; padding: 3px 9px; border-radius: 99px; background: #e2e8f0; color: #475569; }
.pill.ok { background: #dcfce7; color: #15803d; } .pill.warn { background: #ffedd5; color: #c2410c; } .pill.check { background: #fef9c3; color: #854d0e; }
.pill.crit { background: #fee2e2; color: #b91c1c; } .pill.off { background: #e2e8f0; color: #64748b; }
/* AdBlue = blu; carburante = giallo scuro (diverso da «attenzione», giallo chiaro, e da guasto, rosso).
   Tinto = livello grave/in avvertenza; pieno (.urgent) = gravissimo/critico */
.pill.adblue { background: #dbeafe; color: #1d4ed8; box-shadow: inset 0 0 0 1px #93c5fd; }
.pill.adblue.urgent { background: #1d4ed8; color: #fff; box-shadow: none; }
.pill.fuel { background: #f3d36b; color: #5f3d00; box-shadow: inset 0 0 0 1px #b8860b; }
.pill.fuel.urgent { background: #a16207; color: #fff; box-shadow: none; }
.dot.adblue { background: #1d4ed8; }
.grp-adblue { color: #1d4ed8; } .grp-fuel { color: #8a5a00; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { opacity: .55; }
.tablewrap { overflow-x: auto; }

.bar { height: 7px; background: #e8ecf1; border-radius: 99px; overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.warn i { background: var(--warn); } .bar.check i { background: var(--check); } .bar.crit i { background: var(--crit); }

/* form */
label { display: block; font-size: .82rem; font-weight: 600; color: #334155; margin-bottom: 4px; }
input, select { width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid rgba(16,181,160,.35); border-color: var(--accent); }
.field { margin-bottom: 14px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.form { max-width: 520px; }
.wideform { max-width: 1100px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; align-items: start; }
.fgrid .full { grid-column: 1 / -1; }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline .field { margin: 0; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--accent-d); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #cbd5e1; }
.btn.ghost:hover { background: #f1f5f9; }
.btn.danger { background: #fff; color: #b91c1c; border: 1px solid #fecaca; }
.btn.sm { padding: 5px 11px; font-size: .85rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: #ecfdf9; border: 1px dashed var(--accent); color: var(--accent-d); border-radius: 99px; padding: 3px 11px; font-size: .8rem; cursor: pointer; font-family: ui-monospace, Consolas, monospace; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; }
.flash.ok { background: #dcfce7; color: #166534; } .flash.err { background: #fee2e2; color: #991b1b; } .flash.warn { background: #ffedd5; color: #9a3412; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.chart { margin-bottom: 14px; }
.chart svg { width: 100%; height: 90px; background: #f8fafc; border-radius: 8px; }
.chart polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.chart .lbl { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--navy); }
.auth .box { background: #fff; border-radius: 14px; padding: 30px; width: 100%; max-width: 380px; }
.auth .brand { color: var(--ink); padding: 0 0 14px; font-size: 1.6rem; display: block; }

@media (max-width: 900px) {
  .side { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 6px; }
  .brand { padding: 0 10px; } .side nav { flex-direction: row; flex-wrap: wrap; } .navlabel { display: none; }
  .side-foot { width: 100%; border-top: 0; padding: 4px 10px; }
  main { margin-left: 0; padding: 18px 14px 50px; }
  .cols, .g2, .g3 { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .side, .no-print, .btn, form.filters { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; } body { background: #fff; }
  .card { border: 0; padding: 0; }
}
/* 1.10.17: riga visibile solo in stampa/PDF (opposto di .no-print) */
.print-only { display: none; }
@media print { .print-only { display: block; } }
.authline { margin-top: 10px; font-size: 8.5pt; color: #555; text-align: left; }
h2 .pill { margin-left: 8px; vertical-align: 2px; }

/* menu: sezioni, piè di pagina con sviluppatore */
.navlabel { font-size: .68rem; letter-spacing: .8px; text-transform: uppercase; color: #6f819c; padding: 16px 10px 4px; }
.navlabel small { text-transform: none; letter-spacing: 0; opacity: .85; }
.side-foot .co { color: #b6c3d6; margin-bottom: 4px; }
.side-foot a { color: #9fb0c8; }
.dev { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--navy-2); font-size: .74rem; line-height: 1.55; color: #7d8fa9; }
.dev b { color: #cbd5e1; }

/* interruttore Schede / Riquadri */
.seg { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: 6px 15px; color: var(--ink); font-size: .88rem; }
.seg a:hover { background: #eef2f6; text-decoration: none; }
.seg a.on, .seg a.on:hover { background: var(--navy); color: #fff; }

/* dashboard a riquadri */
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.totals .card { margin-bottom: 14px; }
.tstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tstats b { display: block; font-size: 1.45rem; line-height: 1.15; }
.tstats span { color: var(--muted); font-size: .8rem; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: .88rem; margin: 4px 0 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--off); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.check { background: var(--check); } .dot.crit { background: var(--crit); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 160px; padding: 14px 16px;
  border-radius: 12px; border: 2px solid #aeb9c7; background: #eef1f5; color: var(--ink); transition: transform .12s, box-shadow .12s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,27,45,.14); }
.tile.ok { background: #e7f8ee; border-color: var(--ok); }
.tile.warn { background: #fff1e6; border-color: var(--warn); }
.tile.check { background: #fffbe0; border-color: var(--check); }
.tile.crit { background: #fde8e8; border-color: var(--crit); }
.tile.off { background: #eef1f5; border-color: #aeb9c7; }
.tile .plate { font-size: 1.4rem; font-weight: 800; letter-spacing: 1px; line-height: 1.15; }
.tile .tcode { font-size: .82rem; color: var(--muted); }
.tile .tdrv { display: flex; flex-direction: column; font-size: .78rem; line-height: 1.35; }
.tile .tdrv b { font-size: 1.02rem; }
.tile .tfoot { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: #475569; }
.tile .tnote { font-size: .76rem; color: #64748b; margin-top: -4px; }
@media (max-width: 900px) { .totals { grid-template-columns: 1fr; } .tstats { grid-template-columns: repeat(2, 1fr); } }
.tile .tfoot span:last-child { white-space: nowrap; }

/* ---------------- Officina (schermo intero) ---------------- */
body.kiosk { min-height: 100vh; display: flex; flex-direction: column; }
.khead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 22px;
  background: var(--navy); color: #fff; flex-wrap: wrap; }
.khead h1 { color: #fff; font-size: 1.35rem; }
.khead .kl, .khead .kr { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.kbrand { color: #fff; font-size: 1.3rem; font-weight: 300; letter-spacing: .5px; }
.kbrand b { color: var(--accent); }
.kbrand:hover { text-decoration: none; }
.clock { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4ch; }
.khead .btn.ghost { background: transparent; color: #fff; border-color: #3b4f70; }
.khead .btn.ghost:hover { background: var(--navy-2); }
.khead .btn:not(.ghost) { background: var(--accent); }
.kcounts { display: flex; gap: 14px; font-size: 1.1rem; font-weight: 700; }
.kcounts .dot { width: 14px; height: 14px; }
.kflash { margin: 12px 22px 0; }
.kmain { flex: 1; margin-left: 0; max-width: none; padding: 10px 12px 12px; display: flex; flex-direction: column; }

.kgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); grid-auto-rows: 104px; align-content: start; }
.ktile { display: flex; flex-direction: column; justify-content: space-between; gap: 3px; padding: 7px 10px 6px;
  border-radius: 10px; border: 2px solid transparent; color: #fff; transition: transform .12s, box-shadow .12s; overflow: hidden; }
.ktile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,27,45,.28); }
.ktile.crit { background: #dc2626; border-color: #991b1b; }
.ktile.warn { background: #f97316; border-color: #9a3412; color: #1a0a00; }
.ktile.check { background: #facc15; border-color: #a16207; color: #1f1300; }
.ktile.ok { background: #16a34a; border-color: #166534; }
.ktile.off { background: #cbd5e1; border-color: #94a3b8; color: #1e293b; }
.ktop { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kplate { font-size: 1.15rem; font-weight: 800; letter-spacing: .5px; line-height: 1.1; }
.kcode { font-size: .72rem; opacity: .8; line-height: 1.1; }
.ktile .pill { font-size: .62rem; padding: 2px 7px; background: rgba(255,255,255,.28); color: inherit; border: 1px solid rgba(255,255,255,.55); }
.ktile.warn .pill, .ktile.check .pill, .ktile.off .pill { background: rgba(0,0,0,.08); border-color: rgba(0,0,0,.25); }
.kprob { font-size: .78rem; line-height: 1.2; font-weight: 600; overflow: hidden; }
.kprob > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kprob .more, .kprob .ok-line { font-weight: 500; opacity: .85; }
.kinfo { display: flex; justify-content: space-between; gap: 6px; font-size: .68rem; opacity: .85; white-space: nowrap; overflow: hidden; }

.kdetail { display: flex; flex-direction: column; gap: 4px; max-width: 1500px; width: 100%; margin: 0 auto; }
.kstrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kstrip > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.kstrip span { display: block; color: var(--muted); font-size: .82rem; }
.kstrip b { font-size: 1.45rem; }
.kactions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.abtn { border: 0; border-radius: 14px; padding: 22px 16px; font: inherit; font-size: 1.25rem; font-weight: 700; color: #fff;
  cursor: pointer; background: var(--navy); }
.abtn:hover { filter: brightness(1.12); }
.abtn.olio { background: #b45309; } .abtn.gomme { background: #1d4ed8; }
.abtn.freni { background: #7c3aed; } .abtn.risolto { background: var(--accent-d); }
.lockbox { background: #fff; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 16px 20px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.kcols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.erow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.erow:last-child { border-bottom: 0; }

dialog.kdlg { border: 0; border-radius: 16px; padding: 24px 26px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(15,27,45,.35); }
dialog.kdlg::backdrop { background: rgba(15,27,45,.55); }
dialog.kdlg h2 { font-size: 1.25rem; margin-bottom: 10px; }
.pickgrid { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.pick { margin: 0; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick span { display: inline-block; padding: 9px 14px; border: 1px solid #cbd5e1; border-radius: 99px; font-size: .95rem; font-weight: 500; background: #fff; }
.pick input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick input:focus-visible + span { outline: 2px solid var(--accent-d); }
.dlgbtns { display: flex; gap: 10px; margin-top: 8px; }
/* chi registra: meccanico + password in un riquadro compatto, con la password in un campo corto */
.signbox { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px; }
.signbox .field { margin: 0; }
.signbox .sel { flex: 1 1 170px; min-width: 150px; }
.signbox .pw { flex: 0 0 auto; }
.signbox label { font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.field input.pwshort, .signbox input.pwshort { width: 11ch; max-width: 100%; text-align: center; letter-spacing: .25em; font-size: 1.1rem; }
.field input.pwshort::placeholder { letter-spacing: .2em; color: #b6c0cd; }
@media (max-width: 900px) { .kcols { grid-template-columns: 1fr; } .kgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

td .small { overflow-wrap: anywhere; }
.ktotals { display: flex; gap: 18px; font-size: .85rem; color: #cbd5e1; flex-wrap: wrap; }
.ktotals b { color: #fff; }
.kgrid.tall { grid-auto-rows: 124px; }
/* carburante basso / quasi finito (solo Riquadri): rosa, con il bordo del colore di stato */
.ktile.fuel { background: #f472b6; color: #3b0a24; }
.ktile.fuel.crit { border-color: #991b1b; } .ktile.fuel.warn { border-color: #b45309; }
.ktile.fuel.ok { border-color: #166534; } .ktile.fuel.off { border-color: #94a3b8; }
.ktile.fuel .pill { background: rgba(255,255,255,.45); border-color: rgba(0,0,0,.2); }
.dot.fuel { background: #f472b6; }

/* ---------------- Backup (Impostazioni) ---------------- */
.bkstatus { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.bkstatus > div { flex: 1; min-width: 180px; }
.bkerr { color: #b91c1c; font-weight: 600; }
.pick-line { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.pick-line input { width: auto; }
.bkactions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.devbox { margin-top: 16px; padding: 14px 18px; border: 2px solid var(--accent); border-radius: 12px; background: #f0fdfa; }
.devbox ol { line-height: 1.8; }
.devcode { font-size: 1.4rem; font-weight: 800; letter-spacing: 3px; font-family: monospace; background: #fff; border: 1px solid var(--line); padding: 2px 10px; border-radius: 8px; }

/* ---------------- Stile di guida ---------------- */
.score { display: inline-block; min-width: 44px; padding: 3px 10px; border-radius: 99px; font-weight: 800; text-align: center; color: #fff; }
.score.good { background: #16a34a; } .score.mid { background: #f5b301; color: #1f1300; } .score.bad { background: #dc2626; }

/* menu a gruppi con sottomenu */
.side nav details.grp { border-bottom: 1px solid var(--navy-2); padding: 2px 0 6px; }
.side nav details.grp > summary { list-style: none; cursor: pointer; font-size: .68rem; letter-spacing: .8px; text-transform: uppercase;
  color: #8ea0ba; padding: 12px 10px 6px; display: flex; justify-content: space-between; user-select: none; }
.side nav details.grp > summary::-webkit-details-marker { display: none; }
.side nav details.grp > summary::after { content: "▸"; transition: transform .15s; }
.side nav details.grp[open] > summary::after { transform: rotate(90deg); }
.grpbody { display: flex; flex-direction: column; gap: 2px; }
.side nav .sub { display: flex; flex-direction: column; margin: 0 0 4px 14px; border-left: 1px solid var(--navy-2); }
.side nav .sub a { padding: 5px 10px; font-size: .86rem; border-radius: 6px; color: #aebbd0; }
.side nav .sub a.on { color: #fff; background: transparent; box-shadow: none; font-weight: 600; }
.side nav .dis { padding: 8px 10px; color: #5b6b84; display: flex; justify-content: space-between; cursor: not-allowed; }
.side nav .dis .lock { font-style: normal; font-size: .7rem; opacity: .7; }
.side-foot .btn.sm { display: inline-block; margin-bottom: 6px; color: #fff; }
.set-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* Dashboard (riquadri nel layout normale, con menu laterale) */
.dsum { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.dcounts { display: flex; gap: 18px; flex-wrap: wrap; font-size: .92rem; }
.dcounts b { font-size: 1.05rem; margin-right: 3px; }
.dtot { font-size: .86rem; } .dtot b { color: var(--ink); }
main .kgrid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }

/* Dashboard: riquadri compatti (colore fisso) con indicatori digitali; la situazione è solo nel semaforo */
main.wide { max-width: none; }
.dgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 142px; }
.dtile { display: flex; flex-direction: column; justify-content: space-between; gap: 3px; padding: 8px 8px 7px; border-radius: 10px;
  background: #fff; border: 1px solid #cdd6e2; box-shadow: 0 1px 2px rgba(15,27,45,.06); color: var(--ink); overflow: hidden; }
.dtile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,27,45,.18); border-color: #94a3b8; }
.dplate { font-size: 1.2rem; font-weight: 800; letter-spacing: .5px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgauges { display: flex; flex-direction: column; gap: 3px; }
.gauge { display: flex; align-items: center; gap: 5px; background: #0f1b2d; border-radius: 5px; padding: 2px 6px; color: #cbd5e1;
  font-size: .62rem; font-weight: 700; letter-spacing: .3px; }
.gauge .gl { width: 41px; text-transform: uppercase; opacity: .9; }
.gauge .gs { flex: 1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.gauge .gs i { height: 8px; border-radius: 1px; background: #2a3b58; }
.gauge.ok .gs i.on { background: #22c55e; box-shadow: 0 0 4px #22c55e99; }
.gauge.warn .gs i.on { background: #f97316; box-shadow: 0 0 4px #f9731699; }
.gauge.crit .gs i.on { background: #ef4444; box-shadow: 0 0 5px #ef4444cc; }
.gauge.blue.ok .gs i.on { background: #38bdf8; box-shadow: 0 0 4px #38bdf899; }
.gauge .gv { width: 28px; text-align: right; color: #fff; font-size: .72rem; }
.ddrv { font-size: .74rem; font-weight: 600; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbot { display: flex; justify-content: space-between; align-items: flex-end; }
.dkm { font-size: .72rem; color: #475569; } .dkm b { font-size: .95rem; color: var(--ink); }
.tl { display: inline-flex; gap: 4px; background: #0f1b2d; padding: 4px 6px; border-radius: 99px; }
.tl i { width: 11px; height: 11px; border-radius: 50%; background: #2a3b58; }
.tl .r.on { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.tl .o.on { background: #f97316; box-shadow: 0 0 6px #f97316; }
.tl .y.on { background: #facc15; box-shadow: 0 0 6px #facc15; }
.tl .g.on { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.tl .o.blink, .dot.blink { animation: tlblink 1s steps(1, end) infinite; }
@keyframes tlblink { 50% { background: #2a3b58; box-shadow: none; } }
.dot.warn.blink { animation-name: dotblink; } @keyframes dotblink { 50% { opacity: .2; } }
.dcounts .dot { margin-right: 5px; }

/* menu laterale: contrasto alto (testo chiaro su blu notte, voce attiva ben evidente) */
.side { background: #0e1a2e; color: #e8eef8; }
.brand { color: #fff; }
.side nav a { color: #e8eef8; font-weight: 500; }
.side nav a:hover { background: #22395c; color: #fff; }
.side nav a.on { background: #234676; color: #fff; font-weight: 700; box-shadow: inset 4px 0 0 #2dd4bf; }
.side nav small, .side nav a small.muted { color: #9fb6d6; }
.side nav details.grp { border-bottom: 1px solid #2a4066; }
.side nav details.grp > summary { color: #a9c0e0; font-weight: 700; font-size: .72rem; letter-spacing: 1px; }
.side nav details.grp > summary:hover { color: #fff; }
.side nav .sub { border-left: 2px solid #35507c; }
.side nav .sub a { color: #d3e0f2; font-size: .88rem; }
.side nav .sub a:hover { background: #22395c; color: #fff; }
.side nav .sub a.on { color: #fff; background: #1c3a66; font-weight: 700; box-shadow: inset 3px 0 0 #2dd4bf; }
.side nav .dis { color: #8aa0c0; }
.side-foot { color: #c3d1e6; border-top: 1px solid #2a4066; }
.side-foot .co { color: #e8eef8; font-weight: 600; }
.side-foot a, .side-foot button { color: #d3e0f2; }
.side-foot .btn.sm { color: #04211e; background: #2dd4bf; }
.dev { color: #aebfd8; border-top: 1px solid #2a4066; }
.dev b { color: #e8eef8; }
.dev a { color: #d3e0f2; }
.badge { background: #ef4444; color: #fff; }

/* riquadri grigio-azzurro tenue (riposante), testo blu notte */
.dtile { background: #dfe6ef; border: 1px solid #b7c4d6; color: #1c2940; box-shadow: 0 1px 2px rgba(15,27,45,.08); }
.dtile:hover { border-color: #8196b3; box-shadow: 0 6px 16px rgba(15,27,45,.18); }
.ddrv { color: #2b3b55; }
.dkm { color: #34445e; line-height: 1.25; } .dkm b { color: #1c2940; }
.dupd { font-size: .68rem; color: #46587a; font-weight: 600; }
.gauge.na .gv { color: #8aa0c0; }

/* marchio FleetOBD: font Exo 2 ExtraBold Italic (SIL OFL, incluso nel programma: nessuna connessione a internet) */
@font-face { font-family: "Exo 2"; font-style: italic; font-weight: 800; font-display: swap; src: url("fonts/exo-2-latin-800-italic.woff2") format("woff2"); }
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-ico { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 2px 6px rgba(16,181,160,.45)); }
.logo-txt { font-family: "Exo 2", "Segoe UI", system-ui, sans-serif; font-style: italic; font-weight: 800; font-size: 1.95rem; line-height: 1;
  letter-spacing: .3px; color: #fff; }
.logo-txt b { color: #2dd4bf; font-weight: 800; }
.logo.sm .logo-ico { width: 26px; height: 26px; } .logo.sm .logo-txt { font-size: 1.45rem; }
.logo.lg .logo-ico { width: 46px; height: 46px; } .logo.lg .logo-txt { font-size: 2.4rem; }
.logo.dark .logo-txt { color: var(--ink); } .logo.dark .logo-txt b { color: #0b9c89; }
.side .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 2px 8px 16px; margin-bottom: 4px;
  border-bottom: 1px solid #2a4066; font-size: inherit; font-weight: inherit; }
.side .brand .tagline { font-size: .62rem; letter-spacing: 2.4px; text-transform: uppercase; color: #a9c0e0; font-weight: 600; padding-left: 48px; }
.auth .brand { padding: 0 0 18px; display: block; text-align: center; }
.auth .brand .logo { justify-content: center; }
.kbrand { display: inline-flex; align-items: center; }

/* Officina: i veicoli OK hanno un riquadro neutro (schermo meno carico); solo la sigla OK è verde.
   I riquadri gialli e rossi restano a colori pieni per far risaltare i problemi. */
.ktile.ok { background: #dfe6ef; border-color: #b7c4d6; color: #1c2940; }
.ktile.ok .pill { background: #16a34a; border-color: #15803d; color: #fff; }
.ktile.ok .kprob .ok-line, .ktile.ok .kinfo { color: #34445e; }

/* intestazioni dei gruppi nella tabella Avvisi */
tr.grp td { background: #f1f5f9; padding-top: 8px; padding-bottom: 8px; border-top: 2px solid #e2e8f0; }

/* livello dei messaggi WhatsApp (1 = primo avviso, 3 = ultimo) */
.pill.lvl { min-width: 22px; text-align: center; padding: 3px 8px; }
.pill.lvl1 { background: #dbeafe; color: #1d4ed8; } .pill.lvl2 { background: #fde68a; color: #92400e; } .pill.lvl3 { background: #dc2626; color: #fff; }
.btn.wa { background: #1fa855; color: #fff; border-color: #1fa855; } .btn.wa:hover { background: #17874a; }
.lvlpick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; }
textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; box-sizing: border-box; }

/* Dashboard: veicoli «appena arrivati» in cima, separati da una linea */
.dsep { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; font-size: .78rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #0e7f70; }
.dsep::after { content: ""; flex: 1; height: 2px; background: #10b5a0; border-radius: 2px; }
.dsep.rest { color: #64748b; margin-top: 18px; }
.dsep.rest::after { background: #94a3b8; }
.dtile.new { border: 2px solid #10b5a0; position: relative; overflow: visible; }
.dnew { position: absolute; top: -10px; left: 10px; z-index: 2; padding: 1px 8px; border-radius: 99px; background: #10b5a0; color: #fff; font-size: .62rem; font-weight: 800; letter-spacing: .5px; line-height: 1.6; box-shadow: 0 1px 3px rgba(15,27,45,.3); }

/* turno con badge non assegnato: link per registrare subito l'autista */
a.newdrv { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
a.newdrv:hover { text-decoration: none; }
a.newdrv:hover .newdrv-plus { background: #0e7f70; }
.newdrv-plus { background: #10b5a0; color: #fff; border-radius: 99px; padding: 0 8px; font-size: .72rem; font-weight: 700; line-height: 1.6; }

/* ---------- pneumatici ---------- */
.tywrap { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: center; }
.tydiag { width: 100%; max-width: 290px; height: auto; display: block; margin: 0 auto; }
.tydiag .tybody { fill: #e6ecf3; stroke: #94a3b8; stroke-width: 2; }
.tydiag .tycab { fill: #cfd8e3; }
.tydiag .tyaxle { stroke: #94a3b8; stroke-width: 4; stroke-linecap: round; }
.tydiag .tytxt { fill: #64748b; font: 700 9px system-ui, sans-serif; letter-spacing: 1.5px; }
.tydiag .tytxt.big { font-size: 13px; letter-spacing: 1px; fill: #475569; }
.tydiag .tyre .tybase { fill: #8795a8; stroke: #0f172a; stroke-width: 1.5; transition: fill .12s; }
.tydiag .tyre .tyfill { fill: #64748b; transition: height .3s, y .3s; }
.tydiag .tyre.ty-ok .tyfill { fill: #22a55b; }
.tydiag .tyre.ty-warn .tyfill { fill: #f97316; }
.tydiag .tyre.ty-crit .tyfill { fill: #dc2626; }
.tydiag .tyre.ty-crit .tybase { stroke: #dc2626; stroke-width: 2.5; }
.tydiag .tyre.ty-na .tybase { fill: #000; stroke: #000; }
.tydiag .tyre.ty-na .tytread { stroke: #262626; }
.tydiag .typct { fill: #fff; font: 800 9.5px system-ui, sans-serif; stroke: #0f172a; stroke-width: 2.4px; paint-order: stroke; stroke-linejoin: round; pointer-events: none; }
.typill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; color: #fff; background: #64748b; }
.typill.ty-ok { background: #22a55b; } .typill.ty-warn { background: #f97316; color: #fff; }
.typill.ty-crit { background: #dc2626; } .typill.ty-na { background: #000; }
.tylegend { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 2px; }
.tydiag .tytread { stroke: #6b7a8f; stroke-width: 2; fill: none; stroke-linecap: round; }
.tydiag .tycheck { stroke: #fff; stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; display: none; }
.tydiag.sel .tyre { cursor: pointer; outline: none; }
.tydiag.sel .tyre:hover .tybase, .tydiag.sel .tyre:focus .tybase { fill: #a3b0c2; stroke: #10b5a0; stroke-width: 3; }
.tydiag .tyre.on .tybase { fill: #10b5a0; stroke: #0b7f70; }
.tydiag .tyre.on .tyfill { opacity: .55; }
.tydiag .tyre.on .tytread { stroke: #0b7f70; }
.tydiag .tyre.on .tycheck { display: block; }
.tysel { display: grid; grid-template-columns: 290px 1fr; gap: 14px; align-items: center; margin: 6px 0 12px; }
.tybtns { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.tybtns .btn { text-align: center; }
.tycount { margin-top: 4px; min-height: 2.4em; }
@media (max-width: 720px) { .tywrap, .tysel { grid-template-columns: 1fr; } }
.tyuse td { background: #f0fdf9; }
.tycard td.num { white-space: nowrap; }

.oilbar { height: 8px; border-radius: 99px; background: #e2e8f0; overflow: hidden; margin-bottom: 3px; }
.oilbar i { display: block; height: 100%; background: #10b5a0; }
.oilbar.soon i { background: #f59e0b; }
.oilbar.over i { background: #ef4444; }
.oilneg { color: #b91c1c; }
.side-foot .who { color: #dbe4f0; margin-bottom: 8px; line-height: 1.3; }
.side-foot a.acct { display: block; text-align: center; color: #dbe4f0; border: 1px solid #2a3a57; border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; text-decoration: none; font-weight: 600; }
.side-foot a.acct:hover { background: #16243b; }
.auth .co { text-align: center; color: #64748b; font-size: .85rem; margin: 6px 0 14px; letter-spacing: .3px; }
.lockbox { border-left: 4px solid #f59e0b; }
.rolehelp { font-size: .82rem; color: var(--muted); margin-top: 4px; min-height: 1.2em; }

/* origine dei dati: ECU / STIMA */
.src{display:inline-block;font-size:10px;font-weight:700;letter-spacing:.04em;padding:1px 5px;border-radius:4px;vertical-align:middle;background:#e8eef5;color:#46607a;border:1px solid #d3dde8}
.src.est{background:#fff3d6;color:#8a5a00;border-color:#f0d9a0}
.gsrc{display:block;font-style:normal;font-size:8px;letter-spacing:.05em;color:#f0b429;line-height:1}
.pids{font-family:ui-monospace,Consolas,monospace;font-size:12px;word-break:break-word;background:#f4f6f9;border-radius:6px;padding:8px;margin-top:4px}
form.fe .field{margin-bottom:8px}

.auth .ver { text-align: center; color: #94a3b8; font-size: .78rem; margin: 14px 0 0; letter-spacing: .3px; }
.ver-inline { font-size: .72rem; font-weight: 600; color: #7fd6c6; opacity: .9; }

/* rapporto diagnostico DTC */
.dtcrep-head { display: flex; gap: 28px; flex-wrap: wrap; }
.dtcrep-head > div { min-width: 150px; }
.dtcrep-h { font-size: .9rem; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .4px; color: #475569; }
.dtcrep-ul { margin: 0; padding-left: 20px; }
.dtcrep-ul li { margin: 2px 0; }
@media print { .dtcrep-item { break-inside: avoid; border-bottom: 1px solid #cbd5e1; padding-bottom: 10px; margin-bottom: 10px; } }

/* turno aperto (Dashboard) */
.ddrv.shift { color: #0f7a4a; font-weight: 600; }
.ddrv.shift.long { color: #b45309; }
/* diagnosi in diretta */
.livebar { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.livebar > div { min-width: 120px; }
.livedot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #16a34a; margin-right: 6px; animation: livep 1.2s infinite; }
.livedot.off { background: #94a3b8; animation: none; }
@keyframes livep { 50% { opacity: .35; } }
.livepids td.mono { font-size: .85rem; }
.chip-live { background: #dc2626; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: .72rem; font-weight: 700; }

/* cruscotto live */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line, #cbd5e1); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; color: #334155; }
.seg button.on { background: #0f172a; color: #fff; }
.cluster { display: grid; grid-template-columns: 1fr 1.5fr 1.5fr 1fr; gap: 12px; align-items: center; background: #020617; border-radius: 16px; padding: 16px; }
.gwrap .gauge { width: 100%; height: auto; display: block; }
.gauge .needle { transform-origin: 100px 100px; transition: transform .9s cubic-bezier(.3,.7,.3,1); }
.telltales { display: flex; gap: 18px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.tt { display: flex; align-items: center; gap: 8px; color: #94a3b8; opacity: .45; font-weight: 600; }
.tt.on { color: #f59e0b; opacity: 1; animation: ttp 1s infinite; filter: drop-shadow(0 0 6px #f59e0b); }
.tt b { font-size: 1.4rem; color: #334155; }
@keyframes ttp { 50% { opacity: .55; } }
@media (max-width: 760px) { .cluster { grid-template-columns: 1fr 1fr; } .gwrap.big { grid-column: span 1; } }
@media (prefers-reduced-motion: reduce) { .gauge .needle { transition: none; } .tt.on { animation: none; } }
.gwrap, .gwrap .gauge { background: transparent !important; border: 0; box-shadow: none; padding: 0; }
.telltales { background: #020617; border-radius: 12px; padding: 10px 16px; margin-top: 10px; }
.tt b { color: #94a3b8; }

.othertitle { margin: 16px 0 8px; font-size: 1rem; }
.otherpids { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.opid { background: #0f172a; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.opid .on { color: #94a3b8; font-size: .78rem; line-height: 1.2; }
.opid b { color: #f8fafc; font-size: 1.25rem; }
.opid small { color: #94a3b8; font-weight: 500; font-size: .75rem; }

.ignbox { display: inline-block; margin-left: 6px; vertical-align: middle; }
.ignbox summary { list-style: none; cursor: pointer; display: inline-block; }
.ignbox summary::-webkit-details-marker { display: none; }
.ignbox form { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
form.inl { display: inline-block; margin-left: 6px; vertical-align: middle; }
tr.isnew td { background: #fffdf5; }
.readok { color: #0f7a4a; font-weight: 600; }

/* ===== menu (1.5.7): gerarchia chiara ===== */
.side nav.nv { gap: 0; }
.side nav.nv .nv-main { display: flex; flex-direction: column; gap: 3px; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid #2a4066; }
.side nav.nv .nv-main a, .side nav.nv .nv-main .dis { font-size: 1.08rem; font-weight: 700; color: #fff; padding: 11px 12px; border-radius: 10px; }
.side nav.nv .nv-main a:hover { background: #1c3252; }
.side nav.nv .nv-main a.on { background: var(--accent); color: #062b27; box-shadow: none; }
.side nav.nv details.grp { border: 0; padding: 0; margin-top: 6px; }
.side nav.nv details.grp > summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 9px 10px;
  font-size: .74rem; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; color: #2dd4bf; background: #12233d; border-radius: 8px; }
.side nav.nv details.grp > summary:hover { background: #1a3050; color: #5eead4; }
.side nav.nv details.grp > summary::after { content: "▸"; color: #2dd4bf; }
.side nav.nv details.grp[open] > summary::after { transform: rotate(90deg); }
.side nav.nv .grpbody { padding: 4px 0 4px 10px; margin: 2px 0 4px 8px; border-left: 2px solid #2a4066; gap: 1px; }
.side nav.nv .grpbody > a, .side nav.nv .grpbody > .dis { font-size: .92rem; font-weight: 500; color: #c9d6e8; padding: 7px 10px; }
.side nav.nv .grpbody > a:hover { background: #1a3050; color: #fff; }
.side nav.nv .grpbody > a.on { background: #1c3a66; color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 #2dd4bf; }
.side nav.nv .sub { margin: 2px 0 6px 10px; border-left: 1px dashed #35507c; }
.side nav.nv .sub a { font-size: .82rem; color: #93a8c6; padding: 4px 10px; }
.side nav.nv .sub a.on { color: #fff; background: transparent; font-weight: 700; box-shadow: none; }

/* ===== stampa (1.5.7): intestazione e piè di pagina su ogni pagina ===== */
.print-head, .print-foot { display: none; }
/* a video la tabella di servizio per la stampa non esiste: tutto blocco, nessuno spazio */
.pwrap, .pwrap > thead, .pwrap > tbody, .pwrap > tfoot, .prow, .pcell { display: block; padding: 0; border: 0; background: transparent !important; }
.pspc-h, .pspc-f { height: 0; }
@media print {
  @page { size: A4; margin: 0; }
  .print-head { display: flex; gap: 14px; align-items: center; position: fixed; top: 0; left: 0; right: 0; height: 30mm; padding: 6mm 12mm 0; background: #fff; }
  .print-head::after { content: ""; position: absolute; left: 12mm; right: 12mm; bottom: 2mm; border-bottom: 1.5px solid #0f1b2d; }
  .print-head .ph-logo { max-height: 18mm; max-width: 40mm; object-fit: contain; }
  .print-head .ph-name { font-size: 13pt; font-weight: 700; }
  .print-head .ph-line { font-size: 8.5pt; color: #333; line-height: 1.3; }
  .print-foot { display: flex; justify-content: space-between; position: fixed; bottom: 0; left: 0; right: 0; height: 14mm; padding: 3mm 12mm 0; font-size: 8.5pt; color: #333; background: #fff; }
  .print-foot::before { content: ""; position: absolute; left: 12mm; right: 12mm; top: 1mm; border-top: 1px solid #999; }
  .pwrap { display: table; width: 100%; border-collapse: collapse; }
  .pwrap > thead { display: table-header-group; } .pwrap > tbody { display: table-row-group; } .pwrap > tfoot { display: table-footer-group; }
  .prow { display: table-row; } .pcell { display: table-cell; padding: 0; }
  .pspc-h { height: 32mm; } .pspc-f { height: 16mm; }
  .ptb main { padding: 0 12mm; }
}

/* scheda veicolo a schede (1.5.7) */
.vtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; border-bottom: 2px solid var(--line); }
.vtab { background: none; border: 0; padding: 11px 18px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.vtab:hover { color: var(--ink); }
.vtab.on { color: var(--ink); border-bottom-color: var(--accent); }
.vcnt { font-style: normal; background: var(--crit); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; margin-left: 4px; }
.vpane[hidden] { display: none; }
@media print { .vpane[hidden] { display: block; } .vtabs { display: none; } }

/* cruscotto 1.5.7 */
.dash3wrap { background: #000; border-radius: 22px; padding: 10px; }
.dash3wrap svg { width: 100%; height: auto; display: block; max-width: 1000px; margin: 0 auto; }
.pill { white-space: nowrap; }

/* 1.5.8: turno di officina (meccanico) */
.pill.shop { background: #ede9fe; color: #5b21b6; box-shadow: inset 0 0 0 1px #c4b5fd; }
tr.shoprow td { background: #e9e3ff; }
tr.shoprow td:first-child { box-shadow: inset 4px 0 0 #7c3aed; }

.ddrv.shopdrv { color: #5b21b6; }
.pill.badge { background: #e0f2fe; color: #0369a1; box-shadow: inset 0 0 0 1px #7dd3fc; }

/* 1.5.8: avvisi già visti, tab rifornimenti */
.seen-h { margin: 14px 0 6px; font-size: .95rem; color: #64748b; }
.erow.seen { opacity: .62; filter: grayscale(.85); }
label.chk { display: flex; align-items: center; gap: 6px; font-weight: 600; padding-bottom: 8px; }
.logospec { background: #f1f5f9; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 6px 0 10px; font-size: .88rem; }
.logospec ul { margin: 4px 0 6px 18px; padding: 0; }
label.chk { white-space: nowrap; }
.pill.nobadge { background: #ffedd5; color: #9a3412; box-shadow: inset 0 0 0 1px #fdba74; }
.pill.bday { background: #fce7f3; color: #9d174d; box-shadow: inset 0 0 0 1px #f9a8d4; }
.bdaycard h2 { margin-top: 0; }
.pill.shop::before { content: '🔧 '; }

/* 1.6.4 · Utilizzo flotta */
.stats.s6 { grid-template-columns: repeat(3, 1fr); }
.vbars { display: flex; gap: 10px; align-items: flex-end; height: 210px; padding-top: 6px; }
.vbars.wide { gap: 6px; }
.vb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; text-align: center; }
.vb .vcol { width: 100%; max-width: 54px; flex: 1; display: flex; align-items: flex-end; margin: 3px 0 4px; }
.vb .vcol i { display: block; width: 100%; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; }
.vb .vcol i.zero { background: #cbd5e1; }
.vb .vn { font-size: .78rem; font-weight: 700; }
.vb .vl { font-size: .7rem; color: var(--muted); line-height: 1.25; }
.hbars { display: grid; gap: 7px; }
.hb { display: grid; grid-template-columns: 44px 1fr minmax(120px, 230px); gap: 10px; align-items: center; font-size: .85rem; }
.hb .hl { font-weight: 700; }
.hb .hbar { height: 14px; background: #eef1f5; border-radius: 99px; overflow: hidden; }
.hb .hbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hb .hbar.warn i { background: var(--warn); }
.hb.nowork .hl, .hb.nowork .hv { color: var(--muted); }
.hb.nowork .hbar i { background: #94a3b8; }
@media (max-width: 800px) { .stats.s6 { grid-template-columns: repeat(2, 1fr); } .hb { grid-template-columns: 44px 1fr; } .hb .hv { grid-column: 1 / -1; } }
.hb { grid-template-columns: 44px 1fr 86px; }
.hb.plate { grid-template-columns: 96px 1fr minmax(120px, 260px); }
.nw { white-space: nowrap; }
.hb.plate .hv { white-space: nowrap; }
table.util th, table.util td { padding-left: 7px; padding-right: 7px; font-size: .84rem; }

/* 1.7.1 – freni (disco = cerchio, pastiglie = barra) e schede «Pneumatici / Insumi» */
.tydiag .brpart .brshape { fill: #000; stroke: #0f172a; stroke-width: 1.5; transition: fill .12s; }
.tydiag .brpart.ty-ok .brshape { fill: #22a55b; }
.tydiag .brpart.ty-warn .brshape { fill: #f97316; }
.tydiag .brpart.ty-crit .brshape { fill: #dc2626; stroke: #7f1d1d; stroke-width: 2.5; }
.tydiag .brpart.ty-na .brshape { fill: #000; }
.tydiag .brhub { fill: #e6ecf3; stroke: #0f172a; stroke-width: 1; pointer-events: none; }
.tydiag .brpct { font-size: 8.5px; }
.tydiag .brtxt { fill: #334155; font: 700 8px system-ui, sans-serif; }
.tydiag.sel .brpart { cursor: pointer; outline: none; }
.tydiag.sel .brpart:hover .brshape, .tydiag.sel .brpart:focus .brshape { stroke: #10b5a0; stroke-width: 3; }
.tydiag .brpart.on .brshape { fill: #10b5a0; stroke: #0b7f70; }
.tydiag .brpart.on .tycheck { display: block; }
.tydiag .brpart.on .brhub { fill: #fff; }
.instabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.instabs .btn.on { background: var(--accent, #10b5a0); color: #fff; border-color: transparent; }
.inspane[hidden] { display: none; }

/* 1.7.2 – priorità: rosso · arancione (ex giallo) · giallo «Verificare»; riga di errore col proprio colore dentro il riquadro dell'Officina */
.kprob .kl { padding: 0 4px; margin: 0 -4px; border-radius: 3px; }
.ktile.crit .kl.warn { background: #f97316; color: #1a0a00; }
.ktile.crit .kl.check, .ktile.warn .kl.check { background: #facc15; color: #1f1300; }
.ktile.check .kl.warn { background: #f97316; color: #1a0a00; }
.erow .pill.check, .pill.check { box-shadow: inset 0 0 0 1px #facc15; }
.prio { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }
.prio select { font: inherit; font-size: .78rem; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.prio .btn { padding: 2px 8px; font-size: .75rem; }
.pill.manual-prio { background: #e0e7ff; color: #3730a3; font-size: .6rem; }

/* 1.7.2 – grafici del turno con assi fissi e colori di soglia */
.chart .cwrap { display: flex; gap: 6px; align-items: stretch; }
.chart .caxis { position: relative; width: 44px; height: 90px; flex: none; font-size: .68rem; color: var(--muted); }
.chart .caxis span { position: absolute; right: 0; transform: translateY(-50%); }
.chart .cwrap svg { flex: 1; min-width: 0; }
.chart svg .grid { stroke: #e2e8f0; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart svg .thr { stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.chart svg .thr.crit { stroke: #dc2626; } .chart svg .thr.warn { stroke: #f97316; }
.chart polyline.seg.ok { stroke: var(--accent); } .chart polyline.seg.warn { stroke: #f97316; } .chart polyline.seg.crit { stroke: #dc2626; }
.chart polyline.seg { stroke-width: 1.8; stroke-linejoin: round; }
.chart .ctime { display: flex; justify-content: space-between; margin-left: 50px; font-size: .68rem; color: var(--muted); }

tr.archived { opacity: .6; }

/* ===== 1.7.2: menu comprimibile (barra sottile con le icone; al passaggio del mouse si apre con testo) ===== */
.side .ic { font-style: normal; width: 1.5rem; text-align: center; flex: none; font-size: 1.05rem; line-height: 1; }
.side nav a, .side nav .dis, .side nav details.grp > summary { gap: 8px; justify-content: flex-start !important; }
.side nav .t { flex: 1; min-width: 0; }
.side nav .lock { margin-left: auto; }
.side nav a .badge { margin-left: auto; }
.side nav.nv details.grp > summary::after { margin-left: auto; }
.brandrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.navpin, .navbtn { background: #12233d; color: #cbd5e1; border: 1px solid #2a4066; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 1rem; line-height: 1; flex: none; }
.navpin:hover, .navbtn:hover { background: #1c3252; color: #fff; }
.navbtn { display: none; }
@media (min-width: 901px) {
  .side { transition: width .15s ease; overflow-x: hidden; z-index: 40; }
  html.navc main { margin-left: 70px; }
  html.navc .side { width: 70px; padding-left: 8px; padding-right: 8px; }
  html.navc .side:hover, html.navc .side:focus-within { width: 230px; padding-left: 12px; padding-right: 12px; box-shadow: 6px 0 24px rgba(0, 0, 0, .4); }
  html.navc .side:not(:hover):not(:focus-within) .t,
  html.navc .side:not(:hover):not(:focus-within) .tagline,
  html.navc .side:not(:hover):not(:focus-within) .logo-txt,
  html.navc .side:not(:hover):not(:focus-within) .navpin,
  html.navc .side:not(:hover):not(:focus-within) .sub,
  html.navc .side:not(:hover):not(:focus-within) .side-foot > *,
  html.navc .side:not(:hover):not(:focus-within) .lock,
  html.navc .side:not(:hover):not(:focus-within) details.grp > summary::after { display: none !important; }
  html.navc .side:not(:hover):not(:focus-within) nav a,
  html.navc .side:not(:hover):not(:focus-within) nav .dis,
  html.navc .side:not(:hover):not(:focus-within) nav details.grp > summary { justify-content: center !important; padding-left: 4px; padding-right: 4px; position: relative; }
  html.navc .side:not(:hover):not(:focus-within) nav a .badge { position: absolute; top: 1px; right: 2px; font-size: .6rem; padding: 0 5px; margin: 0; }
  html.navc .side:not(:hover):not(:focus-within) .grpbody { padding-left: 0 !important; margin-left: 0 !important; border-left: 0 !important; }
}
@media (max-width: 900px) {
  .navpin { display: none; }
  .navbtn { display: block; }
  .brandrow { width: 100%; align-items: center; }
  .side nav, .side .side-foot { display: none; }
  .side.open nav { display: flex; width: 100%; flex-direction: column; }
  .side.open .side-foot { display: block; }
}
@media (min-width: 901px) {
  .side { overflow-x: hidden; }
  .brandrow { position: relative; display: block; }
  .navpin { position: absolute; top: -10px; right: -6px; width: 22px; height: 22px; font-size: .8rem; border-radius: 6px; }
}

/* ===== 1.7.2: carrozzeria realistica (auto / furgone / camion) ===== */
.tydiag .vb-shadow { fill: #0f172a; opacity: .14; }
.tydiag .vb-body { stroke: #64748b; stroke-width: 1.6; }
.tydiag .vb-roof { stroke: #94a3b8; stroke-width: 1; }
.tydiag .vb-glass { stroke: #0f2a4a; stroke-width: 1.2; }
.tydiag .vb-glint { fill: #fff; opacity: .28; }
.tydiag .vb-crease, .tydiag .vb-door, .tydiag .vb-rib { stroke: #94a3b8; stroke-width: 1; fill: none; opacity: .75; }
.tydiag .vb-grille { stroke: #475569; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.tydiag .vb-mirror { fill: #475569; stroke: #1e293b; stroke-width: 1; }
.tydiag .vb-head { fill: #fde68a; stroke: #b45309; stroke-width: 1; }
.tydiag .vb-tail { fill: #ef4444; stroke: #7f1d1d; stroke-width: 1; }
.tydiag .vb-chassis { fill: #64748b; stroke: #475569; stroke-width: 1; }
.tydiag .vb-plate { fill: #fff; stroke: #475569; stroke-width: 1.2; }
.tydiag .vb-plt { fill: #1e293b; font-size: 11px; letter-spacing: .5px; }
.tydiag .vb-muso { fill: #475569; opacity: .8; }
.tydiag .vb-wheel { fill: #1f2937; stroke: #0f172a; stroke-width: 1.5; }
.tydiag .tyre .tybase { filter: drop-shadow(0 1px 1.5px rgba(15, 23, 42, .45)); }
.tydiag .brpart .brshape { filter: drop-shadow(0 1px 1.5px rgba(15, 23, 42, .5)); }

/* ===== 1.7.4: pressione gomme (TPMS) ===== */
.tydiag .tybar { font: 800 13px system-ui, sans-serif; fill: #fff; stroke: #0f172a; stroke-width: 3.4px; paint-order: stroke; stroke-linejoin: round; pointer-events: none; }
.tydiag .tybar.tb-warn { fill: #fdba74; } .tydiag .tybar.tb-crit { fill: #fca5a5; } .tydiag .tybar.tb-ok { fill: #86efac; }
.barpill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-weight: 700; font-size: .82rem; background: #dcfce7; color: #14532d; }
.barpill.tb-warn { background: #ffedd5; color: #9a3412; } .barpill.tb-crit { background: #fee2e2; color: #991b1b; }
.tpmsgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tpmsw { background: #f1f5f9; border-radius: 10px; padding: 10px 12px; font-size: 1.1rem; }
@media (max-width: 720px) { .tpmsgrid { grid-template-columns: repeat(2, 1fr); } }

.pill.autista { background: #7c3aed; color: #fff; }

/* 1.7.8: viola = segnalazione dell'autista (ultimo nella scala: rosso > arancione > giallo > viola) */
.dot.drv { background: #7c3aed; }
.pill.drv { background: #ede9fe; color: #5b21b6; }
.tl .p.on { background: #a855f7; box-shadow: 0 0 6px #a855f7; }
.ktile.drv { background: #7c3aed; border-color: #5b21b6; }
.kprob .kl.drv { background: #7c3aed; color: #fff; }

/* ---- 1.8.3: larghezza dei campi proporzionata al dato (cadastri, filtri, impostazioni). Su telefono tutto torna a larghezza piena. ---- */
.field input, .field select { max-width: 100%; }
.field input[name="sort"],
.field input[name="pct"],
.field input[name="low_pct"],
.field input[name="fuel_warn"],
.field input[name="fuel_crit"],
.field input[name="adblue_grave"],
.field input[name="adblue_gravissima"],
.field input[name="refuel_min_pct"],
.field input[name="drain_min_pct"],
.field input[name="util_low"],
.field input[name="util_high"],
.field input[name="hours_day"],
.field input[name="harsh_acc"],
.field input[name="harsh_brk"],
.field input[name="temp_warn"],
.field input[name="temp_crit"],
.field input[name="tyre_bar_crit"],
.field input[name="tyre_bar_low"],
.field input[name="tyre_bar_high"],
.field input[name="admin_session_h"],
.field input[name="idle_min_s"],
.field input[name="shift_max_h"],
.field input[name="merge_gap_min"],
.field input[name="wa_window_days"],
.field input[name="pump_tol_min"],
.field input[name="pg_months"],
.field input[name="bk_keep"],
.field input[name="phone_prefix"],
.field input[name="heartbeat_s"],
.field input[name="present_timeout_s"],
.field input[name="sample_s"],
.field input[name="giorni"],
.field input[name="mpassword"],
.field input[name="oil_interval_h"],
.field input[name="oil_base_h"] { width: calc(8ch + 30px); }
.field input[name="plate"],
.field input[name="tank_l"],
.field input[name="adblue_tank_l"],
.field input[name="tank_l_default"],
.field input[name="adblue_tank_default"],
.field input[name="odometer"],
.field input[name="km"],
.field input[name="liters"],
.field input[name="oil_liters"],
.field input[name="oil_interval_km"],
.field input[name="oil_base_km"],
.field input[name="tyre_life_km"],
.field input[name="brake_pad_km"],
.field input[name="brake_disc_km"],
.field input[name="fuel_price"],
.field input[name="adblue_price"],
.field input[name="capacity"],
.field input[name="initial"],
.field input[name="cons_default"],
.field input[name="phone"],
.field input[name="co_phone"],
.field input[name="co_zip"],
.field input[name="co_prov"],
.field input[name="co_rea"],
.field input[name="co_sdi"],
.field input[name="bk_time"],
.field input[name="code"],
.field input[name="invoice_no"],
.field input[name="new"],
.field input[name="new2"],
.field input[name="old"],
.field input[name="pin"],
.field input[name="pin2"] { width: calc(15ch + 30px); }
.field input[name="nickname"],
.field input[name="brand"],
.field input[name="rfid"],
.field input[name="ibutton"],
.field input[name="co_vat"],
.field input[name="co_cf"],
.field input[name="supplier"],
.field input[name="q"],
.field input[name="username"],
.field input[name="password"],
.field input[name="co_country"] { width: calc(26ch + 30px); }
.field input[name="name"],
.field input[name="company"],
.field input[name="co_legal"],
.field input[name="co_addr"],
.field input[name="co_city"],
.field input[name="co_email"],
.field input[name="co_pec"],
.field input[name="title"],
.field input[name="reason"],
.field input[name="ref"],
.field input[name="bk_dir"],
.field input[name="bk_folder"],
.field input[name="dtc_loc"],
.field input[name="dtc_key"],
.field input[name="text"] { width: calc(46ch + 30px); }
.field input[type="date"], .field input[type="month"] { width: calc(14ch + 30px); }
.field input[type="datetime-local"] { width: calc(22ch + 30px); }
.field input[name^="speed_"], .field input[name^="rev_"], .field input[name^="ct_"], .field input[name^="cr_"] { width: calc(8ch + 30px); }
.field input[name="bk_g_client_id"], .field input[name="bk_g_client_secret"] { width: 100%; max-width: 560px; }
.field select { width: auto; min-width: 10ch; }
.field select[name="veicolo"], .field select[name="meccanico"], .field select[name="autista"], .field select[name="utente"] { min-width: 14ch; }
.field input.pwshort { width: 11ch; }
@media (max-width: 720px) {
  .field input, .field select, .field input[type="date"], .field input[type="month"], .field input[type="datetime-local"] { width: 100% !important; }
}

/* ---- 1.8.5: moduli più compatti (colonne che si adattano ai campi stretti) e schermate di accesso ordinate ---- */
.field { margin-bottom: 10px; }
.grid:has(> .field) { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 26px; align-items: start; }
.grid > div:empty { display: none; }
.grid > .hint, .grid > h3, .grid > p, .grid > .note { grid-column: 1 / -1; }
.grid > .field:has(input[name="name"], input[name="company"], input[name="co_legal"], input[name="co_addr"], input[name="co_city"], input[name="co_email"], input[name="co_pec"], input[name="title"], input[name="reason"], input[name="ref"], input[name="bk_dir"], input[name="bk_folder"], input[name="text"]) { grid-column: span 2; }
.grid > .field:has(textarea), .grid > .field:has(.axrows), .grid > .field#axed { grid-column: 1 / -1; }
.field .hint { max-width: 60ch; }
.field label { display: block; margin-bottom: 4px; }
.card > h2 { margin-bottom: 12px; }
@media (max-width: 720px) {
  .grid:has(> .field) { grid-template-columns: 1fr; gap: 0; }
  .grid > .field:has(input), .grid > .field:has(textarea) { grid-column: auto; }
}
/* accesso e primo avvio: scheda centrata, campi tutti alla stessa larghezza */
.auth { padding: 24px 16px; }
.auth .box { max-width: 400px; padding: 34px 32px 26px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.auth .box .field { margin-bottom: 16px; }
.auth .box .field input, .auth .box .field select { width: 100% !important; max-width: none; }
.auth .box .field label { font-weight: 600; font-size: .86rem; color: #334155; }
.auth .box .btn { width: 100%; padding: 11px 14px; font-size: 1rem; margin-top: 4px; }
.auth .box > p.muted { text-align: center; margin: 0 0 18px; font-size: .9rem; }
.auth .box .flash { margin-bottom: 14px; }
@media (max-width: 480px) { .auth .box { padding: 26px 20px 20px; } }
.field input[name="phone"], .field input[name="co_phone"] { width: calc(21ch + 30px); }

.tydiag .tybar .tybar2 { font-size: 10.5px; font-weight: 700; stroke-width: 3px; }

/* 1.9.4: documento di servizio su un solo foglio A4 e report in tabella */
.svcrep th, .svcrep td { white-space: nowrap; }
@media print {
  .svcdoc { font-size: 10pt; }
  .svcdoc table td, .svcdoc table th { padding: 3px 8px; }
  .svcdoc h3 { margin: 8px 0 4px; }
  .svcdoc img { max-height: 120mm !important; max-width: 100% !important; object-fit: contain; }
  .svcdoc, .svcdoc * { break-inside: avoid; page-break-inside: avoid; }
  .svcrep { font-size: 8pt; } .svcrep th, .svcrep td { padding: 2px 5px; white-space: normal; }
  /* 1.10.11: nel documento di servizio, i campi modificabili (Supporto/Ufficio) devono stampare come testo, non come caselle */
  .svcdoc input.fi { border: none; background: none; padding: 0; appearance: none; font: inherit; color: inherit; }
}

/* 1.10.17: checklist veicoli pesanti su un solo foglio A4 (stesso principio del documento di servizio, 1.9.4) */
@media print {
  .chkdoc { font-size: 9.5pt; }
  .chkdoc table td, .chkdoc table th { padding: 2px 6px; }
  .chkdoc h3 { margin: 6px 0 3px; }
  .chkdoc img { max-height: 70mm !important; max-width: 100% !important; object-fit: contain; }
  .chkdoc, .chkdoc * { break-inside: avoid; page-break-inside: avoid; }
}
