/* ═══════════════════════════════════════════════════════════
   TELAIO — gestionale per concessionari (demo standalone)
   ═══════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;
  --bg: #f2f2f0;          /* cornice: barra laterale e barra in alto */
  --surface: #ffffff;     /* il foglio e le card */
  --surface-2: #f7f7f5;
  --surface-3: #eeeeeb;
  --active: #e6e6e2;
  --ink: #161718;
  --ink-2: #3f4146;
  --muted: #62656b;
  --line: #e7e6e3;
  --line-2: #d4d3cf;
  --accent: #e5481b;
  --accent-ink: #b8340f;
  --accent-soft: #fde9e1;
  --ok: #1d7f55;
  --ok-soft: #e1f2e9;
  --warn: #b97a06;
  --warn-soft: #fbf0d6;
  --info: #2a64c9;
  --info-soft: #e3ecfb;
  --neutral-soft: #eeeeeb;
  --bad: #c42b2b;
  --bad-soft: #fbe5e3;
  --rule: #f0efed;          /* righe tra le voci */
  --primary: #161718; --primary-hover: #2a2c31; --on-primary: #ffffff;
  --ring: rgba(23, 24, 27, .07);
  --bar: #2b2c2f; --bar-hover: #55575c; --grid-line: #ececea;
  --a1: #d9d8d4; --a2: #aeaca6; --a3: #6f6d68;
  --fase-1: #c9c7c1; --fase-2: #a8a59e; --fase-3: #86837c; --fase-4: #5e5b55; --fase-5: #2b2a27;
  --ok-bg: #dff3e7; --ok-ink: #14583a;
  --warn-bg: #fcefd6; --warn-ink: #8a4b06;
  --info-bg: #e4ecfa; --info-ink: #1f4f9e;
  --late-bg: #fdebd9; --late-ink: #94420b;
  --bad-ink: #9f1f1f;
  --swatch-edge: rgba(0, 0, 0, .15);
  --scrim: rgba(19, 20, 23, .38);
  --asphalt: #2c2d30; --zone: #3a3b3f;
  --side: var(--bg);
  --side-ink: #45474c;
  --radius: 10px;
  --radius-sm: 8px;
  --sheet-r: 16px;
  --gap: 16px;
  --shadow-lg: 0 24px 60px -18px rgba(22, 23, 24, .32);
  --bar-h: 40px;
  --side-w: 236px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

