/* ==========================================================================
   Gestione Provvigioni Agente — foglio di stile "Campo"
   Ordine: 1 font e token · 2 base · 3 guscio · 4 componenti · 5 pagine ·
           6 utilita' · 7 compatibilita' (classi delle viste non ancora rifatte)
   La stampa sta in stampa.css. Niente strumenti di build: file scritto a mano.
   ========================================================================== */

/* ── 1. Font e token ─────────────────────────────────────────────────────── */

@font-face { font-family: 'Inter'; src: url('fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;

  /* primitivi */
  --verde-950: #0A1F15; --verde-900: #0F2A1D; --verde-800: #163A29; --verde-700: #1E4D36;
  --verde-600: #2A6547; --verde-500: #3A8259; --verde-200: #C2DCC6; --verde-100: #DCEBDD; --verde-50: #EEF3EA;
  --lime-100: #EEF8DC; --lime-300: #CDEE96; --lime-400: #B6E36A; --lime-500: #A5D653; --lime-800: #3F6510;
  --carta: #FFFFFF; --pagina: #F4F6F1; --linea: #DDE3D9; --linea-forte: #C5CEC1;
  --inchiostro: #10231A; --inchiostro-2: #5B6B62;

  /* semantici: i componenti usano solo questi */
  --sup-pagina: var(--pagina); --sup-card: var(--carta); --sup-velo: var(--verde-50);
  --sup-scura: var(--verde-900); --sup-scura-2: var(--verde-800);
  --testo: var(--inchiostro); --testo-2: var(--inchiostro-2);
  --su-scuro: #FFFFFF; --su-scuro-2: #C9D6CD; --su-scuro-3: #9DB0A4;
  --bordo: var(--linea); --bordo-forte: var(--linea-forte); --bordo-campo: #7F8E85;
  --primario: var(--verde-700); --primario-hover: var(--verde-800);
  --accento: var(--lime-400); --accento-hover: var(--lime-500); --su-accento: var(--inchiostro);
  --link: var(--verde-600);

  --ok-bg: #DCEBDD; --ok-testo: #1E4D36; --ok-bordo: #A9CDB0;
  --att-bg: #FFF3D6; --att-testo: #7A4A00; --att-bordo: #E9C46A;
  --err-bg: #FDE8E5; --err-testo: #A32218; --err-bordo: #F0B4AC; --err-pieno: #B3261E;
  --info-bg: #E6F0F8; --info-testo: #1D4F7A; --info-bordo: #B4CFE4;

  --font-testo: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-titoli: 'Manrope', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --t-xs: .75rem; --t-s: .8125rem; --t-m: .9375rem; --t-l: 1.0625rem; --t-xl: 1.375rem; --t-2xl: 1.75rem; --t-3xl: 2.5rem;

  --r-s: 8px; --r-m: 12px; --r-l: 18px; --r-pill: 999px;
  --ombra-1: 0 1px 2px rgba(16, 35, 26, .05), 0 2px 10px rgba(16, 35, 26, .04);
  --ombra-2: 0 6px 16px rgba(16, 35, 26, .10), 0 16px 40px rgba(16, 35, 26, .10);
  --anello: 0 0 0 3px rgba(42, 101, 71, .28);
  --veloce: .16s cubic-bezier(.4, 0, .2, 1);
  --morbido: .28s cubic-bezier(.4, 0, .2, 1);

  --barra-l: 264px; --appbar-h: 56px; --tabbar-h: 64px;
}

/* ── 2. Base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-testo); font-size: var(--t-m); line-height: 1.55; color: var(--testo);
  background: var(--sup-pagina); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-titoli); line-height: 1.2; letter-spacing: -.01em; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--verde-800); }
strong, b { font-weight: 650; }
code, pre { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .85em; }
code { background: var(--sup-velo); padding: 1px 5px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--bordo); margin: 16px 0; }
ul, ol { padding-left: 1.2em; }
:focus-visible { outline: 0; box-shadow: var(--anello); border-radius: 6px; }

.icona { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }
.marchio { width: 32px; height: 32px; flex: none; border-radius: 9px; }

/* campi */
label { display: block; font-size: var(--t-s); font-weight: 600; color: var(--testo-2); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=search], input[type=file], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--bordo-campo); border-radius: var(--r-s);
  font: inherit; font-size: var(--t-m); background: var(--carta); color: var(--testo);
  transition: border-color var(--veloce), box-shadow var(--veloce);
}
input[type=file] { padding: 6px; }
select { padding-right: 30px; }
textarea { min-height: 84px; }
input:hover, select:hover, textarea:hover { border-color: var(--verde-600); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--verde-600); box-shadow: var(--anello); }
input[readonly] { background: var(--sup-velo); color: var(--testo-2); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--verde-700); vertical-align: -3px; flex: none; }
::placeholder { color: #8A978F; }

/* ── 3. Guscio ───────────────────────────────────────────────────────────── */

.salta { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accento); color: var(--su-accento); padding: 8px 14px; border-radius: var(--r-s); font-weight: 600; text-decoration: none; }
.salta:focus { top: 12px; }

