/* Fornietic — veste v3 (DESIGN.md 2026-09-21): fondo chiaro, carte bianche, un accento verde, General Sans,
   forme tonde. Niente da servizi esterni: le pagine mostrano nomi di clienti, quindi font e script stanno in
   static/. I nomi dei token della v2 restano dove il ruolo è lo stesso: cambiano i valori. */

@font-face { font-family: 'General Sans'; src: url('/static/fonts/GeneralSans-Variable.woff2') format('woff2');
             font-weight: 200 700; font-display: swap; }

/* --- 1. tavolozza --------------------------------------------------------- */
:root {
  /* superfici */
  --fondo:       #f3f4f4;   /* l'applicazione */
  --side:        #f7f7f7;   /* la colonna laterale */
  --paper:       #ffffff;   /* le carte */
  --paper-tint:  #f7f7f7;   /* campi, selettori, pannelli */
  --cream:       var(--fondo);
  --tessera:     var(--paper);
  --line:        #e9eae7;
  --line-faint:  #eff0ee;
  --grid:        #e9eae7;

  /* il verde, unico accento */
  --green-900:   #13452d;
  --green-700:   #1f5c3f;
  --green-500:   #227d53;
  --green-300:   #5fbd92;
  --green-100:   #cff9e4;
  --scuro:       linear-gradient(180deg, #13452d 0%, #257246 100%);
  --spruce:      var(--green-900);
  --spruce-2:    var(--green-500);
  --spruce-soft: var(--green-100);
  --sage-deep:   var(--green-700);
  --sage-soft:   var(--green-100);
  --sage:        var(--green-300);

  /* testo */
  --ink:         #1c1f1d;
  --ink-2:       #1c1f1d;
  --text:        #4a504b;
  --muted:       #8a8f8a;
  --muted-2:     #8a8f8a;
  --axis:        #8a8f8a;

  /* stati, riservati: sempre con la parola accanto */
  --ok-bg:       #cff9e4;  --ok-fg:       #1f5c3f;
  --wait-bg:     #f3e7c6;  --wait-fg:     #856733;
  --risk-bg:     #fbe4e1;  --risk-fg:     #a85439;
  --terracotta:  var(--risk-fg);  --terracotta-2: var(--risk-fg);  --terracotta-soft: var(--risk-bg);
  --ochre:       var(--wait-fg);  --ochre-soft:   var(--wait-bg);
  --grey-green:  #9aa49f;
  --olive:       var(--green-300);

  /* tratteggio: vuoto, in attesa, non stimato */
  --hatch: repeating-linear-gradient(45deg, #dce4df 0 4.5px, #9aa49f 4.5px 6px);

  --sans: 'General Sans', system-ui, sans-serif;
  --mono: var(--sans);
  --sidebar-w: 248px;
  --r-card: 20px; --r-inner: 16px; --r-field: 12px; --r-pill: 999px;
  /* una sola ombra sulle carte, una per la lista della ricerca, l'anello di messa a fuoco */
  --shadow-card: 0 8px 24px rgba(20, 40, 30, .06);
  --shadow-tile: var(--shadow-card);
  --shadow-pop:  0 16px 40px rgba(20, 40, 30, .14);
  --shadow-fab:  var(--shadow-card);
  --ring: 0 0 0 3px rgba(34, 125, 83, .25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--fondo);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: none; box-shadow: var(--ring); }

/* --- 5. colonna laterale (v3: chiara) ------------------------------------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--side); padding: 24px 16px 20px;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar .logo { display: block; width: 168px; margin: 4px 12px 28px; }
.side-label {
  font-size: 11px; font-weight: 600; line-height: 1.2; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 24px 0 8px 16px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 12px 0 16px; border-radius: var(--r-field);
  font-size: 15px; font-weight: 500; line-height: 1.2; color: var(--text); text-decoration: none;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item span { flex: 1; }
.nav-item:hover { background: rgba(0, 0, 0, .03); color: var(--ink); }
.nav-item.active { background: var(--paper); color: var(--green-900); font-weight: 600; box-shadow: var(--shadow-card); }
/* la barretta verde a sinistra della voce attiva, come nel riferimento */
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
                           border-radius: 2px; background: var(--green-500); }
.nav-count {
  flex: none; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--wait-bg); color: var(--wait-fg); font-size: 11px; font-weight: 600; line-height: 22px;
}
.sidebar footer { margin-top: auto; padding: 0 8px; }
.sidebar footer .who { display: flex; align-items: center; gap: 12px; }
.who-testo { display: flex; flex-direction: column; min-width: 0; }
.who-nome { font-size: 15px; font-weight: 500; line-height: 1.3; color: var(--ink);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar footer a { font-size: 13px; color: var(--muted); text-decoration: none; }
.sidebar footer a:hover { text-decoration: underline; }
.sidebar footer .esci button { font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0;
                               padding: 0; cursor: pointer; text-align: left; }
.sidebar footer .esci button:hover { text-decoration: underline; }

/* --- 3. impaginazione ----------------------------------------------------- */
main { margin-left: var(--sidebar-w); padding: 24px 32px 40px; }

/* --- 5. barra in alto ----------------------------------------------------- */
/* la barra sottile in cima: ricerca a sinistra, a destra l'avviso dei dati (se c'è) e il contatore degli invii,
   sempre ultimo: chi ha il margine automatico spinge a destra, e la pillola lo cede al contatore che la segue */
.barra-alta { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.barra-alta .data-chip { margin-left: auto; }
.barra-alta .data-chip + .contatore-invii { margin-left: 0; }
.topbar { display: flex; align-items: flex-end; gap: 24px; min-height: 56px; margin-bottom: 24px; }
.topbar-testo { min-width: 0; }
.page-title { font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; color: var(--ink); }
.page-subtitle { font-size: 14px; line-height: 1.4; color: var(--muted); margin-top: 2px; }
.page-subtitle:empty { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-actions .btn { height: 40px; }
.data-chip {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--paper);
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.data-chip.stale { background: var(--wait-bg); color: var(--wait-fg); border-color: transparent; }

/* il contatore degli invii del mese: il numero e un cerchio che si riempie. Verde sotto 80, ambra da 80, rosso al limite */
.contatore-invii {
  flex: none; display: inline-flex; align-items: center; gap: 10px; margin-left: auto;
  font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.contatore-invii svg { width: 28px; height: 28px; }
.contatore-invii .giro-fondo { stroke: var(--line); }
.contatore-invii .giro-pieno { stroke: var(--sage-deep); }
.contatore-invii.livello-attenzione .giro-pieno { stroke: var(--wait-fg); }
.contatore-invii.livello-pieno .giro-pieno { stroke: var(--risk-fg); }

/* la ricerca: capsula con la lente dentro, la lista bianca che galleggia sotto */
.cerca-cliente { position: relative; width: 380px; flex: none; }
.cerca-cliente > svg { position: absolute; left: 16px; top: 12px; width: 20px; height: 20px;
                       color: var(--muted); pointer-events: none; }
/* .field arriva dopo nel file e a parità di specificità vincerebbe lei: il selettore composto tiene
   lo spazio per la lente */
.field.field-cerca { padding: 0 16px 0 46px; border-radius: var(--r-pill); }
.cerca-lista { position: absolute; left: 0; right: 0; top: 52px; z-index: 20; background: var(--paper);
               border: 1px solid var(--line); border-radius: var(--r-inner); box-shadow: var(--shadow-pop);
               padding: 6px; }
.cerca-lista[hidden] { display: none; }
.cerca-lista ul { list-style: none; }
.cerca-lista a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px;
                 color: var(--ink); text-decoration: none; }
.cerca-lista a:hover, .cerca-lista a:focus-visible { background: var(--paper-tint); }
.cerca-testo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cerca-nome { font-size: 14px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden;
              text-overflow: ellipsis; }
.cerca-nome b { color: var(--green-900); }
.cerca-meta { font-size: 12px; line-height: 1.3; color: var(--muted); }
.cerca-vuoto { padding: 10px 12px; font-size: 14px; color: var(--muted); }

/* --- 5. bottoni ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 20px; border-radius: var(--r-pill); border: none; cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 600; line-height: 1; text-decoration: none;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--green-900); color: #fff; }
.btn-white { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn-urgent { background: var(--terracotta); color: var(--paper); }
.btn-min {
  display: inline-flex; align-items: center; height: 44px; padding: 0 10px; border-radius: var(--r-pill);
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 600; line-height: 1;
  list-style: none; width: max-content;
}
.btn-min::-webkit-details-marker { display: none; }
.btn-min::after { content: ' \25BE'; }
details[open] > .btn-min::after { content: ' \25B4'; }
.btn-min:hover { color: var(--ink-2); }

/* --- 5. chip di fascia ---------------------------------------------------- */
/* Due scale, mai gli stessi colori: sul rischio "alto" è una cattiva notizia, sulla probabilità "alta" è una
   buona notizia e non può vestire il colore dell'urgenza. */
.chip { display: inline-block; border-radius: 9999px; padding: 3px 10px;
        font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.chip-risk-alta  { color: var(--risk-fg); background: var(--risk-bg); }
.chip-risk-media, .chip-prob-media { color: var(--wait-fg); background: var(--wait-bg); }
.chip-risk-bassa, .chip-prob-alta  { color: var(--ok-fg); background: var(--ok-bg); }
.chip-prob-bassa, .chip-risk-nd, .chip-prob-nd { color: var(--muted); background: var(--line-faint); }

/* --- 5. scheda ------------------------------------------------------------ */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card);
        padding: 24px; box-shadow: var(--shadow-card); }
.card-title { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
.card-label { font-size: 11px; font-weight: 600; line-height: 1.2; letter-spacing: .06em;
              text-transform: uppercase; color: var(--muted); }
.hero { font-size: 44px; font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; color: var(--ink);
        font-variant-numeric: tabular-nums; }
.hero-caption { font-size: 15px; font-weight: 400; line-height: 1.4; color: var(--muted); }

/* --- 5. righe di elenco --------------------------------------------------- */
.rows { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.row { min-height: 44px; }
.row-head { display: flex; align-items: center; gap: 10px; min-height: 22px; }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--grey-green); }
.dot-risk-alta  { background: var(--risk-fg); }
.dot-risk-media, .dot-prob-media { background: var(--wait-fg); }
.dot-risk-bassa, .dot-prob-alta  { background: var(--green-500); }
.dot-prob-bassa, .dot-risk-nd, .dot-prob-nd { background: var(--grey-green); }
.row-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; line-height: 1.4; color: var(--text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amount { margin-left: auto; padding-left: 12px; font-size: 15px; font-weight: 500; line-height: 1.4;
              color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-note { margin-left: 18px; font-size: 12px; line-height: 1.4; color: var(--muted-2);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-bar { margin: 6px 0 0 18px; height: 3px; border-radius: 2px; background: var(--line); }
.row-bar > span { display: block; height: 3px; border-radius: 2px; background: var(--grey-green); }
.row-bar > .fill-risk-alta  { background: var(--risk-fg); }
.row-bar > .fill-risk-media, .row-bar > .fill-prob-media { background: var(--wait-fg); }
.row-bar > .fill-risk-bassa, .row-bar > .fill-prob-alta  { background: var(--green-500); }
.row-bar > .fill-prob-bassa { background: var(--grey-green); }

/* --- 5. la scheda dell'Agenda --------------------------------------------- */
.queue-section { margin-bottom: 28px; }
.queue-section > .card-title { margin-bottom: 16px; }
.queue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.slot { display: flex; flex-direction: column; }
.slot-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.slot-head .chip { margin-left: auto; }
.slot .hero-caption { margin-bottom: 20px; }
.customer { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.customer-testo { min-width: 0; }
.customer-name { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); }
.customer-name a { color: inherit; text-decoration: none; }
.customer-name a:hover { text-decoration: underline; }
.customer-meta { font-size: 13px; line-height: 1.4; color: var(--muted); }
.delta-down { color: var(--risk-fg); font-weight: 600; }
.delta-up { color: var(--green-700); font-weight: 600; }
/* "perché?" e "altre N proposte" partono dalla colonna della nota (18px); le ragioni rientrano di altri 20 */
.why > .btn-min, .more > .btn-min { margin-left: 8px; }
.racconto { margin-left: 18px; padding: 4px 0 2px; font-size: 13px; line-height: 1.55; color: var(--text); }
.why > ul { list-style: disc; margin: 0 0 4px 38px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.more > .rows { margin-top: 12px; }
/* la griglia allinea le schede in altezza: le azioni restano in fondo, mai a mezz'aria */
.card-foot { margin-top: auto; padding-top: 24px; display: flex; align-items: center; gap: 12px;
             flex-wrap: wrap; }
.card-foot .open { margin-left: auto; font-size: 14px; color: var(--muted); text-decoration: none; }
.card-foot .open:hover { color: var(--ink-2); text-decoration: underline; }
/* "Rinvia" e "Non adatto" sostituiscono i tre bottoni con il proprio modulo, dentro la scheda e non sopra */
.card-foot .act { flex: 1 1 100%; display: grid; gap: 10px; }
.act .field-label { margin-bottom: 0; }
.act label { display: grid; gap: 6px; }
/* nella scheda cliente il piede è largo quanto la pagina: un campo data di 1400px non ha senso */
.act label, .act > .field { max-width: 420px; }
.act-buttons { display: flex; gap: 12px; margin-top: 4px; }
/* la ✕ di riga è minima (DESIGN.md §5, bottoni): si colora solo al passaggio */
.row-drop { display: flex; flex: none; }
.row-x { width: 28px; height: 28px; border: none; border-radius: 50%; background: transparent;
         color: var(--muted-2); cursor: pointer; font-family: var(--sans); font-size: 13px; line-height: 1; }
.row-x:hover { color: var(--risk-fg); background: var(--risk-bg); }
.empty { color: var(--muted); font-size: 15px; padding: 24px 0; }

/* --- 5. tabella ----------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
thead th { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
           color: var(--muted-2); text-align: left; background: transparent;
           border-bottom: 1px solid var(--line); padding: 8px 12px; }
tbody td { height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--line-faint); color: var(--text); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.row-n { width: 48px; font-size: 12px; color: var(--axis); font-variant-numeric: tabular-nums; }

/* --- 5. filtri ------------------------------------------------------------ */
.filter { display: inline-flex; align-items: center; height: 40px; padding: 0 14px;
          border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
          font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; }
.filter.on { border-color: var(--green-500); color: var(--ink); }
.filter-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card);
              padding: 20px 24px; box-shadow: var(--shadow-card); }

/* --- 5. selettore a segmenti ---------------------------------------------- */
.segmented { display: flex; height: 48px; padding: 4px; gap: 4px;
             background: var(--paper-tint); border: 1px solid var(--line); border-radius: var(--r-pill); }
.segmented > a { flex: 1; display: flex; align-items: center; justify-content: center; border-radius: var(--r-pill);
                 font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: none; }
.segmented > a.on { background: var(--paper); border: 1px solid var(--line); color: var(--ink);
                    box-shadow: var(--shadow-card); }

/* --- 5. campi ------------------------------------------------------------- */
.field { width: 100%; height: 44px; padding: 0 14px; background: var(--paper);
         border: 1px solid var(--line); border-radius: var(--r-field);
         font-family: var(--sans); font-size: 15px; color: var(--ink-2); }
.field::placeholder { color: var(--muted-2); }
.field:focus { outline: none; border-color: var(--green-500); box-shadow: var(--ring); }
.field-label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field-error { color: var(--risk-fg); font-size: 13px; }

/* --- 5. grafici (v3) ------------------------------------------------------ */
.grafico { display: block; width: 100%; height: auto; overflow: visible; }
.grafico-barre { min-height: 170px; }
.grafico-barre .asse { stroke: var(--line); stroke-width: 1; }
/* il bersaglio del passaggio è tutta la colonna del mese, non la barra sottile */
.grafico-barre .bersaglio { fill: transparent; }
.grafico-barre .barra { fill: var(--green-500); transition: fill .15s; }
/* il mese senza ordini è tratteggiato: la regola sopra, da sola, lo colorerebbe di verde come un ordine piccolo */
.grafico-barre .barra.vuota, .grafico-barre .colonna:hover .barra.vuota { fill: url(#tratteggio); }
/* più resi che ordini: la barra sale come le altre ma nel colore di rischio, e il riquadro dice «resi» */
.grafico-barre .barra.negativa, .grafico-barre .colonna:hover .barra.negativa { fill: var(--risk-fg); }
.grafico-barre .colonna:hover .barra { fill: var(--green-900); }
.grafico-barre .colonna:hover .bersaglio { fill: rgba(34, 125, 83, .06); }
.grafico-barre .etichetta { font-family: var(--sans); font-size: 11px; fill: var(--muted);
                            font-variant-numeric: tabular-nums; }
.grafico-anello { width: 96px; height: 96px; flex: none; }
.anello-fondo { fill: none; stroke: var(--line-faint); stroke-width: 10; }
.segmento { fill: none; stroke-width: 10; stroke-linecap: butt; cursor: default; transition: stroke .15s; }
/* il neutro è #8a8f8a e non una tinta più chiara: sotto il 3:1 sul bianco il segmento sparisce
   (validatore dataviz, 2026-09-21) */
.segmento-pieno { stroke: var(--green-500); }
.segmento-pieno:hover { stroke: var(--green-900); }
.segmento-grigio { stroke: var(--muted); }
.anello-centro { font-family: var(--sans); font-size: 20px; font-weight: 600; fill: var(--ink);
                 font-variant-numeric: tabular-nums; }
.numero.scuro .anello-fondo { stroke: rgba(255, 255, 255, .18); }
.numero.scuro .anello-centro { fill: #fff; }

/* il riquadro al passaggio: una capsula scura sopra l'elemento, disegnata da app.js */
.tip { position: absolute; z-index: 30; transform: translate(-50%, -100%); padding: 6px 10px;
       border-radius: var(--r-pill); background: var(--green-900); color: #fff;
       font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; pointer-events: none; }
.tip[hidden] { display: none; }

/* Grafico | Tabella, e le pillole delle famiglie sopra il grafico */
.viste { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
         margin-bottom: 16px; }
.viste .segmented { height: 40px; width: 220px; }
.viste .segmented > button { flex: 1; border: none; background: transparent; border-radius: var(--r-pill);
                             cursor: pointer; font-family: var(--sans); font-size: 14px; font-weight: 600;
                             color: var(--muted); }
.viste .segmented > button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-card); }
.famiglie { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.famiglie a { display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
              border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper);
              font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }
.famiglie a:hover { border-color: var(--green-500); color: var(--green-900); }
.famiglie a.on { background: var(--green-900); border-color: var(--green-900); color: #fff; }

/* --- 5. accesso ----------------------------------------------------------- */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px;
             background: var(--fondo); }
.login-card { width: 380px; background: var(--paper); border: 1px solid var(--line);
              border-radius: var(--r-card); padding: 32px; box-shadow: var(--shadow-card); }
.login-card .logo { display: block; width: 160px; margin-bottom: 24px; }
.login-card .field-label { margin-top: 16px; }
.login-card .btn-primary { width: 100%; margin-top: 24px; }
.login-card .login-testo { font-size: 14px; color: var(--muted); margin-top: 16px; line-height: 1.5; }
.login-card .btn-white { width: 100%; margin-top: 8px; }
.login-card a.btn { display: block; text-align: center; margin-top: 24px; }

/* Sotto i 1368px la griglia dei posti passa a due colonne; sotto i 1180 la colonna laterale tiene le sole
   icone (l'etichetta resta nel title); sotto i 1000 una colonna sola. */
@media (max-width: 1368px) {
  .queue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  :root { --sidebar-w: 72px; }
  .sidebar { padding: 20px 12px; }
  .sidebar .logo { width: 44px; margin: 0 2px 24px; object-fit: cover; object-position: left; }
  .side-label, .nav-item span, .who-testo { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-count { position: absolute; right: 4px; top: 4px; height: 16px; line-height: 16px; padding: 0 5px; font-size: 10px; }
  .cerca-cliente { width: 260px; }
}
@media (max-width: 1000px) {
  main { padding: 20px 16px; }
  .queue-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- 5. scheda cliente ---------------------------------------------------- */
/* Schede in colonna, una per blocco della spec §6.3; la barra in alto porta il ritorno all'Agenda */
.stack { display: grid; gap: 20px; }
.stack .card-title { margin-bottom: 16px; }
.topbar-actions .btn { height: 40px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px 24px; margin-top: 20px; }
.facts div { min-width: 0; }
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.facts dd { margin: 0; font-size: 15px; line-height: 1.4; color: var(--text); overflow-wrap: anywhere; }
.facts a, .evidence a, .stack td a { color: var(--spruce-2); }
.history td.fam, .stack td.fam { font-weight: 500; color: var(--ink-2); }
.history td.state { white-space: nowrap; }
.history td.state .dot { display: inline-block; margin-right: 8px; vertical-align: middle; }

.titolo-cliente { display: inline-flex; align-items: center; gap: 14px; }
/* le micro-barre nella tabella: nessun mese è speciale, un solo verde */
.bars { display: flex; align-items: flex-end; gap: 2px; width: 216px; height: 28px; border-bottom: 1px solid var(--line); }
.bar { flex: 1 1 0; min-width: 0; background: var(--green-300); border-radius: 2px 2px 0 0; }
.chart-caption, .source-note { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.source-note { margin: 0 0 12px; }
.summary { font-size: 15px; line-height: 1.5; color: var(--text); }
.evidence { list-style: none; display: grid; gap: 8px; margin-top: 16px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.evidence a { overflow-wrap: anywhere; }
.evidence q { color: var(--text); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.5; padding: 3px 9px; border: none;
       border-radius: var(--r-pill); background: var(--line-faint); color: var(--muted); white-space: nowrap;
       vertical-align: middle; }
/* la persona in correzione: campi e bottone compatti dentro la riga di tabella (44px) */
.field.in-table { height: 36px; padding: 0 10px; font-size: 14px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-right: 8px; }
.link-quiet { font-size: 14px; color: var(--muted); text-decoration: none; }
.link-quiet:hover { color: var(--ink-2); text-decoration: underline; }
.add-form { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.add-form .field { flex: 1 1 200px; width: auto; }
.add-form .btn { flex: none; height: 48px; }
.timeline { list-style: none; display: grid; gap: 12px; margin-top: 20px; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; font-size: 15px; line-height: 1.5; color: var(--text); }
.timeline .when { font-size: 12px; color: var(--axis); padding-top: 3px; font-variant-numeric: tabular-nums; }
.timeline .who { display: block; font-size: 13px; color: var(--muted-2); }


/* --- 5. Opportunità: le due liste complete -------------------------------- */
.lists { max-width: 420px; margin-bottom: 20px; }
.filter-box { margin-bottom: 20px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.filter-grid label { display: grid; gap: 6px; min-width: 0; }
.filter-grid .field-label { margin-bottom: 0; }
.filter-foot { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.filter-foot .btn { margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--green-500); }
.count { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

/* la tabella: un <tbody> per proposta, così il pannello sta sotto la sua riga (DESIGN.md §5, tabella) */
.opportunita { table-layout: fixed; }
.opportunita thead th a { color: inherit; text-decoration: none; }
.opportunita thead th a:hover { color: var(--ink-2); }
.opportunita thead th.sorted { color: var(--ink-2); }
.opportunita td { vertical-align: top; padding-top: 10px; }
.c-n { width: 40px; } .c-cliente { width: 252px; }   /* v3: la cella ospita anche il cerchio da 28px */ .c-fam { width: 150px; } .c-motivo { width: auto; }
/* «probabilità alta» per esteso: il colore da solo si contraddice fra allarmi e riprese */
.c-fascia { width: 150px; } .c-num { width: 112px; } .c-stato { width: 88px; } .c-azioni { width: 188px; }   /* «Lo contatto io» 120 + «altro» 39 + gli spazi: a 164 «altro» usciva dalla cella */
/* l'ellissi su una cella: con table-layout: fixed basta overflow, mentre display:block la toglierebbe
   dalla tabella e le larghezze del colgroup non varrebbero più */
.opportunita td.fam, .opportunita td.motivo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opportunita td.cliente a, .opportunita td.cliente .meta {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opportunita td.motivo { font-size: 13px; color: var(--muted-2); line-height: 1.4; }
.opportunita td.fascia { font-size: 13px; white-space: nowrap; }
.opportunita td.fascia .dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.opportunita td.stato { font-size: 13px; color: var(--muted); }
.opportunita td.azioni { white-space: nowrap; text-align: right; }
.opportunita td.azioni form { display: inline-block; }
.opportunita td.azioni .link-quiet { background: none; border: none; cursor: pointer; padding: 0 0 0 10px;
                                     font-family: var(--sans); }
.opportunita td.cliente a { color: var(--ink-2); font-weight: 500; text-decoration: none; }
.opportunita td.cliente a:hover { text-decoration: underline; }
.opportunita td.cliente .meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted-2);
                                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-row tr.panel > td { border-bottom: 1px solid var(--line-faint); background: var(--paper-tint); }
.act-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 4px 0 8px; }
.act-row label { display: grid; gap: 6px; }
.act-row .field { width: 280px; }
.paging { display: flex; align-items: center; gap: 16px; margin-top: 20px; font-size: 14px; color: var(--muted); }


/* --- 5. Registro ---------------------------------------------------------- */
.nav-count.vuoto { display: none; }
#attesa { margin-bottom: 28px; }
#attesa .card-title { margin-bottom: 8px; }
.section-note { font-size: 14px; line-height: 1.5; color: var(--muted); margin-bottom: 16px; max-width: 720px; }
/* una telefonata per riquadro. Riquadri larghi, non la griglia a tre colonne dell'Agenda: qui ogni riga
   porta il nome del prodotto e due bottoni, e in una colonna stretta andrebbero tutti a capo */
.attesa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 20px; }
.card.attesa { display: flex; flex-direction: column; }
.card.attesa .customer-name { margin-bottom: 16px; }
.card.attesa .customer-name a { color: inherit; text-decoration: none; }
.card.attesa .customer-name a:hover { text-decoration: underline; }
.attesa-riga { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.attesa-riga .row-name { flex: 1 1 auto; }
.riga-azioni { display: flex; gap: 8px; }
.attesa-dettaglio { display: grid; grid-template-columns: 1fr 80px 1fr; gap: 12px; margin-top: 20px; }
.attesa-dettaglio label { display: grid; gap: 6px; min-width: 0; }
.attesa-dettaglio .field-label { margin-bottom: 0; }
.attesa-dettaglio .field { height: 40px; font-size: 14px; }
.tabs { max-width: 620px; margin-bottom: 20px; }
.cerca { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.cerca-campo { position: relative; flex: 1 1 320px; display: grid; gap: 6px; }
/* nei filtri il campo ha un'etichetta sopra: la lista si appende in fondo all'etichetta, non a 52px fissi */
.cerca-campo > .cerca-lista { top: 100%; margin-top: 6px; }
.cerca .field-label { margin-bottom: 0; }
.cerca .switch { padding-bottom: 12px; }
/* Clienti: la stessa tabella di Opportunità, senza le azioni */
.clienti { table-layout: fixed; }
.clienti thead th a { color: inherit; text-decoration: none; }
.clienti thead th a:hover { color: var(--ink-2); }
.clienti thead th.sorted { color: var(--ink-2); }
.clienti td { vertical-align: top; padding-top: 10px; }
.clienti td.cliente a, .clienti td.cliente .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clienti td.cliente a { color: var(--ink-2); font-weight: 500; text-decoration: none; }
.clienti td.cliente a:hover { text-decoration: underline; }
.clienti td.cliente .meta { margin-top: 2px; font-size: 12px; color: var(--muted-2); }
.clienti td.quando { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.registro { table-layout: fixed; }
.registro td { vertical-align: top; padding-top: 10px; }
.c-quando { width: 100px; } .c-esito { width: 210px; } .c-conv { width: 200px; }
.registro td.fam, .registro td.motivo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.registro td.motivo { font-size: 13px; color: var(--muted-2); line-height: 1.4; }
.registro td.quando { font-size: 12px; color: var(--axis); font-variant-numeric: tabular-nums; }
.registro td.cliente a { color: var(--ink-2); font-weight: 500; text-decoration: none; }
.registro td.cliente a:hover { text-decoration: underline; }
.registro td.esito, .registro td.conv { font-size: 13px; }
.registro td.esito .meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted-2); }


/* --- 6. v3: pillole, iniziali, bottoni rotondi ---------------------------- */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
        font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; }
.pill-positivo { background: var(--ok-bg); color: var(--ok-fg); }
.pill-attesa   { background: var(--wait-bg); color: var(--wait-fg); }
.pill-rischio  { background: var(--risk-bg); color: var(--risk-fg); }
.pill-neutro   { background: var(--line-faint); color: var(--muted); }
.ini { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%;
       font-weight: 600; color: var(--green-900); letter-spacing: .02em; }
.ini-28 { width: 28px; height: 28px; font-size: 11px; }
.ini-36 { width: 36px; height: 36px; font-size: 13px; }
.ini-48 { width: 48px; height: 48px; font-size: 18px; }
.ini-t0 { background: #cff9e4; } .ini-t1 { background: #dce9e2; } .ini-t2 { background: #e3f1ea; } .ini-t3 { background: #eef2ee; }
.btn-round { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
             border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
             text-decoration: none; cursor: pointer; font-size: 16px; line-height: 1; }
.btn-round:hover { border-color: var(--green-500); color: var(--green-900); }


/* --- 6. v3: riga dei numeri ----------------------------------------------- */
.numeri { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 24px; }
.numeri-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.numero { position: relative; background: var(--paper); border: 1px solid var(--line);
          border-radius: var(--r-inner); padding: 20px 22px 18px; box-shadow: var(--shadow-card);
          min-height: 148px; display: flex; flex-direction: column; }
/* una sola carta scura per pagina: la prima della riga */
.numero.scuro { background: var(--scuro); border-color: transparent; color: #fff; }
.numero-testa { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
                margin-bottom: 10px; }
.numero-etichetta { font-size: 14px; font-weight: 500; line-height: 1.3; color: var(--text); }
.numero.scuro .numero-etichetta { color: rgba(255, 255, 255, .85); }
.numero-vai { width: 32px; height: 32px; font-size: 14px; flex: none; }
.numero.scuro .numero-vai { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25);
                            color: #fff; }
.numero.scuro .numero-vai:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.numero-valore { font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -0.03em;
                 color: var(--ink); font-variant-numeric: tabular-nums; }
.numero.scuro .numero-valore { color: #fff; }
.numero-valore a { color: inherit; text-decoration: none; }
.numero-valore a:hover { text-decoration: underline; }
.numero-corpo { margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 10px;
                flex-wrap: wrap; }
.numero-sotto { font-size: 13px; line-height: 1.4; color: var(--muted); }
.numero.scuro .numero-sotto { color: rgba(255, 255, 255, .72); }
.numero.scuro .pill-positivo { background: rgba(255, 255, 255, .16); color: #fff; }
.numero-anello { display: flex; align-items: center; gap: 16px; }
.numero-anello .numero-corpo { margin-top: 0; padding-top: 0; flex-direction: column;
                               align-items: flex-start; gap: 6px; }
@media (max-width: 1368px) { .numeri { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .numeri, .numeri-3 { grid-template-columns: minmax(0, 1fr); } }

/* --- 6. v3: iniziali nelle tabelle --------------------------------------- */
.cliente-cella { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cliente-testo { display: flex; flex-direction: column; min-width: 0; }
.registro td.cliente .cliente-cella a, .opportunita td.cliente .cliente-cella a, .clienti td.cliente .cliente-cella a {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.attesa .customer-name a { display: inline-flex; align-items: center; gap: 12px; }
.attesa-grid { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.lists, .tabs { max-width: 420px; }

/* --- 7. Email: le spunte, la sovrimpressione con i destinatari e l'anteprima (spec 2026-09-25 §5b) --- */
.scelta-barra { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.scelta-barra .count { margin-bottom: 0; }
.scelta-barra .btn { margin-left: auto; }
.c-scelta { width: 44px; }
td.scelta input { width: 18px; height: 18px; accent-color: var(--green-500); }
.disiscrivi { margin-top: 24px; }
.sovrimpressione { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start;
                   justify-content: center; padding: 48px 24px; background: rgba(20, 40, 30, .35); overflow-y: auto; }
.sovr-box { width: min(760px, 100%); display: grid; gap: 16px; box-shadow: var(--shadow-pop); }
.sovr-conto { font-size: 15px; color: var(--ink); }
.sovr-nomi { list-style: none; max-height: 168px; overflow-y: auto; columns: 2; column-gap: 24px;
             font-size: 14px; line-height: 1.6; color: var(--text); }
.sovr-sotto { font-size: 14px; font-weight: 600; color: var(--muted); }
.anteprima { background: var(--paper-tint); border: 1px solid var(--line); border-radius: var(--r-inner);
             padding: 16px 20px; max-height: 360px; overflow-y: auto; }
.anteprima-oggetto { font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.anteprima-testo { white-space: pre-wrap; font-size: 15px; line-height: 1.55; color: var(--ink); }
.anteprima mark { background: var(--wait-bg); color: var(--wait-fg); border-radius: 4px; padding: 0 2px; }
.anteprima-html { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: var(--r-inner); background: #fff; }
.sovr-piede { display: flex; justify-content: flex-end; gap: 12px; }
.sovr-piede form { display: contents; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
