:root {
  --blu: #1d4f91; --blu2: #2b6cb0; --bg: #f3f5f9; --card: #fff; --bordo: #d9dfe8; --testo: #1f2933; --muted: #6b7280;
  --ok: #157347; --warn: #b45309; --rosso: #b91c1c; --giallo: #fff3cd;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--testo); background: var(--bg); line-height: 1.45; }
a { color: var(--blu2); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
header.top { background: var(--blu); color: #fff; }
header.top .wrap { display: flex; align-items: center; gap: 22px; min-height: 54px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.brand span { font-weight: 300; }
.brand.big { color: var(--blu); font-size: 26px; margin-bottom: 4px; display: block; }
header nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
header nav a { color: #dbe6f7; text-decoration: none; padding: 8px 12px; border-radius: 6px; }
header nav a.on, header nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.chi { font-size: 14px; color: #dbe6f7; display: flex; gap: 10px; align-items: center; }
.chi a { color: #fff; text-decoration: none; }
button.link { background: none; border: 0; color: #dbe6f7; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
main { padding: 20px 20px 60px; }
footer.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
h1 { font-size: 24px; margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 14px; color: var(--blu); }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #e7f6ec; border-color: #b7e1c4; color: #14532d; }
.flash.err { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.flash.warn { background: var(--giallo); border-color: #f0d58c; color: #7a5200; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.bottom { justify-content: flex-end; margin-top: 8px; }
.card { background: var(--card); border: 1px solid var(--bordo); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.form label { display: block; font-size: 13px; color: #374151; margin-bottom: 10px; }
.form label.inline { display: flex; align-items: center; gap: 8px; }
.form label.inline input { width: auto; margin: 0; }
.form input, .form select, .form textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--bordo); border-radius: 6px; font: inherit; font-size: 15px; background: #fff; }
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid #bcd3f5; border-color: var(--blu2); }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.form .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.form .errore { color: var(--rosso); font-size: 12px; margin-top: 3px; }
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--bordo); background: #fff; color: var(--testo); border-radius: 6px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: #b9c3d3; background: #f8fafc; }
.btn.primary { background: var(--blu2); border-color: var(--blu2); color: #fff; }
.btn.primary:hover { background: var(--blu); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 8px; font-size: 13px; }
.btn.danger { color: var(--rosso); }
.btn.danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn[disabled] { opacity: .5; cursor: default; }
.mini { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.mini:hover { color: var(--blu); }
.mini.del:hover { color: var(--rosso); }
.filtri { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filtri input, .filtri select { padding: 8px 10px; border: 1px solid var(--bordo); border-radius: 6px; font: inherit; font-size: 14px; background: #fff; }
.filtri input[type=search] { min-width: 240px; flex: 1; }
.tabella-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--bordo); border-radius: 10px; }
table.lista { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lista th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--bordo); background: #fafbfd; white-space: nowrap; }
table.lista td { padding: 10px 12px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
table.lista tr:last-child td { border-bottom: 0; }
table.lista tr.click { cursor: pointer; }
table.lista tr.click:hover td { background: #f8fafc; }
.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.azioni { white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #e5e7eb; color: #374151; font-weight: 500; white-space: nowrap; }
.badge.s-bozza { background: #e0e7ff; color: #3730a3; }
.badge.s-inviato { background: #dbeafe; color: #1e40af; }
.badge.s-accettato { background: #dcfce7; color: #166534; }
.badge.s-perso { background: #fee2e2; color: #991b1b; }
.badge.s-scaduto { background: #fef3c7; color: #92400e; }
.badge.warn { background: var(--giallo); color: #7a5200; border: 1px solid #f0d58c; font-weight: 700; }
.badge.cat { background: #eef3fa; color: var(--blu); }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.login { width: 100%; max-width: 420px; }
.chip { border: 1px solid var(--bordo); background: #f8fafc; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--blu2); color: var(--blu2); }
.chip.on { background: var(--blu2); color: #fff; border-color: var(--blu2); }
/* cruscotto */
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi .k { background: #fff; border: 1px solid var(--bordo); border-radius: 10px; padding: 12px 14px; }
.kpi .k b { display: block; font-size: 26px; color: var(--blu); font-variant-numeric: tabular-nums; }
.kpi .k span { font-size: 13px; color: var(--muted); }
/* editor */
.cliente-box { display: flex; gap: 12px; align-items: flex-start; }
.suggerimenti { position: absolute; z-index: 20; background: #fff; border: 1px solid var(--bordo); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); width: 100%; max-height: 320px; overflow: auto; }
.suggerimenti div { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f1f4f8; font-size: 14px; }
.suggerimenti div:hover { background: #f3f7fd; }
.suggerimenti small { color: var(--muted); display: block; }
.rel { position: relative; }
table.righe { width: 100%; border-collapse: collapse; font-size: 14px; }
table.righe th { text-align: left; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--bordo); background: #fafbfd; }
table.righe td { padding: 6px 4px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
table.righe input, table.righe select, table.righe textarea { margin: 0; padding: 6px 8px; font-size: 14px; }
table.righe td.foto { width: 64px; }
table.righe td.foto img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--bordo); border-radius: 4px; background: #fff; }
table.righe td.foto .foto-up { display: block; margin-top: 4px; font-size: 11px; color: var(--blu); cursor: pointer; text-align: center; white-space: nowrap; }
table.righe td.foto .foto-up input { display: none; }
table.righe td.foto .foto-up.off, table.righe td.foto .foto-carico { display: none; }
table.righe td.foto .foto-carico.on { display: block; cursor: default; }
table.righe td.foto .foto-del { display: block; margin: 0 auto; font-size: 11px; white-space: nowrap; }
table.righe .w-q { width: 64px; text-align: right; }
table.righe .w-p { width: 110px; text-align: right; }
table.righe .w-s { width: 130px; }
table.righe td.tot { padding-top: 12px; font-weight: 600; white-space: nowrap; }
table.righe label.extra { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 4px; font-size: 11px; color: var(--muted); }
table.righe label.extra input { padding: 3px 6px; font-size: 12px; width: 74px; }
table.righe .extra-tot { margin-top: 6px; font-size: 11px; font-weight: 400; color: var(--muted); }
table.righe .extra-tot s { opacity: .75; }
table.righe tr.opz td { background: #eef3fa; color: var(--blu); font-weight: 700; padding: 8px; }
.totali { display: flex; gap: 24px; justify-content: flex-end; padding: 12px 8px 0; font-size: 15px; flex-wrap: wrap; }
.totali b { color: var(--blu); }
.condizione { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #eef1f5; align-items: start; }
.condizione textarea { width: 100%; min-height: 44px; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--bordo); border-radius: 6px; }
.condizione .tipo { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--blu); font-weight: 700; }
.foto-art { width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--bordo); border-radius: 8px; background: #fff; }
.thumb { width: 44px; height: 44px; object-fit: contain; border: 1px solid var(--bordo); border-radius: 4px; background: #fff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bordo); margin-bottom: 14px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--blu); border-color: var(--blu); font-weight: 600; }
.log { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
[wire\:loading] { opacity: .6; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd5e1; border-top-color: var(--blu2); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* finestra modale (invio email dal preventivo) */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; padding: 20px 24px 22px; box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.modal .row { margin-top: 4px; }
.avviso-bg { align-items: center; z-index: 70; }
.modal.avviso { max-width: 560px; border-left: 6px solid; font-size: 15px; line-height: 1.45; }
.modal.avviso h2 { margin: 0 0 8px; font-size: 17px; }
.modal.avviso-ok { border-left-color: #22c55e; }
.modal.avviso-ok h2 { color: #14532d; }
.modal.avviso-err { border-left-color: #ef4444; }
.modal.avviso-err h2 { color: #7f1d1d; }
.modal.avviso .avviso-testo { white-space: pre-line; overflow-wrap: anywhere; }
.modal.avviso .avviso-testo + .avviso-testo { margin-top: 10px; }
.modal.avviso .avviso-testo a { color: var(--blu); }