/* Tema scuro: neutri veri, nessun blu notte. Lo stesso blocco vale per la
   preferenza del sistema e per la scelta fatta con il pulsante. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-2: #1b1b1c;
    --surface-3: #232325;
    --active: #26262a;
    --ink: #f3f3f1;
    --ink-2: #d2d2cf;
    --muted: #a4a4a1;
    --line: #262627;
    --line-2: #3b3b3d;
    --rule: #1f1f20;
    --accent: #ef5a2b;
    --accent-ink: #c63c14;
    --accent-soft: #3a1a10;
    --ok: #43c47f; --ok-soft: #142a1d;
    --warn: #e3a845; --warn-soft: #2d2110;
    --info: #7aa5f2; --info-soft: #16213a;
    --bad: #f07272; --bad-soft: #2f1717;
    --neutral-soft: #232325;
    --side-ink: #c9c9c6;
    --primary: #f3f3f1; --primary-hover: #d9d9d6; --on-primary: #111111;
    --ring: rgba(255, 255, 255, .1);
    --bar: #cfcfcc; --bar-hover: #a4a4a1; --grid-line: #232324;
    --a1: #38383a; --a2: #626264; --a3: #9b9b9d;
    --fase-1: #3a3a3c; --fase-2: #5a5a5c; --fase-3: #7f7f81; --fase-4: #a7a7a9; --fase-5: #dcdcda;
    --ok-bg: #142a1d; --ok-ink: #6fd8a0;
    --warn-bg: #2d2110; --warn-ink: #f0b860;
    --info-bg: #16213a; --info-ink: #9dbcf6;
    --late-bg: #2e1c10; --late-ink: #f3a771;
    --bad-ink: #f59a9a;
    --swatch-edge: rgba(255, 255, 255, .22);
    --scrim: rgba(0, 0, 0, .62);
    --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .7);
    --asphalt: #222325; --zone: #303134;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1b1b1c;
  --surface-3: #232325;
  --active: #26262a;
  --ink: #f3f3f1;
  --ink-2: #d2d2cf;
  --muted: #a4a4a1;
  --line: #262627;
  --line-2: #3b3b3d;
  --rule: #1f1f20;
  --accent: #ef5a2b;
  --accent-ink: #c63c14;
  --accent-soft: #3a1a10;
  --ok: #43c47f; --ok-soft: #142a1d;
  --warn: #e3a845; --warn-soft: #2d2110;
  --info: #7aa5f2; --info-soft: #16213a;
  --bad: #f07272; --bad-soft: #2f1717;
  --neutral-soft: #232325;
  --side-ink: #c9c9c6;
  --primary: #f3f3f1; --primary-hover: #d9d9d6; --on-primary: #111111;
  --ring: rgba(255, 255, 255, .1);
  --bar: #cfcfcc; --bar-hover: #a4a4a1; --grid-line: #232324;
  --a1: #38383a; --a2: #626264; --a3: #9b9b9d;
  --fase-1: #3a3a3c; --fase-2: #5a5a5c; --fase-3: #7f7f81; --fase-4: #a7a7a9; --fase-5: #dcdcda;
  --ok-bg: #142a1d; --ok-ink: #6fd8a0;
  --warn-bg: #2d2110; --warn-ink: #f0b860;
  --info-bg: #16213a; --info-ink: #9dbcf6;
  --late-bg: #2e1c10; --late-ink: #f3a771;
  --bad-ink: #f59a9a;
  --swatch-edge: rgba(255, 255, 255, .22);
  --scrim: rgba(0, 0, 0, .62);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .7);
  --asphalt: #222325; --zone: #303134;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg { display: block; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.mono { font-variant-numeric: tabular-nums; }

/* ─── Demo bar ─────────────────────────────────────────────── */
.demo-bar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: .9rem;
  background: var(--bg); color: var(--muted); font-size: 12.5px; padding: 0 16px 0 calc(var(--side-w) + 8px);
  justify-content: flex-start;
}
.demo-bar b { color: var(--ink); font-weight: 600; }
.demo-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.demo-bar button {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
  border: 1px solid var(--line-2); border-radius: 6px; height: 28px; padding: 0 10px; background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--ink); transition: border-color .15s, background .15s;
}
.demo-bar button:hover { border-color: var(--muted); }
.demo-bar button:active { transform: scale(.97); }
.demo-bar .theme-btn { margin-left: auto; }
.demo-bar .theme-btn + button { margin-left: 0; }
.demo-bar button svg { width: 12px; height: 12px; }