/* barra laterale (computer) */
.barra {
  position: fixed; inset: 0 auto 0 0; width: var(--barra-l); z-index: 40; display: flex; flex-direction: column;
  background: var(--sup-scura); color: var(--su-scuro-2); padding: 20px 14px 14px;
}
.barra__marchio { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: var(--su-scuro); text-decoration: none; }
.barra__marchio:hover { color: var(--su-scuro); }
.barra__nome { font-family: var(--font-titoli); font-weight: 700; font-size: 1rem; line-height: 1.15; }
.barra__nome small { display: block; font-family: var(--font-testo); font-size: .6875rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--su-scuro-3); margin-bottom: 2px; }
.barra__nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: var(--verde-700) transparent; }
.barra__gruppo { font-size: .6875rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--su-scuro-3); padding: 18px 12px 6px; }
/* anno di competenza: uno solo per tutte le pagine */
.barra__anno { margin: 0 2px 8px; padding: 12px; border-radius: var(--r-m); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .10); }
.barra__anno-titolo { display: block; font-size: .6875rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--su-scuro-3); margin-bottom: 8px; }
.barra__anno select, .appbar__anno select { width: 100%; min-height: 38px; padding: 6px 32px 6px 12px; background-color: rgba(255, 255, 255, .10); color: var(--su-scuro); border-color: rgba(255, 255, 255, .22); font-weight: 650; font-variant-numeric: tabular-nums; color-scheme: dark; }
.barra__anno select:focus, .appbar__anno select:focus { border-color: var(--accento); box-shadow: 0 0 0 3px rgba(182, 227, 106, .35); }
/* l'elenco che si apre puo' avere lo sfondo chiaro (dipende dal browser): le voci hanno sempre testo scuro su bianco */
.barra__anno option, .appbar__anno option { color: var(--inchiostro); background-color: #FFFFFF; }
.barra__anno-nota { display: block; margin-top: 8px; font-size: var(--t-xs); line-height: 1.4; color: var(--su-scuro-3); }
.barra__anno-nota--pagina { color: #FFD27A; }
.voce {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 10px;
  color: var(--su-scuro-2); text-decoration: none; font-weight: 500; font-size: var(--t-m);
  transition: background var(--veloce), color var(--veloce);
}
.voce:hover { background: rgba(255, 255, 255, .07); color: var(--su-scuro); }
.voce.is-attiva { background: rgba(182, 227, 106, .13); color: var(--su-scuro); font-weight: 600; }
.voce.is-attiva .icona { color: var(--accento); }
.voce.is-attiva::before { content: ''; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accento); }
.voce:focus-visible, .tasto-icona:focus-visible, .barra__marchio:focus-visible { box-shadow: 0 0 0 3px rgba(182, 227, 106, .55); }
.barra__utente { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .10); }
.barra__chi { flex: 1; min-width: 0; line-height: 1.25; }
.barra__chi strong { display: block; color: var(--su-scuro); font-weight: 600; font-size: var(--t-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra__chi small { font-size: var(--t-xs); color: var(--su-scuro-3); }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--accento); color: var(--su-accento); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-titoli); font-weight: 700; font-size: var(--t-s); }
.tasto-icona { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; background: transparent; color: var(--su-scuro-2); cursor: pointer; transition: background var(--veloce), color var(--veloce); }
.tasto-icona:hover { background: rgba(255, 255, 255, .10); color: var(--su-scuro); }
.prova { align-self: flex-start; margin: -8px 8px 10px; padding: 2px 10px; border-radius: var(--r-pill); background: #FFD27A; color: #4A2E00; font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

/* barre del telefono: nascoste sul computer */
.appbar, .tabbar { display: none; }

/* contenuto */
.guscio-app .contenuto { margin-left: var(--barra-l); padding: 32px 40px 72px; max-width: calc(var(--barra-l) + 1320px); }
.contenuto > * { animation: entra var(--morbido) both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* intestazione di pagina */
.testata { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.testata h1 { font-size: var(--t-2xl); font-weight: 800; }
.testata p { color: var(--testo-2); margin-top: 4px; }
.testata__indietro { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); font-weight: 600; text-decoration: none; margin-bottom: 8px; }
.testata__azioni { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* pannello "Altro" del telefono */
.foglio { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.foglio[hidden] { display: none; }
.foglio__velo { position: absolute; inset: 0; background: rgba(10, 31, 21, .55); animation: velo var(--morbido) both; }
.foglio__corpo { position: relative; width: 100%; max-height: 86vh; overflow-y: auto; background: var(--sup-card); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: sale var(--morbido) both; }
.foglio__maniglia { width: 40px; height: 4px; border-radius: 4px; background: var(--bordo-forte); margin: 0 auto 10px; }
@keyframes velo { from { opacity: 0; } }
@keyframes sale { from { transform: translateY(40px); opacity: 0; } }
.menu-completo__utente { display: flex; align-items: center; gap: 12px; padding: 8px 4px 14px; }
.menu-completo__utente strong { display: block; }
.menu-completo__utente small { color: var(--testo-2); }
.menu-completo__gruppo { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-2); padding: 14px 6px 6px; }
.menu-completo__voci { border: 1px solid var(--bordo); border-radius: var(--r-m); overflow: hidden; }
.voce-riga { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 14px; background: var(--sup-card); border: 0; border-bottom: 1px solid var(--bordo); color: var(--testo); font: inherit; font-weight: 500; text-decoration: none; text-align: left; cursor: pointer; }
.menu-completo__voci > :last-child, .menu-completo__voci > :last-child .voce-riga { border-bottom: 0; }
.voce-riga > span { flex: 1; }
.voce-riga > .icona:first-child { color: var(--verde-600); }
.voce-riga:hover { background: var(--sup-velo); color: var(--testo); }
.voce-riga.is-attiva { background: var(--lime-100); font-weight: 650; }
.voce-riga--esci, .voce-riga--esci > .icona:first-child { color: var(--err-testo); }
.icona--freccia { color: var(--bordo-forte); }

/* gusci senza menu: accesso e messaggi */
.guscio-messaggio .contenuto { max-width: 520px; margin: 0 auto; padding: 9vh 20px 48px; }
.messaggio__marchio { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; color: var(--testo); text-decoration: none; font-family: var(--font-titoli); font-weight: 700; }
.guscio-accesso { background: var(--sup-card); }
.accesso { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.accesso__fascia { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 44px 52px 56px; background: var(--sup-scura); color: var(--su-scuro-2); }
.accesso__marchio { display: flex; align-items: center; gap: 14px; color: var(--su-scuro); font-family: var(--font-titoli); font-weight: 700; font-size: var(--t-l); position: relative; z-index: 1; }
.accesso__marchio .marchio { width: 44px; height: 44px; border-radius: 12px; }
.accesso__messaggio { position: relative; z-index: 1; max-width: 30em; }
.accesso__messaggio h1 { color: var(--su-scuro); font-size: clamp(1.75rem, 3.1vw, 2.75rem); font-weight: 800; letter-spacing: -.02em; }
.accesso__messaggio h1::after { content: ''; display: block; width: 56px; height: 4px; border-radius: 4px; background: var(--accento); margin: 22px 0 18px; }
.accesso__messaggio p { font-size: var(--t-l); line-height: 1.6; }
.accesso__solchi { position: absolute; inset: auto 0 0 0; width: 100%; height: 62%; pointer-events: none; }
.accesso__modulo { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--sup-pagina); }
.accesso__card { width: 100%; max-width: 400px; background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-l); box-shadow: var(--ombra-2); padding: 34px 32px 30px; }
.accesso__logo { display: block; height: 60px; width: auto; max-width: 100%; margin: 0 0 20px; }
.accesso__card h2 { font-size: var(--t-2xl); font-weight: 800; }
.accesso__aiuto { color: var(--testo-2); margin: 4px 0 22px; }
.accesso__prova { margin-top: 16px; font-size: var(--t-s); color: var(--att-testo); background: var(--att-bg); border-radius: var(--r-s); padding: 8px 12px; }

/* ── 4. Componenti ───────────────────────────────────────────────────────── */

/* avvisi (anche i messaggi dopo un'operazione) */
.avviso { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--att-bordo); border-radius: var(--r-m); background: var(--att-bg); color: var(--att-testo); font-size: var(--t-m); }
.avviso > .icona { margin-top: 2px; }
.avviso > div { flex: 1; min-width: 0; }
.avviso a { color: inherit; font-weight: 600; }
.avviso--ok { background: var(--ok-bg); border-color: var(--ok-bordo); color: var(--ok-testo); }
.avviso--info { background: var(--info-bg); border-color: var(--info-bordo); color: var(--info-testo); }
.avviso--errore { background: var(--err-bg); border-color: var(--err-bordo); color: var(--err-testo); }
.avviso__chiudi { flex: none; width: 28px; height: 28px; margin: -3px -6px -3px 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; opacity: .7; }
.avviso__chiudi:hover { opacity: 1; background: rgba(16, 35, 26, .08); }

/* pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 18px;
  border: 1px solid transparent; border-radius: 10px; background: var(--primario); color: #fff;
  font: inherit; font-size: var(--t-m); font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--veloce), border-color var(--veloce), color var(--veloce), transform var(--veloce), box-shadow var(--veloce);
}
.btn:hover { background: var(--primario-hover); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--anello); }
.btn[disabled], .btn.is-disattivo { opacity: .5; cursor: not-allowed; }
.btn-sec { background: var(--carta); color: var(--verde-700); border-color: var(--bordo-forte); }
.btn-sec:hover { background: var(--sup-velo); color: var(--verde-800); border-color: var(--verde-600); }
.btn-accento { background: var(--accento); color: var(--su-accento); }
.btn-accento:hover { background: var(--accento-hover); color: var(--su-accento); }
.btn-danger { background: var(--err-pieno); }
.btn-danger:hover { background: #8F1D17; }
.btn-small { min-height: 32px; padding: 5px 12px; font-size: var(--t-s); border-radius: 8px; }
.btn-grande { min-height: 48px; padding: 12px 22px; font-size: var(--t-l); border-radius: 12px; }
.btn-blocco { width: 100%; }

/* card */
.card { background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-l); box-shadow: var(--ombra-1); padding: 24px 28px; margin-bottom: 20px; }
.card .card { box-shadow: none; background: var(--sup-velo); border-radius: var(--r-m); padding: 18px 20px; margin: 16px 0 0; }
.card--stretta { max-width: 560px; margin-left: auto; margin-right: auto; }
.campo { margin-bottom: 16px; }

