/* ==========================================================================
   Gestionale Dogre — foglio di stile

   I colori vengono dal logo: il blu notte dell'arco (#272F6C) è il colore
   del programma, tutto il resto è carta e inchiostro. I caratteri (IBM Plex
   Sans e Mono) sono ospitati qui, in public/fonts: niente richieste a
   Google a ogni pagina, e il programma si vede uguale anche senza Internet.
   ========================================================================== */

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/ibm-plex-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/ibm-plex-sans-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/ibm-plex-sans-600.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/ibm-plex-sans-700.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/ibm-plex-mono-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/ibm-plex-mono-600.woff2') format('woff2'); }

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* Il blu del logo, e le sue gradazioni. */
  --brand: #272F6C; --brand-ink: #1D2352; --brand-600: #3A4390; --brand-300: #8B91C0;
  --brand-soft: #EDEEF6; --brand-line: #D5D8EA;
  /* Nomi di prima, tenuti perché le schermate li usano. */
  --navy: #1D2352; --navy2: #161B40; --blue: #272F6C; --blue-d: #1D2352;
  --green: #2E7D4F; --green-d: #256841; --red: #B3261E; --amber: #A66A00;
  --green-soft: #E6F1EA; --red-soft: #FBEEEC; --amber-soft: #FCF1DD;
  /* Carta e inchiostro. */
  --ink: #1A1C24; --ink-2: #3D4150; --muted: #6A6E7B; --faint: #9A9DA8;
  --line: #E6E3DD; --line2: #F0EEEA; --line-strong: #D3CFC7;
  --bg: #F6F5F2; --card: #fff; --surface-2: #FBFAF8;
  --radius: 12px; --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(26, 28, 36, .05);
  --shadow-2: 0 12px 32px -12px rgba(26, 28, 36, .18), 0 2px 6px -2px rgba(26, 28, 36, .06);
  --focus: 0 0 0 3px rgba(39, 47, 108, .16);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
input, select, button, textarea { font-family: inherit; color: inherit; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: #D9DCF0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }
@keyframes gira { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D6D2CA; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Il caricamento iniziale: il logo, e sotto un filo che scorre. */
.boot { display: flex; flex-direction: column; gap: 18px; align-items: center; justify-content: center;
  height: 100vh; color: var(--muted); font-size: 13px; }
.boot img { height: 40px; }
.boot-filo { width: 120px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; }
.boot-filo::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--brand); border-radius: 2px;
  animation: filo 1.1s cubic-bezier(.6, 0, .4, 1) infinite; }
