/* ============================================================
   GESTIONALE PDD — Design System
   Stile "Data-Dense Dashboard" premium: Inter, palette slate/blu,
   ombre stratificate, cifre tabulari, micro-interazioni curate.
   ============================================================ */

:root {
  /* --- Colore ---
     Un solo accento (petrolio brand) + neutri slate + semantici sobri.
     I colori inline dei grafici vengono desaturati globalmente (vedi
     "Armonia colore" in fondo alle sezioni grafici). */
  --blu:        #0d6d90;   /* accento unico: petrolio brand */
  --blu-scuro:  #095673;
  --blu-chiaro: #eef5f8;
  /* Brand cliente: Professionisti del Debito */
  --brand:      #005478;
  --brand2:     #0a7ea4;
  --brand-soft: #8fe3c8;
  --verde:      #0e9f6e;
  --verde-bg:   #eefaf5;
  --rosso:      #d64545;
  --rosso-bg:   #fdf1f1;
  --ambra:      #c9820e;
  --giallo:     #c9820e;

  --sfondo:     #f7f8fa;
  --bianco:     #ffffff;
  --testo:      #101828;
  --testo-medio:#344054;
  --testo-tenue:#667085;
  --bordo:      #e9ecf1;
  --bordo-forte:#d5dae2;

  /* Sidebar scura */
  --side-bg:    #0c1118;
  --side-bg2:   #10161f;
  --side-testo: #8b94a3;
  --side-attivo:#ffffff;

  /* --- Raggi --- */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* --- Ombre stratificate --- */
  --ombra-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --ombra-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --ombra:    0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 6px -2px rgba(15, 23, 42, .05);
  --ombra-lg: 0 12px 28px -6px rgba(15, 23, 42, .16), 0 6px 12px -6px rgba(15, 23, 42, .08);
  --ombra-xl: 0 28px 60px -12px rgba(15, 23, 42, .28), 0 10px 24px -12px rgba(15, 23, 42, .14);

  /* --- Motion --- */
  --ease: cubic-bezier(.32, .72, 0, 1);
  --t-veloce: .14s var(--ease);
  --t: .22s var(--ease);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* L'attributo hidden deve sempre vincere sui display: flex delle viste */
[hidden] { display: none !important; }

/* Icone SVG inline: allineate al testo */
.ic { display: inline-block; vertical-align: -.14em; flex-shrink: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Fondo minimal con gradient moderno: due bagliori brand molto
     tenui in alto + degradé verticale appena percettibile. */
  background:
    radial-gradient(1100px 420px at 88% -8%, rgba(10, 126, 164, .065), transparent 62%),
    radial-gradient(850px 360px at 4% -4%, rgba(0, 84, 120, .045), transparent 58%),
    linear-gradient(180deg, #fafbfd 0%, var(--sfondo) 420px);
  background-attachment: fixed;
  background-color: var(--sfondo);
  color: var(--testo);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Inter: interlinea contestuale + alternative moderne (1, l, a a un piano) */
  font-feature-settings: 'cv11', 'ss01', 'cv05', 'cv08';
}

/* Titoli e numeri chiave: Inter Tight, display stretto e contemporaneo */
h1, h2, h3, h4,
.stat-valore, .hero-nome, .marchio, .logo-testo, .pagina-testata h2 {
  font-family: 'Inter Tight', 'Inter', -apple-system, sans-serif;
}

/* Cifre tabulari per dati, importi, tabelle */
.tabella, .stat-valore, .card-valore, .conteggio, .cal-num,
.dash-riga, .barra-info, .badge { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.028em; color: var(--testo); }
h2 { font-size: 22px; }
/* Titoli pagina: gradient tipografico sobrio (slate → petrolio) */
.pagina-testata h2 {
  background: linear-gradient(120deg, var(--testo) 55%, var(--brand));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
h3 { font-size: 15px; }

button { font: inherit; cursor: pointer; color: inherit; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--bordo-forte);
  border-radius: 10px;
  background: var(--bianco);
  color: var(--testo);
  transition: border-color var(--t-veloce), box-shadow var(--t-veloce);
}
input::placeholder, textarea::placeholder { color: #9aa7b8; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blu);
  box-shadow: 0 0 0 3.5px rgba(13, 109, 144, .14);
}
select {
  appearance: none;
  background-image: url("../assets/ic/chevron.svg");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: background var(--t-veloce), border-color var(--t-veloce),
              box-shadow var(--t-veloce), transform var(--t-veloce);
}
.btn:active { transform: translateY(.5px) scale(.99); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3.5px rgba(13, 109, 144, .28); }

.btn-primario {
  background: linear-gradient(135deg, #0a7ea4, #005478);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 84, 120, .4), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primario:hover {
  background: linear-gradient(135deg, #0b8ab3, #00618a);
  box-shadow: var(--ombra), 0 1px 2px rgba(0, 84, 120, .4);
}

.btn-secondario {
  background: var(--bianco);
  color: var(--testo-medio);
  border-color: var(--bordo-forte);
  box-shadow: var(--ombra-xs);
}
.btn-secondario:hover { background: #f8fafc; border-color: #c3ccd9; }

.btn-pericolo { background: var(--rosso-bg); color: #b91c1c; }
.btn-pericolo:hover { background: #fde4e4; }

.btn-blocco { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

.btn-icona {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: inherit;
  opacity: .68;
  padding: 6px;
  border-radius: var(--r-sm);
  transition: opacity var(--t-veloce), background var(--t-veloce), color var(--t-veloce);
}
.btn-icona:hover { opacity: 1; background: rgba(100, 116, 139, .14); }
.btn-icona svg { width: 17px; height: 17px; display: block; }

/* ---------- Login ---------- */
#vista-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 620px at 15% -5%, #0a5c80 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 110%, #0e7490 0%, transparent 50%),
    linear-gradient(135deg, #04283a 0%, #062c3f 100%);
}
.login-card {
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--r-xl);
  padding: 34px 32px;
  width: 100%;
  max-width: 410px;
  box-shadow: var(--ombra-xl);
}
.login-marchio { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.marchio-glifo {
  width: 50px; height: 50px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--brand2), var(--brand));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; letter-spacing: -.5px;
  box-shadow: var(--ombra), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.login-card h1 { font-size: 21px; letter-spacing: -.03em; }
.login-card h1 span { color: var(--brand2); }
.login-sotto { color: var(--testo-tenue); font-size: 13px; margin-top: 1px; }
#form-login .campo { margin-bottom: 15px; }
#form-login { margin-top: 4px; }

/* ---------- Layout app ---------- */
#vista-app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 244px;
  background: linear-gradient(180deg, var(--side-bg2) 0%, var(--side-bg) 100%);
  color: var(--side-testo);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 18px;
}
.logo-glifo {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand2), var(--brand));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: -.5px;
  box-shadow: 0 4px 12px -2px rgba(10, 126, 164, .55), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.logo-testo { font-size: 15.5px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.logo-testo span { color: var(--brand-soft); }

/* Logo aziendale (immagine su fondo scuro) — sidebar */
.logo-marchio {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px;
  background: #05131c;
  padding: 4px;
  object-fit: contain;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
}
/* Logo aziendale — card di login */
.marchio-logo {
  width: 54px; height: 54px; flex-shrink: 0;
  border-radius: 14px;
  background: #05131c;
  padding: 6px;
  object-fit: contain;
  box-shadow: var(--ombra), inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* Logo aziendale (marchio SCL) + dicitura di proprietà */
.logo-img {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 11px;
  background: #06121d;
  padding: 3px;
  box-shadow: 0 4px 12px -2px rgba(20, 176, 175, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
/* Footer copyright in fondo alla sidebar */
.sidebar-footer {
  padding: 10px 20px 16px;
  font-size: 9.5px; line-height: 1.5;
  color: rgba(255, 255, 255, .38);
  letter-spacing: .02em;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
/* Copyright in fondo alla card di login */
.login-proprieta {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--bordo);
  font-size: 10.5px; line-height: 1.5;
  color: var(--testo-tenue); text-align: center;
}

.sidebar-nav {
  flex: 1;
  padding: 6px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-gruppo {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: #5b6675;
  padding: 6px 12px 4px;
  margin-top: 12px;
}

/* Trigger ricerca globale in sidebar */
.ricerca-globale-trigger {
  display: flex; align-items: center; gap: 9px;
  margin: 4px 12px 8px; padding: 9px 11px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px; color: #94a3b8; cursor: pointer;
  font-size: 13px; transition: background var(--t-veloce), border-color var(--t-veloce);
}
.ricerca-globale-trigger:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .16); color: #cbd5e1; }
.ricerca-globale-trigger svg { width: 15px; height: 15px; flex-shrink: 0; }
.ricerca-globale-trigger span { flex: 1; text-align: left; }
.ricerca-globale-trigger kbd {
  font-size: 10px; font-family: inherit; font-weight: 600;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 5px; padding: 1px 5px; color: #94a3b8;
}

/* Command palette overlay */
.rg-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(8, 12, 20, .5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh; animation: rg-in .12s var(--ease);
}
@keyframes rg-in { from { opacity: 0 } to { opacity: 1 } }
.rg-box {
  width: min(600px, 92vw); background: var(--bianco);
  border: 1px solid var(--bordo); border-radius: 16px;
  box-shadow: var(--ombra-xl); overflow: hidden;
}
.rg-search { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--bordo); }
.rg-search svg { width: 19px; height: 19px; color: var(--testo-tenue); flex-shrink: 0; }
.rg-search input { border: none; padding: 0; font-size: 16px; background: none; }
.rg-search input:focus { outline: none; box-shadow: none; }
.rg-search kbd {
  font-size: 11px; font-family: inherit; font-weight: 600; color: var(--testo-tenue);
  background: var(--sfondo); border: 1px solid var(--bordo); border-radius: 5px; padding: 2px 6px;
}
.rg-risultati { max-height: 56vh; overflow-y: auto; padding: 8px; }
.rg-hint { padding: 24px 18px; text-align: center; color: var(--testo-tenue); font-size: 13px; }
.rg-gruppo {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--testo-tenue); padding: 12px 10px 5px;
}
.rg-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border: none; background: none; border-radius: 10px;
  cursor: pointer; text-align: left; transition: background var(--t-veloce);
}
.rg-item:hover { background: var(--blu-chiaro); }
.rg-ic { display: flex; width: 30px; height: 30px; flex-shrink: 0; align-items: center; justify-content: center;
  background: var(--sfondo); border-radius: 8px; color: var(--brand); }
.rg-ic svg { width: 16px; height: 16px; }
.rg-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rg-txt strong { font-size: 13.5px; font-weight: 600; color: var(--testo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-sub { font-size: 12px; color: var(--testo-tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-badge {
  font-size: 10.5px; font-weight: 700; text-transform: capitalize; color: var(--testo-tenue);
  background: var(--sfondo); border-radius: 999px; padding: 2px 9px; flex-shrink: 0;
}
.sidebar-gruppo:first-child { margin-top: 2px; }
.sidebar-nav::-webkit-scrollbar { width: 7px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--side-testo);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  position: relative;
  transition: background var(--t-veloce), color var(--t-veloce);
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.sidebar-nav a.attivo {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.sidebar-nav a.attivo svg { opacity: 1; color: var(--brand-soft); }
.sidebar-nav a.attivo::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-soft);
}

.sidebar-utente {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--brand2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.utente-info { flex: 1; min-width: 0; }
#utente-nome { color: #fff; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utente-ruolo { font-size: 11px; color: #7e8ca3; text-transform: capitalize; margin-top: 1px; }
.sidebar-utente .btn-icona { color: #94a3b8; }
.sidebar-utente .btn-icona:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.contenuto { flex: 1; padding: 26px 30px 40px; min-width: 0; }

/* ---------- Testata pagina ---------- */
.pagina-testata {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pagina-testata h2 { line-height: 1.1; }
.conteggio { color: var(--testo-tenue); font-size: 12.5px; font-weight: 500; }
.testata-azioni { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.input-cerca { width: 230px; padding-left: 34px;
  background-image: url("../assets/ic/search.svg");
  background-repeat: no-repeat; background-position: left 11px center;
}

/* ---------- Tabelle ---------- */
.tabella-wrap {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  overflow-x: auto;
}
.tabella { width: 100%; border-collapse: collapse; }
.tabella th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--testo-tenue);
  background: #fbfcfe;
  border-bottom: 1px solid var(--bordo);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.tabella td { padding: 12px 16px; border-bottom: 1px solid var(--bordo); color: var(--testo-medio); }
.tabella tbody tr { cursor: pointer; transition: background var(--t-veloce); }
.tabella tbody tr:hover { background: #f6f8fa; }
.tabella tbody tr:last-child td { border-bottom: none; }
.tabella strong { color: var(--testo); font-weight: 600; }

.vuoto {
  padding: 44px 24px; text-align: center;
  color: var(--testo-tenue); font-size: 13.5px;
}
/* Icona "vassoio vuoto" davanti a ogni stato vuoto */
.vuoto::before {
  content: ''; display: block;
  width: 42px; height: 42px; margin: 0 auto 10px;
  opacity: .45; background: currentColor;
  -webkit-mask: url("../assets/ic/inbox.svg") center / contain no-repeat;
  mask: url("../assets/ic/inbox.svg") center / contain no-repeat;
}
/* Niente icona sui piccoli "Caricamento…" dentro pannelli e modali */
.pannello .vuoto::before, .modal .vuoto::before { display: none; }
.pannello .vuoto, .modal .vuoto { padding: 18px; }

/* ---------- Proponi servizio (modale) ---------- */
.proponi-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .proponi-griglia { grid-template-columns: 1fr; } }
.proponi-btn {
  justify-content: center; gap: 8px;
  padding: 16px 12px; font-size: 13.5px; font-weight: 600;
  border-radius: 10px;
}
.proponi-btn .ic { width: 16px; height: 16px; color: var(--blu); }
.proponi-btn:hover { border-color: var(--blu); background: var(--blu-chiaro); }

/* ---------- Indicatore fattibilità (scheda lead) ---------- */
.fattibilita {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--fs, var(--blu)) 35%, transparent);
  background: color-mix(in srgb, var(--fs, var(--blu)) 7%, var(--bianco));
  font-size: 13px;
}
.fattibilita .ic { width: 17px; height: 17px; color: var(--fs, var(--blu)); flex-shrink: 0; }
.fattibilita strong { color: var(--testo); }

/* Urgenza sulla card kanban */
.card-urgente {
  display: inline-flex; align-items: center; width: fit-content;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: #b91c1c; background: var(--rosso-bg);
  border-radius: 999px; padding: 2px 9px;
}

/* ---------- Skeleton di caricamento ---------- */
.skel {
  position: relative; overflow: hidden;
  background: #e6ebf2; border-radius: 8px;
}
.skel::after {
  content: ''; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
  animation: skel-shimmer 1.3s infinite;
}
@keyframes skel-shimmer { to { transform: translateX(100%); } }
.skel-lista { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.skel-riga { height: 46px; }
.skel-colonna { padding: 12px 10px; gap: 8px; }
.skel-testata { height: 15px; width: 65%; border-radius: 5px; }
.skel-card { height: 78px; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }

/* Sotto-blocco (es. intestatario 1 / 2) nel form e nella scheda */
.sub-blocco {
  background: var(--sfondo); border: 1px solid var(--bordo);
  border-radius: 10px; padding: 12px 14px;
}
.sub-titolo {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--testo-tenue); margin-bottom: 8px;
}

/* ---------- Analisi: highlights e podio ---------- */
.hl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.hl-card {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--sfondo); border: 1px solid var(--bordo);
  border-radius: 10px; padding: 12px 14px;
}
.hl-lab { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--testo-tenue); }
.hl-lab .ic { width: 13px; height: 13px; }
.hl-card strong { font-size: 15px; letter-spacing: -.01em; }
.hl-val { font-size: 12.5px; font-weight: 600; color: var(--verde); }
/* Badge di posizione (1/2/3) al posto delle medaglie emoji */
.rango {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%;
  font-size: 11px; font-weight: 800; color: #fff; vertical-align: -4px;
}
.rango.r1 { background: linear-gradient(140deg, #d4a017, #b8860b); }
.rango.r2 { background: linear-gradient(140deg, #9ca8b4, #78828f); }
.rango.r3 { background: linear-gradient(140deg, #c17a4a, #a05a2c); }

.hl-card.podio-0 { background: var(--blu-chiaro); border-color: color-mix(in srgb, var(--brand2) 26%, transparent); }
.hl-card.podio-1 { background: #f8fafc; border-color: #e2e8f0; }
.hl-card.podio-2 { background: #fafbfc; border-color: var(--bordo); }

/* ---------- Analisi Uffici (card strutturate) ---------- */
.uff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.uff-card { background: var(--bianco); border: 1px solid var(--bordo); border-radius: 14px; padding: 16px; }
.uff-card.uff-zero { opacity: .62; background: var(--sfondo); }
.uff-badge-zero { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--testo-tenue); background: var(--bianco); border: 1px solid var(--bordo); border-radius: 999px; padding: 1px 7px; vertical-align: middle; margin-left: 6px; }
.uff-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--sfondo); }
.uff-nome { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.uff-venduto { text-align: right; font-size: 18px; font-weight: 800; color: var(--verde); line-height: 1.1; }
.uff-venduto span { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--testo-tenue); }
.uff-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.uff-kpi > div { display: flex; flex-direction: column; align-items: center; text-align: center; background: var(--sfondo); border-radius: 8px; padding: 8px 4px; }
.uff-kpi b { font-size: 15px; letter-spacing: -.02em; }
.uff-kpi span { font-size: 9.5px; color: var(--testo-tenue); text-transform: uppercase; letter-spacing: .03em; margin-top: 1px; }
.uff-funnel { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.uff-f-riga { display: grid; grid-template-columns: 62px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; }
.uff-f-lab { color: var(--testo-tenue); }
.uff-f-bar { height: 8px; background: var(--sfondo); border-radius: 999px; overflow: hidden; }
.uff-f-bar > span { display: block; height: 100%; border-radius: 999px; }
.uff-f-num { text-align: right; font-weight: 700; }
.uff-team { border-top: 1px solid var(--sfondo); padding-top: 10px; }
.uff-team-tit { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--testo-tenue); margin-bottom: 8px; }
.uff-team-tit .ic { width: 13px; height: 13px; }
.uff-comm { display: grid; grid-template-columns: 1fr 70px auto; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }
.uff-comm-bar { height: 6px; background: var(--sfondo); border-radius: 999px; overflow: hidden; }
.uff-comm-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #0a7ea4, #005478); border-radius: 999px; }
.uff-comm-v { font-weight: 700; color: var(--verde); font-size: 11.5px; }

/* ---------- Pagina Analisi (cruscotto direzionale) ---------- */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel-tappa { display: grid; grid-template-columns: 160px 1fr 170px; gap: 12px; align-items: center; }
@media (max-width: 640px) { .funnel-tappa { grid-template-columns: 110px 1fr; } .funnel-conv { display: none; } }
.funnel-info { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.funnel-info strong { font-size: 18px; letter-spacing: -.02em; }
.funnel-barra { height: 22px; background: var(--sfondo); border-radius: 6px; overflow: hidden; }
.funnel-barra > div { height: 100%; border-radius: 6px; transition: width .4s var(--ease); }
.funnel-conv { font-size: 12.5px; font-weight: 700; color: var(--testo-medio); }
.mini-kpi { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 8px; }
.mini-kpi > div { display: flex; flex-direction: column; }
.mini-num { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.mini-lab { font-size: 11.5px; color: var(--testo-tenue); }
.an-riga-alert { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sfondo); font-size: 13px; font-weight: 500; }

/* ---------- Documenti della pratica (checklist + allegati) ---------- */
.doc-sezione { margin-top: 22px; border-top: 1px solid var(--bordo); padding-top: 18px; }
.doc-testa { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-tit { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.doc-tit .ic { width: 16px; height: 16px; color: var(--blu); }
.doc-azioni-testa { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-azioni-testa .btn { padding: 6px 12px; font-size: 12.5px; }
.doc-avanz { font-size: 12px; color: var(--testo-tenue); font-weight: 600; }
.doc-barra { height: 6px; border-radius: 999px; background: var(--sfondo); overflow: hidden; margin-bottom: 14px; }
.doc-barra > div { height: 100%; background: linear-gradient(90deg, #16a34a, #059669); border-radius: 999px; transition: width var(--t-veloce); }
.doc-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--testo-tenue); margin: 12px 0 4px; }
.doc-riga {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--sfondo);
}
.doc-riga:last-child { border-bottom: none; }
.doc-nome { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; min-width: 0; }
.doc-nome > .ic { width: 15px; height: 15px; color: var(--testo-tenue); flex-shrink: 0; }
.doc-dx { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.doc-dx .btn-icona { width: 28px; height: 28px; }
.doc-upload { cursor: pointer; }
.doc-upload:hover { color: var(--blu); background: var(--blu-chiaro); }

/* ---------- Pagamenti/scadenze nella pratica ---------- */
.badge-ritardo {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--rosso-bg); color: #b91c1c;
  border-radius: 999px; padding: 2px 9px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge-ritardo .ic { width: 12px; height: 12px; }
.pag-sezione { margin-bottom: 18px; }
.pag-titolo {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 700; margin-bottom: 10px;
}
.pag-titolo .ic { width: 16px; height: 16px; color: var(--blu); }
.pag-avviso {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--rosso-bg); border: 1px solid #fecaca;
  border-radius: var(--r); padding: 10px 13px; margin-bottom: 12px;
  font-size: 13px; color: #7f1d1d;
}
.pag-avviso .ic { width: 18px; height: 18px; color: var(--rosso); flex-shrink: 0; }
.pag-riepilogo {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 16px;
  background: var(--sfondo); border-radius: var(--r); padding: 13px 15px;
}
.pag-riepilogo > div { display: flex; flex-direction: column; gap: 2px; }
.pag-riepilogo strong { font-size: 15px; }

/* ---------- Grafico Incassato per mese (cliccabile) ---------- */
.grafico-mesi {
  display: flex; align-items: flex-end; gap: 6px;
  height: 200px; padding-top: 20px;
}
.gm-col {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: inherit; border-radius: 8px;
  transition: background var(--t-veloce);
}
.gm-col:hover { background: var(--sfondo); }
.gm-val { font-size: 10px; font-weight: 700; color: var(--testo-medio); white-space: nowrap; min-height: 13px; }
.gm-barre { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; flex: 1; }
.gm-barra {
  width: 60%; max-width: 34px; min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #14b0af, #005478);
  transition: height var(--t-veloce), filter var(--t-veloce);
}
.gm-barre .gm-barra { width: 15px; }
.gm-atteso { background: #cbd5e1; }
.gm-legenda { display: flex; gap: 18px; justify-content: center; margin-top: 10px; font-size: 11.5px; color: var(--testo-tenue); }
.gm-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.gm-legenda i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.gm-legenda .l-inc { background: linear-gradient(180deg, #14b0af, #005478); }
.gm-legenda .l-att { background: #cbd5e1; }
.gm-col:hover .gm-barra { filter: brightness(1.1); }
.gm-col.sel .gm-barra { background: linear-gradient(180deg, var(--brand2), var(--brand)); box-shadow: 0 0 0 3px rgba(10, 126, 164, .18); }
.gm-col.sel { background: var(--blu-chiaro); }
.gm-label { font-size: 10px; color: var(--testo-tenue); text-transform: capitalize; white-space: nowrap; }
.gm-col.sel .gm-label { color: var(--brand); font-weight: 700; }

/* Delta di confronto (su/giù) */
.delta { font-weight: 700; }
.delta.su { color: var(--verde); }
.delta.giu { color: var(--rosso); }

/* ---------- Armonia colore ----------
   I grafici ricevono i colori inline dal JS/DB (fasi, serie, accenti).
   Qui vengono desaturati in blocco: le distinzioni restano leggibili,
   ma l'insieme è tonale e coerente — niente arcobaleno. */
.gm-barra,
.vend-barra > div,
.funnel-barra > div,
.uff-f-bar span,
.uff-comm-bar span,
.colonna-pallino,
.fase-step,
.badge,
.cal-evento,
.giorno-riga,
.mini-kpi .mini-num,
.hl-card {
  filter: saturate(.62);
}

/* ---------- Presenze (Team) ---------- */
.pallino-online {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--verde); vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(14, 159, 110, .2);
}
.stato-online { display: inline-flex; align-items: center; gap: 6px; color: var(--verde); font-weight: 600; }

/* ---------- Pagina Vendite (resoconto) ---------- */
.vendite-griglia {
  display: grid; grid-template-columns: 7fr 5fr;
  gap: 14px; align-items: start;
}
@media (max-width: 900px) { .vendite-griglia { grid-template-columns: 1fr; } }
.vend-riga { padding: 11px 0; border-bottom: 1px solid var(--sfondo); }
.vend-riga:last-child { border-bottom: none; }
.vend-testa { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vend-nome { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; }
.vend-nome .avatar { width: 26px; height: 26px; font-size: 10px; }
.vend-tot { font-weight: 800; font-size: 14px; color: var(--verde); font-variant-numeric: tabular-nums; }
.vend-barra {
  height: 7px; border-radius: 999px; background: var(--sfondo);
  margin: 7px 0 5px; overflow: hidden;
}
.vend-barra > div {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #005478, #0e7ba6);
  transition: width .4s var(--ease);
}
.vend-sotto { font-size: 11.5px; color: var(--testo-tenue); }
.vend-ultima {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--sfondo);
}
.vend-ultima:last-child { border-bottom: none; }
.vend-ultima-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.vend-ultima-info strong { font-size: 13px; }
.vend-ultima-info .tenue { font-size: 11.5px; }
.vend-ultima-importo { font-weight: 700; font-size: 13px; color: var(--verde); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* Azioni account nella scheda utente (reset password / elimina) */
.utente-extra {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap;
  margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--bordo);
}
.btn-testo.pericolo { color: var(--rosso); }
.btn-testo.pericolo:hover { color: #b91c1c; }
.btn-testo[disabled] { opacity: .5; cursor: default; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--badge, var(--blu));
  background: color-mix(in srgb, var(--badge, var(--blu)) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--badge, var(--blu)) 22%, transparent);
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---------- Modali ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11, 18, 32, .5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 44px 20px;
  z-index: 100;
  overflow-y: auto;
  animation: overlay-in .2s ease-out;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bianco);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--ombra-xl);
  animation: modal-in .26s var(--ease);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.modal-larga { max-width: 660px; }
.modal-xl { max-width: 1060px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--bordo);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 22px; }

.campo { margin-bottom: 15px; }
.campo label { display: block; font-weight: 600; font-size: 12.5px; color: var(--testo-medio); margin-bottom: 6px; }
.check-label { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13px; cursor: pointer; }
.check-label input { width: auto; accent-color: var(--blu); width: 16px; height: 16px; }
.form-azioni { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; flex-wrap: wrap; }
.form-errore {
  background: var(--rosso-bg);
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .2);
  margin-bottom: 13px;
  font-size: 13px;
  font-weight: 500;
}

.dettaglio-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 15px;
}
.dettaglio-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--testo-tenue);
  margin-bottom: 3px;
}

/* ---------- Form a sezioni ---------- */
.form-sezione { margin-bottom: 18px; }
.form-sezione-tit {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--testo-tenue);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--bordo);
}
.griglia-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.griglia-3 { display: grid; grid-template-columns: 1.4fr 1fr .6fr; gap: 12px; }

/* Toggle segmentato (Privato / Azienda) */
.seg {
  display: inline-flex;
  background: #eef2f7;
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 12px;
}
.seg-btn {
  padding: 6px 18px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  color: var(--testo-tenue);
  transition: background var(--t-veloce), color var(--t-veloce), box-shadow var(--t-veloce);
}
.seg-btn.attivo { background: var(--bianco); color: var(--blu); box-shadow: var(--ombra-sm); }

/* Testata scheda: tag a sinistra, meta a destra */
.scheda-testa {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px 18px; flex-wrap: wrap; margin-bottom: 14px;
}
.scheda-testa .scheda-tags, .scheda-testa .scheda-meta { margin-bottom: 0; }
.scheda-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.scheda-valore { font-size: 18px; font-weight: 800; color: var(--verde); letter-spacing: -.02em; margin-left: auto; }

/* ---------- Hero scheda cliente (postazione call center) ---------- */
.scheda-hero {
  background: linear-gradient(130deg, #005478 0%, #0a3d5c 55%, #072c44 100%);
  border-radius: 14px; padding: 18px 20px 16px;
  color: #fff; margin-bottom: 14px;
  box-shadow: var(--ombra-sm);
}
.hero-riga { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.avatar-hero {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25);
  font-weight: 700; font-size: 16px; letter-spacing: .02em;
}
.hero-info { min-width: 0; }
.hero-nome { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px;
  font-size: 12px; color: rgba(255, 255, 255, .72);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-meta .ic { width: 13px; height: 13px; }
.hero-tags { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hero-valore { font-size: 19px; font-weight: 800; color: var(--brand-soft); letter-spacing: -.02em; }
.hero-contatti { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hero-tel {
  display: inline-flex; align-items: center; gap: 9px;
  background: #fff; color: var(--verde);
  border-radius: 999px; padding: 9px 18px;
  font-size: 16px; font-weight: 800; letter-spacing: .4px;
  text-decoration: none; font-variant-numeric: tabular-nums;
  transition: transform var(--t-veloce), box-shadow var(--t-veloce);
}
.hero-tel:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.hero-tel .ic { width: 17px; height: 17px; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .12); color: #fff;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px; padding: 8px 15px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background var(--t-veloce);
}
.hero-pill:hover { background: rgba(255, 255, 255, .22); }
button.hero-pill { cursor: pointer; font-family: inherit; }
/* invito ad aggiungere il contatto: tratteggiato e cliccabile */
.hero-pill.vuo {
  background: rgba(255, 255, 255, .06);
  border-style: dashed; border-color: rgba(255, 255, 255, .4);
  color: rgba(255, 255, 255, .92); font-weight: 600;
}
.hero-pill.vuo:hover { background: rgba(255, 255, 255, .2); border-style: solid; }
.hero-pill.vuo .ic:last-child { width: 12px; height: 12px; opacity: .8; }
.hero-pill .ic { width: 14px; height: 14px; }

/* Griglia di lavoro: dati a sinistra, chiamata+attività a destra */
.scheda-lavoro {
  display: grid; grid-template-columns: 5fr 7fr;
  gap: 14px; align-items: start;
}
@media (max-width: 900px) { .scheda-lavoro { grid-template-columns: 1fr; } }
.lavoro-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pannello {
  background: linear-gradient(180deg, #fff, #fdfdfe);
  border: 1px solid var(--bordo);
  border-radius: var(--r-lg); padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.pannello-tit {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--testo-tenue); margin-bottom: 12px;
}
.pannello-tit .ic { width: 15px; height: 15px; color: var(--blu); }
.pannello-chiamata { background: #f0f7fa; border-color: #cfe3ec; }
.pannello-chiamata .pannello-tit { color: #005478; }
.pannello-chiamata .pannello-tit .ic { color: #005478; }
.pannello-chiamata textarea { background: var(--bianco); }
.nota-riga { display: flex; justify-content: flex-end; margin: -2px 0 8px; }
.feed-scroll { max-height: 380px; overflow-y: auto; }
.pannello .note-sezione { margin-top: 0; border-top: none; padding-top: 0; }

/* Stepper delle fasi (scheda) */
.fasi-stepper-wrap {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.fasi-stepper {
  display: flex; gap: 4px; overflow-x: auto; flex: 1;
  padding: 3px 2px; scrollbar-width: none;
}
.fasi-stepper::-webkit-scrollbar { display: none; }
.fase-step {
  flex-shrink: 0; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; font-family: inherit;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--bordo); background: var(--bianco); color: var(--testo-tenue);
  cursor: pointer; transition: all var(--t-veloce);
}
.fase-step:hover:not([disabled]) { border-color: var(--fs, var(--blu)); color: var(--testo); }
.fase-step.fatta { background: var(--sfondo); color: var(--testo-medio); border-color: transparent; }
.fase-step.attuale {
  background: var(--fs, var(--blu)); border-color: var(--fs, var(--blu));
  color: #fff; cursor: default;
}
.fase-step[disabled]:not(.attuale) { opacity: .55; cursor: default; }
.btn-testo {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  background: none; border: none; padding: 5px 4px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit; color: var(--testo-tenue);
  transition: color var(--t-veloce);
}
.btn-testo:hover { color: var(--blu); }
.btn-testo .ic { width: 13px; height: 13px; }

/* Tab della scheda */
.scheda-tabs {
  display: flex; gap: 2px; margin-bottom: 16px;
  border-bottom: 1px solid var(--bordo);
}
.scheda-tab {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--testo-tenue);
  padding: 9px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  transition: color var(--t-veloce), border-color var(--t-veloce);
}
.scheda-tab:hover { color: var(--testo); }
.scheda-tab.attiva { color: var(--blu); border-bottom-color: var(--blu); }
.scheda-pane { min-height: 120px; }

/* Cronologia compatta raggruppata per giorno */
.cronologia-lista { display: flex; flex-direction: column; }
.crono-giorno {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--testo-tenue); padding: 12px 0 5px;
}
.crono-giorno:first-child { padding-top: 0; }
.crono-riga {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--sfondo);
  font-size: 13px;
}
.crono-chip {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sfondo); color: var(--testo-tenue);
}
.crono-chip .ic { width: 14px; height: 14px; }
.crono-chip.fase { background: var(--blu-chiaro); color: var(--blu); }
.crono-chip.esito { background: var(--verde-bg); color: var(--verde); }
.crono-chip.nota { background: #f4f1e8; color: #8a6d3b; }
.crono-chip.att { background: #ede9fe; color: #7c3aed; }
.crono-txt { flex: 1; min-width: 0; font-weight: 500; color: var(--testo); }
.crono-dx { display: inline-flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.crono-chi { font-size: 11.5px; color: var(--testo-tenue); }
.crono-ora { font-size: 11.5px; color: var(--testo-tenue); font-variant-numeric: tabular-nums; }

/* Cronologia fasi (timeline — usata altrove) */
.cronologia { list-style: none; position: relative; padding-left: 6px; }
.cronologia li { position: relative; padding: 0 0 14px 20px; }
.cronologia li::before {
  content: '';
  position: absolute; left: 4px; top: 13px; bottom: -3px;
  width: 2px; background: var(--bordo);
}
.cronologia li:last-child::before { display: none; }
.crono-punto {
  position: absolute; left: 0; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blu);
  box-shadow: 0 0 0 3px var(--blu-chiaro);
}
.cronologia li:first-child .crono-punto { background: var(--verde); box-shadow: 0 0 0 3px var(--verde-bg); }
.crono-fase { font-weight: 600; font-size: 13.5px; }
.crono-fase .tenue { font-weight: 400; color: var(--testo-tenue); font-size: 12px; }
.crono-meta { font-size: 11.5px; color: var(--testo-tenue); margin-top: 1px; }

/* ---------- Strumenti (admin) ---------- */
.strumenti-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.strumenti-desc { color: var(--testo-tenue); font-size: 12.5px; margin-bottom: 14px; }
.config-riga {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid var(--bordo);
}
.config-riga:last-child { border-bottom: none; }
.config-riga strong { font-weight: 600; }

/* ---------- Telefono grande (scheda incarico) ---------- */
.chiama-grande {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--verde-bg); color: var(--verde);
  border-radius: var(--r); padding: 14px; margin-top: 4px;
  font-size: 20px; font-weight: 800; letter-spacing: .5px;
  text-decoration: none; font-variant-numeric: tabular-nums;
}
.chiama-grande .ic { width: 22px; height: 22px; }
.chiama-grande:hover { background: #d1fae5; }

/* Barra contatto in cima alla scheda (telefono grande + email) */
.scheda-contatto { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.scheda-contatto .chiama-grande { flex: 0 0 auto; margin-top: 0; padding: 10px 18px; font-size: 18px; }
.scheda-email {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--testo-medio); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.scheda-email:hover { color: var(--blu); }
.scheda-email .ic { color: var(--testo-tenue); }

/* Riga meta compatta (assegnato / ufficio / fonte / data) */
.scheda-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 12.5px; color: var(--testo-tenue); margin-bottom: 16px;
}
.scheda-meta span { display: inline-flex; align-items: center; gap: 5px; }
.scheda-meta .ic { width: 14px; height: 14px; }

/* Scheda lead a due colonne */
.scheda-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 640px) { .scheda-griglia { grid-template-columns: 1fr; } }
.scheda-griglia .form-sezione, .scheda-griglia > div { margin-bottom: 0; }
.scheda-pane .scheda-griglia { margin-bottom: 16px; }
.scheda-azioni { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--bordo); }

/* ---------- Pulsante chiamata ---------- */
.btn-chiama {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  border: none; border-radius: 8px;
  background: var(--verde-bg); color: var(--verde);
  transition: background var(--t-veloce), transform var(--t-veloce);
}
.btn-chiama:hover { background: #d1fae5; transform: scale(1.06); }
.btn-chiama .ic { width: 16px; height: 16px; }

/* ---------- Rate / piano pagamenti ---------- */
.rata {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--bordo);
}
.rata:last-child { border-bottom: none; }
.rata-n { font-weight: 600; width: 64px; flex-shrink: 0; }
.rata-imp { font-weight: 700; font-variant-numeric: tabular-nums; width: 90px; }
.rata-scad { color: var(--testo-tenue); font-size: 13px; flex: 1; }
.rata-btn { padding: 5px 12px; font-size: 12.5px; }
.rata.pagata .rata-imp, .rata.pagata .rata-n { opacity: .6; }

/* ---------- La mia giornata ---------- */
.giornata-sezione { margin-bottom: 22px; }
.giornata-tit {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 10px; padding-left: 10px; border-left: 3px solid var(--blu);
}
.giornata-tit span {
  background: var(--sfondo); color: var(--testo-tenue);
  border-radius: 20px; padding: 1px 9px; font-size: 12px; font-weight: 700;
}
.giornata-rosso { border-left-color: var(--rosso); color: var(--rosso); }
.giornata-blu { border-left-color: var(--blu); color: var(--blu); }
.giornata-grigio { border-left-color: var(--testo-tenue); color: var(--testo-tenue); }
.giornata-ambra { border-left-color: var(--ambra); color: var(--ambra); }
.giornata-viola { border-left-color: #8b5cf6; color: #8b5cf6; }
.giornata-lista {
  background: var(--bianco); border: 1px solid var(--bordo);
  border-radius: var(--r-lg); box-shadow: var(--ombra-sm); overflow: hidden;
}
.giornata-riga {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--bordo);
}
.giornata-riga:last-child { border-bottom: none; }
.giornata-riga:hover { background: #f8fafc; }
.giornata-main { flex: 1; min-width: 0; }
.giornata-nome { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.giornata-sotto { font-size: 12.5px; color: var(--testo-medio); margin-top: 2px; }
.giornata-azioni { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.giornata-azioni .btn { padding: 6px 12px; font-size: 12.5px; }
.giornata-azioni .btn-chiama { text-decoration: none; }

/* ---------- Esiti chiamata ---------- */
.esiti-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.esiti-griglia .btn { justify-content: center; }

/* ---------- Banner prossima azione ---------- */
.azione-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--blu-chiaro); border: 1px solid #dbe6fb;
  border-radius: var(--r); padding: 10px 14px; margin-bottom: 18px;
  font-size: 13.5px;
}
.azione-banner .ic { color: var(--blu); width: 18px; height: 18px; flex-shrink: 0; }
.azione-banner.scaduta-banner { background: var(--rosso-bg); border-color: #fecaca; }
.azione-banner.scaduta-banner .ic { color: var(--rosso); }

/* Tabella compatta (creditori) */
.tabella-mini th, .tabella-mini td { padding: 7px 10px; font-size: 12.5px; }
.tabella-mini tbody tr { cursor: pointer; }
.tabella-mini tfoot td { border-top: 2px solid var(--bordo-forte); border-bottom: none; background: #fbfcfe; }

/* ---------- Note / storico ---------- */
.note-sezione { margin-top: 22px; border-top: 1px solid var(--bordo); padding-top: 18px; }
.note-sezione h4 { margin-bottom: 12px; font-size: 13.5px; }
/* Dentro il tab "Note" la sezione è già intitolata dal tab stesso */
[data-pane="note"] .note-sezione { margin-top: 0; border-top: none; padding-top: 0; }
[data-pane="note"] .note-sezione h4 { display: none; }
.nota-form { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 14px; }
.nota-form textarea { flex: 1; }
.nota { padding: 11px 0; border-bottom: 1px solid var(--bordo); }
.nota:last-child { border-bottom: none; }
.nota-meta { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: var(--testo-tenue); margin-bottom: 3px; }
.nota-meta strong { color: var(--testo); }
.nota-del { margin-left: auto; }
.nota-testo { white-space: pre-wrap; color: var(--testo-medio); }

/* ---------- Toast ---------- */
#toast-box {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}
.toast {
  background: #0b1220;
  color: #fff;
  padding: 12px 17px;
  padding-left: 40px;
  border-radius: var(--r);
  box-shadow: var(--ombra-lg);
  font-weight: 500;
  font-size: 13.5px;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transition: opacity var(--t), transform var(--t);
  max-width: 340px;
  position: relative;
}
.toast::before {
  content: '';
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px;
  background: no-repeat center / contain
    url("../assets/ic/check.svg");
}
.toast.show { opacity: 1; transform: none; }
.toast-errore { background: var(--rosso); }
.toast-errore::before {
  background-image: url("../assets/ic/close.svg");
}

/* ---------- Dashboard ---------- */
.stat-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}
.stat-card {
  background: linear-gradient(165deg, #fff 55%, #fbfcfd);
  border: 1px solid var(--bordo);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
/* L'accento (--acc) non è più una banda colorata: solo un puntino
   discreto accanto all'etichetta, desaturato per coerenza tonale. */
.stat-card .stat-label::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--acc, var(--blu));
  margin-right: 7px;
  vertical-align: 1px;
  filter: saturate(.55) brightness(1.05);
}
.team-nota {
  margin-top: 16px;
  background: var(--blu-chiaro);
  border: 1px solid var(--bordo);
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--testo-medio);
}
.team-nota b { color: var(--testo); }
.stat-card:hover { box-shadow: var(--ombra); transform: translateY(-1px); border-color: var(--bordo-forte); }
.stat-card .stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--testo-tenue); }
.stat-card .stat-valore {
  font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin-top: 7px; line-height: 1;
  background: linear-gradient(135deg, var(--testo) 40%, #3a4d63);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .stat-extra { font-size: 12px; color: var(--testo-tenue); margin-top: 6px; }

.dash-colonne {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
}
.dash-box {
  background: linear-gradient(180deg, #fff, #fdfdfe);
  border: 1px solid var(--bordo);
  border-radius: var(--r-lg);
  padding: 19px 21px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.dash-box h3 { font-size: 14.5px; margin-bottom: 15px; }
.dash-riga {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bordo);
  font-size: 13px;
  color: var(--testo-medio);
}
.dash-riga:last-child { border-bottom: none; }
.dash-riga .tenue { color: var(--testo-tenue); font-size: 12px; }
.scaduta { color: var(--rosso); font-weight: 600; }

.barra-wrap { margin-bottom: 14px; }
.barra-wrap:last-child { margin-bottom: 0; }
.barra-info { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; color: var(--testo-medio); }
.barra-fondo { background: #eef2f7; border-radius: 6px; height: 9px; overflow: hidden; }
.barra {
  height: 100%;
  background: linear-gradient(90deg, var(--brand2), var(--brand));
  border-radius: 6px;
  transition: width .5s var(--ease);
}

/* Grafico a barre (lead per giorno) */
.grafico-barre {
  display: flex; align-items: flex-end; gap: 6px;
  height: 150px; padding-top: 8px;
}
.gb-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.gb-barra {
  width: 100%; max-width: 34px;
  min-height: 3px;
  background: linear-gradient(180deg, #22d3ee, var(--blu));
  border-radius: 6px 6px 0 0;
  position: relative;
  display: flex; align-items: flex-start; justify-content: center;
  transition: height .5s var(--ease);
}
.gb-barra span { position: absolute; top: -17px; font-size: 11px; font-weight: 700; color: var(--testo-medio); }
.gb-et { font-size: 10.5px; color: var(--testo-tenue); margin-top: 5px; font-variant-numeric: tabular-nums; }

/* ---------- Kanban ---------- */
.kanban-testata {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.pipeline-tabs {
  display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  background: linear-gradient(180deg, #f0f2f6, #eceff4); padding: 4px; border-radius: 11px;
  scrollbar-width: thin;
}
.pipeline-tabs::-webkit-scrollbar { height: 6px; }
.pipeline-tabs::-webkit-scrollbar-thumb { background: rgba(100,116,139,.25); border-radius: 3px; }
.pipeline-tab { white-space: nowrap; flex-shrink: 0; }

/* Barra filtri kanban — riga dedicata, ricerca prominente */
.kanban-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.kanban-cerca {
  flex: 1; min-width: 240px; max-width: 460px;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; background: var(--bianco);
  border: 1px solid var(--bordo-forte); border-radius: 10px;
  transition: border-color var(--t-veloce), box-shadow var(--t-veloce);
}
.kanban-cerca:focus-within { border-color: var(--blu); box-shadow: 0 0 0 3.5px rgba(13,109,144,.14); }
.kanban-cerca svg { width: 16px; height: 16px; color: var(--testo-tenue); flex-shrink: 0; }
.kanban-cerca input { border: none; padding: 0; background: none; font-size: 14px; }
.kanban-cerca input:focus { outline: none; box-shadow: none; }
.kanban-filtro { width: auto; min-width: 150px; }
.kanban-toggle {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 14px; border: 1px solid var(--bordo-forte); border-radius: 10px;
  background: var(--bianco); font-size: 13px; font-weight: 600; color: var(--testo-medio);
  cursor: pointer; transition: background var(--t-veloce), border-color var(--t-veloce), color var(--t-veloce);
}
.kanban-toggle:hover { border-color: var(--bordo-forte); background: #f8fafc; }
.kanban-toggle.attivo { background: var(--blu-chiaro); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.kanban-toggle input { width: auto; }
.pipeline-tab {
  padding: 7px 15px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--testo-tenue);
  font-weight: 600;
  font-size: 13px;
  transition: background var(--t-veloce), color var(--t-veloce), box-shadow var(--t-veloce);
}
.pipeline-tab:hover { color: var(--testo-medio); }
.pipeline-tab.attiva { background: var(--bianco); color: var(--blu); box-shadow: var(--ombra-sm); }
.pipeline-tab.tab-drop { background: var(--blu); color: #fff; box-shadow: 0 0 0 2px var(--blu); }

.mini-link {
  background: none; border: none; color: var(--blu);
  font-size: 12px; font-weight: 600; padding: 0;
}
.mini-link:hover { text-decoration: underline; }

.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 14px;
}
.colonna {
  --fase: var(--blu);
  background: linear-gradient(180deg, #f3f5f9, #edf0f5);
  border-radius: 14px;
  width: 238px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  /* Altezza piena: tutta la colonna è bersaglio del rilascio */
  min-height: calc(100dvh - 235px);
  max-height: calc(100dvh - 235px);
  border: 1px solid var(--bordo);
  transition: border-color var(--t-veloce), box-shadow var(--t-veloce);
}
/* Mentre trascini, le colonne si "offrono" come bersagli */
.kanban.trascinando .colonna { border-style: dashed; border-color: #94a3b8; }
.kanban.trascinando .colonna:has(.drag-sopra) {
  border-color: var(--fase); border-style: solid;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fase) 18%, transparent);
}
/* Header a "scheda": fondo bianco, accento colore fase a sinistra */
.colonna-testata {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  margin: 7px 7px 4px;
  padding: 10px 12px 10px 13px;
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: 10px;
  position: relative; overflow: hidden;
}
.colonna-testata::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--fase);
}
.colonna-nome {
  font-weight: 700; font-size: 12.5px; letter-spacing: -.01em; color: var(--testo);
  line-height: 1.25;
  font-family: 'Inter Tight', Inter, sans-serif;
  /* Riserva sempre l'altezza di 2 righe così tutti gli header sono uguali */
  min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.colonna-conteggio {
  justify-self: end;
  min-width: 22px; height: 20px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--fase) 12%, transparent);
  color: color-mix(in srgb, var(--fase) 78%, #1e293b);
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.colonna-valore {
  grid-column: 1 / -1;
  font-size: 11.5px; font-weight: 600; color: var(--testo-tenue);
  font-variant-numeric: tabular-nums;
}
/* Pallino colorato generico (calendario, incarichi, appuntamenti) */
.colonna-pallino {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.colonna-aggiungi { margin-left: auto; }
.colonna-corpo {
  padding: 4px 8px 10px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 7px;
  min-height: 50px;
  flex: 1;
  border-radius: var(--r);
  transition: background var(--t-veloce), box-shadow var(--t-veloce);
}
.colonna-corpo::-webkit-scrollbar { width: 7px; }
.colonna-corpo::-webkit-scrollbar-thumb { background: rgba(100,116,139,.22); border-radius: 4px; }
.colonna-corpo.drag-sopra {
  background: var(--blu-chiaro);
  box-shadow: inset 0 0 0 2px var(--blu);
}
.colonna-altre {
  text-align: center; font-size: 11px; color: var(--testo-tenue);
  padding: 6px; font-weight: 500;
}
/* ---------- Pagina Appuntamenti (agenda operativa) ---------- */
.app-riga {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 4px; border-bottom: 1px solid var(--sfondo);
  flex-wrap: wrap;
}
.app-riga:last-child { border-bottom: none; }
.app-ora {
  display: flex; flex-direction: column; align-items: center;
  min-width: 62px; flex-shrink: 0;
  padding: 6px 8px; border-radius: 10px;
  background: var(--blu-chiaro);
}
.app-ora strong { font-size: 15px; color: var(--blu); font-variant-numeric: tabular-nums; }
.app-ora span { font-size: 10.5px; color: var(--testo-tenue); text-transform: capitalize; }
.app-info { flex: 1; min-width: 220px; }
.app-cliente { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.app-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 3px; font-size: 12px;
}
.app-meta .tenue { display: inline-flex; align-items: center; gap: 4px; }
.app-meta .ic { width: 13px; height: 13px; }
.app-azioni { display: flex; gap: 6px; flex-wrap: wrap; }
.app-azioni .btn { padding: 5px 12px; font-size: 12px; }

/* Riga-sezione nella vista lista (Scaduti / Scade oggi / …) */
.tr-gruppo td {
  background: var(--sfondo);
  font-weight: 700; font-size: 12px;
  padding: 8px 14px !important;
  border-top: 1px solid var(--bordo);
}
.tr-gruppo .colonna-pallino { display: inline-block; margin-right: 7px; vertical-align: -1px; }
.tr-gruppo:hover td { background: var(--sfondo); }
.card.trascinata { opacity: .35; outline: 2px dashed var(--blu); outline-offset: -2px; }
/* Gli elementi interni non devono "rubare" il trascinamento alla card
   (i link tel: sono trascinabili di default e romperebbero il drag). */
.card a, .card button, .card .avatar, .card .badge, .card [class*="card-"] {
  -webkit-user-drag: none; user-select: none;
}
.drop-indicatore {
  height: 3px; border-radius: 3px; flex-shrink: 0;
  background: var(--blu); margin: 1px 3px;
  box-shadow: 0 0 0 2px var(--blu-chiaro);
}

.card {
  position: relative;
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: 12px;
  padding: 11px 13px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  cursor: grab;
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow var(--t-veloce), transform var(--t-veloce), border-color var(--t-veloce);
}
.card:hover { box-shadow: 0 8px 20px -8px rgba(16, 24, 40, .16); transform: translateY(-1px); border-color: var(--bordo-forte); }
.card:active { cursor: grabbing; }
/* Stato tramite accento sinistro sottile e arrotondato (minimal) */
.card.vinta::before, .card.persa::before, .card.card-rit::before, .card.scaduta-card::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
}
.card.vinta::before { background: var(--verde); }
.card.persa::before { background: var(--rosso); }
.card.persa { opacity: .68; }
.card.card-rit::before, .card.scaduta-card::before { background: var(--rosso); }

.card-titolo { font-weight: 600; color: var(--testo); letter-spacing: -.012em; font-size: 13px; line-height: 1.35; font-family: 'Inter Tight', Inter, sans-serif; }
.card-sotto { font-size: 12px; color: var(--testo-tenue); line-height: 1.3; }
.card-tel {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content;
  font-size: 12px; font-weight: 600; color: var(--testo-medio);
  text-decoration: none; letter-spacing: .01em;
  transition: color var(--t-veloce);
}
.card-tel:hover { color: var(--brand); }
.card-tel .ic { width: 13px; height: 13px; color: var(--brand); }
.card-azione {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--testo-tenue); font-weight: 500;
  background: var(--sfondo); border-radius: 6px; padding: 3px 8px; width: fit-content;
}
.card-azione .ic { width: 12px; height: 12px; }
.card-azione.scaduta { color: var(--rosso); font-weight: 600; background: var(--rosso-bg); }
.card-piede {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 3px; padding-top: 8px; border-top: 1px solid var(--bordo);
}
.card-valore { font-weight: 700; font-size: 13px; color: var(--testo); letter-spacing: -.01em; }
.card-quick { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.card .avatar { width: 22px; height: 22px; font-size: 9.5px; }
.card-btn-esito {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--bordo-forte); background: var(--bianco);
  font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--testo-medio);
  transition: all var(--t-veloce);
}
.card-btn-esito .ic { width: 12px; height: 12px; }
.card-btn-esito:hover { color: var(--brand); border-color: var(--brand); background: var(--blu-chiaro); }


/* ---------- Gestione pipeline (modale) ---------- */
.gestione-riga {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bordo);
}
.gestione-riga:last-child { border-bottom: none; }
.gestione-riga input[type="text"] { flex: 1; }
.gestione-riga input[type="color"] {
  width: 40px; height: 38px; padding: 2px; flex-shrink: 0;
  border-radius: var(--r-sm); cursor: pointer;
}

/* ---------- Filtri a pillole ---------- */
.filtri-pillole { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; }

/* Paginazione (liste server-side) */
.paginazione {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px 16px; border-top: 1px solid var(--bordo);
}
.pag-info { font-size: 12.5px; font-weight: 600; color: var(--testo-tenue); font-variant-numeric: tabular-nums; }
.paginazione .btn { padding: 7px 13px; }
.pillola {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--bordo-forte);
  background: var(--bianco);
  color: var(--testo-medio);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--ombra-xs);
  transition: background var(--t-veloce), color var(--t-veloce), border-color var(--t-veloce);
}
.pillola:hover { border-color: #c3ccd9; background: #f8fafc; }
.pillola.attiva { background: var(--testo); color: #fff; border-color: var(--testo); box-shadow: var(--ombra-sm); }

/* ---------- Calendario ---------- */
.cal-testata {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.cal-testata h3 { font-size: 17px; letter-spacing: -.02em; }
.cal-legenda { display: flex; gap: 13px; flex-wrap: wrap; }
.cal-legenda-voce { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--testo-tenue); }
.cal-griglia {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}
.cal-intesta {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--testo-tenue);
  padding: 2px 0 4px;
}
.cal-cella {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: 10px;
  min-height: 108px;
  padding: 7px;
  box-shadow: var(--ombra-xs);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  transition: box-shadow var(--t-veloce), border-color var(--t-veloce), transform var(--t-veloce);
}
.cal-cella:hover { box-shadow: var(--ombra); border-color: var(--bordo-forte); transform: translateY(-1px); }
.cal-cella.altro-mese { opacity: .5; background: #fbfcfe; }
.cal-cella.oggi { border-color: var(--blu); box-shadow: 0 0 0 1px var(--blu); }
.cal-cella.oggi .cal-num {
  background: var(--blu); color: #fff;
  border-radius: 6px; padding: 0 5px; align-self: flex-start;
}
.cal-num { font-size: 12px; font-weight: 700; color: var(--testo-tenue); }
.cal-evento {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--ev, var(--blu));
  background: color-mix(in srgb, var(--ev, var(--blu)) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ev, var(--blu)) 20%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--t-veloce);
}
.cal-evento:hover { background: color-mix(in srgb, var(--ev, var(--blu)) 24%, transparent); }
.cal-evento.completata { text-decoration: line-through; opacity: .55; }
/* Incarichi/chiamate: task di giornata, stile a bordo tratteggiato */
.cal-evento.cal-task { box-shadow: none; border: 1px dashed color-mix(in srgb, var(--ev, var(--brand2)) 55%, transparent); }

.cal-altri { font-size: 10.5px; color: var(--testo-tenue); font-weight: 600; padding: 0 4px; }

/* ---------- Calendario: vista GIORNO ---------- */
.giorno-fuori, .giorno-task {
  background: var(--bianco); border: 1px solid var(--bordo); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--ombra-sm);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.giorno-task { border-left: 3px solid var(--brand2); }
.giorno-fuori .cal-evento, .giorno-task .cal-evento { position: static; }
.giorno-grid {
  display: flex;
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--r-lg);
  box-shadow: var(--ombra-sm);
  max-height: calc(100dvh - 230px);
  overflow-y: auto;
}
.ora-colonna { width: 62px; flex-shrink: 0; border-right: 1px solid var(--bordo); }
.ora-riga { position: relative; }
.ora-et {
  position: absolute; top: -8px; right: 8px;
  font-size: 11px; font-weight: 600; color: var(--testo-tenue);
  font-variant-numeric: tabular-nums;
}
.giorno-eventi { position: relative; flex: 1; }
.giorno-linea { position: absolute; left: 0; right: 0; border-top: 1px solid var(--bordo); }
.giorno-linea.mezza { border-top-style: dashed; border-top-color: #eef2f7; }
.giorno-ev {
  position: absolute;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  color: #fff;
  background: var(--ev, var(--blu));
  box-shadow: var(--ombra-sm);
  overflow: hidden;
  cursor: pointer;
  line-height: 1.35;
  border-left: 3px solid rgba(255, 255, 255, .5);
  transition: transform var(--t-veloce), box-shadow var(--t-veloce);
}
.giorno-ev:hover { transform: translateY(-1px); box-shadow: var(--ombra); }
.giorno-ev strong { font-weight: 700; }
.giorno-ev.completata { opacity: .5; text-decoration: line-through; }

/* ---------- Calendario: vista AGENDA ---------- */
.agenda {
  background: var(--bianco); border: 1px solid var(--bordo);
  border-radius: var(--r-lg); box-shadow: var(--ombra-sm); overflow: hidden;
}
.agenda-giorno { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--bordo); }
.agenda-giorno:last-child { border-bottom: none; }
.agenda-giorno.oggi { background: var(--blu-chiaro); }
.agenda-data {
  width: 52px; flex-shrink: 0; text-align: center;
  display: flex; flex-direction: column; align-items: center; padding-top: 4px;
}
.agenda-dow { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--testo-tenue); }
.agenda-num { font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.agenda-mese { font-size: 11px; color: var(--testo-tenue); }
.agenda-giorno.oggi .agenda-num { color: var(--blu); }
.agenda-lista { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agenda-voce {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px;
  border-left: 3px solid var(--ev, var(--blu));
  background: #fbfcfe;
  cursor: pointer;
  transition: background var(--t-veloce);
}
.agenda-voce:hover { background: var(--blu-chiaro); }
.agenda-voce.completata .agenda-titolo { text-decoration: line-through; opacity: .55; }
.agenda-ora { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; width: 46px; flex-shrink: 0; }
.agenda-tipo { flex-shrink: 0; }
.agenda-titolo { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.agenda-check { flex-shrink: 0; }

/* ---------- Discussioni / messaggi ---------- */
.disc-messaggi {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 6px 2px;
}
.msg {
  max-width: 82%;
  background: #f1f5f9;
  padding: 9px 13px;
  border-radius: 13px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg.mio {
  background: linear-gradient(140deg, var(--brand2), var(--brand));
  color: #fff;
  align-self: flex-end;
  border-radius: 13px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 13px;
}
.msg.mio .msg-meta { color: rgba(255, 255, 255, .8); }
.msg.mio .msg-meta strong { color: #fff; }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--testo-tenue); margin-bottom: 2px; }
.msg-meta strong { color: var(--testo); }
.msg-del { font-size: 10px; padding: 2px 4px; }
.msg-testo { white-space: pre-wrap; font-size: 13px; line-height: 1.5; }

/* ---------- Scrollbar raffinata ---------- */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); background-clip: content-box; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  #vista-app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    flex-direction: row; align-items: center; flex-wrap: nowrap;
  }
  .sidebar-logo { padding: 12px 14px; }
  .logo-testo { display: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 8px; gap: 3px; }
  .sidebar-nav a { white-space: nowrap; padding: 8px 11px; }
  .sidebar-nav a span { display: none; }
  .sidebar-nav a svg { width: 20px; height: 20px; }
  .sidebar-nav a.attivo::before { display: none; }
  .sidebar-utente { border-top: none; padding: 10px 12px; margin-left: auto; }
  .utente-info { display: none; }
  .sidebar-footer { display: none; }
  .contenuto { padding: 16px; }
  .input-cerca { width: 100%; }
  .testata-azioni { width: 100%; }
  .cal-cella { min-height: 66px; padding: 5px; }
  .cal-evento { font-size: 10px; padding: 2px 4px; }
  .cal-legenda { display: none; }
}

/* ---------- Guida — layout documentazione ---------- */
.doc-layout { display: grid; grid-template-columns: 232px 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .doc-layout { grid-template-columns: 1fr; } .doc-indice { display: none; } }

.doc-indice { position: sticky; top: 16px; align-self: start; }
.doc-indice-gruppo {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--testo-tenue); margin: 16px 0 6px 10px;
}
.doc-indice-gruppo:first-child { margin-top: 0; }
.doc-indice-voce {
  display: block; padding: 7px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--testo-medio); text-decoration: none;
  transition: background var(--t-veloce), color var(--t-veloce);
}
.doc-indice-voce:hover { background: var(--sfondo); color: var(--testo); }
.doc-indice-voce.attiva { background: var(--blu-chiaro); color: var(--brand); font-weight: 600; }

.doc-contenuto { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.doc-sez {
  background: linear-gradient(180deg, #fff, #fdfdfe);
  border: 1px solid var(--bordo); border-radius: var(--r-lg);
  padding: 20px 24px; box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  scroll-margin-top: 16px;
}
.doc-sez-tit {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--testo);
  margin-bottom: 14px; font-family: 'Inter Tight', Inter, sans-serif;
}
.doc-sez-tit .ic { width: 19px; height: 19px; color: var(--brand); }
.doc-body { font-size: 13.5px; line-height: 1.7; color: var(--testo-medio); }
.doc-body p { margin: 0 0 12px; }
.doc-body h4 {
  font-size: 13.5px; font-weight: 700; color: var(--testo);
  margin: 18px 0 8px; letter-spacing: -.01em;
}
.doc-body strong { color: var(--testo); font-weight: 600; }
.doc-body em { color: var(--brand); font-style: normal; font-weight: 600; }
.doc-body code {
  background: var(--sfondo); border: 1px solid var(--bordo); border-radius: 5px;
  padding: 1px 6px; font-size: 12px; font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--brand);
}

/* liste numerate "step" */
.doc-step { margin: 0 0 12px; padding-left: 0; list-style: none; counter-reset: step; }
.doc-step li {
  position: relative; padding: 4px 0 10px 34px; counter-increment: step;
}
.doc-step li::before {
  content: counter(step); position: absolute; left: 0; top: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.doc-step li:not(:last-child)::after {
  content: ''; position: absolute; left: 10.5px; top: 26px; bottom: 2px;
  width: 1.5px; background: var(--bordo);
}

/* tabelle interne */
.doc-tabella { width: 100%; border-collapse: collapse; margin: 4px 0 14px; font-size: 13px; }
.doc-tabella th {
  text-align: left; padding: 8px 12px; background: #fbfcfe;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--testo-tenue); border-bottom: 1px solid var(--bordo);
}
.doc-tabella td { padding: 9px 12px; border-bottom: 1px solid var(--bordo); vertical-align: top; }
.doc-tabella tr:last-child td { border-bottom: none; }
.doc-tabella td:first-child { white-space: nowrap; }

/* callout */
.doc-callout {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 10px; padding: 11px 14px; margin: 6px 0 14px;
  font-size: 13px; line-height: 1.6;
}
.doc-callout .ic { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.doc-tip  { background: var(--verde-bg); color: #0a6b4c; }
.doc-tip .ic { color: var(--verde); }
.doc-warn { background: #fdf6ec; color: #8a5a12; }
.doc-warn .ic { color: var(--ambra); }
.doc-nota { background: var(--blu-chiaro); color: #0a5674; }
.doc-nota .ic { color: var(--brand); }

/* flusso a chip nell'introduzione */
.doc-flow {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 4px 0 14px;
}
.doc-flow span {
  background: var(--sfondo); border: 1px solid var(--bordo); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--testo-medio);
}
.doc-flow .ic { width: 14px; height: 14px; color: var(--testo-tenue); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