/* badge */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 1px solid transparent; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; line-height: 1.45; white-space: nowrap; }

/* tabelle */
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: 10px 12px; background: var(--sup-velo); color: var(--testo-2); font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--bordo-forte); }
td { padding: 10px 12px; border-bottom: 1px solid var(--bordo); vertical-align: middle; }
tbody tr { transition: background var(--veloce); }
tbody tr:hover td { background: #F8FAF6; }
tr.tot td { background: var(--sup-velo); font-weight: 700; border-top: 2px solid var(--bordo-forte); border-bottom: 0; }
tfoot td { background: var(--sup-velo); font-weight: 700; }
.tbl-wrap { overflow: auto; border: 1px solid var(--bordo); border-radius: var(--r-m); -webkit-overflow-scrolling: touch; }
.tbl-wrap table { border: 0; }
.tbl-wrap thead th { position: sticky; top: 0; z-index: 1; }
.tbl-wrap tr:last-child td { border-bottom: 0; }
.td-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-b { font-weight: 650; }
.td-muted { color: var(--testo-2); font-size: var(--t-s); }
.neg { color: var(--err-testo); }

/* numero protagonista */
.eroe {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px 40px; align-items: center;
  padding: 30px 34px; margin-bottom: 28px; border-radius: 22px; color: var(--su-scuro-2);
  background: radial-gradient(120% 140% at 100% 0%, rgba(182, 227, 106, .13) 0%, rgba(182, 227, 106, 0) 55%), var(--sup-scura);
  box-shadow: var(--ombra-2);
}
.eroe__etichetta { display: flex; align-items: center; gap: 8px; color: var(--su-scuro); font-weight: 600; }
.eroe__etichetta .icona { color: var(--accento); }
.eroe__numero { font-family: var(--font-titoli); font-weight: 800; font-size: clamp(2.25rem, 5vw, 3.75rem); line-height: 1.05; letter-spacing: -.03em; color: var(--accento); font-variant-numeric: tabular-nums; margin: 6px 0 8px; white-space: nowrap; }
.eroe__nota { max-width: 34em; font-size: var(--t-m); }
.eroe__numeri { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .12); }
.eroe__numeri dt { font-size: var(--t-s); color: var(--su-scuro-3); }
.eroe__numeri dd { font-family: var(--font-titoli); font-weight: 700; font-size: var(--t-xl); color: var(--su-scuro); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* barra a tre segmenti: liquidato · da liquidare · da incassare */
.avanzamento { display: flex; gap: 3px; height: 14px; border-radius: var(--r-pill); overflow: hidden; background: rgba(16, 35, 26, .08); }
.avanzamento__seg { flex: 0 0 var(--p, 0%); min-width: 0; border-radius: 3px; animation: cresce .9s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left center; }
@keyframes cresce { from { transform: scaleX(0); } }
.avanzamento__seg--incassato { background: var(--verde-600); }
.avanzamento__seg--da-incassare { background: #F2C879; box-shadow: inset 0 0 0 1px rgba(122, 74, 0, .35); }
.avanzamento__legenda { list-style: none; padding: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: var(--t-s); }
.avanzamento__legenda li { display: flex; align-items: center; gap: 8px; }
.avanzamento__legenda li > span:nth-child(2) { flex: 1; }
.avanzamento__legenda strong { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.avanzamento__punto { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.eroe .avanzamento { height: 18px; background: rgba(255, 255, 255, .10); }
.eroe .avanzamento__seg--incassato { background: var(--accento); }
.eroe .avanzamento__seg--da-incassare { background: rgba(255, 255, 255, .28); box-shadow: none; }
.eroe .avanzamento__legenda { font-size: var(--t-m); }
.eroe .avanzamento__legenda strong { color: var(--su-scuro); }

/* titolo di sezione fuori dalle card */
.sezione { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px 14px; }
.sezione h2 { font-size: var(--t-xl); font-weight: 800; }
.sezione__link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--t-s); text-decoration: none; }

/* card agente */
.griglia-agenti { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-bottom: 28px; }
.agente-card { display: flex; flex-direction: column; gap: 14px; background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-l); box-shadow: var(--ombra-1); padding: 22px 24px; transition: box-shadow var(--morbido), transform var(--morbido), border-color var(--morbido); }
.agente-card:hover { box-shadow: var(--ombra-2); transform: translateY(-2px); border-color: var(--bordo-forte); }
.agente-card__chi { display: flex; align-items: center; gap: 12px; }
.agente-card__chi h3 { font-size: var(--t-l); font-weight: 700; }
.agente-card__chi small { color: var(--testo-2); font-size: var(--t-s); }
.agente-card__numero { display: flex; flex-direction: column; }
.agente-card__numero span { font-size: var(--t-s); font-weight: 600; color: var(--testo-2); }
.agente-card__numero strong { font-family: var(--font-titoli); font-weight: 800; font-size: 2rem; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.agente-card__azioni { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.agente-card__azioni .btn { flex: 1; }
.agente-card--vuota { background: transparent; box-shadow: none; border-style: dashed; }
.agente-card--vuota:hover { box-shadow: none; transform: none; }
.agente-card--attenzione { border-color: var(--att-bordo); background: #FFFBEF; }
.avatar--tenue { background: var(--sup-velo); color: var(--testo-2); }
.avatar--att { background: var(--att-bg); color: var(--att-testo); }

/* intestazione e piede dentro una card */
.card__titolo { font-size: var(--t-l); font-weight: 700; margin-bottom: 4px; }
.card__nota { color: var(--testo-2); font-size: var(--t-s); margin-bottom: 16px; }
.card__titolo + :not(.card__nota) { margin-top: 14px; }
.card__azioni { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.card--velo { background: var(--sup-velo); box-shadow: none; }

/* elenchi */
.lista-azioni, .lista-dati { list-style: none; padding: 0; display: flex; flex-direction: column; }
.lista-azioni__voce, .lista-dati li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--bordo); }
.lista-azioni__voce:last-child, .lista-dati li:last-child { border-bottom: 0; padding-bottom: 0; }
.lista-azioni__voce > div, .lista-dati li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lista-azioni__voce span, .lista-dati li span { color: var(--testo-2); font-size: var(--t-s); }
.lista-dati li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-azioni__voce > .icona, .lista-dati li > .icona { width: 22px; height: 22px; }
.lista-azioni__voce--att > .icona { color: #B87A0F; }
.lista-azioni__voce--info > .icona, .lista-dati li > .icona { color: var(--verde-600); }
.lista-dati time { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tutto-ok { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-m); background: var(--ok-bg); color: var(--ok-testo); }
.tutto-ok .icona { width: 28px; height: 28px; }
.tutto-ok div { display: flex; flex-direction: column; }
.tutto-ok span { font-size: var(--t-s); }
.tutto-ok--neutro { background: var(--sup-velo); color: var(--testo-2); }
.tutto-ok--neutro strong { color: var(--testo); }

/* classifica a barre (nome sopra la barra) */
.classifica { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.classifica li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.classifica__nome { font-size: var(--t-s); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.classifica__valore { font-size: var(--t-s); font-weight: 650; font-variant-numeric: tabular-nums; }
.classifica__barra { grid-column: 1 / -1; height: 8px; border-radius: var(--r-pill); background: var(--sup-velo); overflow: hidden; }
.classifica__barra span { display: block; height: 100%; width: var(--p, 0%); border-radius: var(--r-pill); background: var(--verde-600); animation: cresce .8s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left center; }
.classifica li:first-child .classifica__barra span { background: var(--verde-800); }

/* striscia dei cinque numeri */
.numeri { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.numeri__voce { background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-m); box-shadow: var(--ombra-1); padding: 14px 16px; }
.numeri__voce dt { font-size: var(--t-s); color: var(--testo-2); font-weight: 500; }
.numeri__voce dd { font-family: var(--font-titoli); font-weight: 800; font-size: clamp(1.05rem, 1.45vw, 1.375rem); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.numeri__voce--chiave { background: var(--sup-scura); border-color: var(--sup-scura); }
.numeri__voce--chiave dt { color: var(--su-scuro-2); } .numeri__voce--chiave dd { color: var(--accento); }

/* grafici */
.grafico { position: relative; height: 260px; }
.grafico--alto { height: 320px; }
.grafico--ciambella { height: 180px; }
.grafico--incassi { height: 372px; }
.ciambella { display: flex; flex-direction: column; gap: 14px; }
.ciambella__legenda { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: var(--t-s); }
.ciambella__legenda li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 2.6em; gap: 8px; align-items: center; }
.ciambella__legenda li > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ciambella__legenda strong { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ciambella__legenda small { color: var(--testo-2); text-align: right; font-variant-numeric: tabular-nums; }
.ciambella__punto { width: 10px; height: 10px; border-radius: 3px; background: #C9D3C4; }
.ciambella__punto--1 { background: #0F2A1D; } .ciambella__punto--2 { background: #2F6B4A; } .ciambella__punto--3 { background: #7FAE2E; }
.ciambella__punto--4 { background: #B6E36A; } .ciambella__punto--5 { background: #F2C879; } .ciambella__punto--6 { background: #C9962F; }
.grafico__sintesi { margin-top: 12px; font-size: var(--t-s); color: var(--testo-2); }
.grafico__sintesi strong { color: var(--testo); }
.grafico canvas { max-height: none; }

/* aliquote IVA: forma diversa dagli stati */
.iva { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border: 1px solid var(--bordo-forte); border-radius: var(--r-s); background: var(--carta); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.iva::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #2F7F8A; }
.iva--10::before { background: #4F5BD5; } .iva--22::before { background: #8A3F86; }
.aliquote { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.aliquote__voce { border: 1px solid var(--bordo); border-radius: var(--r-m); padding: 14px 16px; }
.aliquote__voce dl { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.aliquote__voce dl div { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-s); }
.aliquote__voce dt { color: var(--testo-2); }
.aliquote__voce dd { font-weight: 650; font-variant-numeric: tabular-nums; }
.aliquote__voce dl div:last-child { border-top: 1px solid var(--bordo); padding-top: 6px; margin-top: 2px; font-size: var(--t-m); }

/* stati */
.stato { gap: 5px; }
.stato .icona { width: 13px; height: 13px; stroke-width: 2; }
.stato--att { background: var(--att-bg); color: var(--att-testo); border-color: var(--att-bordo); }
.stato--lime { background: var(--lime-100); color: var(--lime-800); border-color: #B9DC7C; }
.stato--ok { background: var(--ok-bg); color: var(--ok-testo); border-color: var(--ok-bordo); }
.stato--info { background: var(--info-bg); color: var(--info-testo); border-color: var(--info-bordo); }
.stato--grigio { background: var(--sup-velo); color: var(--testo-2); border-color: var(--bordo-forte); }
.stato__dettaglio { font-weight: 500; opacity: .85; }

/* glossario */
.glossario { display: flex; flex-direction: column; gap: 10px; }
.glossario dt { font-weight: 650; font-size: var(--t-s); }
.glossario dd { color: var(--testo-2); font-size: var(--t-s); }
.glossario--righe { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 28px; }

/* filtri rapidi nell'intestazione */
.filtro-rapido { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filtro-rapido select { width: auto; min-width: 0; font-weight: 500; }
/* estratto per il cliente (scheda del cliente): le scelte su una riga, che va a capo su telefono */
.estratto { margin-top: 14px; gap: 10px 12px; }
.estratto input[type=date] { width: auto; }
.estratto select { max-width: 100%; }
.estratto__stampa { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; } /* etichetta e scelta vanno a capo insieme */

/* caricamento dati: passi, riquadri di caricamento, esito */
.passi { list-style: none; padding: 0; display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.passi__voce { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: var(--r-pill); background: var(--sup-card); border: 1px solid var(--bordo); color: var(--testo-2); font-size: var(--t-s); font-weight: 600; }
.passi__numero { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--sup-velo); font-family: var(--font-titoli); font-weight: 700; }
.passi__numero .icona { width: 15px; height: 15px; stroke-width: 2.5; }
.passi__voce.is-attivo { background: var(--sup-scura); border-color: var(--sup-scura); color: var(--su-scuro); }
.passi__voce.is-attivo .passi__numero { background: var(--accento); color: var(--su-accento); }
.passi__voce.is-fatto { color: var(--verde-700); }
.passi__voce.is-fatto .passi__numero { background: var(--ok-bg); color: var(--ok-testo); }
.carica { display: flex; flex-direction: column; gap: 4px; }
.carica .card__nota { flex: 1; }
.carica__icona { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 13px; background: var(--lime-100); color: var(--lime-800); margin-bottom: 8px; }
.carica__icona .icona { width: 24px; height: 24px; }
.zona-file { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px; margin: 0 0 14px; border: 2px dashed var(--bordo-forte); border-radius: var(--r-m); background: var(--sup-velo); color: var(--testo); cursor: pointer; transition: border-color var(--veloce), background var(--veloce); }
.zona-file:hover, .zona-file.is-sopra { border-color: var(--verde-600); background: var(--lime-100); }
.zona-file.is-scelto { border-style: solid; border-color: var(--verde-600); background: var(--carta); }
.zona-file > .icona { width: 26px; height: 26px; color: var(--verde-600); }
.zona-file__testo { display: flex; flex-direction: column; font-weight: 600; font-size: var(--t-m); min-width: 0; overflow-wrap: anywhere; }
.zona-file__testo small { font-weight: 400; color: var(--testo-2); font-size: var(--t-s); }
.js .zona-file input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; min-height: 0; }
.elenco-fatti { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.elenco-fatti li { display: flex; gap: 12px; align-items: flex-start; }
.elenco-fatti .icona { width: 20px; height: 20px; margin-top: 2px; color: var(--verde-600); }
.elenco-fatti div { flex: 1; min-width: 0; }
.etichette { display: flex; flex-wrap: wrap; gap: 6px; }
.tbl-wrap--bassa { max-height: 200px; } .tbl-wrap--media { max-height: 380px; } .tbl-wrap--alta { max-height: 560px; }
.colonne { border-top: 1px solid var(--bordo); padding: 4px 0; }
.colonne > .tbl-wrap { margin: 6px 0 12px; }
.card__titolo--dentro { padding: 18px 20px 6px; margin: 0; }
.card__testa { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px 10px; }
.card__testa .card__titolo { margin: 0; }
.card__testa > div:first-child { flex: 1 1 320px; min-width: 0; }
.tabella-mappa { width: 100%; }
.tabella-mappa th { width: 46%; text-align: left; font-weight: 600; padding: 6px 12px 6px 0; vertical-align: middle; background: none; border: 0; }
.tabella-mappa th label { margin: 0; font-size: var(--t-m); color: var(--testo); text-transform: none; letter-spacing: 0; }
.tabella-mappa td { padding: 6px 0; border: 0; }
.tabella-mappa select { width: 100%; }
input.campo-corto { width: 120px; }
.esito { text-align: center; max-width: 44em; margin: 0 auto 28px; padding: 34px 28px 28px; background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-l); box-shadow: var(--ombra-1); }
.esito__icona { width: 60px; height: 60px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accento); color: var(--su-accento); animation: spunta .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.esito__icona .icona { width: 32px; height: 32px; stroke-width: 2.25; }
@keyframes spunta { from { transform: scale(.4); opacity: 0; } }
.esito h2 { font-size: var(--t-2xl); font-weight: 800; margin-bottom: 18px; }
.esito__numeri { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.esito__numeri div { padding: 12px; border-radius: var(--r-m); background: var(--sup-velo); }
.esito__numeri dt { font-size: var(--t-s); color: var(--testo-2); }
.esito__numeri dd { font-family: var(--font-titoli); font-weight: 800; font-size: var(--t-xl); font-variant-numeric: tabular-nums; }
.esito__punti { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; color: var(--testo-2); font-size: var(--t-s); text-align: left; }
.esito .avviso { text-align: left; }
.prossimo { display: flex; align-items: center; gap: 16px; padding: 20px 22px; background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-l); box-shadow: var(--ombra-1); color: var(--testo); text-decoration: none; transition: box-shadow var(--morbido), transform var(--morbido), border-color var(--morbido); }
.prossimo:hover { box-shadow: var(--ombra-2); transform: translateY(-2px); border-color: var(--verde-600); color: var(--testo); }
.prossimo > div { flex: 1; display: flex; flex-direction: column; }
.prossimo span { color: var(--testo-2); font-size: var(--t-s); }
.prossimo > .icona:first-child { width: 28px; height: 28px; color: var(--verde-600); }
.prossimo--chiave { background: var(--sup-scura); border-color: var(--sup-scura); color: var(--su-scuro); }
.prossimo--chiave:hover { color: var(--su-scuro); border-color: var(--accento); }
.prossimo--chiave span { color: var(--su-scuro-2); } .prossimo--chiave > .icona { color: var(--accento) !important; }

/* configurazione: aree, schede degli utenti, tabelle con campi, scelte dello svuotamento */
.area { align-items: flex-start; }
.area > .icona:first-child { margin-top: 2px; }
.area > .icona:last-child { align-self: center; color: var(--testo-2); }
.area__stati { margin-top: 10px; }
.utenti { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
details.card.utente { margin: 0; padding: 0; }
details.card.utente > summary { display: flex; align-items: center; gap: 14px; padding: 16px 20px; list-style: none; font-family: var(--font-testo); font-size: var(--t-m); font-weight: 400; border-radius: var(--r-l); }
details.card.utente > summary::-webkit-details-marker { display: none; }
details.card.utente > summary:hover { background: var(--sup-velo); }
.utente__nome { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.utente__nome strong { font-family: var(--font-titoli); font-weight: 700; font-size: var(--t-l); }
.utente__nome small { color: var(--testo-2); font-size: var(--t-s); }
.utente__freccia { color: var(--testo-2); transition: transform var(--veloce); }
.utente[open] .utente__freccia { transform: rotate(180deg); }
.utente[open] > summary { border-bottom: 1px solid var(--bordo); border-radius: var(--r-l) var(--r-l) 0 0; }
.utente__corpo { padding: 4px 20px 20px; }
.tabella-campi td { padding-top: 6px; padding-bottom: 6px; }
.tabella-campi input[type=text], .tabella-campi select { min-height: 36px; padding: 5px 10px; }
.tabella-campi .spunta { display: flex; justify-content: center; }
.link-discreto { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--bordo-forte); }
.link-discreto:hover { color: var(--verde-600); border-bottom-color: var(--verde-600); }
.posizione { display: inline-block; min-width: 2em; text-align: right; color: var(--testo-2); font-variant-numeric: tabular-nums; margin-right: 8px; }
select[multiple] { min-height: 200px; padding: 6px; }
select[multiple] option { padding: 4px 8px; border-radius: 6px; }
.variazione { font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.riga-link--lungo, .card--tabella td:first-child a.riga-link--lungo { white-space: normal; }
.numeri dd.neg, .td-muted.neg { color: var(--err-testo); }
.quota-barra { display: block; height: 6px; margin-top: 4px; border-radius: var(--r-pill); background: #F2C879; overflow: hidden; min-width: 64px; }
.quota-barra span { display: block; height: 100%; width: var(--p, 0%); background: var(--verde-600); }
.card__piede--colonna { flex-direction: column; align-items: stretch; }
.scelta-clienti__testa { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scelta-clienti__testa .barra-filtri__cerca { flex: 1 1 240px; }
.scelta-clienti { list-style: none; padding: 8px 12px; margin: 0; max-height: 280px; overflow: auto; background: var(--carta); border: 1px solid var(--bordo-forte); border-radius: var(--r-m); display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 20px; }
.scelta-clienti li[hidden] { display: none; }
.scelta-clienti .spunta { padding: 4px 0; font-weight: 400; width: 100%; }
.card--tabella > .grafico { margin: 0 20px 16px; }
.variazione--su { color: var(--ok-testo); } .variazione--giu { color: var(--err-testo); }
.card__piede { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--bordo); background: var(--sup-velo); font-size: var(--t-s); }
.scelte { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.scelta { display: flex; gap: 14px; align-items: flex-start; margin: 0; padding: 14px 16px; border: 1px solid var(--bordo-forte); border-radius: var(--r-m); background: var(--carta); color: var(--testo); font-size: var(--t-m); font-weight: 400; cursor: pointer; transition: border-color var(--veloce), background var(--veloce); }
.scelta:hover { border-color: var(--err-pieno); }
.scelta:has(input:checked) { border-color: var(--err-pieno); background: var(--err-bg); }
.scelta:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.scelta > input { margin-top: 3px; }
.scelta__testo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.scelta__testo > span { color: var(--testo-2); font-size: var(--t-s); }
.scelta__testo select { width: auto; max-width: 100%; margin-top: 6px; align-self: flex-start; }
.card--pericolo .card__titolo .icona { vertical-align: -3px; }
.vuoto--errore { border-style: solid; border-color: var(--err-bordo); }
.vuoto--errore .vuoto__icona { color: var(--err-pieno); }
.errore-dettagli { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--t-xs); background: var(--sup-velo); border: 1px solid var(--bordo); border-radius: var(--r-s); padding: 12px; margin-bottom: 20px; max-height: 320px; overflow: auto; }

/* sottomenu: le pagine di una sezione, in fila sotto il titolo */
.sottomenu { display: flex; gap: 2px; margin: -8px 0 20px; border-bottom: 1px solid var(--bordo); overflow-x: auto; scrollbar-width: none; }
.sottomenu::-webkit-scrollbar { display: none; }
.sottomenu__voce { flex: none; padding: 10px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--testo-2); font-size: var(--t-s); font-weight: 600; text-decoration: none; white-space: nowrap; transition: color var(--veloce), border-color var(--veloce); }
.sottomenu__voce:hover { color: var(--testo); border-bottom-color: var(--bordo-forte); }
.sottomenu__voce.is-attiva { color: var(--verde-700); border-bottom-color: var(--verde-600); }
.aggiornato { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 16px; }
.aggiornato .icona { flex: none; margin-top: 3px; }
.tabella-fitta th, .tabella-fitta td { padding-left: 10px; padding-right: 10px; }
.tabella-fitta th { white-space: normal; line-height: 1.3; vertical-align: bottom; }
.due-righe { display: inline-flex; flex-direction: column; gap: 1px; white-space: nowrap; font-size: var(--t-s); }
.da-a { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.da-a .icona { width: 13px; height: 13px; color: var(--testo-2); }
.da-a strong.neg { color: var(--err-testo); }
.quota-barra--peso { background: var(--sup-velo); }
.quota-barra--peso span { background: #D98A2B; }
.importo-barra { display: inline-flex; flex-direction: column; align-items: stretch; min-width: 110px; }
.azioni-riga { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.azioni-riga form { margin: 0; }

/* linguette di stato */
.linguette { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.linguette::-webkit-scrollbar { display: none; }
.linguetta { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--bordo-forte); border-radius: var(--r-pill); background: var(--carta); color: var(--testo); font-size: var(--t-s); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background var(--veloce), border-color var(--veloce); }
.linguetta span { padding: 0 7px; border-radius: var(--r-pill); background: var(--sup-velo); color: var(--testo-2); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.linguetta:hover { border-color: var(--verde-600); color: var(--testo); }
.linguetta.is-attiva { background: var(--sup-scura); border-color: var(--sup-scura); color: var(--su-scuro); }
.linguetta.is-attiva span { background: var(--accento); color: var(--su-accento); }

/* barra dei filtri */
.barra-filtri { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.barra-filtri > div { flex: 0 1 auto; min-width: 0; }
.barra-filtri__spunta .spunta { align-items: center; font-size: var(--t-s); white-space: nowrap; }
.cliente-senza { display: block; margin-top: 2px; font-size: var(--t-xs); font-weight: 400; color: var(--testo-2); }
.barra-filtri select { width: auto; max-width: 100%; }
.barra-filtri__cerca { position: relative; flex: 1 1 260px !important; }
.barra-filtri__cerca .icona { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--testo-2); pointer-events: none; }
.barra-filtri__cerca input { padding-left: 38px; }
.barra-filtri__azzera { font-size: var(--t-s); font-weight: 600; white-space: nowrap; }

/* tabelle di righe cliccabili e con selezione */
.td-spunta { width: 40px; text-align: center; }
.riga-link { color: var(--testo); text-decoration: none; font-weight: 650; white-space: nowrap; }
.riga-link:hover { color: var(--verde-600); text-decoration: underline; }
.js .tabella-righe tbody tr { cursor: pointer; }
.td-b > .td-muted, td > .td-muted { display: block; font-weight: 400; }
td > span.td-muted:only-child { display: inline; }
.riga-attiva td { background: var(--lime-100) !important; }
.btn-solo-icona { padding-left: 9px; padding-right: 9px; }
.azione-gruppo h3 { font-size: var(--t-m); font-weight: 700; margin-bottom: 10px; }
.card--form .frow > div { min-width: 160px; }

/* catena di calcolo "grande": come nasce la provvigione */
.catena { display: flex; align-items: stretch; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.catena__blocco { flex: 1 1 150px; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--sup-card); border: 1px solid var(--bordo); border-radius: var(--r-m); box-shadow: var(--ombra-1); }
.catena__blocco span { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-2); }
.catena__blocco strong { font-family: var(--font-titoli); font-weight: 800; font-size: clamp(1.1rem, 1.7vw, 1.5rem); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.catena__blocco small { font-size: var(--t-xs); color: var(--testo-2); }
.catena__blocco--chiave { background: var(--sup-scura); border-color: var(--sup-scura); flex-grow: 1.3; }
.catena__blocco--chiave span { color: var(--su-scuro); } .catena__blocco--chiave strong { color: var(--accento); } .catena__blocco--chiave small { color: var(--su-scuro-2); }
.catena__op { align-self: center; font-family: var(--font-titoli); font-weight: 800; font-size: var(--t-xl); color: var(--testo-2); }

/* documento "nota provvigioni": a video un foglio, in stampa la pagina */
.documento { position: relative; overflow: hidden; background: var(--carta); border: 1px solid var(--bordo); border-radius: var(--r-m); box-shadow: var(--ombra-2); padding: 44px 48px; margin: 0 auto 24px; max-width: 980px; }
.documento__filigrana { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-family: var(--font-titoli); font-weight: 800; font-size: clamp(4rem, 14vw, 9rem); letter-spacing: .08em; text-transform: uppercase; color: rgba(16, 35, 26, .06); transform: rotate(-24deg); z-index: 0; }
.documento--annullata .documento__filigrana { color: rgba(179, 38, 30, .10); }
.documento > :not(.documento__filigrana) { position: relative; z-index: 1; }
.documento__testa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 24px 40px; padding-bottom: 22px; border-bottom: 3px solid var(--verde-900); }
.documento__tipo { font-size: .6875rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--verde-600); }
.documento__numero { font-family: var(--font-titoli); font-weight: 800; font-size: var(--t-2xl); letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.documento__data { color: var(--testo-2); font-size: var(--t-s); margin-top: 2px; }
.documento__parti { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; font-size: .875rem; }
.documento__parti span { display: block; font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-2); margin-bottom: 3px; }
.documento__parti strong { display: block; font-size: var(--t-m); }
.documento__logo { display: block; height: 52px; width: auto; max-width: 100%; margin-bottom: 10px; }
.documento__info { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 28px; padding: 18px 0; font-size: .875rem; }
.documento__info dt { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-2); }
.documento__info dd span { color: var(--testo-2); }
.documento__riepilogo { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: stretch; margin: 6px 0 28px; }
.documento__totale { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 20px 24px; border-radius: var(--r-m); background: var(--sup-scura); color: var(--su-scuro-2); }
.documento__totale span { font-size: .6875rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--su-scuro); }
.documento__totale strong { font-family: var(--font-titoli); font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -.02em; line-height: 1.15; color: var(--accento); font-variant-numeric: tabular-nums; white-space: nowrap; }
.documento__totale small { font-size: var(--t-s); }
.documento__titolo { font-size: var(--t-l); font-weight: 700; margin: 22px 0 10px; }
.documento__nota { color: var(--testo-2); font-size: var(--t-xs); margin-top: 8px; }
.documento__vuoto { padding: 28px 0 8px; color: var(--testo-2); text-align: center; }
.documento__dicitura { color: var(--testo-2); font-size: var(--t-s); margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--bordo); }
.documento__firme { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; margin-top: 36px; font-size: .875rem; color: var(--testo-2); }
.documento__firme span { display: block; height: 44px; border-bottom: 1px solid var(--bordo-forte); }

.card--emissione { max-width: 980px; margin-left: auto; margin-right: auto; border-color: #B9DC7C; background: var(--lime-100); }
.card--pericolo { max-width: 980px; margin-left: auto; margin-right: auto; border-color: var(--err-bordo); }
.card--pericolo .card__titolo { color: var(--err-testo); }
.card--tabella { padding: 0; overflow: hidden; }
.card--tabella > .tbl-wrap { border: 0; border-radius: 0; }
.card--tabella > .flex-between { padding: 12px 18px; }
.card--tabella td:first-child a { white-space: nowrap; }
.riga-spenta td { color: var(--testo-2); }
.riga-spenta td a { color: var(--testo-2); }
.eroe--compatto { grid-template-columns: minmax(0, 1fr) auto; }
.eroe--compatto .eroe__numero { font-size: clamp(2rem, 4vw, 3rem); }
details.card > summary { font-family: var(--font-titoli); font-weight: 700; font-size: var(--t-l); padding: 0; }

/* casella di spunta con la sua etichetta */
.spunta { display: inline-flex; align-items: flex-start; gap: 10px; font-size: var(--t-m); font-weight: 500; color: var(--testo); cursor: pointer; margin: 0; }
.spunta input { margin-top: 2px; }

/* stato vuoto */
.vuoto { text-align: center; max-width: 34em; margin: 6vh auto; padding: 40px 28px; background: var(--sup-card); border: 1px dashed var(--bordo-forte); border-radius: var(--r-l); }
.vuoto__icona { width: 44px; height: 44px; color: var(--verde-600); margin-bottom: 12px; }
.vuoto h1, .vuoto h2 { font-size: var(--t-xl); font-weight: 800; margin-bottom: 8px; }
.vuoto p { color: var(--testo-2); margin-bottom: 20px; }
.td-azioni { white-space: nowrap; text-align: right; }

/* finestra di conferma */
.dialogo { border: 0; border-radius: var(--r-l); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--ombra-2); color: var(--testo); margin: auto; }
.dialogo::backdrop { background: rgba(10, 31, 21, .55); }
.dialogo form { padding: 26px 26px 22px; }
.dialogo__titolo { font-size: var(--t-xl); font-weight: 800; margin-bottom: 8px; }
.dialogo__testo { color: var(--testo-2); white-space: pre-line; }
.dialogo__azioni { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ── 6. Utilita' ─────────────────────────────────────────────────────────── */

.muted { color: var(--testo-2); }
.right { text-align: right; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.inline-form { display: inline; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: 20px; }
.card .grid-2, .card .grid-3 { margin-bottom: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 7. Moduli su piu' colonne ───────────────────────────────────────────── */

.frow { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.frow > div { flex: 1; min-width: 150px; }
.frow > .fw-auto { flex: 0 0 auto; min-width: 0; }
.tbl-compatta { font-size: var(--t-s); } .tbl-compatta td, .tbl-compatta th { padding: 5px 9px; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.card--tabella > .avviso { margin: 0 20px 14px; }
.paginazione { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 20px; font-size: var(--t-s); }
.paginazione p { margin: 0; }
.card--tabella > .paginazione { margin: 0; padding: 12px 18px; border-top: 1px solid var(--bordo); background: var(--sup-velo); }
.stato-cella { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.stato-cella .td-muted { font-size: var(--t-xs); white-space: nowrap; }
.paginazione__pagine { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.paginazione .btn .icona { width: 15px; height: 15px; }

/* ── Schermi piccoli (solo a video: la stampa ha le sue regole) ──────────── */

@media screen and (max-width: 1023px) {
  .barra { display: none; }
  .appbar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: var(--appbar-h);
    padding: 0 16px; padding-top: env(safe-area-inset-top); background: var(--sup-scura); color: var(--su-scuro);
  }
  .appbar .marchio { width: 30px; height: 30px; display: block; }
  .appbar__titolo { flex: 1; min-width: 0; font-family: var(--font-titoli); font-weight: 700; font-size: var(--t-l); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar .prova { margin: 0; align-self: center; }
  .appbar__anno { margin: 0; flex: none; }
  .appbar__anno select { width: auto; min-height: 36px; padding: 4px 30px 4px 10px; }
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 40; display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--sup-card); border-top: 1px solid var(--bordo); box-shadow: 0 -4px 16px rgba(16, 35, 26, .06);
  }
  .scheda { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--testo-2); text-decoration: none; font-size: .6875rem; font-weight: 600; }
  .scheda__icona { display: inline-flex; padding: 3px 16px; border-radius: var(--r-pill); transition: background var(--veloce); }
  .scheda .icona { width: 22px; height: 22px; }
  .scheda.is-attiva { color: var(--verde-800); }
  .scheda.is-attiva .scheda__icona { background: var(--lime-300); }
  .guscio-app .contenuto { margin-left: 0; padding: 20px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); max-width: none; }
  /* sul telefono il titolo e' gia' nella barra in alto: quello di pagina resta solo per i lettori di schermo */
  .testata h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .testata { margin-bottom: 18px; }
  .testata p { margin-top: 0; }
}

@media screen and (max-width: 899px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .eroe { grid-template-columns: minmax(0, 1fr); padding: 24px 20px; border-radius: 18px; }
  .eroe__numeri { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eroe__numeri dd { font-size: var(--t-l); }
  .numeri { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .numeri__voce--chiave { grid-column: 1 / -1; grid-row: 1; }
  .griglia-agenti { grid-template-columns: minmax(0, 1fr); }
  .testata__azioni { width: 100%; }
  .filtro-rapido { flex: 1; }
  .filtro-rapido select { flex: 1; }
  /* tabelle "a schede": ogni riga diventa una scheda con le etichette a sinistra */
  .tabella-schede thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabella-schede, .tabella-schede tbody, .tabella-schede tr, .tabella-schede td { display: block; width: 100%; }
  .tabella-schede tr { padding: 10px 14px; border-bottom: 1px solid var(--bordo); }
  .tabella-schede tr:last-child { border-bottom: 0; }
  .tabella-schede td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; white-space: normal; }
  .tabella-schede td::before { content: attr(data-label); color: var(--testo-2); font-size: var(--t-s); font-weight: 500; text-align: left; }
  /* la cella "titolo" della scheda: senza etichetta, a tutta larghezza, con spazio per la casella di selezione */
  .tabella-schede td.td-titolo { display: block; text-align: left; font-size: var(--t-l); padding: 0 34px 6px 0; }
  .tabella-schede td.td-titolo::before, .tabella-schede td.td-azioni::before, .tabella-schede td.td-spunta::before { content: none; }
  .tabella-schede td.td-azioni { justify-content: flex-start; padding-top: 8px; flex-wrap: wrap; gap: 8px; white-space: normal; }
  .tabella-campi td { align-items: center; }
  .tabella-campi td > input[type=text], .tabella-campi td > select { flex: 0 1 62%; min-width: 0; }
  .tabella-campi td.td-titolo > input { width: 100%; font-weight: 650; }
  .tabella-campi .spunta { justify-content: flex-end; }
  details.card.utente > summary { flex-wrap: wrap; padding: 14px 16px; }
  .utente > summary > .etichette { order: 3; flex-basis: 100%; }
  .utente__corpo { padding: 4px 14px 16px; }
  .tabella-schede tbody tr:hover td { background: transparent; }
  .tabella-schede tfoot { display: block; }
  .tabella-schede tfoot td:empty { display: none; }
  .tabella-schede tfoot td { padding: 3px 0; }
  .tabella-schede tfoot td:first-child { font-size: var(--t-m); }
  .tabella-schede td.td-spunta { position: absolute; right: 14px; width: auto; padding: 2px 0; }
  .tabella-schede tr { position: relative; }
  .tabella-schede td > .td-muted { text-align: right; }
  .stato-cella { align-items: flex-end; }
  .tabella-schede td.td-titolo > .td-muted { text-align: left; font-size: var(--t-s); }
  .barra-filtri > div, .barra-filtri select { flex: 1 1 100%; width: 100%; }
  .catena__op { display: none; }
  .catena__blocco { flex: 1 1 40%; padding: 12px 14px; }
  .catena__blocco--chiave { flex-basis: 100%; }
  .accesso { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .accesso__fascia { padding: 28px 24px 36px; gap: 22px; }
  .accesso__messaggio p { display: none; }
  .accesso__messaggio h1::after { margin: 16px 0 0; }
  .accesso__solchi { height: 100%; opacity: .7; }
  .accesso__modulo { align-items: flex-start; padding: 24px 16px 40px; }
  .accesso__card { margin-top: -18px; position: relative; padding: 26px 22px 24px; }
  .documento { padding: 24px 18px; }
  .documento__testa, .documento__riepilogo, .eroe--compatto { grid-template-columns: minmax(0, 1fr); }
}

@media screen and (max-width: 599px) {
  .card { padding: 18px 16px; border-radius: var(--r-m); margin-bottom: 16px; }
  .card .card { padding: 14px; }
  .card__testa, .card__titolo--dentro { padding-left: 0; padding-right: 0; padding-top: 0; }
  .tabella-mappa, .tabella-mappa tbody, .tabella-mappa tr, .tabella-mappa th, .tabella-mappa td { display: block; width: 100%; }
  .tabella-mappa th { padding: 8px 0 2px; } .tabella-mappa td { padding: 0 0 6px; }
  .passi { gap: 6px; } .passi__voce { padding: 4px 12px 4px 4px; }
  .paginazione__parola { display: none; }
  .grafico--incassi { height: 300px; }
  .paginazione { justify-content: center; }
  .esito { padding: 26px 16px 20px; } .prossimo { padding: 16px; }
  .frow > div { min-width: 100%; }
  .frow > .fw-auto { min-width: 0; }
  .btn { white-space: normal; text-align: center; }
  th, td { padding: 9px 10px; }
  .dialogo__azioni .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* nomi lunghi (clienti, prodotti) nelle tabelle larghe: vanno a capo, ma la colonna non si riduce a una striscia */
@media screen and (min-width: 900px) {
  td.td-titolo:has(> .riga-link--lungo) { min-width: 230px; }
}
