:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e2e7ef;
  --text: #1b2333;
  --muted: #667085;
  --primary: #1d4ed8;
  --primary-soft: #e8eefc;
  --danger: #c62828;
  --side: #121a2b;
  --side-text: #c6cfdf;
  --aperto: #1d4ed8; --aperto-bg: #e5edff;
  --sospeso: #a15c00; --sospeso-bg: #fff1d6;
  --chiuso: #1e7b45; --chiuso-bg: #dff4e7;
  --radius: 8px;
  font-size: 14px;
}
* { box-sizing: border-box; }
/* il body cresce con la pagina (non height: 100%), cosi' la barra laterale "sticky" resta ferma per tutto lo scorrimento */
html { height: 100%; }
body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  display: grid; grid-template-columns: auto 1fr; min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- sidebar */
.sidebar { background: var(--side); color: var(--side-text); padding: 18px 20px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; }
.brand-logo { width: 36px; height: 36px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; font-weight: 700; }
.brand small { display: block; color: var(--side-text); font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { color: var(--side-text); padding: 9px 12px; border-radius: 6px; }
nav a:hover { background: #1f2a40; color: #fff; text-decoration: none; }
nav a.active { background: var(--primary); color: #fff; }
/* sotto-menu: il titolo apre al click un pannello a comparsa alla destra della barra */
.sidebar { z-index: 30; }
.nav-gruppo { position: relative; }
nav .nav-titolo { display: flex; justify-content: space-between; align-items: center; width: 100%; font: inherit; text-align: left;
  color: var(--side-text); background: none; border: 0; padding: 9px 12px; border-radius: 6px; cursor: pointer; user-select: none; }
nav .nav-titolo::after { content: "›"; font-size: 16px; line-height: 1; transition: transform .15s; }
nav .nav-titolo:hover, .nav-gruppo.aperto > .nav-titolo { background: #1f2a40; color: #fff; }
.nav-gruppo.contiene-attivo > .nav-titolo { color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.nav-sub { display: none; position: absolute; left: calc(100% + 14px); top: 0; min-width: 200px; flex-direction: column; gap: 2px;
  background: var(--side); border: 1px solid #2c3a55; border-radius: 8px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35); z-index: 50; }
.nav-gruppo.aperto > .nav-sub { display: flex; }
nav a.sub { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
/* CashControl (ex SEACloud): sotto Utilità, la scritta come il logo: CASH sopra, CONTROL rosso, carattere pieno e largo
   (sul blu della barra il nero del logo diventa bianco) */
nav a.nav-seacloud { display: flex; align-items: center; justify-content: center; margin-top: 12px; padding: 8px 10px;
  border: 1.5px solid #e3262e; border-radius: 8px; background: transparent; color: #fff; }
nav a.nav-seacloud:hover { background: rgba(227, 38, 46, .14); color: #fff; }
nav a.nav-seacloud.active { background: rgba(227, 38, 46, .26); color: #fff; box-shadow: 0 0 0 1px #e3262e; }
.cc-marchio { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: .92;
  font-family: "Arial Black", "Arial Bold", Arial, Helvetica, sans-serif; font-weight: 900; text-transform: uppercase; }
.cc-cash { font-size: 19px; letter-spacing: .02em; color: #fff; }
.cc-control { font-size: 15px; letter-spacing: .01em; color: #ff2a33; }
/* Licenze SEACassa: sotto CashControl, stessa forma (SEA bianco, CASSA rosso) e la parola Licenze */
nav a.nav-seacassa { margin-top: 8px; }
.sc-licenze { margin-top: 2px; font: 600 10px/1 system-ui, sans-serif; letter-spacing: .14em; color: #c9d3e0; }
/* Avviso sul pulsante SEA CASSA: licenze in scadenza (arancio) o scadute (rosso) */
nav a.nav-seacassa { position: relative; overflow: visible; }
.sc-allarme { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #f59e0b; color: #fff; font: 700 12px/22px system-ui, sans-serif; text-align: center; box-shadow: 0 0 0 2px #0f1b2d;
  animation: sc-pulsa 2s ease-in-out infinite; }
.sc-allarme.scadute { background: #e3262e; }
@keyframes sc-pulsa { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .sc-allarme { animation: none; } }
.seacloud-logo { flex: none; width: 22px; height: 22px; border-radius: 6px; background: #0b6bcb center/100% no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 21a6 6 0 0 1 3-11 8 8 0 0 1 14 3 4 4 0 0 1-1 8z' fill='white'/%3E%3C/svg%3E"); }
.cl-attivo { background: var(--chiuso-bg); color: var(--chiuso); }
.cl-dismesso { background: #f2f4f7; color: #667085; }
label.spunta { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.sidebar-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar .btn:not(.primary) { background: #1f2a40; color: #fff; border-color: #2c3a55; }

main { padding: 24px 28px 60px; min-width: 0; }

/* ---------- elementi comuni */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

.btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 14px;
  border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c3d3; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1a43bd; }
.btn.danger { color: var(--danger); }
.btn.warn { color: var(--sospeso); }
.btn.ok { color: var(--chiuso); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 18px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
/* Tabelle e Backup: tecnici, tipi, marche e modelli in una sola scheda a linguette */
.tabelle-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); }
.tabelle-azioni { display: flex; align-items: center; gap: 8px; }
.tabelle-azioni input[type=search] { width: 220px; }
.tabelle-pannello { max-height: 440px; overflow: auto; }
.tabelle-pannello thead th { position: sticky; top: 0; z-index: 1; }
.tabelle-pannello tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) { .tabelle-azioni, .tabelle-azioni input[type=search] { width: 100%; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text);
  border-left: 4px solid var(--border); }
.kpi:hover { text-decoration: none; border-color: #b9c3d3; }
.kpi .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi.aperto { border-left-color: var(--aperto); }
.kpi.sospeso { border-left-color: var(--sospeso); }
.kpi.chiuso { border-left-color: var(--chiuso); }
.kpi.alert { border-left-color: var(--danger); }

.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 20px; }
.info div > span { display: block; font-size: 12px; color: var(--muted); }
.info div > b { font-weight: 500; white-space: pre-wrap; }
.info .wide { grid-column: 1 / -1; }
.testo { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 4px 0 0; }

/* ---------- badge */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-aperto { background: var(--aperto-bg); color: var(--aperto); }
.st-sospeso { background: var(--sospeso-bg); color: var(--sospeso); }
.st-chiuso { background: var(--chiuso-bg); color: var(--chiuso); }
.st-lavorazione { background: #ffedd5; color: #9a3412; }
.st-annullato { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.alert-box.annullata { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.pr-urgente { background: #fde2e2; color: #b42318; }
.pr-alta { background: #ffe9d5; color: #b54708; }
.pr-normale { background: #eef2f6; color: #475467; }
.pr-bassa { background: #f2f4f7; color: #98a2b3; }
.tag { display: inline-block; background: #eef2f6; color: #475467; padding: 1px 7px; border-radius: 4px; font-size: 12px; }

/* ---------- tabelle */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: #fafbfd; white-space: nowrap; }
tbody tr[data-href] { cursor: pointer; }
tbody tr[data-href]:hover { background: #f5f8ff; }
tbody tr:last-child td { border-bottom: 0; }
td .sec { display: block; color: var(--muted); font-size: 12px; }
td.num, th.num { text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- filtri */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { min-width: 280px; flex: 1; max-width: 420px; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 3px; gap: 2px; }
.tabs button { font: inherit; border: 0; background: none; padding: 5px 12px; border-radius: 5px; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tabs button .c { font-size: 11px; margin-left: 4px; opacity: .8; }

/* ---------- form */
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cfd6e2; border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd0ff; border-color: var(--primary); }
.filters input, .filters select { width: auto; }
textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.field { grid-column: span 6; display: flex; flex-direction: column; gap: 4px; }
.field.s2 { grid-column: span 2; } .field.s3 { grid-column: span 3; } .field.s4 { grid-column: span 4; } .field.s8 { grid-column: span 8; } .field.s12 { grid-column: span 12; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field label .req { color: var(--danger); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check input { width: auto; }
.form-sep { grid-column: span 12; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cerca-disp { position: relative; }
.cerca-cliente { position: relative; margin-bottom: 6px; }
.cerca-risultati { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(16,24,40,.12); z-index: 5; max-height: 260px; overflow: auto; }
.cerca-risultati button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--border); }
.cerca-risultati button:hover { background: #f5f8ff; }
.cerca-risultati small { color: var(--muted); display: block; }

/* ---------- modale */
.overlay { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; }
.modal .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form-err { background: #fde2e2; color: #912018; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; display: none; }
.form-err.show { display: block; }

/* ---------- toast */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1b2333; color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 420px; }
.toast.err { background: var(--danger); }

/* ---------- timeline storico */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.timeline li.aperto::before { background: var(--aperto); }
.timeline li.sospeso::before { background: var(--sospeso); }
.timeline li.chiuso::before { background: var(--chiuso); }
.timeline .when { color: var(--muted); font-size: 12px; }
.alert-box { background: var(--sospeso-bg); color: #7a4500; border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }

/* ---------- verificazioni periodiche */
.vp { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.vp-ok { background: var(--chiuso-bg); color: var(--chiuso); }
.vp-in_scadenza { background: #ffe9c2; color: #8a4b00; }
.vp-scaduta, .vp-negativa { background: #fde2e2; color: #b42318; }
.vp-dismesso { background: #eceff3; color: #5b6472; font-weight: 500; }
.vp-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; padding: 14px 16px; border-radius: 8px;
  margin-bottom: 14px; border: 2px solid var(--border); background: #f8fafc; }
.vp-box span { display: block; font-size: 12px; color: var(--muted); }
.vp-box b { font-size: 20px; display: block; }
.vp-box small { color: var(--muted); }
.vp-box.vp-ok { border-color: #9fd8b6; background: var(--chiuso-bg); }
.vp-box.vp-in_scadenza { border-color: #f0a23c; background: #fff4e0; }
.vp-box.vp-scaduta, .vp-box.vp-negativa { border-color: #e5484d; background: #fdecec; animation: lampeggio 1.6s ease-in-out 3; }
.vp-box.vp-in_scadenza small, .vp-box.vp-scaduta small, .vp-box.vp-negativa small { color: inherit; font-weight: 600; }
@keyframes lampeggio { 50% { box-shadow: 0 0 0 5px rgba(229, 72, 77, .25); } }

.avvisi-bar { background: #fff4e0; border: 1px solid #f0a23c; color: #6b3a00; padding: 9px 14px; border-radius: 7px; margin-bottom: 16px; }
.avvisi-bar.grave { background: #fdecec; border-color: #e5484d; color: #8f1d1d; }
.avvisi-bar a { color: inherit; text-decoration: underline; }
.nav-badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #f0a23c; color: #fff; font-size: 11px;
  font-weight: 700; text-align: center; margin-left: 4px; }
.nav-badge.grave { background: #e5484d; }
/* chiamate da assegnare: pallino rosso lampeggiante accanto a "Chiamate" */
.nav-allarme { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; margin-left: 8px;
  vertical-align: middle; box-shadow: 0 0 0 0 rgba(239, 68, 68, .7); animation: lampeggia 1.2s ease-in-out infinite; }
@keyframes lampeggia {
  0% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, .7); }
  50% { opacity: .35; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@media (prefers-reduced-motion: reduce) { .nav-allarme { animation: none; } }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.sec-note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.info .sec { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

/* ---------- QR Agenzia Entrate */
.qr-zona { border: 2px dashed #c4cede; border-radius: 8px; padding: 16px; text-align: center; margin-bottom: 14px; background: #fafbfd; }
.qr-zona.over { border-color: var(--primary); background: var(--primary-soft); }
.qr-azioni { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.qr-azioni label.btn { display: inline-block; }
.qr-hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.qr-zona video { width: 100%; max-width: 420px; margin-top: 12px; border-radius: 6px; background: #000; }
.qr-stato { margin-top: 8px; font-weight: 600; color: var(--primary); min-height: 1em; }
.ade-box { border: 1px solid #b8cdf3; background: #f3f7ff; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.ade-titolo { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); margin-bottom: 10px; }
.ok-box { background: var(--chiuso-bg); color: #145c33; border-radius: 6px; padding: 10px 12px; }
.form-grid .form-grid { grid-column: 1 / -1; }
[hidden] { display: none !important; }

/* ---------- accesso e utenti */
body.schermata-accesso { grid-template-columns: 1fr; }
body.schermata-accesso .sidebar, body.schermata-accesso #avvisi, body.schermata-accesso #licenza-bar { display: none; }
.accesso { min-height: 80vh; display: grid; place-items: center; }
.accesso-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px 30px; width: 100%; max-width: 400px;
  box-shadow: 0 10px 30px rgba(16,24,40,.08); }
.accesso-card h1 { margin: 18px 0 14px; }
.accesso-card .field { margin-bottom: 12px; }
.accesso-brand { color: var(--text); padding: 0; }
.accesso-brand small { color: var(--muted); }
.utente-box { border-top: 1px solid #2c3a55; padding-top: 10px; margin-top: 4px; color: #fff; }
.utente-nome small { display: block; color: var(--side-text); font-size: 12px; }
.utente-azioni { display: flex; gap: 6px; margin-top: 8px; }
.sidebar .utente-azioni .btn { flex: 1; padding: 4px 6px; }
.perm-barra { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.perm-barra span { color: var(--muted); }
.perm-gruppo { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.perm-gruppo h3 { margin: 0 0 6px; }
.scelta.perm { align-items: flex-start; font-weight: 400; padding: 3px 0; }
.scelta.perm input { margin-top: 3px; }
.ruolo-amministratore { background: #fde2e2; color: #b42318; }
.ruolo-supervisor { background: #ede4ff; color: #5b2fb3; }
.ruolo-tecnico { background: var(--aperto-bg); color: var(--aperto); }
.ruolo-amministrazione { background: var(--chiuso-bg); color: var(--chiuso); }

/* ---------- chiamata chiusa con intervento generato */
.st-intervento { background: #ede4ff; color: #5b2fb3; margin-top: 3px; }
.int-box { background: #f3edff; border: 1px solid #c9b3f5; color: #3e1f86; border-radius: 7px; padding: 10px 14px; margin-bottom: 16px; }

/* ---------- modulo rapportino */
.rapp-cliente { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; }
.rapp-cliente .sec { display: block; color: var(--muted); font-size: 12px; }
.scelte { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.scelta { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.scelta input { width: auto; }
.lavori { gap: 6px; }
.riga-ric { display: grid; grid-template-columns: 1fr 110px 90px 70px 130px 90px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
.riga-costo { flex-direction: row; display: grid; grid-template-columns: 1fr 110px 90px 70px 90px 32px; gap: 6px; align-items: center; }
.riga-costo .lbl-costo { font-weight: 600; }
.tot { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.totali-rapp { flex-direction: row; display: flex; justify-content: flex-end; gap: 22px; align-items: center; flex-wrap: wrap;
  background: #f8fafc; border-radius: 6px; padding: 8px 12px; }
.totali-rapp label { display: flex; align-items: center; gap: 6px; }
.riga-agg { display: grid; grid-template-columns: 1fr 110px 90px 70px 130px 90px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
.disp-ric { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; font-size: 12px; margin-top: -2px; }
.disp-ric:empty { display: none; }
.disp-ric .ok { color: #1b7f3b; } .disp-ric .ko { color: var(--danger); }
.riga-ric.ric-ko input { border-color: var(--danger); background: #fffafa; }
.box-aggiuntivi { background: #f6f8fc; border: 1px dashed #b9c3d6; border-radius: 8px; padding: 10px 12px; }
@media (max-width: 860px) { .riga-ric, .riga-costo, .riga-agg { grid-template-columns: 1fr 1fr; } }
/* pratica di installazione: dispositivi installati nel rapportino e scelta del cliente */
.riga-inst { display: grid; grid-template-columns: 170px 1fr 1fr 140px 140px 1fr 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 860px) { .riga-inst { grid-template-columns: 1fr 1fr; } .riga-inst [data-togli-inst] { justify-self: end; } }
.riga-inst [data-k=negozio_id] { grid-column: 1 / -1; max-width: 420px; }
.inst-clienti { width: 100%; margin-top: 6px; }
.tag.tag-inst { background: #dcfce7; color: #166534; }

/* ---------- rapportino stampabile (modello "Rapporto di intervento polivalente") */
.rp { --rp-blu: #7b86c9; --rp-rosa: #f7dde5; --rp-testo: #3a3f8f; --rp-rosso: #e52b2b;
  background: #fff; width: 200mm; margin: 0 auto; padding: 6mm; font: 8.8pt/1.2 Arial, Helvetica, sans-serif; color: #111;
  border: 1px solid var(--border); }
.rp-intestazione { width: 100%; display: block; margin-bottom: 2mm; }
.rp-t { width: 100%; border-collapse: collapse; margin-bottom: 1.2mm; table-layout: fixed; }
.rp-t td { border: 1px solid var(--rp-blu); padding: 0.7mm 1.6mm; vertical-align: top; background: #fff; overflow-wrap: anywhere; }
.rp-l, .rp-h td, .rp-h.rp-hcell, td.rp-h { color: var(--rp-testo); font-weight: 700; }
.rp-l { margin-right: 2mm; }
.rp-h td, td.rp-h, .rp-hcell { background: var(--rp-rosa) !important; }
.rp-titolo td { vertical-align: middle; height: 7.5mm; white-space: nowrap; }
.rp-titolo .rp-rosso { background: var(--rp-rosso); color: #fff; font-weight: 700; font-size: 10.5pt; width: 44%; border-color: var(--rp-rosso); }
.rp-titolo .rp-num { width: 20%; color: var(--rp-testo); font-size: 10pt; }
.rp-titolo .rp-num b { color: var(--rp-rosso); font-size: 11pt; }
.rp-titolo .rp-data { width: 15%; }
.rp-ana td { background: linear-gradient(#fff, #fdf2f5) !important; height: 5mm; }
.rp-app tr:not(.rp-h) td { height: 5mm; }
.rp-w20 { width: 20%; } .rp-w30 { width: 30%; } .rp-w36 { width: 36%; }
.rp-c { text-align: center; width: 12%; }
.rp-box2 { height: 12mm; white-space: pre-wrap; }
.rp-lavori .rp-note { white-space: pre-wrap; }
.rp-voce { margin: 0.4mm 0; }
.rp-cb { display: inline-block; width: 3.6mm; height: 3.6mm; border: 1.2px solid var(--rp-rosso); vertical-align: -0.7mm;
  text-align: center; line-height: 3.4mm; font-size: 9pt; font-weight: 700; color: #000; margin-right: 1mm; }
.rp-ricambi td { height: 5mm; }
.rp-ricambi tr:not(.rp-h) td:first-child { width: 46%; }
.rp-ricambi .rp-h td { font-size: 8pt; }
.rp .num { text-align: right; white-space: nowrap; }
.rp-basso > tbody > tr > td { padding: 0; border: 0; }
.rp-pag { width: 38%; padding: 0 2mm 0 0 !important; }
.rp-pag > .rp-hcell { padding: 0.7mm 1.6mm; border-bottom: 1px solid var(--rp-blu); }
.rp-regime td { white-space: nowrap; vertical-align: middle; }
.rp-pag > .rp-voce { padding: 0 2mm; }
.rp-pag { border: 1px solid var(--rp-blu) !important; }
.rp-banca { padding-left: 6mm !important; }
.rp-costi { padding: 0 0 0 2mm !important; }
.rp-in { margin: 0; }
.rp-in td { height: 5mm; font-size: 8.5pt; }
.rp-in td.rp-h { width: 36%; font-size: 8pt; }
.rp-dx { text-align: right; }
.rp-ora { border: 1.5px solid var(--rp-rosso) !important; }
.rp-ora .rp-l { color: var(--rp-testo); }
.rp-totale { background: var(--rp-rosa) !important; font-weight: 700; }
.rp-esito td { vertical-align: middle; font-size: 8pt; white-space: nowrap; }
.rp-esito .rp-c { width: 13%; }
.rp-doc { height: 9mm; }
.rp-firme td { height: 18mm; width: 50%; position: relative; }
.rp-linea { position: absolute; left: 40%; right: 4mm; bottom: 3mm; border-bottom: 1px solid #333; }
.rp-firme td:has(.rp-firma) { height: 26mm; }
.rp-firma { position: absolute; left: 30%; right: 3mm; top: 1mm; bottom: 5mm; width: 68%; height: calc(100% - 6mm); object-fit: contain; }
.rp-firmato { position: absolute; left: 1.6mm; bottom: 0.8mm; font-size: 7pt; color: #666; }

@media print {
  @page { size: A4; margin: 6mm; }
  body { display: block; background: #fff; }
  .sidebar, .no-print, #toast-root, #avvisi, #modal-root { display: none !important; }
  main { padding: 0; }
  .rp { border: 0; padding: 0; width: auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.btn-menu { display: none; }

/* ---------- tablet in verticale e schermi stretti */
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  /* barra in alto compatta; il menu si apre con il pulsante */
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; padding: 8px 14px; gap: 0; }
  .brand { justify-content: space-between; }
  .brand small { display: none; }
  .btn-menu { display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; width: 46px; height: 42px; margin-left: auto;
    background: #1f2a40; border: 1px solid #2c3a55; border-radius: 8px; cursor: pointer; padding: 0 11px; }
  .btn-menu span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
  body.menu-aperto .btn-menu span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-aperto .btn-menu span:nth-child(2) { opacity: 0; }
  body.menu-aperto .btn-menu span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .sidebar nav, .sidebar .sidebar-actions { display: none; }
  body.menu-aperto .sidebar { max-height: 100vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
  body.menu-aperto .sidebar nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 10px; }
  nav a.nav-seacloud { grid-column: 1 / -1; margin-top: 6px; }
  body.menu-aperto .sidebar .sidebar-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
  body.menu-aperto .utente-box { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
  nav a { padding: 12px 14px; font-size: 15px; }
  /* qui il sotto-menu si apre sotto il titolo, a tutta larghezza */
  .nav-gruppo { grid-column: 1 / -1; }
  nav .nav-titolo { padding: 12px 14px; font-size: 15px; }
  .nav-gruppo.aperto > .nav-titolo::after { transform: rotate(90deg); }
  .nav-sub { position: static; min-width: 0; box-shadow: none; margin-top: 4px; }
  .nav-gruppo.aperto > .nav-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .field, .field.s2, .field.s3, .field.s4, .field.s8 { grid-column: span 12; }
  .filters input[type=search] { min-width: 0; width: 100%; max-width: none; }
  .filters > * { flex: 1 1 auto; }
  .filters input[type=search] { flex-basis: 100%; order: -1; }
  .page-head h1 { font-size: 20px; }

  /* elenchi: ogni riga diventa una scheda */
  table.a-schede thead { display: none; }
  table.a-schede, table.a-schede tbody, table.a-schede tr, table.a-schede td { display: block; width: 100%; }
  table.a-schede tr { border-bottom: 1px solid var(--border); padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
  table.a-schede tbody tr:last-child { border-bottom: 0; }
  table.a-schede td { border: 0; padding: 2px 0; text-align: left !important; min-width: 0; }
  table.a-schede td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted);
    text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
  table.a-schede td:first-child { grid-column: 1 / -1; font-size: 15px; }
  table.a-schede td:first-child::before { display: none; }
  table.a-schede td.vuota { display: none; }
  table.a-schede .clip { max-width: none; }
  .table-wrap { overflow-x: visible; }
}

/* ---------- schermi touch: controlli piu' grandi */
@media (pointer: coarse) {
  input, select, textarea { min-height: 44px; font-size: 16px; }
  textarea { min-height: 80px; }
  .btn { min-height: 42px; padding: 9px 16px; }
  .btn.small { min-height: 36px; padding: 6px 12px; }
  .tabs button { padding: 9px 14px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; }
  .scelta { padding: 6px 0; min-height: 36px; }
  .modal .x { font-size: 30px; padding: 4px 10px; }
  .modal footer .btn { min-width: 110px; }
  .riga-ric input, .riga-costo input { min-height: 40px; }
}

/* ---------- check-list VP */
.griglia-scelte { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
@media (max-width: 860px) { .griglia-scelte { grid-template-columns: 1fr; } }

/* ---------- magazzino */
.qta-bassa { color: var(--danger); }
.qta-uscita { color: #b42318; font-weight: 600; }
.qta-entrata { color: var(--chiuso); font-weight: 600; }
.copia { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; margin: 4px 0; }
.copia input { width: 360px; max-width: 100%; font-size: 12px; padding: 4px 6px; }
.passi { padding-left: 18px; margin: 0; }
.passi li { margin-bottom: 10px; }

/* ---------- calendario degli interventi */
.cal-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.cal-nav, .cal-schede { display: flex; gap: 4px; }
.cal-titolo { font-size: 15px; margin-right: auto; }
.cal-barra select { width: auto; max-width: 100%; font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.cal-griglia { display: grid; grid-template-columns: repeat(var(--giorni), minmax(0, 1fr)); gap: 8px; }
.cal-giorno { background: var(--bg); border-radius: var(--radius); padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-giorno.oggi { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.cal-giorno.passato { opacity: .75; }
.cal-data { font-size: 13px; color: var(--muted); }
.cal-data b { color: var(--text); font-size: 16px; }
.cal-data em { font-style: normal; color: var(--primary); font-weight: 600; }
.cal-vuoto { color: var(--muted); font-size: 13px; }
.ev { display: block; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c, #98a2b3); border-radius: 6px;
  padding: 6px 8px; color: var(--text); font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
a.ev:hover { text-decoration: none; border-color: #b9c3d3; border-left-color: var(--c, #98a2b3); }
.ev-ora { font-weight: 600; font-size: 12px; color: var(--muted); }
.ev-tit { font-weight: 600; }
.ev-sub, .ev-tec { color: var(--muted); font-size: 12px; }
.ev-tec::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #98a2b3); margin-right: 5px; }
.ev-tablet { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 8px; background: var(--surface-2, #eef2ff); color: var(--primary, #1d4ed8); font-size: 11px; font-weight: 600; }
.ev-pr { background: #fde8e8; color: var(--danger); border-radius: 4px; padding: 0 5px; margin-left: 4px; text-transform: uppercase; font-size: 10px; }
.ev.st-chiuso { opacity: .6; } .ev.st-chiuso .ev-tit { text-decoration: line-through; }
.ev.st-sospeso { background: var(--sospeso-bg); }
.ev.t0 { --c: #1d4ed8; } .ev.t1 { --c: #c2410c; } .ev.t2 { --c: #15803d; } .ev.t3 { --c: #7e22ce; }
.ev.t4 { --c: #be123c; } .ev.t5 { --c: #0e7490; } .ev.t6 { --c: #a16207; } .ev.t7 { --c: #4338ca; } .ev.tn { --c: #98a2b3; }
.cal-dp { margin-top: 14px; }
/* piu' settimane una sotto l'altra (pagina Calendario: questa e la prossima) */
.cal-settimana + .cal-settimana { margin-top: 16px; }
.cal-sett-tit { margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.cal-sett-tit b { color: var(--text); font-size: 14px; margin-right: 6px; }
.cal-dp h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-dp h4 span { background: var(--bg); border-radius: 10px; padding: 0 8px; }
.cal-dp-elenco { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cal-google { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
@media (max-width: 860px) {
  .cal-griglia { grid-template-columns: 1fr; }
  .cal-giorno { min-height: 0; }
  .cal-google { height: 480px; }
}
/* schermo del laboratorio: solo il calendario, a tutto schermo e leggibile da lontano */
body.schermo-lab { display: block; }
body.schermo-lab .sidebar, body.schermo-lab #avvisi, body.schermo-lab #licenza-bar { display: none; }
/* tutto nell'altezza dello schermo (un televisore non si scorre); i caratteri crescono con la larghezza (Full HD, 4K) */
body.schermo-lab main { padding: 1vh 1.2vw; max-width: none; height: 100vh; display: flex; flex-direction: column; overflow: hidden;
  font-size: clamp(15px, 1.05vw, 42px); }
body.schermo-lab #view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lab-testa { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: .6em; font-size: 1.2em; }
.lab-ora { font-size: 1.5em; font-weight: 700; }
.lab-testa .btn { font-size: .7em; }
.cal.lab { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal.lab .cal-barra { margin-bottom: .5em; }
.cal.lab .cal-titolo { font-size: 1.15em; }
.cal.lab .cal-multi { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1em; }
.cal.lab .cal-multi.con-dp { grid-template-columns: minmax(0, 1fr) minmax(13em, 16%); }
.cal.lab .cal-settimane { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: .8em; min-height: 0; }
.cal.lab .cal-settimana { display: flex; flex-direction: column; min-height: 0; }
.cal.lab .cal-sett-tit { margin-bottom: .35em; color: var(--muted); font-size: .85em; }
.cal.lab .cal-sett-tit b { color: var(--text); font-size: 1.1em; margin-right: .3em; }
.cal.lab .cal-griglia { flex: 1; min-height: 0; gap: .5em; grid-template-rows: minmax(0, 1fr); } /* il giorno pieno non allunga la riga */
.cal.lab .cal-giorno { min-height: 0; overflow: hidden; padding: .5em; gap: .4em; }
.cal.lab .ev { font-size: 1em; padding: .4em .6em; }
.cal.lab .ev-ora, .cal.lab .ev-sub, .cal.lab .ev-tec { font-size: .85em; }
.cal.lab .ev-pr { font-size: .7em; }
.cal.lab .cal-data { font-size: 1em; } .cal.lab .cal-data b { font-size: 1.45em; }
.cal.lab .cal-dp { margin-top: 0; display: flex; flex-direction: column; min-height: 0; }
.cal.lab .cal-dp h4 { font-size: .95em; }
.cal.lab .cal-dp-elenco { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .5em; overflow: hidden; }
.cal-altri { color: var(--muted); font-weight: 600; font-size: .85em; text-align: center; padding: .2em 0; }
.cal-pagina { margin-top: auto; color: var(--primary); }
.ev[hidden] { display: none; }
/* schermo del laboratorio: calendario a sinistra, chiamate e interventi da programmare a destra */
body.schermo-lab .lab-corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(16em, 27%); gap: 1em; }
.lab-lato { display: flex; flex-direction: column; gap: .7em; min-height: 0; }
.lab-sez { flex: 1 1 0; min-height: 5.5em; display: flex; flex-direction: column; background: var(--bg); border-radius: var(--radius); padding: .5em .6em; }
.lab-sez h4 { margin: 0 0 .4em; font-size: .95em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; }
.lab-sez h4 span { background: var(--surface); border-radius: 1em; padding: 0 .6em; color: var(--text); }
.lab-sez.lab-libere { background: #fdecec; box-shadow: inset 0 0 0 2px #e5484d; }
.lab-sez.lab-libere h4 { color: #b42318; }
.lab-elenco { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .45em; overflow: hidden; }
.cal.lab .ev, .lab-lato .ev { font-size: 1em; padding: .4em .6em; }
.lab-lato .ev-ora, .lab-lato .ev-sub, .lab-lato .ev-tec { font-size: .85em; }
.lab-lato .ev-pr { font-size: .7em; }
.ev-citta { font-weight: 400; color: var(--muted); font-size: .85em; }
.ev-problema { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-riga { display: flex; gap: .6em; align-items: baseline; min-width: 0; }
.ev-riga .ev-problema { flex: 1; min-width: 0; }
.ev-riga .ev-tec { flex: none; white-space: nowrap; }
.lab-lato .ev-tit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.evc.pr-urgente { border-left-color: #e5484d; background: #fff5f5; }
.ev.evc.pr-alta { border-left-color: #f59e0b; }
.lab-numeri { display: flex; gap: .6em; flex-wrap: wrap; justify-content: center; }
.lab-num { background: var(--bg); border-radius: 2em; padding: .15em .8em; font-size: .85em; }
.lab-num b { font-size: 1.25em; margin-right: .2em; }
.lab-num.avviso { background: #fff4e5; color: #9a3412; }
.lab-num.allarme { background: #e5484d; color: #fff; }
.lab-num.ok { background: #e8f5ec; color: #166534; }
/* area "Il mio account" e istruzioni passo passo */
.passi { padding-left: 20px; line-height: 1.55; }
.passi li { margin-bottom: 6px; }
.copia-riga { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; background: var(--bg); padding: 6px 10px; border-radius: 6px; }
.copia-riga .mono { overflow-wrap: anywhere; }

/* foto degli articoli (scattate con l'app del magazzino) */
.foto-articolo { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.foto-articolo img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
/* seriali dei pezzi nella scheda articolo */
.seriali-agg { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seriali-agg input { flex: 1 1 280px; min-width: 0; width: auto; }
.seriali-agg select { flex: 0 1 220px; width: auto; }
.seriali-scelta { max-height: 180px; overflow: auto; }

/* ---------- revisione per la fatturazione */
.fatt-dash { border-top: 3px solid var(--primary); }
.fatt-testa { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fatt-testa h2 { margin: 0; }
.fatt-dash .kpis { margin-bottom: 12px; }
.kpi-euro { font-weight: 600; margin-top: 2px; }
.fatt-tab tbody tr { cursor: pointer; }
.fatt-tab .sec { display: block; }
.fatt-lavoro { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fatt-azioni { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; background: var(--primary-soft); }
.fatt-azioni span { font-weight: 600; margin-right: auto; }
body.rev-aperta { overflow: hidden; }
.rev-overlay { position: fixed; inset: 0; z-index: 90; background: #e9edf3; display: flex; flex-direction: column; }
.rev-testa { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rev-pos { font-weight: 600; min-width: 64px; text-align: center; }
.rev-titolo { margin-right: auto; min-width: 0; }
.rev-titolo .sec { margin-left: 6px; }
.rev-corpo { flex: 1; overflow: auto; padding: 18px; }
.rev-foglio { max-width: 100%; overflow-x: auto; }
.rev-foglio .rp { box-shadow: 0 2px 10px rgba(16, 24, 40, .12); }
.rev-piede { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border); }
.rev-importi { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); }
.rev-importi b { color: var(--text); }
.rev-totale { font-size: 18px; } .rev-totale b { color: var(--primary); }
.rev-nota { flex: 1; min-width: 200px; }
.rev-bottoni { display: flex; gap: 8px; margin-left: auto; }
.rev-bottoni .btn { padding: 10px 18px; font-weight: 600; }
.rev-bottoni kbd { font: 11px/1 inherit; border: 1px solid currentColor; border-radius: 3px; padding: 1px 4px; margin-left: 6px; opacity: .7; }
.rev-fine { max-width: 420px; margin: 60px auto; text-align: center; background: var(--surface); border-radius: var(--radius); padding: 30px; }
@media (max-width: 860px) {
  .rev-bottoni { width: 100%; } .rev-bottoni .btn { flex: 1; }
  .rev-bottoni kbd { display: none; }
  .fatt-lavoro { white-space: normal; max-width: none; }
}
body.rev-aperta #toast-root { bottom: 130px; z-index: 95; }

/* ---------- firma dell'operatore */
.firma-anteprima { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: #fff; text-align: center; }
.firma-anteprima img { max-width: 100%; max-height: 120px; }
.firma-prova { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.firma-scacchi { min-height: 140px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px;
  background: #fff repeating-conic-gradient(#e6e8ec 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.firma-scacchi img { max-width: 100%; max-height: 200px; }
.firma-rp { position: relative; min-height: 140px; border: 1px solid #333; background: #fff; color: #333; padding: 6px; font-size: 11px; }
.firma-rp #fp-rp { position: absolute; left: 32%; right: 8px; top: 6px; bottom: 10px; display: flex; align-items: center; justify-content: center; }
.firma-rp #fp-rp img { max-width: 100%; max-height: 100%; }
.firma-regola { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.firma-regola label { display: flex; align-items: center; gap: 8px; }
.firma-regola select { width: auto; }
@media (max-width: 700px) { .firma-prova { grid-template-columns: 1fr; } }

/* ---------- WhatsApp */
.wa-tabs { margin-bottom: 14px; }
.wa-elenco { max-height: 60vh; overflow: auto; }
.wa-elenco th { position: sticky; top: 0; z-index: 1; }
label.wa-disp { display: flex; gap: 6px; align-items: flex-start; margin: 2px 0; cursor: pointer; }
label.wa-disp input { margin-top: 3px; }
.wa-anteprima { white-space: pre-wrap; max-height: 7.5em; overflow: auto; font-size: 13px; }
tr.wa-fatto { background: var(--chiuso-bg); }
.form-grid > p.s12 { grid-column: 1 / -1; }
/* scelta del magazzino (centrale o car kit) nel titolo della pagina Magazzino */
.page-head h1 .scelta-magazzino { font-size: 15px; font-weight: 600; margin-left: 10px; vertical-align: middle; max-width: 100%; }

/* licenza */
.licenza-bar { background: #eef4ff; border: 1px solid #9db8f0; color: #1d3f8a; padding: 7px 14px; border-radius: 7px; margin-bottom: 12px; font-size: 13px; }
.licenza-bar.demo { background: #fff4e0; border-color: #f0a23c; color: #6b3a00; }
.licenza-bar a { color: inherit; text-decoration: underline; }
.stato-lic { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; vertical-align: middle; background: #eef2f6; color: #475467; }
.stato-lic.chiuso { background: #e3f6ea; color: #17663a; }
.stato-lic.sospeso { background: #fff4e0; color: #6b3a00; }
.stato-lic.alert { background: #fdecec; color: #8f1d1d; }
/* verifica in due passaggi */
.qr-due-fattori { margin: 10px 0; }
.qr-due-fattori img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.codici-recupero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 8px 0; font-size: 15px; }
.form-attiva { margin-top: 8px; }
/* registro delle operazioni */
.registro-apribile { cursor: pointer; }
.registro-rifiutata td { background: #fff6f5; }
.registro-dettagli td { background: #fafbfd; font-size: 13px; }
.registro-mod { margin-bottom: 8px; }
.registro-campi { margin: 4px 0 0 12px; border-collapse: collapse; }
.registro-campi td { padding: 2px 10px 2px 0; border: 0; background: none; vertical-align: top; word-break: break-word; }
.registro-dettagli .muted, #registro-righe .muted { color: var(--muted); }

/* ---------- documenti condivisi */
.zona-carica { border: 2px dashed var(--border); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted);
  margin-bottom: 14px; background: var(--surface); }
.zona-carica.sopra { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.zona-carica.in-corso { border-style: solid; color: var(--text); }
.doc-tipo { font-weight: 600; min-width: 42px; text-align: center; }

/* ---------- app clienti */
.st-cliente { background: #ccfbf1; color: #115e59; }
.st-nuova { background: #dc2626; color: #fff; }
tr.riga-nuova td:first-child { box-shadow: inset 4px 0 0 #0f766e; }
.alert-box.box-cliente { border-color: #5eead4; background: #f0fdfa; color: #134e4a; }
.foto-chiamata { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.foto-chiamata img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.spunta-riga { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-weight: 400; }
.spunta-riga input { width: auto; }
.alert-box.ok { border-color: #86efac; background: #f0fdf4; color: #14532d; }
.scaduto { color: var(--danger); font-weight: 600; }

/* ---------- pannello della lavorazione della chiamata */
.pannello-lavorazione { border-left: 4px solid var(--primary); }
.pannello-lavorazione textarea { width: 100%; }
.pannello-lavorazione .pannello-azioni { margin-top: 12px; justify-content: flex-end; }

/* Utilità › SEACloud: il pannello occupa tutta la parte destra (la barra del gestionale resta a sinistra) */
body.pagina-seacloud main { padding: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.pagina-seacloud #view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.seacloud-pannello { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--surface); }
@media (max-width: 860px) {
  body.pagina-seacloud main { height: auto; }
  .seacloud-pannello { flex: none; height: calc(100dvh - 64px); }
}

/* dashboard: chiamate ancora da assegnare */
.card.da-assegnare { border-left: 4px solid var(--danger); }
.card.da-assegnare h2 { display: flex; align-items: center; gap: 8px; }
.card.da-assegnare h2 .btn { margin-left: auto; }
.card.da-assegnare h2 .nav-allarme { margin-left: 0; }

/* accesso: "Ricordami su questo dispositivo" */
.check-ricorda { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 14px; cursor: pointer; }
.check-ricorda input { width: 18px; height: 18px; margin: 0; }

/* scheda della chiamata aperta anche da altri operatori */
#presenza:empty { display: none; }
#presenza { display: grid; gap: 6px; margin-bottom: 12px; }
#presenza .alert-box { margin: 0; }
.presenza-cambiata { border-left: 4px solid var(--danger); }
.presenza-cambiata .btn { margin-left: 6px; }
.presenza-cambiata .sec { display: block; margin-top: 4px; }
.presenza-modifica { border-left: 4px solid #f59e0b; }
.presenza-vista { font-size: 13px; color: var(--muted, #64748b); padding: 2px 2px; }

/* chiamata lavorata da un altro operatore: chi entra dopo la vede in sola consultazione */
.presenza-bloccata { border-left: 4px solid var(--danger); background: #fef2f2; }

/* elenchi: colonne ordinabili (clic sull'intestazione: crescente, decrescente, ordine normale) */
#risultati th[data-ordina] { cursor: pointer; user-select: none; white-space: nowrap; }
#risultati th[data-ordina]:hover, #risultati th[data-ordina]:focus-visible { color: var(--primary, #2563eb); }
#risultati th[data-ordina]::after { content: '↕'; margin-left: 4px; opacity: .3; font-size: 11px; }
#risultati th[aria-sort="ascending"]::after { content: '▲'; opacity: 1; }
#risultati th[aria-sort="descending"]::after { content: '▼'; opacity: 1; }
#risultati th.ordinato { color: var(--primary, #2563eb); }
#art-elenco th[data-ordina] { cursor: pointer; user-select: none; white-space: nowrap; }
#art-elenco th[data-ordina]:hover, #art-elenco th[data-ordina]:focus-visible { color: var(--primary, #2563eb); }
#art-elenco th[data-ordina]::after { content: '↕'; margin-left: 4px; opacity: .3; font-size: 11px; }
#art-elenco th[aria-sort="ascending"]::after { content: '▲'; opacity: 1; }
#art-elenco th[aria-sort="descending"]::after { content: '▼'; opacity: 1; }
#art-elenco th.ordinato { color: var(--primary, #2563eb); }
.richieste-3cx { margin-top: 14px; }
/* elenchi Chiamate e Interventi: righe nuove o cambiate arrivate col controllo automatico */
@keyframes rigaNovita { 0%, 60% { background: #fff3c4; } 100% { background: transparent; } }
tr.riga-novita td { animation: rigaNovita 8s ease-out; }
.altre-righe { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); }
/* dashboard personalizzabile */
.dash-scelta { list-style: none; margin: 0; padding: 0; }
.dash-scelta li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.dash-scelta li label { display: flex; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; flex: 1; margin: 0; text-align: left; font-weight: 400; color: var(--text); }
.dash-scelta li input[type=checkbox] { width: 18px; height: 18px; flex: none; margin: 0; }
.dash-scelta li.spento label { color: var(--muted); }
.dash-scelta li.dash-predefinita { justify-content: flex-end; border-bottom: 0; padding-top: 12px; }
.dash-frecce { display: flex; gap: 4px; }
.azioni-rapide { display: flex; flex-wrap: wrap; gap: 8px; }
#dash-promemoria { width: 100%; box-sizing: border-box; }
/* ToDo List */
.todo-avanz { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; vertical-align: middle; }
.todo-barra { display: inline-block; width: 70px; height: 7px; border-radius: 4px; background: var(--border); overflow: hidden; }
.todo-barra > span { display: block; height: 100%; background: var(--primary, #2563eb); }
.todo-avanz.completa .todo-barra > span { background: #16a34a; }
.card h2 .todo-avanz { margin-left: 8px; font-weight: 400; }
.todo-attivita { list-style: none; margin: 0 0 12px; padding: 0; }
.todo-attivita li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.todo-attivita li label { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 200px; cursor: pointer; }
.todo-attivita li input[type=checkbox] { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.todo-attivita li.fatta .testo-att { text-decoration: line-through; color: var(--muted); }
.todo-attivita li .sec { font-size: 12px; }
.todo-att-azioni { display: flex; gap: 4px; }
.todo-nuova { display: flex; gap: 8px; }
.todo-nuova input { flex: 1; min-width: 0; }
/* contatto provvisorio (ToDo e richieste commerciali) */
.badge.da-completare { background: #fef3c7; color: #92400e; font-weight: 500; font-size: 11px; padding: 1px 7px; }
.box-da-completare { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.box-da-completare .info { margin: 10px 0; }
.box-da-completare .sec-note { margin-top: 6px; }
/* richieste commerciali */
.box-reparto-tecnico { background: #eff6ff; border: 1px solid #93c5fd; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.box-reparto-tecnico.fatto { background: var(--chiuso-bg); border-color: #9bd5b2; color: var(--chiuso); }
.nav-lampeggia { animation: lampeggio 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .nav-lampeggia { animation: none; } }
tr.rc-non-letta td { font-weight: 600; background: #fff7ed; }
.rc-da-aprire { color: #c2410c; font-weight: 700; }
.rc-popup { list-style: none; margin: 0; padding: 0; }
.rc-popup li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.badge.tag-commerciale { background: #ede9fe; color: #5b21b6; font-weight: 500; font-size: 11px; padding: 1px 7px; }
.rc-nuova, .rc-nuovo { background: #fef3c7; color: #92400e; }
.rc-in_lavorazione { background: #ffedd5; color: #9a3412; }
.rc-offerta { background: #ede9fe; color: #5b21b6; }
.rc-acquisita { background: var(--chiuso-bg); color: var(--chiuso); }
.rc-persa { background: #f1f5f9; color: #64748b; }
.badge.rc-nuova { background: var(--aperto-bg); color: var(--aperto); }
.badge.rc-nuovo { font-weight: 500; font-size: 11px; padding: 1px 7px; }
.rc-scaduto { color: #b42318; font-weight: 700; }
.rc-scelta { flex-direction: row; gap: 22px; flex-wrap: wrap; }
.rc-scelta label { display: flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; flex-direction: row; white-space: nowrap; color: var(--text, inherit); font-size: 14px; }
.rc-scelta input[type=radio] { width: auto; flex: none; margin: 0; }
.rc-stati { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 16px; }
.rc-nota { display: grid; grid-template-columns: 150px 1fr; gap: 8px; margin-bottom: 14px; }
.rc-nota textarea { grid-column: 1 / -1; }
.rc-nota label { display: flex; align-items: center; gap: 8px; }
.rc-nota button { justify-self: end; grid-column: 2; }
.rc-diario { list-style: none; margin: 0; padding: 0; }
.rc-diario li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.rc-diario li > div:first-child { display: flex; align-items: center; gap: 8px; }
.rc-diario li > div:first-child .btn { margin-left: auto; }
.rc-diario .testo-nota { white-space: pre-wrap; margin-top: 3px; }
.rc-diario-stato .testo-nota { color: var(--muted); font-style: italic; }
.rc-prev { display: flex; gap: 8px; flex-wrap: wrap; }
.rc-prev select { flex: 1; min-width: 220px; }
.int-box.rc-esito-acquisita { background: var(--chiuso-bg); border-color: #9bd5b2; color: var(--chiuso); }
.int-box.rc-esito-persa { background: #f8fafc; border-color: #cbd5e1; color: #475569; }
/* pulsanti delle righe del magazzino: colonne fisse, cosi' restano allineati anche quando un pulsante manca */
#art-elenco td.col-azioni { white-space: nowrap; width: 1%; }
.azioni-art { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; justify-content: end; }
.azioni-art.kit { grid-template-columns: repeat(5, auto); }
.azioni-art .btn { margin: 0; text-align: center; }
.registro-elenco > summary { cursor: pointer; font-weight: 600; padding: 10px 14px; margin-bottom: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); }
.registro-elenco > summary .muted { font-weight: 400; }
.richieste-3cx > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.richieste-3cx[open] > summary { margin-bottom: 6px; }
.voci-magazzino { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.voci-magazzino .card { margin: 0; }
.voci-magazzino h2 { padding: 12px 14px 0; }
.voce-nuova { display: flex; gap: 8px; padding: 10px 14px; }
.voce-nuova input { flex: 1; min-width: 0; }
.voci-magazzino td { padding-top: 6px; padding-bottom: 6px; }

/* magazzino: carico da DDT */
.ddt-zona { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 26px; }
.ddt-zona.sopra { background: #eef4ff; border-color: var(--primary); }
.ddt-stato { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #eef4ff; color: #1e3a8a; }
.ddt-stato.err { background: #fde2e2; color: #912018; }
.ddt-righe td { vertical-align: top; }
.ddt-righe input { padding: 5px 7px; font-size: 13px; }
.ddt-righe input.num { text-align: right; }
.ddt-letto { display: block; font-family: Consolas, monospace; font-size: 11px; color: var(--muted); }
.ddt-avviso { font-size: 12px; margin-top: 3px; }
.ddt-avviso .ko { color: var(--danger); }
tr.ddt-esclusa td { opacity: .5; }
.ddt-testo { max-height: 320px; overflow: auto; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-size: 12px; white-space: pre-wrap; }

/* contabilita': documenti ai clienti */
.doc-scaduto { background: #fde2e2; color: #991b1b; }
.form-err { white-space: pre-line; } /* messaggi su piu' righe (es. i controlli prima dell'emissione della fattura) */
.lista-problemi { margin: 8px 0 0; padding-left: 20px; }
.lista-problemi li { margin: 4px 0; }
.doc-esito { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-cerca-art { width: min(460px, 100%); }
.doc-righe { width: 100%; }
.doc-righe td { padding: 4px 4px; vertical-align: top; }
.doc-righe input, .doc-righe select, .doc-righe textarea { padding: 5px 6px; font-size: 13px; }
.doc-righe textarea { min-height: 32px; resize: none; overflow: hidden; }
.doc-righe input.num { text-align: right; }
.doc-righe td:nth-child(2) { min-width: 260px; }
.doc-righe .errato { border-color: var(--danger); background: #fff5f5; }
.doc-righe td[data-importo] { padding-top: 10px; font-weight: 600; }
.doc-righe tr.descrittiva textarea { font-weight: 600; background: #f8fafc; }
.doc-riga-azioni .btn.small { padding: 3px 7px; margin-left: 2px; }
.doc-righe-vista tr.descrittiva td { font-weight: 600; background: #f8fafc; }
.doc-totali { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.doc-riep { width: auto; min-width: 320px; font-size: 13px; }
.doc-riep td, .doc-riep th { padding: 4px 10px; }
.doc-somme { min-width: 260px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.doc-somme div { display: flex; justify-content: space-between; gap: 20px; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.doc-somme div:last-child { border-bottom: 0; }
.doc-somme span { color: var(--muted); }
.doc-somme .tot { background: #e3262e; color: #fff; font-size: 17px; }
.doc-somme .tot span { color: #fff; font-weight: 600; }

/* app clienti: opzione che dipende da quella sopra (accessi del cliente) */
.field.check:has(> .sotto-opzione) { padding-left: 28px; }
.field.check.disattivo { opacity: .5; }
