/* IronFoxGarage – terminale officina (desktop / tablet) */

body.officina { min-height: 100vh; }
.boot { padding: 3rem; text-align: center; }

/* Struttura: barra laterale + contenuto */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 26px); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem .9rem; background: var(--bg-2); border-right: 1px solid var(--line); }
.side-brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); padding: .2rem .4rem .9rem; border-bottom: 1px solid var(--line); }
.side-brand b { display: block; font: 700 1rem var(--serif); letter-spacing: .04em; }
.side-brand small { display: block; color: var(--muted); font-size: .75rem; }
.side-logo { width: 46px; height: 46px; object-fit: contain; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active .ico { color: var(--accent-2); }
.ico { width: 20px; height: 20px; flex: none; }
.nav-count { margin-left: auto; font-style: normal; min-width: 22px; height: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { border-top: 1px solid var(--line); padding: .9rem .4rem 0; display: flex; flex-direction: column; gap: .35rem; }
.side-user { font-weight: 600; margin-bottom: .3rem; }
.side-foot .btn .ico { width: 16px; height: 16px; }

.main { padding: 1.6rem 2rem 4rem; min-width: 0; }
.page { max-width: 1400px; margin: 0 auto; }
.page > * + * { margin-top: 1rem; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0 0 .15rem; font-size: 1.9rem; }
.page-head p { margin: 0; text-transform: none; }
.page-head > :first-child { flex: 1 1 280px; min-width: 0; }
.back { display: inline-block; color: var(--text-2); text-decoration: none; font-size: .88rem; margin-bottom: .3rem; }
.back:hover { color: var(--accent-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn.small .ico { width: 16px; height: 16px; }
.btn .ico { width: 18px; height: 18px; }
.small-input { width: auto; padding: .4rem .6rem; font-size: .88rem; }
.danger-text { color: var(--bad) !important; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .bad-text { color: var(--bad); }
.nowrap { white-space: nowrap; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; }
.kpi-tile.card { display: flex; flex-direction: column; gap: .15rem; padding: 1.1rem 1.2rem; position: relative; overflow: hidden; }
.kpi-tile::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(252, 132, 0, .18), transparent 70%); }
.kpi-tile.hl { border-color: rgba(224, 168, 58, .55); background: linear-gradient(160deg, rgba(224, 168, 58, .1), var(--surface) 60%); }
.kpi-tile .kpi { line-height: 1.1; margin: .2rem 0 .1rem; }
.kpi-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 1rem; }

/* Liste */
.list { display: flex; flex-direction: column; }
.li { display: flex; flex-wrap: wrap; row-gap: .4rem; align-items: center; gap: .8rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; border-radius: var(--radius-sm); padding-left: .5rem; padding-right: .5rem; margin: 0 -.3rem; }
.li.click:hover { background: var(--surface-2); }
.li-time { display: flex; flex-direction: column; min-width: 64px; line-height: 1.2; }
.li-time b { font-size: 1rem; }
.li-time small { color: var(--muted); font-size: .74rem; }
.li > .grow { min-width: 190px; }
.li-title { font-weight: 600; }
.li-end { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; margin-left: auto; }
.li-sub { font-size: .84rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.li .plate { font-size: .8rem; }
.info-box { background: linear-gradient(160deg, rgba(106, 165, 216, .08), var(--surface) 70%); border-color: rgba(106, 165, 216, .3); }
.info-box h3 { font-family: var(--sans); font-size: .98rem; }
.pending-box { border-color: rgba(224, 168, 58, .45); }

/* Tabelle */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: .8rem 1rem; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.tbl td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; }
.tbl a { text-decoration: none; }
.msg-cell { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cars { display: flex; flex-direction: column; gap: .35rem; }
.car-chip { display: inline-flex; align-items: center; gap: .5rem; }
.car-chip small { color: var(--text-2); }
.car-chip .plate { font-size: .78rem; }
.searchbar { display: flex; align-items: center; gap: 1rem; }
.searchbar input { max-width: 560px; padding-left: 2.4rem; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a7f71' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat .8rem center; }

/* Tab */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .9rem; border-bottom: 1px solid var(--line); }
.tab { padding: .55rem .9rem; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; display: inline-flex; align-items: center; gap: .4rem; }
.tab small { color: var(--muted); font-family: 'Courier New', monospace; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs.big .tab { font-size: 1rem; }

/* Scheda cliente */
.cli-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 1rem; align-items: start; }
.car-box { display: flex; gap: 1.2rem; align-items: flex-start; }
.car-photo { width: 190px; flex: none; display: flex; flex-direction: column; gap: .4rem; }
.car-photo img, .car-photo-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
.car-photo-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .8rem; background: var(--bg-2); border-style: dashed; }
.car-photo label.btn { cursor: pointer; }
.stats { display: flex; gap: 1.6rem; flex-wrap: wrap; margin-top: .9rem; }
.stats > div { display: flex; flex-direction: column; }
.stats b { font-size: 1.15rem; }
.car-qr { width: 150px; flex: none; display: flex; flex-direction: column; gap: .4rem; align-items: stretch; text-align: center; }
.qr-code { font-size: .7rem; color: var(--text-2); word-break: break-all; }
.mnt h3 { margin: .1rem 0 0; }
.mnt-cost { margin-right: .3rem; }
details { margin-top: .5rem; }
details summary { cursor: pointer; color: var(--accent-2); font-size: .86rem; font-weight: 500; }
details[open] summary { margin-bottom: .5rem; }
#chat { max-height: 420px; overflow-y: auto; min-height: 220px; }
.wa-head .logo, .wa-head img { object-fit: contain; padding: 3px; }
.wa-chat.mini { min-height: 0; padding: .6rem; }
.wa-chat.mini .bubble { max-width: 100%; }

/* Modale prenotazione */
.bk-head { display: flex; gap: .8rem; align-items: center; margin-bottom: .8rem; padding-right: 1.5rem; }
.bk-head h2 { margin: 0 0 .2rem; }
.bk-ico { font-size: 1.8rem; width: 52px; height: 52px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.modal-actions { margin-top: 1rem; }

/* Scanner QR */
.scan-video { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: .6rem; aspect-ratio: 4 / 3; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid var(--accent-2); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }

/* Form intervento */
.int-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
.int-side { position: sticky; top: 1rem; }
.chk { display: flex; flex-direction: column; gap: .4rem; }
.chk-row { display: grid; grid-template-columns: minmax(150px, 1fr) 200px minmax(0, 1.4fr); gap: .6rem; align-items: center; padding: .45rem .6rem; border-radius: var(--radius-sm); background: var(--bg-2); border-left: 3px solid var(--line); }
.chk-row select, .chk-row input { padding: .5rem .6rem; font-size: .9rem; }
.chk-label { font-weight: 500; font-size: .92rem; }
.chk-row.st-sostituito { border-left-color: var(--ok); }
.chk-row.st-controllato { border-left-color: var(--info); }
.chk-row.st-presto { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-bg), var(--bg-2) 40%); }
.chk-row.st-urgente { border-left-color: var(--bad); background: linear-gradient(90deg, var(--bad-bg), var(--bg-2) 40%); }
.chk-row.st-none .chk-label { color: var(--text-2); }
.ric-tbl th { padding: .5rem .4rem; background: none; }
.ric-tbl td { padding: .3rem .4rem; border: 0; }
.ric-tbl input { padding: .5rem .6rem; font-size: .9rem; }

/* Calendario settimanale */
.wk-scroll { overflow-x: auto; }
.wk { display: grid; grid-template-columns: 62px repeat(7, minmax(118px, 1fr)); min-width: 920px; }
.wk-corner, .wk-h { position: sticky; top: 0; background: var(--bg-2); border-bottom: 1px solid var(--line); z-index: 1; }
.wk-h { display: flex; flex-direction: column; align-items: center; padding: .6rem .3rem; line-height: 1.15; border-left: 1px solid var(--line); }
.wk-h span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.wk-h b { font: 700 1.25rem var(--serif); }
.wk-h small { font-size: .7rem; color: var(--text-2); min-height: 1em; }
.wk-h.today b { color: #fff; background: var(--accent); border-radius: 50%; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; }
.wk-h.closed { opacity: .5; }
.wk-t { font-size: .78rem; color: var(--muted); padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.wk-c { min-height: 46px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 3px; display: flex; flex-direction: column; gap: 3px; }
.wk-c.closed { background: repeating-linear-gradient(135deg, transparent, transparent 6px, rgba(255, 255, 255, .02) 6px, rgba(255, 255, 255, .02) 12px), var(--bg); }
.wk-c.passato { background: rgba(0, 0, 0, .18); }
.wk-c.blocked { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); cursor: pointer; }
.blk-lbl { font-size: .72rem; color: var(--text-2); padding: .2rem .3rem; }
.wk-c.free { cursor: pointer; }
.wk-add { font-size: .72rem; color: transparent; margin: auto; transition: color .1s; }
.wk-c.free:hover { background: var(--ok-bg); }
.wk-c.free:hover .wk-add { color: var(--ok); }
.wk-break { grid-column: 1 / -1; font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); text-align: center; padding: .25rem; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.wk-empty { grid-column: 1 / -1; padding: 2rem; text-align: center; color: var(--muted); }
.ev { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; width: 100%; padding: .3rem .45rem; border-radius: 6px; border: 0; border-left: 3px solid var(--muted); background: var(--surface-2); color: var(--text); font: .76rem/1.25 var(--sans); cursor: pointer; overflow: hidden; }
.ev b { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ev small { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: .7rem; }
.ev.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.ev.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.ev.info { border-left-color: var(--info); background: var(--info-bg); }
.ev.cont { opacity: .75; flex: 1; justify-content: center; }
.ev:hover { filter: brightness(1.2); }
.wk-legend { padding: .8rem 1rem; margin: 0; border-top: 1px solid var(--line); }
/* Categorie appuntamento (Officina arancione, Elettronica verde, Carrozzeria blu) e stato */
.wk-t.half { opacity: .6; font-size: .72rem; }
.ev.cat { border-left: 4px solid var(--cat); background: var(--surface-2); background: color-mix(in srgb, var(--cat) 22%, var(--surface-2)); }
.ev.cat.warn { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cat) 22%, var(--surface-2)) 0 8px, var(--surface-2) 8px 14px); outline: 1px dashed var(--cat); outline-offset: -1px; }
.ev.cat.info { opacity: .55; }
.sw.sw-attesa { background: repeating-linear-gradient(135deg, var(--text-2) 0 3px, transparent 3px 6px); outline: 1px dashed var(--text-2); }
.sw.sw-fatto { background: var(--text-2); opacity: .45; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); flex: none; align-self: center; }
.cat-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; color: var(--text); background: color-mix(in srgb, var(--cat) 25%, transparent); border: 1px solid var(--cat); }
.cat-pick { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat-pick label { position: relative; cursor: pointer; }
.cat-pick input { position: absolute; opacity: 0; pointer-events: none; }
.cat-pick span { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); font-size: .88rem; color: var(--text-2); }
.cat-pick span::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--cat); }
.cat-pick input:checked + span { border-color: var(--cat); color: var(--text); font-weight: 600; background: color-mix(in srgb, var(--cat) 22%, var(--bg-2)); }
.cat-pick input:focus-visible + span { outline: 2px solid var(--cat); outline-offset: 2px; }
/* Promemoria interni dell'officina */
.nota { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid #e8c547; border-radius: 5px; background: rgba(232, 197, 71, .14); color: var(--text); font: .7rem/1.25 var(--sans); padding: .22rem .4rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nota.fatto { opacity: .5; text-decoration: line-through; }
.nota:hover { filter: brightness(1.2); }
.wk-notes { display: flex; flex-direction: column; gap: 2px; width: 100%; margin-top: .3rem; }
.nota-fatta .grow { text-decoration: line-through; opacity: .6; }
.nota-chk { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.cal-bottom { align-items: start; }
/* Targa con suggerimenti nel nuovo preventivo */
.plate-pick { max-width: 560px; }
.targa-input { font: 700 1.3rem var(--mono, monospace); letter-spacing: .12em; text-transform: uppercase; }
.sugg { display: flex; flex-direction: column; gap: .3rem; margin-top: .4rem; }
.sugg-item { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; padding: .5rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); cursor: pointer; }
.sugg-item .grow { display: flex; flex-direction: column; min-width: 0; }
.sugg-item.on, .sugg-item:hover { border-color: var(--accent); background: var(--surface-2); }
.sugg-empty { padding: .5rem .2rem; color: var(--text-2); }
.ospite-box { padding: .2rem 0; }

/* WhatsApp: modelli */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { border: 1px solid var(--line); background: var(--bg-2); color: var(--accent-2); border-radius: 999px; padding: .25rem .6rem; font: 500 .8rem 'Courier New', monospace; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.tpl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.tpl-name { color: var(--text); font-size: .95rem; }
.tpl textarea { font-family: var(--sans); font-size: .9rem; min-height: 130px; }

/* Adesivi: etichetta per stampante termica */
.stk-grid { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.seg button { flex: 1; padding: .55rem .6rem; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); border-radius: var(--radius-sm); font: 500 .85rem var(--sans); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.qr-url { word-break: break-all; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem; }
.stk-preview { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 2rem 1rem; border-radius: var(--radius); background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--bg-2)); border: 1px solid var(--line); overflow: hidden; }
.stk-zoom { zoom: 2; }
.print-area { width: var(--lw); height: var(--lh); }
.label { --s: 1; width: var(--lw); height: var(--lh); background: #fff; color: #000; display: flex; align-items: center; gap: calc(1.6mm * var(--s)); padding: calc(1.6mm * var(--s)); box-sizing: border-box; overflow: hidden; font-family: Arial, Helvetica, sans-serif; border-radius: 1.5mm; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lb-qr { width: var(--qr); height: var(--qr); flex: none; }
.lb-qr svg { width: 100%; height: 100%; display: block; }
.lb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: calc(.45mm * var(--s)); line-height: 1.1; }
.lb-brand { display: block; align-self: flex-start; height: calc(4.2mm * var(--s)); width: auto; margin-bottom: calc(.4mm * var(--s)); }
.lb-car { font-weight: 700; font-size: calc(1.9mm * var(--s)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lb-plate { font: 900 calc(3.4mm * var(--s)) / 1 'Courier New', Courier, monospace; letter-spacing: .03em; white-space: nowrap; }
.lb-row { font-size: calc(1.5mm * var(--s)); }
.lb-row span { display: block; }
.lb-row b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-garage { font-size: calc(1.35mm * var(--s)); margin-top: calc(.3mm * var(--s)); border-top: .2mm solid #000; padding-top: calc(.4mm * var(--s)); }

/* Impostazioni */
.orari { display: flex; flex-direction: column; gap: .4rem; }
.orario { display: grid; grid-template-columns: 170px 1fr auto; gap: .8rem; align-items: center; padding: .5rem .7rem; border-radius: var(--radius-sm); background: var(--bg-2); }
.orario .fasce { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.orario input[type=time] { width: 118px; padding: .45rem .5rem; }
.orario .closed-lbl { display: none; }
.orario.off .fasce { opacity: .35; }
.orario.off .closed-lbl { display: inline; }
.day-toggle { align-items: center; color: var(--text); font-size: .95rem; }

/* Login */
.login-wrap { min-height: calc(100vh - 26px); }
.login { min-height: calc(100vh - 26px); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: radial-gradient(ellipse at top, rgba(252, 132, 0, .16), transparent 60%); }
.login-card { width: 100%; max-width: 400px; padding: 2rem 1.8rem; text-align: center; box-shadow: var(--shadow); }
.login-card form { text-align: left; margin-top: 1.2rem; }
.login-logo { width: 104px; height: 104px; object-fit: contain; margin-bottom: .8rem; }
.login-card h1 { letter-spacing: .06em; margin-bottom: .2rem; }
.eyebrow { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; margin-bottom: .2rem; }
.demo-hint { margin-top: 1.2rem; font-size: .82rem; color: var(--text-2); background: var(--bg-2); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .6rem; }

/* Responsive: sotto i 900px la barra laterale diventa una barra in alto */
@media (max-width: 1180px) {
  .cli-grid, .int-grid { grid-template-columns: minmax(0, 1fr); }
  .int-side { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Tablet verticale (700-1023px): menu laterale stretto con icona e nome sotto, tutto visibile senza scorrere */
@media (min-width: 700px) and (max-width: 1023px) {
  .shell { grid-template-columns: 92px minmax(0, 1fr); }
  .side { padding: .8rem .45rem; gap: .6rem; overflow-y: auto; scrollbar-width: none; }
  .side-brand { justify-content: center; padding: 0 0 .7rem; }
  .side-brand span { display: none; }
  .side-logo { width: 42px; height: 42px; }
  .nav a { flex-direction: column; gap: .25rem; padding: .55rem .2rem; font-size: .68rem; line-height: 1.15; text-align: center; position: relative; }
  .nav a .ico { width: 22px; height: 22px; }
  .nav a.active { box-shadow: inset 3px 0 0 var(--accent); }
  .nav-count { position: absolute; top: 2px; right: 8px; margin: 0; min-width: 18px; height: 18px; font-size: .66rem; }
  .side-foot { padding: .7rem 0 0; align-items: stretch; }
  .side-foot > :not(.btn) { display: none; }
  .side-foot .btn { flex-direction: column; gap: .2rem; font-size: .66rem; padding: .45rem .2rem; }
  .side-foot .btn span { display: block; }
  .main { padding: 1.3rem 1.3rem 3rem; }
}
/* Telefono: il menu diventa una barra in alto */
@media (max-width: 699px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 50; height: auto; flex-direction: row; align-items: center; gap: .5rem; padding: .5rem .7rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-brand { border: 0; padding: 0; }
  .side-brand span { display: none; }
  .side-logo { width: 36px; height: 36px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 0; scrollbar-width: none; }
  .nav a { padding: .5rem .6rem; font-size: .85rem; white-space: nowrap; gap: .4rem; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-count { margin-left: .2rem; }
  .side-foot { border: 0; padding: 0; flex-direction: row; }
  .side-foot > :not(.btn) { display: none; }
  .side-foot .btn span { display: none; }
  .main { padding: 1.1rem 1rem 3rem; }
}
@media (max-width: 900px) {
  .dash-grid, .stk-grid, .tpl-grid { grid-template-columns: minmax(0, 1fr); }
  .chk-row { grid-template-columns: 1fr 1fr; }
  .chk-row input, .chk-row .chk-nospec { grid-column: 1 / -1; }
  .chk-row .chk-nospec { display: none; }
  .orario { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: .6rem .6rem; }
  .card.flush { overflow-x: auto; }
  .stk-zoom { zoom: 1.4; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
  .car-box { flex-direction: column; }
  .car-photo, .car-qr { width: 100%; max-width: 240px; }
  .hide-sm { display: none; }
  .nav a span { display: none; }
  .page-head h1 { font-size: 1.5rem; }
  .li { flex-wrap: wrap; }
  .stk-zoom { zoom: 1; }
}

/* Stampa: solo l'etichetta, in scala 1:1 (il formato pagina è impostato da @page dinamico) */
@media print {
  html, body { background: #fff !important; margin: 0; padding: 0; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: fixed; left: 0; top: 0; }
  .stk-zoom { zoom: 1 !important; }
  .label { box-shadow: none; border-radius: 0; }
  #toasts, .modal-wrap { display: none !important; }
}
.card > .grid-2 + .grid-3, .card > .grid-2 + .grid-2, .card > .grid-2 + label.field, .card > .grid-3 + label.field { margin-top: .75rem; }

/* ---------- documenti, richieste di preventivo, foto ---------- */
.upload { display: flex; align-items: center; justify-content: center; min-height: 52px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: var(--bg-2); color: var(--text-2); font-size: .9rem; cursor: pointer; padding: .6rem; text-align: center; }
.upload:hover { border-color: var(--accent); color: var(--text); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; margin-top: .5rem; }
.gallery:empty { display: none; }
.g-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); padding: 0; background: #000; cursor: pointer; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; line-height: 1; }
.quote { margin: .6rem 0; padding: .7rem .9rem; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; }
.mono { font-family: 'Courier New', monospace; letter-spacing: .03em; }
.danger-zone { border-color: color-mix(in srgb, var(--bad, #c0392b) 45%, var(--line)); }
#btn-notif { margin-bottom: .4rem; }
#btn-notif.on { border-color: var(--accent); color: var(--accent-2); }

/* Scheda intervento: chilometraggio in testa e lavorazioni a tessere, come la scheda auto del cliente */
.km-card { background: linear-gradient(160deg, var(--surface-2), var(--surface) 60%); }
.km-car { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.km-ph { width: 120px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); display: grid; place-items: center; flex: none; }
.km-ph img { width: 100%; height: 100%; object-fit: cover; }
.km-ph svg { width: 100px; height: auto; }
.km-model { font-family: var(--serif); text-transform: uppercase; font-size: 1.15rem; margin-top: .35rem; }
.km-field { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.km-input { display: flex; align-items: baseline; gap: .5rem; margin-top: .35rem; border-bottom: 2px solid var(--accent); }
.km-input input { flex: 1; min-width: 0; background: transparent; border: 0; padding: .1rem 0; font-family: var(--serif); font-size: 2.6rem; font-weight: 600; color: var(--text); letter-spacing: .02em; box-shadow: none; }
.km-input input:focus { outline: none; box-shadow: none; }
.km-input span { font-family: var(--serif); font-size: 1.2rem; color: var(--muted); }
.km-hint { margin: .5rem 0 1rem; font-size: .88rem; color: var(--text-2); }
.km-hint.bad { color: var(--bad); }
.tipo-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.tipo-tabs button { border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); border-radius: 999px; padding: .4rem .85rem; font-size: .88rem; cursor: pointer; }
.tipo-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.lav { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; margin-top: .4rem; }
.lav-item { display: flex; flex-direction: column; gap: .5rem; padding: .7rem; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--line); }
.lav-head { display: flex; align-items: center; gap: .5rem; }
.lav-ic { font-size: 1.25rem; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); }
.lav-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.lav-seg button { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: .75rem; padding: .4rem .2rem; border-radius: 6px; cursor: pointer; }
.lav-seg button.on.seg-sostituito { background: var(--ok); border-color: var(--ok); color: #06140b; font-weight: 600; }
.lav-seg button.on.seg-controllato { background: var(--info); border-color: var(--info); color: #06101c; font-weight: 600; }
.lav-seg button.on.seg-presto { background: var(--warn); border-color: var(--warn); color: #1c1203; font-weight: 600; }
.lav-seg button.on.seg-urgente { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.lav-item input[data-sp] { padding: .45rem .6rem; font-size: .85rem; }
.lav-item.st-sostituito { border-left-color: var(--ok); }
.lav-item.st-controllato { border-left-color: var(--info); }
.lav-item.st-presto { border-left-color: var(--warn); }
.lav-item.st-urgente { border-left-color: var(--bad); }
.lav-item.st-none .chk-label { color: var(--text-2); }
.lav-head { justify-content: flex-start; text-align: left; }
.km-box { margin-top: 1rem; padding: 1rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.km-box .km-chart { margin-top: .6rem; }
.lb-scan { font-size: calc(1.4mm * var(--s)); font-weight: 700; }
.car-photo-model { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; display: grid; place-items: center; }
.car-photo-model svg { width: 86%; height: auto; }
.km-ph .fa { width: 100%; height: 100%; display: grid; place-items: center; }

/* Allegati dei sinistri: anteprima dei PDF accanto alle foto. */
.g-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; background: var(--bg-2); color: var(--text-2); padding: .3rem; }
.g-pdf .g-ic { font-size: 1.6rem; }
.g-pdf small { font-size: .65rem; line-height: 1.1; word-break: break-all; text-align: center; max-height: 2.2em; overflow: hidden; }
.ins-row { margin-top: .5rem; align-items: center; }

/* Preventivo compilato */
.tbl-wrap { overflow-x: auto; }
.pv-imp { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.pv-tbl th.num { text-align: right; }
.pv-prezzo { display: grid; grid-template-columns: 64px 1fr auto; gap: .4rem; align-items: end; }
.pv-prezzo label { display: grid; gap: .15rem; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pv-prezzo input { padding: .45rem .5rem; font-size: .88rem; }
.pv-prezzo .pv-imp { padding-bottom: .5rem; min-width: 64px; }
.pv-iva { gap: 1.4rem; margin-bottom: .3rem; }
.pv-iva label.check { font-weight: 600; color: var(--text); }
.pv-tot { display: grid; gap: .35rem; margin-top: .6rem; font-variant-numeric: tabular-nums; }
.pv-totale { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .2rem; font-size: 1.1rem; }
.pv-totale b:last-child { color: var(--accent); }
#pv-voci .section-title { margin-top: 1rem; }
/* Fattura compilata: le select delle righe come gli input */
.ric-tbl select { padding: .5rem .3rem; font-size: .9rem; width: 100%; }
.ft-tbl { min-width: 720px; }
@media (max-width: 640px) {
  .pv-tbl thead { display: none; }
  .pv-tbl tr { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .3rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
  .pv-tbl td { padding: 0; }
  .pv-tbl td:first-child, .pv-tbl td:nth-child(2) { grid-column: span 2; }
  .pv-tbl td.pv-imp { align-self: center; }
  .ft-tbl { min-width: 0; }
  .ft-tbl tr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ft-tbl td:nth-child(1), .ft-tbl td:nth-child(5) { grid-column: span 2; }
  .ft-tbl td:nth-child(2) { grid-column: span 4; }
  .ft-tbl td:nth-child(3), .ft-tbl td:nth-child(4), .ft-tbl td:nth-child(6), .ft-tbl td:nth-child(7), .ft-tbl td:nth-child(9) { grid-column: span 1; }
  .ft-tbl td:nth-child(8) { grid-column: span 5; }
  .ft-tbl input, .ft-tbl select { padding: .45rem .3rem; font-size: .85rem; }
}

/* Scheda di uscita delle auto sostitutive */
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: 1rem; color: var(--text-2); }
.kv { width: 100%; border-collapse: collapse; font-size: .9rem; }
.kv th { text-align: left; font-weight: 500; color: var(--muted); padding: .35rem .8rem .35rem 0; width: 38%; vertical-align: top; }
.kv td { padding: .35rem .6rem .35rem 0; overflow-wrap: anywhere; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid var(--line); }
.kv-2 th { width: 46%; }
.uscita-aperta { display: flex; gap: .8rem; align-items: center; padding: .75rem .9rem; border: 1px solid var(--warn); background: var(--warn-bg); border-radius: var(--radius-sm); cursor: pointer; }
.disegno-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem; }
.disegno-wrap svg { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: manipulation; }
.disegno-wrap.sola-lettura svg { cursor: default; }
.disegno-wrap .segno { cursor: pointer; }
.danni-tipi button { flex: 1 1 auto; }
.danni-tipi .sigla { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: #0a0a0a; color: #fff; font-size: .75rem; margin-right: .2rem; border: 1px solid #555; }
.danni-lista { list-style: none; counter-reset: n; padding: 0; margin: .8rem 0 0; display: grid; gap: .45rem; }
.danni-lista li { display: flex; gap: .6rem; align-items: center; font-size: .9rem; }
.danni-lista .grow { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; }
.danno-nota { flex: 1 1 14rem; min-width: 0; }
.danno-sigla { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #0a0a0a; color: #fff; font-weight: 700; font-size: .8rem; border: 1px solid #555; }
.danno-sigla.nuovo { background: #d92d20; border-color: #d92d20; }
.legenda { margin: .7rem 0 0; }
.fuel-seg { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; margin-top: .35rem; max-width: 520px; }
.fuel-seg button { height: 2.6rem; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font: 600 .75rem var(--sans); cursor: pointer; padding: 0; }
.fuel-seg button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.fuel-seg button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.fuel-seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fuel-seg button:first-child.on { background: var(--bad); border-color: var(--bad); }
.fuel-seg button.cur { box-shadow: inset 0 0 0 2px #fff; }
.fuel-label { margin: .35rem 0 0; }
.dotazioni { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .55rem 1rem; }
.firma-pad { display: block; width: 100%; max-width: 620px; aspect-ratio: 900 / 260; background: #fff; border: 2px dashed var(--line); border-radius: var(--radius-sm); touch-action: none; cursor: crosshair; }
.firme { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .5rem; }
.firme > div { flex: 1 1 12rem; }
.firma-img { display: block; width: 100%; max-width: 260px; background: #fff; border-radius: 6px; margin-top: .3rem; }

/* Moduli di noleggio dell'auto sostitutiva compilati in app */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.grid-4 > .span-2 { grid-column: span 2; }
@media (max-width: 760px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr; } .grid-4 > .span-2 { grid-column: auto; } }
#f-mod .card > .grid-2, #f-mod .card > .grid-3, #f-mod .card > .grid-4 { margin-top: .75rem; }
.cond-noleggio summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.cond-testo { max-height: 22rem; overflow-y: auto; margin-top: .6rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cond-testo h3 { font-size: .8rem; margin: .8rem 0 .3rem; color: var(--text); }
.cond-testo p { margin: 0 0 .45rem; }
.firme-pad { margin-top: 1rem; }
.firme-pad .firma-pad { margin-top: .35rem; }
.motivi-noleggio .motivo-testo { width: 100%; margin: .35rem 0 0 1.85rem; max-width: calc(100% - 1.85rem); }
.mod-sub { font-size: .9rem; margin: 1.2rem 0 0; }
@media (max-width: 640px) { .grid-2.firme-pad { grid-template-columns: 1fr; } }
