/* Font ospitati sul sito (niente Google Fonts: nessun IP dei clienti inviato a terzi). Licenza SIL OFL in assets/fonts. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/oswald-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/oswald-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/oswald-latin-700-normal.woff2') format('woff2'); }

/* IronFoxGarage – tema condiviso (brand Iron Fox Garage) */
:root {
  /* Palette dal nuovo sito iron-fox.it: nero e arancione Iron Fox Garage (#fc8400) */
  --bg: #0a0a0a;
  --bg-2: #121212;
  --surface: #181818;
  --surface-2: #232323;
  --line: #2e2e2e;
  --text: #f5f5f5;
  --text-2: #bdbdbd;
  --muted: #8a8a8a;
  --accent: #fc8400;
  --accent-2: #ffa338;
  --accent-ink: #0a0a0a;
  --ok: #5fae6e;
  --ok-bg: rgba(95, 174, 110, .14);
  --warn: #e0a83a;
  --warn-bg: rgba(224, 168, 58, .14);
  --bad: #e0574a;
  --bad-bg: rgba(224, 87, 74, .14);
  --info: #6aa5d8;
  --info-bg: rgba(106, 165, 216, .14);
  --wa: #25d366;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  /* Font PROVVISORI: li sceglie Nicole. Per cambiarli: file woff2 in assets/fonts, @font-face in cima a questo file e queste due variabili. */
  --serif: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* App installata sulla home (iOS/Android): niente rimbalzo della pagina quando il contenuto entra già nello schermo. */
html, body { overscroll-behavior-y: none; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; text-transform: uppercase; letter-spacing: .02em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.center { text-align: center; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

.row { display: flex; align-items: center; gap: .5rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.gap { gap: .75rem; }
.col { display: flex; flex-direction: column; gap: .5rem; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: .75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

/* Bottoni */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .7rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #08361b; }
.btn.small { padding: .4rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* Form */
label.field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--text-2); }
input, select, textarea { width: 100%; padding: .7rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: 1rem var(--sans); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .88rem; color: var(--text-2); cursor: pointer; }
label.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.form-error { color: var(--bad); font-size: .88rem; min-height: 1.2em; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin: 0; }
legend { padding: 0 .4rem; color: var(--text-2); font-size: .85rem; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.tap { cursor: pointer; transition: border-color .15s; text-decoration: none; color: inherit; display: block; }
.card.tap:hover { border-color: var(--accent); }
.card h3 { margin-bottom: .25rem; }
.section-title { font: 600 .78rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 1.4rem 0 .6rem; }

/* Badge */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }

/* Targa italiana */
.plate { display: inline-flex; align-items: stretch; background: #f4f4f0; color: #111; border: 2px solid #111; border-radius: 5px; font: 700 .95rem/1.5 'Courier New', monospace; letter-spacing: .08em; overflow: hidden; white-space: nowrap; }
.plate .eu { background: #1d3fa3; color: #fff; font: 700 .65rem/1 var(--sans); padding: 0 .3rem; display: flex; align-items: flex-end; padding-bottom: .2rem; margin-right: .4rem; }
.plate { padding-right: .45rem; }

/* Toast */
#toasts { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--ok); color: var(--text); padding: .7rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast.err { border-left-color: var(--bad); }
.toast.wa { border-left-color: var(--wa); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Modale */
.modal-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: opacity .15s; }
.modal { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
.modal-x { position: absolute; top: .5rem; right: .6rem; background: none; border: 0; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.confirm-text { font-size: 1.02rem; margin: .4rem 1.5rem 1.2rem 0; }
@keyframes fade { from { opacity: 0; } }

/* Calendario mensile */
.cal { user-select: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.cal-head h3 { margin: 0; }
.cal-nav { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .72rem; color: var(--muted); text-transform: uppercase; padding: .2rem 0; }
.cal-day { aspect-ratio: 1; border-radius: 10px; border: 1px solid transparent; background: var(--bg-2); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; font: 600 .95rem var(--sans); cursor: pointer; position: relative; padding: 0; }
.cal-day .n { font-size: .62rem; font-weight: 500; color: var(--muted); }
.cal-day.out { opacity: .25; }
.cal-day.libero { background: var(--ok-bg); border-color: rgba(95, 174, 110, .35); }
.cal-day.quasi { background: var(--warn-bg); border-color: rgba(224, 168, 58, .35); }
.cal-day.pieno { background: var(--bad-bg); color: var(--text-2); cursor: not-allowed; }
.cal-day.chiuso, .cal-day.passato { background: transparent; color: var(--muted); cursor: not-allowed; }
.cal-day.today { outline: 1px solid var(--text-2); }
.cal-day.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-day.sel .n { color: #fff; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .78rem; color: var(--text-2); margin-top: .7rem; }
.cal-legend span { display: inline-flex; gap: .35rem; align-items: center; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.libero { background: var(--ok); } .sw.quasi { background: var(--warn); } .sw.pieno { background: var(--bad); } .sw.chiuso { background: var(--line); }

/* Slot orari */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .5rem; }
.slot { padding: .6rem .3rem; border-radius: var(--radius-sm); border: 1px solid rgba(95, 174, 110, .45); background: var(--ok-bg); color: var(--text); font: 600 .92rem var(--sans); cursor: pointer; text-align: center; }
.slot small { display: block; font-weight: 500; font-size: .66rem; color: var(--text-2); }
.slot.occupato, .slot.bloccato, .slot.passato, .slot.nofit { background: var(--surface-2); border-color: var(--line); color: var(--muted); cursor: not-allowed; text-decoration: line-through; }
.slot.nofit { text-decoration: none; }
.slot.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.slot.sel small { color: #fff; }

/* Chat WhatsApp */
.wa-chat { background: #0b141a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M10 10h4v4h-4zM50 40h3v3h-3zM30 65h2v2h-2z' fill='%23ffffff' fill-opacity='.03'/%3E%3C/svg%3E"); border-radius: var(--radius); padding: .8rem; display: flex; flex-direction: column; gap: .4rem; min-height: 300px; }
.wa-day { align-self: center; background: #182229; color: #8696a0; font-size: .72rem; padding: .2rem .6rem; border-radius: 7px; margin: .4rem 0; }
.bubble { max-width: 85%; padding: .45rem .65rem .3rem; border-radius: 9px; font-size: .9rem; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; color: #e9edef; position: relative; }
.bubble.in { align-self: flex-start; background: #202c33; border-top-left-radius: 2px; }
.bubble.out { align-self: flex-end; background: #005c4b; border-top-right-radius: 2px; }
.bubble .meta { display: block; text-align: right; font-size: .66rem; color: #8696a0; margin-top: .15rem; }
.bubble .meta .ticks.letto { color: #53bdeb; }
.wa-head { display: flex; align-items: center; gap: .7rem; background: #202c33; padding: .6rem .8rem; border-radius: var(--radius) var(--radius) 0 0; }
.wa-head img { width: 38px; height: 38px; border-radius: 50%; background: #0a0a0a; object-fit: contain; padding: 3px; }
.wa-head + .wa-chat { border-top-left-radius: 0; border-top-right-radius: 0; }
.wa-input { display: flex; gap: .5rem; margin-top: .5rem; }
.wa-input input { border-radius: 999px; background: #2a3942; border-color: #2a3942; }
.wa-input button { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex: none; }

/* Timeline interventi */
.timeline { position: relative; padding-left: 1.4rem; }
.timeline::before { content: ''; position: absolute; left: .45rem; top: .3rem; bottom: .3rem; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: .8rem; }
.tl-item::before { content: ''; position: absolute; left: -1.22rem; top: 1.1rem; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }

/* Tabella dettagli */
.det { width: 100%; border-collapse: collapse; font-size: .9rem; }
.det td { padding: .55rem .2rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.det td:first-child { color: var(--text-2); width: 42%; }
.det tr:last-child td { border-bottom: 0; }

.empty { text-align: center; color: var(--muted); padding: 1.6rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.kpi { font: 700 1.9rem var(--serif); color: var(--text); }
.qr-box svg { width: 100%; height: auto; background: #fff; border-radius: 8px; display: block; }

.demo-banner { background: repeating-linear-gradient(45deg, #2b2621, #2b2621 10px, #241f1b 10px, #241f1b 20px); color: var(--text-2); font-size: .75rem; text-align: center; padding: .3rem .6rem; }
.demo-banner a { color: var(--accent-2); }

/* ---------- tema "officina scura" ---------- */
body { background: radial-gradient(1200px 600px at 50% -200px, rgba(252, 132, 0, .10), transparent 70%), var(--bg); background-attachment: fixed; }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(252, 132, 0, .28); }
.btn.primary:hover { filter: brightness(1.06); }
.card { border-top-color: color-mix(in srgb, var(--line) 60%, #fff 8%); }

/* Grafico dello storico chilometri (app cliente, officina e report pubblico) */
.km-chart { width: 100%; height: auto; max-height: 300px; display: block; }
.km-chart .km-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.km-chart .km-ax { fill: var(--muted); font: 500 15px var(--sans); }
.km-chart .km-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.km-chart .km-dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2.5; }
.km-chart .km-dot.intervento { fill: var(--accent); }
.km-chart-empty { padding: 1.2rem; text-align: center; color: var(--muted); font-size: .9rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.km-legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--muted); margin-top: .4rem; flex-wrap: wrap; }
.km-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); margin-right: .3rem; vertical-align: -1px; }
.km-legend i.full { background: var(--accent); }
.km-ok { color: var(--ok); font-weight: 600; }
.km-bad { color: var(--bad); font-weight: 600; }

/* Foto di esempio del modello (Wikimedia Commons) al posto della sagoma */
.fa { display: block; position: relative; }
.fa svg { display: block; }
.fa.fa-ok img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fa-credit { position: absolute; left: 0; right: 0; bottom: 0; font-size: .62rem; line-height: 1.3; padding: .15rem .4rem; background: rgba(0,0,0,.62); color: #e6e6e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
a.fa-credit:hover { text-decoration: underline; color: #fff; }

/* Fascia "nuova versione disponibile" */
.upd-bar { position: fixed; left: 16px; right: 16px; margin: 0 auto; max-width: 460px; justify-content: space-between; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 1000; display: flex; align-items: center; gap: .8rem; padding: .6rem .7rem .6rem 1rem; background: var(--surface-2); border: 1px solid var(--accent); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: .9rem; }

/* Requisiti password sotto la casella (staccati dal bordo, senza doppio pallino) */
.pwreq { list-style: none; margin: .1rem 0 0; padding: 0; display: grid; gap: .1rem; line-height: 1.35; }
/* Su telefoni e tablet lo sfondo "fisso" fa ridisegnare la pagina mentre si scorre (iOS): lo lasciamo scorrere. */
@media (hover: none) { body { background-attachment: scroll; } }
button.badge { border: 0; font-family: inherit; cursor: pointer; }
button.badge:hover { filter: brightness(1.15); }