@keyframes filo { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ------------------------------------------------------------------ login */
.login { display: grid; grid-template-columns: minmax(360px, 520px) 1fr; min-height: 100vh; background: var(--card); }
.login-col { display: flex; flex-direction: column; padding: 40px 56px; min-height: 100vh; }
.login-logo { height: 44px; width: auto; align-self: flex-start; }
.login-corpo { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 380px; width: 100%; padding: 40px 0; }
.login-sopra { font-size: 12px; font-weight: 600; letter-spacing: .9px; text-transform: uppercase; color: var(--brand); margin-bottom: 14px; }
.login-titolo { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.login-titolo .parola { display: inline-block; }
.login-sotto { font-size: 14px; color: var(--muted); margin: 12px 0 30px; line-height: 1.5; }
.login-campo { margin-bottom: 16px; }
.login-campo label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.login-campo .in { height: 44px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.login-btn { width: 100%; height: 46px; margin-top: 6px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600; display: flex; align-items: center;
  justify-content: center; gap: 10px; position: relative; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 6px 16px -6px rgba(29, 35, 82, .6);
  transition: background-color .15s, transform .1s; }
.login-btn:hover { background: var(--brand-ink); }
.login-btn:active:not(:disabled) { transform: translateY(1px); }
.login-btn:disabled { cursor: default; background: var(--brand-600); }
.login-btn .freccia { transition: transform .2s cubic-bezier(.16, 1, .3, 1); display: inline-flex; }
.login-btn:hover .freccia { transform: translateX(3px); }
.giro { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: gira .7s linear infinite; }
.login-err { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 13px; font-size: 13px;
  font-weight: 500; margin-bottom: 16px; display: flex; gap: 9px; align-items: flex-start; }
.login-piede { font-size: 12px; color: var(--faint); line-height: 1.55; }
.login-piede b { color: var(--muted); font-weight: 500; }

/* La colonna blu: gli archi del logo, e le date che contano. */
.login-arte { position: relative; overflow: hidden; background: var(--brand); color: #fff;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 48px 56px; isolation: isolate; }
.login-arte::before { content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 90% at 85% 10%, #323B85 0%, rgba(39,47,108,0) 60%),
              linear-gradient(180deg, #272F6C 0%, #1D2352 100%); }
.login-archi { position: absolute; right: -8%; top: 50%; width: 118%; max-width: 980px; transform: translateY(-58%); z-index: -1; }
.login-archi .arco-eco, .login-archi .arco-maschera { fill: none; stroke-linecap: round; }
.login-motto { font-size: 22px; line-height: 1.35; font-weight: 500; letter-spacing: -.01em; max-width: 520px; margin-bottom: 28px; color: rgba(255,255,255,.94); }
.login-motto span { color: rgba(255,255,255,.55); }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-arte { display: none; }
  .login-col { padding: 28px 24px; }
}

/* ------------------------------------------------------------ struttura */
.shell { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }
.sidebar { width: 244px; flex: none; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar .brand { padding: 22px 22px 14px; }
.sidebar .brand img.logo { height: 34px; width: auto; display: block; }
.sidebar .brand img.segno { display: none; width: 30px; height: 30px; }
.sidebar .brand span { display: block; margin-top: 10px; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.nav { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 4px 12px 12px; flex: 1; overflow-y: auto; }
.nav-gruppo { font-size: 10.5px; font-weight: 600; letter-spacing: .9px; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; }
.nav button { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px;
  border: none; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; text-align: left;
  background: transparent; color: var(--ink-2); transition: color .15s, background-color .15s; }
.nav button:hover { background: var(--line2); color: var(--ink); }
.nav button.active { color: var(--brand); font-weight: 600; }
.nav button.active:hover { background: transparent; }
.nav button .ico { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: var(--faint); transition: color .15s; }
.nav button:hover .ico, .nav button.active .ico { color: currentColor; }
.nav button .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-indicatore { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 8px; background: var(--brand-soft);
  opacity: 0; pointer-events: none; }
.nav-indicatore::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.sidebar .foot { padding: 12px; border-top: 1px solid var(--line); }
.utente { display: flex; align-items: center; gap: 10px; padding: 6px 6px 10px; }
.utente .avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .3px; }
.utente .who { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.utente .role { font-size: 11.5px; color: var(--muted); }
.foot-azioni { display: flex; gap: 6px; }
/* L'ente su cui si lavora, quando la sessione ne ha più d'uno. */
.ente-sel { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 8px; padding: 7px 9px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; color: var(--ink);
  transition: background-color .15s, border-color .15s; }
.ente-sel:hover { border-color: var(--line-strong); background: var(--card); }
.ente-sel .ico { flex: none; display: grid; place-items: center; color: var(--brand); }
.ente-sel .lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ente-sel .lbl small { font-size: 10.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.ente-sel .lbl b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ente-sel .dx { color: var(--muted); }
.sidebar .foot .logout { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px;
  background: var(--card); color: var(--ink-2); border: 1px solid var(--line); border-radius: 8px;
  font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s; }
.sidebar .foot .logout:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { min-height: 64px; flex: none; background: var(--bg); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 28px; flex-wrap: wrap; }
.topbar .titoli { display: flex; flex-direction: column; min-width: 0; }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.topbar .conv { font-size: 12px; color: var(--muted); }
.topbar .btn { height: 34px; }
.content { flex: 1; overflow: auto; padding: 24px 28px 48px; }

/* ------------------------------------------------------------ componenti */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 18px 20px; }
.grid { display: grid; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent;
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 500; line-height: 1.2; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { flex: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 1px 2px rgba(29,35,82,.25); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-green { background: var(--green); color: #fff; } .btn-green:hover { background: var(--green-d); }
.btn-ghost { background: var(--card); border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: #BFBAB0; color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: #8F1E17; }
.btn:disabled { opacity: .5; cursor: default; }
.pill { font-size: 11.5px; font-weight: 500; border-radius: 999px; padding: 2px 9px; display: inline-block; white-space: nowrap; }
/* Un importo che si apre: nel prospetto il pagato apre lo storico dei versamenti. */
.cella-apri { background: none; border: 0; border-bottom: 1px dotted #9AA0B4; padding: 0; font: inherit;
  color: inherit; cursor: pointer; text-align: right; }
.cella-apri:hover { color: var(--brand); border-bottom-color: var(--brand); }
.tag { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; background: var(--brand-soft);
  border: 1px solid var(--brand-line); border-radius: 5px; padding: 1px 6px; color: var(--brand); }
label.fld { font-size: 12px; font-weight: 500; color: var(--ink-2); display: block; margin-bottom: 5px; }
input.in, select.in, textarea.in { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
input.in:hover, select.in:hover, textarea.in:hover { border-color: #BFBAB0; }
input.in:focus, select.in:focus, textarea.in:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input.in[readonly] { background: var(--surface-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.msg-ok { background: var(--green-soft); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; color: var(--green); font-weight: 500; }
.msg-err { background: var(--red-soft); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; color: var(--red); font-weight: 500; }
/* Né un successo né un errore: qualcosa da guardare prima di andare avanti. */
.msg-warn { background: var(--amber-soft); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; color: #8A5800; font-weight: 500; line-height: 1.55; }
.msg-warn code { background: #F6E4C4; border-radius: 4px; padding: 1px 5px; font-size: 11.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.muted { color: var(--muted); }
h2.sec { margin: 0 0 12px; font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; }
a { color: var(--brand); }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: 10px; font-size: 13px; line-height: 1.45; z-index: 9999; max-width: 380px;
  box-shadow: 0 16px 40px -12px rgba(26,28,36,.45); animation: toast-in .42s cubic-bezier(.16, 1, .3, 1); }
.toast.err { background: #7A2320; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

/* ------------------------------------------------------------ dashboard */
.dash { display: flex; flex-direction: column; gap: 18px; max-width: 1280px; }
.dash-saluto { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-saluto h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.dash-saluto p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.dash-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; overflow: hidden; }
.dash-kpi > div { padding: 18px 20px 16px; position: relative; }
.dash-kpi > div + div { border-left: 1px solid var(--line2); }
.kpi-et { font-size: 12px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kpi-et i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.kpi-val { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 500;
  letter-spacing: -.03em; margin-top: 8px; color: var(--ink); white-space: nowrap; }
.kpi-sot { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.kpi-barra { flex: 1; height: 4px; border-radius: 4px; background: var(--line2); overflow: hidden; }
.kpi-barra > span { display: block; height: 100%; border-radius: 4px; transform-origin: left; }
.dash-griglia { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card-testa { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 30px; }
.card-testa h2 { font-size: 14.5px; font-weight: 600; flex: 1; letter-spacing: -.005em; }
.card-testa .sot { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }

/* Selettore a pastiglia con l'indicatore che scorre. */
.seg { position: relative; display: inline-flex; background: var(--line2); border-radius: 9px; padding: 3px; }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; border-radius: 7px; padding: 5px 11px;
  font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; transition: color .15s; }
.seg button.on { color: var(--ink); }
.seg-ind { position: absolute; left: 0; top: 0; z-index: 0; background: #fff; border-radius: 7px;
  box-shadow: 0 1px 2px rgba(26,28,36,.1), 0 0 0 1px rgba(26,28,36,.04); opacity: 0; }

.lista-riga { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 8px 8px; margin: 0 -8px; border-radius: 9px; cursor: pointer; transition: background-color .15s; }
.lista-riga:hover { background: var(--surface-2); }
.lista-riga + .lista-riga { box-shadow: 0 -1px 0 var(--line2); }
.lista-riga:hover + .lista-riga, .lista-riga:hover { box-shadow: none; }
.giorno { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.giorno b { font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 500; }
.giorno span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-top: 3px; }
.giorno.vicino { border-color: #EBD3A4; background: #FFF8EA; }
.giorno.vicino b { color: #9A5B00; }
.giorno.oggi { border-color: var(--brand); background: var(--brand); color: #fff; }
.giorno.oggi span { color: rgba(255,255,255,.75); }
.lista-nome { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-meta { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-meta .mono { font-size: 11.5px; }
.lista-dx { font-size: 12.5px; font-weight: 500; text-align: right; white-space: nowrap; }
.vuoto { padding: 22px 8px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.vuoto svg { color: var(--faint); margin-bottom: 8px; }

.rischio-riga { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--red-soft); margin-bottom: 6px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.rischio-riga:hover { box-shadow: 0 0 0 1px #EFC9C4; }
.polso { position: relative; width: 8px; height: 8px; flex: none; }
.polso::before, .polso::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--red); }
.polso::after { animation: polso 1.6s cubic-bezier(.2, .6, .35, 1) infinite; }
@keyframes polso { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(3.2); opacity: 0; } }

.avviso-termine { display: flex; gap: 14px; flex-wrap: wrap; }
.avviso-termine > div { flex: 1; min-width: 300px; border-radius: var(--radius); padding: 16px 18px; cursor: pointer;
  display: grid; grid-template-columns: 38px 1fr auto; gap: 14px; align-items: center; border: 1px solid transparent;
  transition: box-shadow .2s, transform .2s; }
.avviso-termine > div:hover { box-shadow: var(--shadow-2); }
.avviso-termine .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.55); }
.avviso-termine .et { font-size: 11.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.avviso-termine .imp { font-family: 'IBM Plex Mono', monospace; font-size: 22px; font-weight: 500; letter-spacing: -.03em; margin: 3px 0 2px; }
.avviso-termine .sot { font-size: 12.5px; opacity: .92; }
.avviso-termine .vai { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* Grafico degli incassi. */
.grafico { position: relative; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico .barra { transition: fill .15s; }
.grafico .colonna:hover .barra { fill: var(--brand); }
.grafico-tip { position: absolute; pointer-events: none; transform: translate(-50%, -100%); background: var(--ink); color: #fff;
  border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .12s;
  box-shadow: 0 8px 20px -8px rgba(26,28,36,.5); }
.grafico-tip b { font-family: 'IBM Plex Mono', monospace; font-weight: 500; }

.tipo-riga { display: grid; grid-template-columns: 54px minmax(0, 1fr) 44px; gap: 12px; align-items: center; padding: 8px 0; }
.tipo-riga + .tipo-riga { border-top: 1px solid var(--line2); }
.tipo-nome { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.tipo-barre { display: flex; height: 6px; border-radius: 6px; overflow: hidden; background: var(--line2); gap: 2px; }
.tipo-barre span { height: 100%; transform-origin: left; }
.tipo-tot { font-family: 'IBM Plex Mono', monospace; font-size: 15px; text-align: right; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 12px; }
.legenda i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: 0; }

@media (max-width: 1100px) {
  .dash-griglia { grid-template-columns: 1fr; }
  .dash-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi > div:nth-child(3) { border-left: 0; }
  .dash-kpi > div:nth-child(n+3) { border-top: 1px solid var(--line2); }
}
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar .brand span, .nav-gruppo, .nav button .lbl, .utente > div, .foot-azioni .lbl, .ente-sel .lbl, .ente-sel .dx { display: none; }
  .ente-sel { justify-content: center; padding: 8px 0; }
  .sidebar .brand { padding: 18px 17px 10px; }
  .sidebar .brand img.logo { display: none; }
  .sidebar .brand img.segno { display: block; }
  .nav button { justify-content: center; padding: 0; }
  .nav .badge { position: absolute; top: 1px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .sidebar .foot .logout { flex: none; height: 34px; }
  .nav { padding: 4px 8px; }
  .nav-indicatore::before { left: -8px; }
  .foot-azioni { flex-direction: column; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 10px 16px; }
}

/* ---------- guida ---------- */
.guida { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 26px; max-width: 1180px; align-items: start; }
.guida-lato { position: sticky; top: 0; }
.guida-indice { display: flex; flex-direction: column; gap: 1px; }
.guida-indice button { text-align: left; border: none; background: transparent; cursor: pointer;
  padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--muted); border-left: 3px solid transparent; }
.guida-indice button:hover { background: var(--line2); color: var(--ink); }
.guida-indice button.on { background: var(--brand-soft); color: var(--blue); font-weight: 700; border-left-color: var(--blue); }
.guida-corpo { display: flex; flex-direction: column; gap: 16px; }
.guida-sez { scroll-margin-top: 12px; }
.guida-sez h2 { font-size: 17px; margin: 0 0 4px; }
.guida-sez h3 { font-size: 13.5px; margin: 16px 0 6px; }
.guida-sez p { font-size: 13.5px; line-height: 1.6; margin: 8px 0; }
.guida-sez ul, .guida-sez ol { font-size: 13.5px; line-height: 1.6; margin: 8px 0 8px 18px; }
.guida-sez li { margin: 3px 0; }
.guida-sez table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 10px 0; }
.guida-sez th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; vertical-align: bottom; }
.guida-sez td { border-bottom: 1px solid var(--line2); padding: 7px 8px 7px 0; vertical-align: top; line-height: 1.5; }
.guida-sez tr:last-child td { border-bottom: none; }
.guida-nota { background: #F4F5FA; border-left: 3px solid var(--brand-300); border-radius: 0 7px 7px 0;
  padding: 10px 14px; font-size: 12.5px; line-height: 1.55; margin: 10px 0; }
.guida-attenzione { background: #FDF8EE; border-left-color: #D9B36A; }
.guida-esempio { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 12px 0; font-size: 12.5px; line-height: 1.55; }
.guida-esempio > .tit { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--green); margin-bottom: 8px; }
.guida-esempio table { margin: 6px 0; }
.guida-sez pre { background: var(--ink); color: #E9E8E4; border-radius: 7px; padding: 11px 13px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11.5px; line-height: 1.55;
  overflow-x: auto; margin: 10px 0; }
.guida-flusso { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; font-size: 12px; }
.guida-flusso span.p { background: var(--brand-soft); color: var(--blue); border: 1px solid var(--brand-line);
  border-radius: 13px; padding: 3px 10px; font-weight: 600; }
.guida-flusso span.f { color: var(--muted); }
.guida-passi { counter-reset: passo; list-style: none; margin-left: 0; }
.guida-passi li { counter-increment: passo; position: relative; padding-left: 30px; margin: 8px 0; }
.guida-passi li::before { content: counter(passo); position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff;
  font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ruolo { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.ruolo-tutti { background: var(--line2); color: var(--ink-2); }
.ruolo-op { background: var(--brand-soft); color: var(--blue); }
.ruolo-sup { background: #F2E7DC; color: var(--amber); }
@media (max-width: 900px) {
  .guida { grid-template-columns: 1fr; }
  .guida-lato { position: static; }
  .guida-indice { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- modal ---------- */
.modal-ov { position: fixed; inset: 0; background: rgba(26,28,36,.42); backdrop-filter: blur(2px); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 1000; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px;
  box-shadow: 0 30px 80px -20px rgba(26,28,36,.45), 0 0 0 1px rgba(26,28,36,.05);
  animation: modale-in .38s cubic-bezier(.16, 1, .3, 1); }
@keyframes modale-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; letter-spacing: -.01em; }
.modal-x { border: none; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 16px 22px; border-top: 1px solid var(--line2); }
.modal .fld { margin-top: 12px; }
.modal .fld:first-child { margin-top: 0; }

/* Pannello del regolamento (Amministrazione). */
.rg-tit { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.rg-tab { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.rg-tab th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 5px 6px; border-bottom: 1px solid var(--line); }
.rg-tab td { padding: 5px 6px; border-bottom: 1px solid var(--line2); vertical-align: middle; }

/* ------------------------------------------------------------ tutorial ---- */
/* La palestra: una fascia che non si può non vedere. */
.palestra-fascia { position: fixed; top: 0; left: 0; right: 0; height: 36px; z-index: 1100;
  display: flex; align-items: center; gap: 12px; padding: 0 14px; font-size: 12.5px; color: #4A3200;
  background: repeating-linear-gradient(-45deg, #F7D774 0 14px, #F3CC5C 14px 28px);
  border-bottom: 1px solid #D9A92B; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.palestra-fascia .pf-tag { background: #4A3200; color: #F7D774; font-weight: 800; letter-spacing: 1.5px;
  padding: 3px 9px; border-radius: 4px; font-size: 11px; }
.palestra-fascia .pf-testo { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palestra-fascia button { background: rgba(255,255,255,.75); border: 1px solid #B98A1B; color: #4A3200;
  border-radius: 6px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.palestra-fascia button:hover { background: #fff; }
body.in-palestra .shell { height: calc(100vh - 36px); margin-top: 36px; }

/* Il riflettore: un buco nel velo scuro, che non blocca i clic. */
.tut-luce { position: fixed; z-index: 1500; pointer-events: none; border-radius: 9px; display: none;
  box-shadow: 0 0 0 9999px rgba(14,28,44,.52), 0 0 0 3px #F3CC5C inset;
  transition: top .18s ease, left .18s ease, width .18s ease, height .18s ease; }
.tut-luce::after { content: ''; position: absolute; inset: -4px; border-radius: 11px; border: 2px solid #F3CC5C;
  animation: tut-anello 1.6s ease-out infinite; }
@keyframes tut-anello { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.12); } }
.tut-velo { position: fixed; inset: 0; z-index: 1490; background: rgba(14,28,44,.38); pointer-events: none; display: none; }

.tut-fumetto { position: fixed; z-index: 1600; background: #fff; border-radius: 12px; padding: 12px 14px 11px;
  box-shadow: 0 12px 40px rgba(10,22,36,.35); border: 1px solid #E2D29A; font-size: 13.5px; line-height: 1.5;
  transition: top .18s ease, left .18s ease, transform .2s ease; }
.tut-fumetto.tut-ok { transform: scale(.97); opacity: .7; }
.tut-testa { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tut-mis { flex: 1; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: #A66A00; }
.tut-num { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.tut-x { border: none; background: transparent; font-size: 19px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
.tut-testo { color: var(--ink); }
.tut-avviso { margin-top: 8px; font-size: 12px; color: #8A5800; background: #FCF1DD; border-radius: 6px; padding: 6px 8px; }
.tut-barra { height: 5px; background: var(--line2); border-radius: 3px; overflow: hidden; margin: 10px 0 8px; }
.tut-barra > div { height: 100%; background: linear-gradient(90deg, #C08A2E, #F3CC5C); border-radius: 3px; transition: width .3s ease; }
.tut-barra-grossa { height: 8px; margin: 7px 0 0; }
.tut-piede { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tut-salta { border: none; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; }
.tut-avanti { font-size: 12.5px; padding: 6px 14px; }
.tut-tocca { font-size: 12px; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 7px; }
.tut-puls { width: 9px; height: 9px; border-radius: 50%; background: #F3CC5C; box-shadow: 0 0 0 0 rgba(243,204,92,.8);
  animation: tut-puls 1.3s infinite; }
@keyframes tut-puls { 0% { box-shadow: 0 0 0 0 rgba(243,204,92,.8); } 100% { box-shadow: 0 0 0 10px rgba(243,204,92,0); } }

/* Finestre del tutorial: benvenuto, conferme, pannello, festa. */
.tut-ov { position: fixed; inset: 0; z-index: 2000; background: rgba(14,28,44,.55); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.tut-dlg { background: #fff; border-radius: 14px; max-width: 520px; width: 100%; padding: 24px 26px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); font-size: 13.5px; line-height: 1.55; margin-top: 6vh; }
.tut-dlg h3 { margin: 4px 0 8px; font-size: 18px; }
.tut-dlg-ico { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-600));
  color: #F3CC5C; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.tut-dlg-piede { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }

.tut-hub { background: #fff; border-radius: 14px; max-width: 900px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.tut-hub-testa { display: flex; gap: 12px; align-items: flex-start; padding: 18px 22px 14px;
  background: linear-gradient(135deg, var(--brand-ink), var(--brand)); color: #fff; }
.tut-hub-testa .tut-x { color: rgba(255,255,255,.8); }
.tut-hub-tit { font-size: 19px; font-weight: 800; letter-spacing: .3px; color: #F3CC5C; }
.tut-hub-sot { font-size: 12.5px; color: rgba(255,255,255,.8); margin-top: 2px; }
.tut-hub > .tut-hub-testa + .tut-profilo { margin-top: 0; }
.tut-profilo { display: flex; gap: 14px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.tut-grado-ico { width: 46px; height: 46px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FBE7A6, #C08A2E);
  color: #4A3200; font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px #E2C06B; }
.tut-grado-nome { font-weight: 800; font-size: 15px; }
.tut-grado-sot { font-size: 12px; color: var(--muted); }
.tut-palestra { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 22px 4px; padding: 10px 12px;
  border-radius: 9px; background: var(--surface-2); font-size: 12.5px; }
.tut-palestra span { flex: 1; min-width: 220px; }
.tut-palestra.dentro { background: #FDF3D3; border: 1px solid #EBCB6B; }
.tut-palestra .btn { font-size: 12px; padding: 5px 11px; }
.tut-livello { padding: 12px 22px 4px; }
.tut-liv-testa { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.tut-liv-n { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #F3CC5C; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 13px; }
.tut-liv-tit { font-weight: 700; font-size: 14px; }
.tut-liv-sot { font-size: 11.5px; color: var(--muted); }
.tut-liv-conta { font-size: 12px; font-weight: 700; color: #A66A00; font-family: ui-monospace, monospace; }
.tut-carte { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tut-carta { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px 10px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.tut-carta-med { font-size: 18px; line-height: 1; color: #C08A2E; }
.tut-carta-tit { font-weight: 700; font-size: 13px; }
.tut-carta-sot { font-size: 12px; color: var(--muted); flex: 1; }
.tut-carta-piede { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; min-height: 28px; }
.tut-carta.tut-fatta { background: linear-gradient(180deg, #FFFBEE, #fff); border-color: #EBCB6B; }
.tut-carta.tut-libera { border-color: #9DB6CF; box-shadow: 0 2px 10px rgba(30,75,122,.10); }
.tut-carta.tut-bloccata, .tut-carta.tut-ruolo { opacity: .62; }
.tut-carta.tut-bloccata .tut-carta-med, .tut-carta.tut-ruolo .tut-carta-med { font-size: 14px; }
.tut-gioca { font-size: 12px; padding: 5px 12px; }
.tut-rigioca { border: none; background: transparent; color: var(--brand); font-size: 11.5px; cursor: pointer; text-decoration: underline; }
.tut-medaglia-nome { font-size: 11.5px; font-weight: 700; color: #8A5800; }
.tut-perche { font-size: 11.5px; color: var(--muted); }
.tut-hub-piede { padding: 12px 22px 16px; text-align: right; }

.tut-festa { position: relative; background: #fff; border-radius: 16px; max-width: 440px; width: 100%; text-align: center;
  padding: 26px 26px 20px; margin-top: 10vh; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.tut-festa-med { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; font-size: 44px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #FBE7A6, #C08A2E 70%); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 5px #fff, 0 0 0 7px #E2C06B, 0 10px 30px rgba(192,138,46,.45); animation: tut-pop .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes tut-pop { 0% { transform: scale(.2) rotate(-40deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.tut-festa-tit { font-size: 21px; font-weight: 800; color: var(--brand-ink); }
.tut-festa-sot { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.tut-festa-premio { font-size: 14px; }
.tut-festa-grado { margin-top: 8px; display: inline-block; background: var(--brand-ink); color: #F3CC5C; border-radius: 20px; padding: 4px 14px; font-size: 13px; }
.tut-festa-conto { margin-top: 8px; font-size: 12px; color: var(--muted); }
.tut-festa .tut-dlg-piede { justify-content: center; }
.tut-coriandoli { position: absolute; inset: 0; pointer-events: none; }
.tut-coriandoli i { position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 2px; opacity: 0;
  animation: tut-cade 1.8s ease-in forwards; }
@keyframes tut-cade { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(420px) rotate(540deg); } }

/* Il pulsante in alto. */
.btn-tutorial { padding: 6px 12px; border-color: #E2C06B; color: #8A5800; font-weight: 700; }
.btn-tutorial .tut-conta { font-family: ui-monospace, monospace; font-size: 11px; background: #FDF3D3; border-radius: 9px; padding: 1px 6px; margin-left: 4px; }

/* ---------------------------------------------------------- amministrazione
   Una panoramica di tessere con lo stato vero, e una sezione alla volta con
   la barra che resta in alto. Ctrl+K apre la ricerca (.pal, più sotto). */
.amm { max-width: 1180px; }
.amm-testa { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.amm-testa h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.amm-testa p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.amm-cerca { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; width: 320px; max-width: 100%; height: 38px;
  padding: 0 7px 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--muted);
  font-size: 13.5px; cursor: text; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, color .15s; }
.amm-cerca:hover { border-color: #BFBAB0; color: var(--ink-2); }
.amm-cerca span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amm-cerca.piccola { width: auto; height: 32px; margin-left: auto; gap: 8px; font-size: 12.5px; }
kbd { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 10.5px; font-weight: 500; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
  white-space: nowrap; line-height: 1.4; }

/* «Prima di lavorare»: l'anello e quello che manca. */
.amm-pronto { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 18px; row-gap: 12px; align-items: center;
  margin-bottom: 28px; padding: 18px 20px; }
.amm-pronto.tutto { background: linear-gradient(180deg, #F4FAF6, #fff 70%); border-color: #D6E8DC; }
.amm-anello { width: 64px; height: 64px; position: relative; }
.amm-anello svg { transform: rotate(-90deg); display: block; }
.amm-anello-n { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.amm-anello-n b { font-size: 19px; font-weight: 500; letter-spacing: -.03em; }
.amm-anello-n span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.amm-pronto-tx h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.amm-pronto-tx p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.amm-pronto-voci { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line2); }
.amm-voce { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; border-radius: 999px;
  padding: 5px 11px 5px 9px; border: 1px solid; white-space: nowrap; }
.amm-voce.fatto { background: var(--green-soft); border-color: #CFE3D6; color: var(--green); }
.amm-voce.da-fare { background: #FFF8EA; border-color: #EBD3A4; color: #7A4B00; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .2s cubic-bezier(.16, 1, .3, 1); }
.amm-voce.da-fare:hover { background: #FCEFD6; border-color: #DDBB78; }
.amm-voce.da-fare svg:last-child { margin-left: -2px; opacity: .6; transition: transform .2s cubic-bezier(.16, 1, .3, 1), opacity .15s; }
.amm-voce.da-fare:hover svg:last-child { transform: translateX(2px); opacity: 1; }

/* I gruppi: due colonne, ogni gruppo un elenco di voci. */
.amm-colonne { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
.amm-colonna { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.amm-gruppo-nome { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  margin: 0 0 8px 2px; display: flex; align-items: center; gap: 12px; }
.amm-gruppo-nome::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.amm-lista { padding: 5px; }
.amm-riga { position: relative; overflow: hidden; display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; gap: 14px;
  align-items: start; width: 100%; padding: 13px 12px; text-align: left; border: 0; background: transparent; border-radius: 9px;
  cursor: pointer; font: inherit; color: inherit; transition: background-color .15s; }
.amm-riga + .amm-riga { box-shadow: 0 -1px 0 var(--line2); }
.amm-riga:hover, .amm-riga:hover + .amm-riga { box-shadow: none; }
.amm-riga::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(39, 47, 108, .07), transparent 70%); }
.amm-riga:hover { background: var(--surface-2); }
.amm-riga:hover::before { opacity: 1; }
.amm-riga:active { background: var(--line2); }
.amm-ico { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-line);
  transition: background-color .2s, color .2s, box-shadow .2s, transform .35s cubic-bezier(.16, 1, .3, 1); }
.amm-riga:hover .amm-ico { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -6px rgba(39, 47, 108, .55); transform: scale(1.04); }
.amm-riga-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; }
.amm-tit { font-size: 14px; font-weight: 600; letter-spacing: -.005em; color: var(--ink); }
.amm-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.amm-stato { margin-top: 7px; font-size: 12px; font-weight: 500; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; max-width: 100%; min-height: 16px; }
.amm-stato > span:not(.amm-scheletro) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amm-stato .dot, .pal-stato .dot { background: var(--faint); width: 7px; height: 7px; }
.tono-ok .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.tono-attenzione { color: #8A5800; }
.tono-attenzione .dot { background: #D08A00; box-shadow: 0 0 0 3px var(--amber-soft); }
.tono-errore { color: var(--red); }
.tono-errore .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.amm-freccia { align-self: center; color: var(--faint); opacity: .6;
  transition: opacity .2s, transform .3s cubic-bezier(.16, 1, .3, 1), color .2s; }
.amm-riga:hover .amm-freccia, .amm-riga:focus-visible .amm-freccia { opacity: 1; transform: translateX(3px); color: var(--brand); }
.amm-riga.pericolo .amm-ico { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 1px #F2D3CF; }
.amm-riga.pericolo:hover .amm-ico { background: var(--red); color: #fff; box-shadow: 0 6px 14px -6px rgba(179, 38, 30, .5); }
.amm-riga.pericolo::before { background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(179, 38, 30, .06), transparent 70%); }
.amm-riga.pericolo:hover .amm-freccia { color: var(--red); }
.amm-scheletro { display: inline-block; width: 128px; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, var(--line2) 0%, #F9F8F5 50%, var(--line2) 100%); background-size: 200% 100%;
  animation: luccica 1.3s linear infinite; }
@keyframes luccica { to { background-position: -200% 0; } }

/* Una sezione aperta: la barra resta in alto mentre si scorre. */
.amm-barra { position: sticky; top: -24px; z-index: 6; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -24px -28px 20px; padding: 12px 28px; background: rgba(246, 245, 242, .88);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.amm-indietro { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px 0 8px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s; }
.amm-indietro:hover { border-color: #BFBAB0; color: var(--ink); }
.amm-indietro svg { transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.amm-indietro:hover svg { transform: translateX(-2px); }
.amm-briciola { font-size: 12px; color: var(--faint); font-weight: 500; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.amm-briciola::before { content: ''; width: 1px; height: 18px; background: var(--line-strong); }
.amm-schede { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.amm-schede::-webkit-scrollbar { display: none; }
.amm-schede button { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 6px 12px; font-size: 12.5px; }
.amm-schede button svg { opacity: .75; }
.amm-schede button.on svg { opacity: 1; color: var(--brand); }
.amm-box { display: flex; flex-direction: column; gap: 18px; }
.amm-luce { animation: amm-luce 1.8s cubic-bezier(.16, 1, .3, 1); border-radius: 8px; }
@keyframes amm-luce { 0%, 30% { box-shadow: 0 0 0 4px rgba(39, 47, 108, .22); } 100% { box-shadow: 0 0 0 4px rgba(39, 47, 108, 0); } }

/* ----------------------------------------------------- ricerca (Ctrl+K) */
.pal-ov { position: fixed; inset: 0; z-index: 9000; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: rgba(26, 28, 36, .34); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
/* Con una missione in corso il fumetto e il riflettore restano sopra la ricerca. */
body.pal-aperta .tut-luce { z-index: 9010; }
body.pal-aperta .tut-fumetto { z-index: 9020; }
.pal { width: 100%; max-width: 620px; max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 14px; box-shadow: 0 32px 80px -20px rgba(26, 28, 36, .5), 0 0 0 1px rgba(26, 28, 36, .07); }
.pal-testa { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-in { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15.5px; color: var(--ink); }
.pal-in::placeholder { color: var(--faint); }
.pal-lista { overflow: auto; padding: 6px; overscroll-behavior: contain; }
.pal-gruppo { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.pal-voce { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 9px; cursor: pointer; font: inherit; color: inherit; }
.pal-voce .ico { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .12s, color .12s; }
.pal-tx { min-width: 0; }
.pal-tx b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pal-tx small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-voce .dx { display: flex; align-items: center; gap: 10px; color: var(--faint); }
.pal-voce .dx > svg { opacity: 0; transition: opacity .12s; }
.pal-voce.sel { background: var(--brand-soft); }
.pal-voce.sel .ico { background: var(--brand); color: #fff; box-shadow: none; }
.pal-voce.sel .dx > svg { opacity: 1; color: var(--brand); }
.pal-voce mark { background: transparent; color: var(--brand); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.pal-stato { display: inline-flex; }
.pal-vuoto { padding: 30px 20px; text-align: center; color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }
.pal-vuoto span { color: var(--muted); font-size: 12.5px; }
.pal-piede { display: flex; gap: 18px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--surface-2);
  font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }

@media (max-width: 900px) {
  .amm-cerca { width: 100%; margin-left: 0; }
  .amm-cerca.piccola { width: auto; }
  .amm-cerca.piccola span, .amm-cerca.piccola kbd { display: none; }
  .amm-barra .amm-cerca.piccola { order: 2; }
  .amm-barra .amm-schede { order: 3; flex-basis: 100%; }
  .amm-barra { top: -18px; margin: -18px -16px 18px; padding: 10px 16px; }
  .amm-briciola { display: none; }
  .pal-piede span:last-child { display: none; }
}
@media (max-width: 1180px) {
  .amm-colonne { grid-template-columns: minmax(0, 1fr); }
  .amm-colonna + .amm-colonna { margin-top: 24px; }
}

/* ------------------------------------------ testi dei segnaposto (Amministrazione) */
.sp-chip { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; max-height: 112px; overflow: auto; padding: 2px;
  margin-bottom: 16px; }
.sp-chip .tag { cursor: pointer; }
.sp-chip .sp-chip-uff { background: var(--amber-soft); border-color: #EBD3A4; color: #7A4B00; }
.sp-voce { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.sp-voce + .sp-voce { margin-top: 12px; }
.sp-testa { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sp-var + .sp-var { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.sp-var textarea { font-size: 13px; line-height: 1.5; resize: vertical; }
.sp-sotto { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; }
.sp-resa { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; }
.sp-resa:empty { display: none; }
.sp-es { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); margin-right: 8px; }
.sp-originale { font-size: 12px; padding: 5px 10px; flex: none; }
.sp-uff { display: grid; grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) minmax(160px, 220px) auto; gap: 12px;
  align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line2); }
.sp-uff:first-child { padding-top: 0; }
.sp-nome { display: flex; align-items: center; gap: 4px; font-family: 'IBM Plex Mono', monospace; color: var(--faint); }
.sp-nome .in { flex: 1; min-width: 0; }
.sp-uff .sp-resa { margin-top: 6px; }
.sp-togli { margin-top: 22px; padding: 8px 10px; }
@media (max-width: 900px) {
  .sp-uff { grid-template-columns: 1fr; }
  .sp-togli { margin-top: 0; justify-self: start; }
}

/* ------------------------------------------------ Amministrazione → Enti */
.enti-lista { display: flex; flex-direction: column; gap: 8px; }
.enti-riga { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.enti-riga.corrente { border-color: #CFE3D6; background: #F6FBF7; }
.enti-riga .ico { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.enti-nome { font-size: 14px; font-weight: 600; color: var(--ink); }
@media (max-width: 900px) { .enti-riga { flex-wrap: wrap; } }
.enti-primo { margin: 16px 0 0; padding: 12px 14px 12px; border: 1px solid var(--line); border-radius: 10px; max-width: 900px; }
.enti-primo legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.enti-primo legend .muted { font-weight: 400; font-size: 12px; }
@media (max-width: 900px) { .enti-primo .grid { grid-template-columns: 1fr !important; } }