/* ─── Shell ────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); padding: var(--bar-h) 8px 8px 0; min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; margin-top: calc(-1 * var(--bar-h)); z-index: 51;
  background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 18px 12px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name svg { display: block; height: 15px; width: auto; }
.brand-name { color: var(--ink); line-height: 1; }
.brand-tenant { font-size: 12px; color: var(--muted); margin-top: 5px; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 34px; padding: 0 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none;
  font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--active); color: var(--ink); }
.nav a[aria-current="page"] svg { color: var(--ink); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: var(--on-primary); background: var(--primary); }
.nav .count:empty { display: none; }

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.side-foot b { display: block; color: var(--ink); font-weight: 600; font-size: 13px; }
.side-foot span { font-size: 12px; color: var(--muted); }

.main { padding: 28px 32px 56px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--sheet-r); }
.topbar { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { font-stretch: 110%; font-weight: 650; font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input {
  width: 280px; height: 36px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px;
  padding: 0 44px 0 34px; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--ring); }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-family: var(--font); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: var(--surface-2); }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: background .15s, border-color .15s, transform .12s var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 18px; height: 18px; }

/* ─── Cards / grid ─────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 20px 0; }
.card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.card-head .hint { color: var(--muted); font-size: 13px; }
.card-head .right { margin-left: auto; }
.link { color: var(--ink-2); font-weight: 600; font-size: 12.5px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link svg { width: 14px; height: 14px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: var(--gap); }
.kpi { padding: 18px 20px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-stretch: 108%; font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 8px; line-height: 1.05; white-space: nowrap; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.kpi-sub .warn { color: var(--ink); font-weight: 600; }
.kpi-sub .bad { color: var(--bad); font-weight: 600; }
.kpi-sub .ok { color: var(--ok); font-weight: 600; }
.meter { height: 4px; border-radius: 9px; background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.dash-row { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.dash-row.r1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-row.r2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); align-content: start; min-width: 0; }

/* Bar chart */
.chart { padding: 10px 20px 14px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid-line); }
.chart .ax { font-size: 11.5px; fill: var(--muted); }
.chart .bar rect.fill { fill: var(--bar); transition: fill .15s; }
.chart .bar.cur rect.fill { fill: var(--accent); }
.chart .bar rect.ghost { fill: url(#hatch); }
.chart .ax.now { fill: var(--ink); font-weight: 700; }
.chart .bar:hover rect.fill { fill: var(--bar-hover); }
.chart .bar.cur:hover rect.fill { fill: var(--accent-ink); }
.chart .bar .val { font-size: 11.5px; font-weight: 600; fill: var(--ink); opacity: 0; transition: opacity .15s; }
.chart .bar:hover .val, .chart .bar.cur .val { opacity: 1; }
.chart-legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding: 0 20px 18px; }
.chart-legend b { color: var(--ink); font-weight: 600; }

/* Aging */
.aging { padding: 14px 20px 18px; }
.aging-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.aging-bar span { display: block; height: 100%; }
.aging-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.aging-legend div { font-size: 12.5px; color: var(--muted); }
.aging-legend b { display: block; font-size: 20px; font-weight: 600; color: var(--ink); font-stretch: 108%; }
.aging-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.a1 { background: var(--a1); } .a2 { background: var(--a2); } .a3 { background: var(--a3); } .a4 { background: var(--accent); }

.list { list-style: none; }
.list li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 20px; border-top: 1px solid var(--rule); }
.list li:first-child { border-top: 0; }
.list .grow { min-width: 0; flex: 1; }
.list .t { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .s { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .end { text-align: right; flex: none; }
.list .end b { display: block; font-weight: 600; }
.list-empty { margin: 14px 20px 20px; padding: 11px 14px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--muted); font-size: 13px; }
.list-note { padding: 10px 20px 4px; color: var(--muted); font-size: 13px; }
.time { font-size: 13px; font-weight: 600; width: 52px; flex: none; color: var(--ink); }
.time b { display: block; font-weight: 500; font-size: 12px; color: var(--muted); text-transform: capitalize; }

/* Dashboard: liste e mix */
.linkish { display: block; max-width: 100%; text-align: left; padding: 0; cursor: pointer; }
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }
.mini-car { width: 72px; flex: none; }
.mini-car svg { width: 100%; height: auto; }
.mini-car img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.list li.is-done { opacity: .5; }
.list li.is-done .t { text-decoration: line-through; }
.list.bordered { border: 1px solid var(--line); border-radius: 10px; }
.list.bordered li { padding: 9px 12px; }
.divider { height: 1px; background: var(--rule); margin: 0 20px; }
.mini-t { font-size: 13px; font-weight: 600; color: var(--ink); padding: 16px 20px 10px; }
.mix { padding: 14px 20px 18px; display: grid; gap: 9px; }
.mix-row { display: grid; grid-template-columns: 76px 1fr 22px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.mix-row .track { height: 4px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.mix-row .track i { display: block; height: 100%; background: var(--ink-2); border-radius: inherit; }
.mix-row b { text-align: right; font-weight: 600; color: var(--ink); }

/* Mappa del piazzale: asfalto, righe bianche, le auto nel loro colore */
.lot-card { display: flex; flex-direction: column; }
.lot { display: grid; grid-template-columns: minmax(460px, 1fr) 150px; gap: 12px; margin: 14px 20px 0; padding: 16px; background: var(--asphalt); border-radius: 8px; overflow-x: auto; }
.yard { display: flex; gap: 0; min-width: 460px; }
.bay { flex: 1 1 0; display: flex; flex-direction: column; min-width: 78px; }
.bay-name { font-size: 11.5px; font-weight: 600; color: #b9bbbf; padding: 0 0 8px 2px; }
.slots { display: flex; flex-direction: column; border-top: 2px solid rgba(255, 255, 255, .55); }
.slot { position: relative; height: 50px; border-bottom: 2px solid rgba(255, 255, 255, .55); display: grid; place-items: center; }
.bay + .bay .slot { border-left: 2px solid rgba(255, 255, 255, .55); }
.slot.van { height: 60px; }
.slot-n { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 18px; text-align: center; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .42); pointer-events: none; }
.aisle { position: relative; flex: 0 0 34px; margin-top: 26px; }
.aisle::before { content: ''; position: absolute; left: 50%; top: 6px; bottom: 6px; border-left: 2px dashed rgba(255, 255, 255, .22); }
.stall { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: 3px 6px 3px 24px; border-radius: 4px; transition: background .15s; }
.stall:hover, .stall:focus-visible { background: rgba(255, 255, 255, .09); }
.stall:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.stall .car-top { width: 100%; max-width: 92px; height: auto; transition: transform .2s var(--ease); }
.stall .car-top.l { transform: scaleX(-1); }
.stall:hover .car-top { transform: scale(1.06); }
.stall:hover .car-top.l { transform: scaleX(-1) scale(1.06); }
.stall.is-old { outline: 2px solid var(--accent); outline-offset: -2px; }
.stall-tag { position: absolute; right: 3px; bottom: 3px; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 5px; border-radius: 4px; background: var(--accent-ink); color: #fff; pointer-events: none; }
.zones { display: grid; gap: 10px; align-content: start; }
.zone { background: var(--zone); border-radius: 6px; padding: 10px; }
.zone-name { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: #e9eaec; margin-bottom: 6px; }
.zone-name span { color: #b9bbbf; font-weight: 500; }
.zone-cars { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.stall.mini { height: 40px; padding: 2px 4px; }
.zone-empty { grid-column: 1 / -1; font-size: 12px; color: #b9bbbf; }
.lot-cap { margin: 0 20px; padding: 12px 0 16px; font-size: 13px; color: var(--ink-2); min-height: 46px; }

/* Consegne a tutta larghezza: grafico e numeri affiancati */
.deliveries { margin-bottom: var(--gap); }
.deliveries-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; align-items: center; padding-right: 20px; }
.deliveries-stats { display: grid; gap: 0; }
.deliveries-stats div { padding: 12px 0; border-top: 1px solid var(--rule); }
.deliveries-stats div:first-child { border-top: 0; }
.deliveries-stats dt { font-size: 13px; color: var(--muted); }
.deliveries-stats dd { font-size: 20px; font-weight: 600; font-stretch: 108%; letter-spacing: -.01em; }
.deliveries-stats dd small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 5px; letter-spacing: 0; }

/* ─── Chips / pills / plate ────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; flex: none; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
.s-disponibile { color: var(--ok-ink); background: var(--ok-bg); }
.s-prenotata { color: var(--warn-ink); background: var(--warn-bg); }
.s-venduta { color: var(--ink-2); background: var(--surface-3); }
.s-preparazione { color: var(--info-ink); background: var(--info-bg); }
.s-arrivo { color: var(--ink-2); background: var(--neutral-soft); }
.vimg .pill.s-arrivo { background: var(--surface); }
.s-fase { color: var(--ink-2); background: var(--neutral-soft); }
.days { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.days.d3 { background: var(--late-bg); color: var(--late-ink); }
.days.d4 { background: var(--bad-soft); color: var(--bad-ink); }

.plate {
  display: inline-flex; align-items: stretch; height: 20px; border: 1px solid #b9bcc2; border-radius: 4px; overflow: hidden;
  background: #fff; font-family: var(--mono); font-weight: 600; font-size: 11.5px; letter-spacing: .04em; color: #111; flex: none;
}
.plate::before { content: 'I'; display: grid; place-items: center; width: 12px; background: #1f47b5; color: #fff; font-size: 8px; font-family: var(--font); font-weight: 700; padding-top: 6px; }
.plate span { padding: 0 6px; display: grid; place-items: center; }
.plate.none { border-style: dashed; color: #5f6268; font-weight: 500; }
.plate.none::before { background: #c5c8ce; }
.plate.lg { height: 28px; font-size: 15px; }
.plate.lg::before { width: 16px; font-size: 10px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip .n { font-weight: 500; opacity: .7; }

/* ─── Forms ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span:first-child, .field > label:first-child { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .select {
  height: 38px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 0 11px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2380838a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.input:focus, .select:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.field .err { font-size: 11.5px; color: var(--bad); }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 34px; }
.input-suffix em { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 12.5px; pointer-events: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.seg { display: flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; height: 32px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); transition: background .15s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); outline: 1px solid var(--line-2); outline-offset: -1px; }
.seg.icons { flex: none; }
.seg.icons button { flex: none; width: 36px; height: 26px; display: grid; place-items: center; }
.seg.icons svg { width: 16px; height: 16px; }
.checks { display: flex; gap: 16px; align-items: center; min-height: 38px; }
.checks label { display: flex; gap: 7px; align-items: center; font-size: 13px; font-weight: 500; cursor: pointer; }
.checks input { width: 16px; height: 16px; accent-color: var(--ink); }
.giac { display: flex; align-items: center; gap: 8px; height: 38px; font-size: 12.5px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(14px); background: var(--on-primary); }
input[type="range"] { width: 100%; accent-color: var(--ink); }

/* ─── Parco auto ───────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select { width: auto; min-width: 150px; height: 32px; font-size: 13px; border-radius: 6px; }
.toolbar .spacer { flex: 1; }
.result-count { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--gap); }
.vcard {
  text-align: left; display: flex; flex-direction: column; overflow: hidden; width: 100%;
  transition: transform .2s var(--ease), border-color .2s;
}
.vcard:hover { transform: translateY(-2px); border-color: var(--muted); }
.vcard img { transition: transform .5s var(--ease); }
.vcard:hover img { transform: scale(1.03); }
.vcard:active { transform: translateY(0) scale(.99); }
.vimg { position: relative; display: block; overflow: hidden; background: var(--surface-3); aspect-ratio: 16 / 9; }
.vimg svg { position: absolute; inset: 14% 7% 4%; width: 86%; height: 82%; }
.vimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vimg .pill { position: absolute; left: 10px; top: 10px; }
.vimg .days { position: absolute; right: 10px; top: 10px; }
.vbody { display: block; padding: 14px 16px 16px; }
.vmake { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.vmodel { display: block; font-weight: 650; font-size: 16px; letter-spacing: -.01em; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vver { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vmeta { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.vfoot { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.vprice { font-stretch: 106%; font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.vmargin { font-size: 12.5px; font-weight: 600; color: var(--ok); }
.vmargin.low { color: var(--warn-ink); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { height: 52px; padding: 8px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; }
.tbl .model b { font-weight: 600; }
.tbl .model span { color: var(--muted); font-size: 12px; margin-left: 4px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--swatch-edge); vertical-align: -1px; margin-right: 6px; }

/* ─── Drawer / modal ───────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; animation: fade .2s ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); z-index: 61; background: var(--surface);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideIn .32s var(--ease) both;
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 19px; font-weight: 650; letter-spacing: -.015em; font-stretch: 106%; line-height: 1.2; }
.drawer-head .vmake { margin-bottom: 2px; }
.drawer-head .icon-btn { margin-left: auto; flex: none; }
.drawer-body { overflow-y: auto; padding: 0 20px 24px; flex: 1; overscroll-behavior: contain; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-foot .btn { flex: 1; }
.hero-car { margin: 0 -20px; background: var(--surface-3); padding: 18px 40px 8px; }
.hero-car svg { width: 100%; height: auto; }
.hero-car.is-photo { position: relative; padding: 0; background: var(--surface-3); }
.hero-car img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.photo-credit { position: absolute; right: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 2px 7px; border-radius: 4px; background: rgba(19, 20, 23, .55); color: #fff; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-credit:hover { background: rgba(19, 20, 23, .75); }
.ids { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ids .vin { font-family: var(--mono); font-size: 13px; color: var(--ink-2); letter-spacing: .02em; }
.ids .vin small { font-family: var(--font); color: var(--muted); font-size: 12px; margin-right: 6px; letter-spacing: 0; }
.section-t { font-size: 14px; font-weight: 650; color: var(--ink); margin: 24px 0 10px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.specs div { padding: 9px 12px; border-top: 1px solid var(--line); }
.specs div:nth-child(-n+2) { border-top: 0; }
.specs div:nth-child(odd) { border-right: 1px solid var(--line); }
.specs dt { font-size: 12px; color: var(--muted); }
.specs dd { font-weight: 600; font-size: 13.5px; }
.econ { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.econ-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.econ-row:first-child { border-top: 0; }
.econ-row .input { width: 130px; height: 32px; text-align: right; font-weight: 600; }
.econ-row.total { background: var(--surface-2); font-weight: 650; }
.econ-row.total .v { font-size: 16px; }
.econ .neg { color: var(--bad); }
.timeline { list-style: none; position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.timeline li { position: relative; padding: 4px 0 10px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -18px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.timeline li.done::before { background: var(--ink); border-color: var(--ink); }
.timeline li span { display: block; font-size: 12px; color: var(--muted); }

.modal-wrap { position: fixed; inset: 0; z-index: 61; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { width: min(560px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .28s var(--ease) both; }
.modal-head { display: flex; align-items: center; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 17px; font-weight: 650; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 10px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }

/* ─── Kanban ───────────────────────────────────────────────── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 240px; scroll-snap-align: start; transition: background .15s, box-shadow .15s; }
.col.over { background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--ink); }
.col-head { display: flex; align-items: baseline; gap: 8px; padding: 4px 4px 10px; }
.col-head h2 { font-size: 13.5px; font-weight: 650; }
.col-head .n { font-size: 12px; color: var(--muted); font-weight: 600; }
.col-head .sum { margin-left: auto; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.col-bar { height: 2px; border-radius: 2px; margin: 0 4px 10px; }
.deals { display: flex; flex-direction: column; gap: 8px; }
.deal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 9px; cursor: grab;
  transition: border-color .18s, transform .18s var(--ease), opacity .15s;
}
.deal:hover { border-color: var(--muted); }
.deal.dragging { opacity: .4; }
.deal.flash { animation: flash 1.1s ease; }
.deal-top { display: flex; align-items: baseline; gap: 8px; }
.deal-top b { font-weight: 650; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-top .v { margin-left: auto; font-weight: 600; font-size: 12.5px; flex: none; }
.deal-car { font-size: 13px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); }
.tag.hot { background: var(--bad-soft); color: var(--bad-ink); }
.tag.blue { background: var(--info-bg); color: var(--info-ink); }
.deal-foot { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }
.deal-foot .age.stale { color: var(--bad); font-weight: 600; }
.deal-foot .move { margin-left: auto; display: flex; gap: 2px; }
.deal-foot .icon-btn { width: 26px; height: 26px; }
.deal-foot .icon-btn svg { width: 15px; height: 15px; }
.deal-foot .icon-btn:disabled { opacity: .25; cursor: default; }
.board-hint { font-size: 13px; color: var(--muted); margin: -6px 0 16px; }

/* ─── Preventivo ───────────────────────────────────────────── */
.quote { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: 24px; align-items: start; }
.qform { display: flex; flex-direction: column; gap: var(--gap); }
.qform .card-pad { display: flex; flex-direction: column; gap: 12px; }
.qform h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.estimate { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.estimate b { color: var(--ink); }
.range-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.range-row b { color: var(--ink); font-size: 13px; }
.fin-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fin-out div { background: var(--surface); padding: 9px 11px; }
.fin-out span { display: block; font-size: 12px; color: var(--muted); }
.fin-out b { font-size: 15px; font-weight: 650; }
.fin-out .big b { color: var(--ink); font-size: 17px; }

.doc-wrap { position: sticky; top: calc(var(--bar-h) + 20px); background: var(--surface-3); border-radius: var(--radius); padding: 16px; }
.doc-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.doc {
  color-scheme: light; --ink: #161718; --ink-2: #3f4146; --muted: #62656b; --line: #e7e6e3; --line-2: #d4d3cf;
  --surface-2: #f7f7f5; --ok: #1d7f55; --accent: #e5481b; --accent-soft: #fde9e1;
  color: var(--ink); background: #fff; border-radius: 4px; padding: 36px 40px 32px; font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.doc-dealer b { font-stretch: 115%; font-weight: 750; font-size: 18px; letter-spacing: -.01em; display: block; }
.doc-dealer span { font-size: 12px; color: var(--muted); display: block; }
.doc-meta { text-align: right; font-size: 12px; color: var(--muted); }
.doc-meta b { display: block; font-size: 16px; color: var(--ink); font-weight: 650; }
.doc-to { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; font-size: 12.5px; }
.doc-to span { display: block; color: var(--muted); font-size: 12px; }
.doc-to b { font-weight: 650; font-size: 14px; }
.doc-car { display: flex; gap: 16px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.doc-car svg { width: 150px; flex: none; }
.doc-car img { width: 150px; flex: none; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; }
.doc-car b { display: block; font-size: 15px; font-weight: 650; }
.doc-car span { display: block; font-size: 12px; color: var(--muted); }
.doc-lines { width: 100%; border-collapse: collapse; margin-top: 16px; }
.doc-lines td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.doc-lines td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.doc-lines td small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.doc-lines tr.neg td:last-child { color: var(--ok); }
.doc-lines tr.tot td { border-bottom: 0; border-top: 2px solid var(--ink); padding-top: 12px; font-size: 16px; font-weight: 700; }
.doc-fin { margin-top: 18px; border: 1px solid var(--ink); border-radius: 8px; padding: 14px 16px; display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 12px; align-items: end; }
.doc-fin span { display: block; font-size: 12px; color: var(--muted); }
.doc-fin b { font-size: 14px; font-weight: 650; }
.doc-fin .rata b { font-size: 24px; font-stretch: 108%; letter-spacing: -.02em; }
.doc-note { margin-top: 18px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.doc-sign { display: flex; justify-content: space-between; margin-top: 28px; font-size: 11.5px; color: var(--muted); }
.doc-sign div { width: 42%; border-top: 1px solid var(--line-2); padding-top: 6px; }

/* ─── Agenda ───────────────────────────────────────────────── */
.week { display: grid; grid-template-columns: repeat(6, minmax(170px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: max(360px, calc(100vh - 230px)); display: flex; flex-direction: column; }
.day.today { border-color: var(--ink); }
.day-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--rule); display: flex; align-items: baseline; gap: 8px; }
.day-head b { font-stretch: 110%; font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1; }
.day-head span { font-size: 12.5px; color: var(--muted); font-weight: 500; text-transform: capitalize; }
.day-head .today-tag { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--on-primary); background: var(--primary); padding: 2px 8px; border-radius: 99px; }
.appts { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.appt { position: relative; border-radius: 8px; padding: 9px 10px 9px 13px; background: var(--surface-2); border: 0; display: flex; gap: 8px; align-items: flex-start; }
.appt::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, var(--ink)); }
.appt .info { min-width: 0; flex: 1; }
.appt .when { font-size: 12.5px; font-weight: 600; }
.appt .kind { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.appt .who { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .what { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.done { opacity: .5; }
.appt.done .who { text-decoration: line-through; }
.appt input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--ink); flex: none; cursor: pointer; }
.day-add { margin: 0 8px 8px; height: 32px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; transition: background .15s, color .15s; }
.day-add:hover { background: var(--surface-2); color: var(--ink); }
.day-add svg { width: 14px; height: 14px; }
.dot-tipo { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }

/* ─── Toast ────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: toastIn .3s var(--ease) both; }
.toast svg { width: 16px; height: 16px; color: var(--ok); }
.toast.out { animation: toastOut .25s ease both; }

/* ─── Motion ───────────────────────────────────────────────── */
@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(6px); opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.view.enter { animation: fade .18s ease both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 1320px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { grid-column: span 2; }
  .kpi:nth-child(4), .kpi:nth-child(5) { grid-column: span 3; border-top: 1px solid var(--line); }
  .kpi:nth-child(4) { border-left: 0; }
  .dash-row.r2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .quote { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  :root { --side-w: 68px; }
  .brand-name, .brand-tenant, .nav-label, .nav a .label, .nav .count, .side-foot div { display: none; }
  .brand { justify-content: center; padding: 0 0 18px; }
  .demo-bar { padding-left: calc(var(--side-w) + 8px); }
  .nav a { justify-content: center; padding: 0; height: 40px; }
  .side-foot { justify-content: center; padding: 12px 0 0; }
  .dash-row.r1, .dash-row.r2 { grid-template-columns: minmax(0, 1fr); }
  .quote { grid-template-columns: minmax(0, 1fr); }
  .doc-wrap { position: static; }
}
@media (max-width: 760px) {
  :root { --bar-h: 30px; }
  body { font-size: 14px; }
  .demo-bar { font-size: 12px; gap: 8px; padding: 0 16px; }
  .demo-bar .long { display: none; }
  .demo-bar button { height: 26px; }
  .app { grid-template-columns: 1fr; padding: var(--bar-h) 0 64px; }
  .main { border: 0; border-radius: 0; }
  .side { position: fixed; inset: auto 0 0 0; top: auto; height: 64px; margin: 0; padding: 0 12px; flex-direction: row; z-index: 40; padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .brand, .side-foot, .nav-label { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; align-items: center; }
  .nav a { flex-direction: column; justify-content: center; gap: 3px; height: 54px; padding: 0 4px; flex: 1; font-size: 11px; }
  .nav a[aria-current="page"] { background: transparent; }
  .nav a .label { display: block; }
  .main { padding: 18px 16px 30px; }
  .topbar h1 { font-size: 23px; }
  .topbar-actions { width: 100%; margin-left: 0; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .search kbd { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi, .kpi:nth-child(4), .kpi:nth-child(5) { grid-column: auto; border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px; }
  .kpi:nth-child(odd):not(:first-child) { border-left: 1px solid var(--line); }
  .kpis > :first-child { grid-column: 1 / -1; border-top: 0; }
  .kpi-value { font-size: 22px; }
  .dash-row.r2 { grid-template-columns: minmax(0, 1fr); }
  .toolbar .select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .toolbar .seg { margin-left: auto; }
  .toolbar .spacer { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .vgrid { grid-template-columns: minmax(0, 1fr); }
  .week { grid-template-columns: minmax(0, 1fr); }
  .day { min-height: 0; }
  .doc { padding: 22px 18px; }
  .doc-head, .doc-to { flex-direction: column; gap: 8px; }
  .doc-meta { text-align: left; }
  .doc-car svg { width: 100px; }
  .doc-car img { width: 100px; }
  .card-head { flex-wrap: wrap; row-gap: 2px; }
  .card-head .hint { flex-basis: 100%; }
  .lot { grid-template-columns: minmax(0, 1fr); margin: 14px 16px 0; padding: 12px; }
  .zones { grid-template-columns: 1fr 1fr; }
  .lot-cap { margin: 0 16px; }
  .deliveries-body { grid-template-columns: minmax(0, 1fr); padding: 0 0 4px; }
  .deliveries-stats { grid-template-columns: 1fr 1fr; padding: 0 20px 8px; column-gap: 16px; }
  .deliveries-stats div:nth-child(2) { border-top: 0; }
  .doc-fin { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .toasts { bottom: 80px; }
}

/* ─── Print: solo il documento di preventivo ───────────────── */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .demo-bar, .side, .topbar, .qform, .doc-actions, .toasts { display: none !important; }
  .doc-wrap { background: none; padding: 0; }
  .app { display: block; padding: 0; }
  .main { padding: 0; border: 0; }
  .quote { display: block; }
  .doc { border: 0; box-shadow: none; padding: 0; }
  .view.enter { animation: none; }
}
