/* Kloudico · la pagina del socio, grafica «stile Signal» (09 §C).
   Pulita e ariosa, un solo colore d'accento (l'azzurro della K), forme morbide, Figtree servito da qui.
   Telefono per primo: barra in basso e fogli che salgono dal basso. Dai 900 px in su: colonna a sinistra.
   Tema scuro automatico. Nessuno stile in linea (CSP style-src 'self'): le misure che cambiano le mette il JS
   con el.style.setProperty(). */

/* ------------------------------------------------------------------ carattere */
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/figtree-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/figtree-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/figtree-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/figtree-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 800; src: url(/fonts/figtree-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/figtree-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/figtree-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/figtree-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ------------------------------------------------------------------ colori */
:root {
  color-scheme: light;
  --fondo: #ffffff;
  --fondo-lato: #f6f8fa;
  --bolla: #f2f4f7;
  --bolla-forte: #e9edf2;
  --bordo: #e4e7ec;
  --testo: #101418;
  --testo-2: #5f6670;
  --testo-3: #6b727c;            /* almeno 4,5:1 sul bianco e sulle bolle */
  --accento: #0a72ae;            /* pulsanti e collegamenti: l'azzurro della K, un po' più scuro per leggerlo bene */
  --accento-vivo: #1b9ad6;       /* l'azzurro del marchio, per il grafico e le icone */
  --accento-tenue: #e1f1fb;
  --accento-testo: #0b5e8e;
  --su-accento: #ffffff;
  --eroe: #0a72ae;
  --eroe-2: #1b9ad6;
  --magenta: #a2307f;
  --magenta-tenue: #f8e6f2;
  --arancio: #f39c32;
  --verde: #137a3e;
  --verde-tenue: #e3f5ea;
  --ambra: #8a5a00;
  --ambra-tenue: #fff1d6;
  --rosso: #b42318;
  --rosso-tenue: #fde7e5;
  --ombra: 0 1px 2px rgba(16, 20, 24, 0.05), 0 8px 24px rgba(16, 20, 24, 0.06);
  --ombra-foglio: 0 -8px 40px rgba(16, 20, 24, 0.18);
  --velo: rgba(16, 20, 24, 0.42);
  --scheletro: #eceff3;
  --scheletro-luce: #f6f8fa;
  --tondo: 20px;
  --tondo-piccolo: 14px;
  --barra-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fondo: #0f1113;
    --fondo-lato: #0b0c0e;
    --bolla: #1a1c1f;
    --bolla-forte: #24272b;
    --bordo: #2a2d31;
    --testo: #eef0f2;
    --testo-2: #9aa1ab;
    --testo-3: #8d949e;
    --accento: #1673ae;
    --accento-vivo: #4db8ee;
    --accento-tenue: #0e2a3b;
    --accento-testo: #7ccbf5;
    --su-accento: #ffffff;
    --eroe: #135f91;
    --eroe-2: #1b86c4;
    --magenta: #e58ac8;
    --magenta-tenue: #3a1630;
    --verde: #6fd69a;
    --verde-tenue: #133222;
    --ambra: #f5c266;
    --ambra-tenue: #3a2c0e;
    --rosso: #ff8a80;
    --rosso-tenue: #3b1614;
    --ombra: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --ombra-foglio: 0 -8px 40px rgba(0, 0, 0, 0.6);
    --velo: rgba(0, 0, 0, 0.62);
    --scheletro: #1d2023;
    --scheletro-luce: #26292d;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--testo);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accento-testo); }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--accento-vivo); outline-offset: 2px; border-radius: 8px; }
.di-nascosto { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-piccola { width: 18px; height: 18px; }
.cifre { font-variant-numeric: tabular-nums; white-space: nowrap; }
.testo-3 { color: var(--testo-3); font-weight: 500; }
.sotto { color: var(--testo-2); }
.aiuto-segnalino { margin: 0 0 14px; font-size: 14px; }
.senza-js { padding: 24px; text-align: center; }

.avvio { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.avvio img { width: 64px; height: 64px; animation: respiro 1.6s ease-in-out infinite; }
@keyframes respiro { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ------------------------------------------------------------------ guscio */
.guscio { min-height: 100vh; min-height: 100dvh; }
.lato { display: none; }
.testata {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--fondo) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.testata.con-ombra { border-bottom-color: var(--bordo); }
.marchio { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--testo); min-width: 0; }
.marchio img { width: 32px; height: 32px; }
.marchio span { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.testata .marchio { flex: 1; }
.tondino {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accento-tenue); color: var(--accento-testo);
  font-weight: 700; font-size: 15px; text-decoration: none;
  border: 0;
}
.tondino[aria-current="page"] { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--accento-vivo); }

.contenuto {
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: 8px 16px calc(var(--barra-h) + 32px + env(safe-area-inset-bottom));
}

.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--fondo) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--bordo);
}
.barra a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: 16px;
  text-decoration: none; color: var(--testo-2);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
.barra a .pastiglia-icona { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background-color 0.2s; }
.barra a[aria-current="page"] { color: var(--testo); }
.barra a[aria-current="page"] .pastiglia-icona { background: var(--accento-tenue); color: var(--accento-testo); }

@media (min-width: 900px) {
  .guscio { display: grid; grid-template-columns: 264px minmax(0, 1fr); }
  .testata, .barra { display: none; }
  .lato {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: 24px 16px;
    background: var(--fondo-lato);
    border-right: 1px solid var(--bordo);
  }
  .lato .marchio { padding: 4px 12px 24px; }
  .lato .marchio img { width: 36px; height: 36px; }
  .lato .marchio span { font-size: 22px; }
  .lato nav { display: flex; flex-direction: column; gap: 4px; }
  .lato nav a {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; border-radius: 14px;
    text-decoration: none; color: var(--testo-2); font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
  }
  .lato nav a:hover { background: var(--bolla); color: var(--testo); }
  .lato nav a[aria-current="page"] { background: var(--accento-tenue); color: var(--accento-testo); }
  .lato .chi { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; text-decoration: none; color: var(--testo); }
  .lato .chi:hover { background: var(--bolla); }
  .lato .chi[aria-current="page"] { background: var(--accento-tenue); }
  .lato .chi .nome { font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lato .chi .login { color: var(--testo-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lato .chi > div { min-width: 0; }
  .contenuto { max-width: 1040px; padding: 40px 40px 64px; }
}

/* ------------------------------------------------------------------ fascia della prova (specchio) */
.fascia-prova {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 8px 0 20px; padding: 14px 16px;
  border-radius: var(--tondo-piccolo);
  background: var(--accento-tenue); color: var(--testo);
}
.fascia-prova .i { color: var(--accento-testo); margin-top: 1px; }
.fascia-prova strong { display: block; font-weight: 700; }
.fascia-prova p { color: var(--testo-2); font-size: 15px; }

/* ------------------------------------------------------------------ viste */
.vista { animation: entra 0.28s ease-out both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } }
.capo { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0 20px; }
.capo h1 { font-size: 28px; font-weight: 800; }
.capo .sotto { color: var(--testo-2); margin-top: 4px; max-width: 52ch; }
.capo h1:focus { outline: none; }
@media (min-width: 900px) { .capo h1 { font-size: 34px; } .capo { margin-top: 0; } }
.sezione { margin-top: 32px; }
.sezione > h2 { font-size: 19px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sezione > h2 a { font-size: 15px; font-weight: 600; text-decoration: none; padding: 13px 4px; margin: -13px -4px; }

/* ------------------------------------------------------------------ saldo in grande */
.eroe {
  position: relative; overflow: hidden;
  padding: 24px 22px 22px;
  border-radius: 24px;
  background: var(--eroe); color: var(--su-accento);
  box-shadow: var(--ombra);
  isolation: isolate;
}
.eroe::before, .eroe::after { content: ""; position: absolute; border-radius: 50%; z-index: -1; pointer-events: none; }
.eroe::before { width: 260px; height: 260px; right: -90px; top: -120px; background: var(--eroe-2); opacity: 0.55; }
.eroe::after { width: 120px; height: 120px; right: 70px; bottom: -80px; background: var(--eroe-2); opacity: 0.35; }
.eroe .etichetta { font-size: 15px; font-weight: 600; opacity: 0.92; }
.eroe .cifra { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 6px 0 4px; }
.eroe .cifra .euro { font-size: 0.55em; font-weight: 700; margin-right: 0.4em; color: inherit; opacity: 0.85; vertical-align: 0.32em; }
.eroe .nota { font-size: 14px; opacity: 0.9; max-width: 40ch; }
.eroe .azioni { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
/* il pulsante secondario sul blu: fondo più scuro (non più chiaro) così il bianco si legge bene (oltre 4,5:1) */
.eroe .pulsante { background: rgba(0, 24, 48, 0.24); color: #fff; flex: 1 1 auto; }
@media (min-width: 600px) { .eroe .pulsante { flex: 0 0 auto; } }
.eroe .pulsante:hover { background: rgba(0, 24, 48, 0.34); }
.eroe .nota-zero { margin-top: 14px; font-size: 15px; font-weight: 600; }
.eroe .pulsante--chiaro { background: #fff; color: #0a5f92; }
.eroe .pulsante--chiaro:hover { background: #eef7fd; }
@media (min-width: 900px) { .eroe { padding: 32px 32px 28px; } .eroe .cifra { font-size: 56px; } }
/* Un saldo da centomila in su (10 caratteri o più): la cifra si stringe con lo schermo, così sta nel riquadro anche a 360 px. */
.eroe .cifra.lunga { font-size: clamp(28px, 8.5vw, 44px); }
@media (min-width: 900px) { .eroe .cifra.lunga { font-size: 50px; } }

/* ------------------------------------------------------------------ tessere dei totali */
.tessere { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.tessera { padding: 14px 16px; border-radius: var(--tondo-piccolo); background: var(--bolla); min-width: 0; }
.tessera--larga { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tessera .etichetta { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--testo-2); font-weight: 600; }
.tessera .etichetta .punto { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--testo-3); }
.tessera .valore { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; overflow-wrap: anywhere; }
.tessera--larga .valore { margin-top: 0; font-size: 22px; }
.cifre .euro { font-weight: 600; color: var(--testo-2); margin-right: 0.28em; font-size: 0.85em; }
/* Sui telefoni stretti due tessere affiancate non bastano per i milioni: una per riga, etichetta a sinistra e cifra a destra. */
@media (max-width: 479px) {
  .tessere { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tessera { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .tessera .valore, .tessera--larga .valore { margin-top: 0; font-size: 18px; text-align: right; }
}
.punto--azzurro { background: var(--accento-vivo) !important; }
.punto--magenta { background: var(--magenta) !important; }
.punto--arancio { background: var(--arancio) !important; }
.punto--verde { background: var(--verde) !important; }
@media (min-width: 900px) {
  .tessere { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tessera { padding: 16px 18px; }
}

/* ------------------------------------------------------------------ scheda e grafico */
.scheda { padding: 18px; border-radius: var(--tondo); background: var(--bolla); }
.grafico-capo { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.grafico-capo .mese { color: var(--testo-2); font-size: 14px; font-weight: 600; }
.grafico-capo .valore { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.grafico-capo .valore .euro { font-size: 0.7em; color: var(--testo-2); margin-right: 0.2em; font-weight: 700; }
.grafico-capo .aiuto { color: var(--testo-3); font-size: 13px; }
.grafico .valore { min-height: 30px; }
/* Niente spazio fra le colonne: ogni colonna si tocca su tutta la sua larghezza, lo stacco lo fa il margine interno. */
.grafico .colonne {
  display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: 0; align-items: end;
  height: 190px; padding-top: 4px;
  background-image: linear-gradient(to bottom, var(--bordo) 1px, transparent 1px);
  background-size: 100% 33.333%;
  border-bottom: 1px solid var(--bordo);
}
.grafico .colonna { height: 100%; padding: 0 3px; border: 0; background: transparent; display: flex; align-items: flex-end; justify-content: center; border-radius: 8px 8px 0 0; }
.grafico .asta {
  display: block; width: 100%; max-width: 34px;
  height: calc(var(--h, 0) * 100%);
  border-radius: 8px 8px 3px 3px;
  background: var(--accento-vivo); opacity: 0.35;
  transition: opacity 0.15s, height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.grafico .colonna.piena .asta { min-height: 3px; }
.grafico .colonna:hover .asta { opacity: 0.6; }
.grafico .colonna.scelta .asta { opacity: 1; }
.grafico .colonna:focus-visible { outline-offset: 0; }
.grafico .mesi { display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: 0; margin-top: 8px; font-size: 12px; color: var(--testo-2); font-weight: 600; text-align: center; line-height: 1.3; }
.grafico .mesi > span { white-space: nowrap; overflow: visible; display: flex; flex-direction: column; align-items: center; }
.grafico .mesi .anno { color: var(--testo-3); font-weight: 500; font-size: 11px; min-height: 14px; }
.grafico .mesi > span:first-child { align-items: flex-start; }
.grafico .mesi > span:last-child { align-items: flex-end; }
.grafico .aiuto-grafico { margin-top: 10px; color: var(--testo-3); font-size: 13px; }
.scelta-mesi { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fondo); }
.scelta-mesi button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--testo-2); font-size: 13px; font-weight: 700; }
.scelta-mesi button[aria-pressed="true"] { background: var(--accento-tenue); color: var(--accento-testo); }
.grafico--vuoto p { color: var(--testo-2); padding: 24px 0; text-align: center; }
@media (min-width: 900px) { .grafico .colonne { height: 230px; } .grafico .colonna { padding: 0 5px; } .scheda { padding: 22px 24px; } }

/* ------------------------------------------------------------------ pulsanti */
.pulsante {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 0;
  font-weight: 700; font-size: 16px; text-decoration: none; white-space: nowrap;
  background: var(--bolla); color: var(--testo);
  transition: background-color 0.15s, transform 0.1s, opacity 0.15s;
}
.pulsante:hover { background: var(--bolla-forte); }
.pulsante:active { transform: scale(0.98); }
.pulsante[disabled] { opacity: 0.55; cursor: default; transform: none; }
.pulsante--primario { background: var(--accento); color: var(--su-accento); }
.pulsante--primario:hover { background: color-mix(in srgb, var(--accento) 88%, #000); }
.pulsante--pieno { width: 100%; }
.pulsante--testo { background: transparent; color: var(--accento-testo); padding: 0 12px; }
.pulsante--testo:hover { background: var(--accento-tenue); }
.pulsante--pericolo { background: var(--rosso-tenue); color: var(--rosso); }
.pulsante--pericolo:hover { background: color-mix(in srgb, var(--rosso-tenue) 80%, var(--rosso)); }
.pulsante--piccolo { min-height: 36px; padding: 0 14px; font-size: 14px; }
.pulsante .ruota { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: gira 0.7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ pastiglie (stati e tipi) */
.pastiglia {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.4; white-space: nowrap;
  background: var(--bolla-forte); color: var(--testo-2);
}
.pastiglia::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pastiglia--verde { background: var(--verde-tenue); color: var(--verde); }
.pastiglia--ambra { background: var(--ambra-tenue); color: var(--ambra); }
.pastiglia--rosso { background: var(--rosso-tenue); color: var(--rosso); }
.pastiglia--azzurro { background: var(--accento-tenue); color: var(--accento-testo); }
.pastiglia--magenta { background: var(--magenta-tenue); color: var(--magenta); }

/* ------------------------------------------------------------------ elenchi a bolle */
.elenco { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.voce { padding: 16px; border-radius: var(--tondo-piccolo); background: var(--bolla); min-width: 0; }
.voce.nuova { animation: lampo 1.6s ease-out; }
@keyframes lampo { 0%, 30% { box-shadow: 0 0 0 3px var(--accento-vivo); } 100% { box-shadow: 0 0 0 3px transparent; } }
.voce-riga { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.voce-riga > :first-child { min-width: 0; }
.voce .titolo { font-weight: 700; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.voce .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--testo-2); font-size: 14px; }
.voce .importo { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; text-align: right; }
.voce .testo { margin-top: 10px; color: var(--testo); white-space: pre-line; overflow-wrap: anywhere; }
.voce .testo.chiuso { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.voce .testo.vuoto { color: var(--testo-3); font-style: normal; }
.voce .apri-testo { margin: -6px 0 -6px -8px; min-height: 44px; padding: 4px 8px; border: 0; background: none; color: var(--accento-testo); font-weight: 600; font-size: 14px; }
.voce .nota-kloudico { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--fondo); font-size: 15px; overflow-wrap: anywhere; }
.voce .nota-kloudico strong { display: block; font-size: 13px; color: var(--testo-2); font-weight: 700; margin-bottom: 2px; }
.voce .nota-kloudico.rifiuto strong { color: var(--rosso); }
.voce .nota-kloudico p { white-space: pre-line; }
.voce .piede { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.voce .piede .spinta { margin-left: auto; }
.voce .chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--fondo); color: var(--accento-testo); border: 0;
  font-weight: 700; font-size: 14px; text-decoration: none;
}
.voce .chip:hover { background: var(--accento-tenue); }
.voce .chip--spento { color: var(--testo-3); }
.voce .chip--spento:hover { background: var(--fondo); }

/* incassi: tre cifre sotto */
.cifre-incasso { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.cifre-incasso div { padding: 8px 10px; border-radius: 10px; background: var(--fondo); min-width: 0; }
.cifre-incasso dt { font-size: 12px; color: var(--testo-2); font-weight: 600; }
.cifre-incasso dd { margin: 0; font-weight: 700; font-size: 15px; }
/* Sui telefoni stretti (360 px) tre caselline non bastano per «€ 20.000,00»: una riga per voce, la cifra a destra. */
@media (max-width: 479px) {
  .cifre-incasso { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 2px 12px; border-radius: 10px; background: var(--fondo); }
  .cifre-incasso div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-radius: 0; background: none; }
  .cifre-incasso div + div { border-top: 1px solid var(--bordo); }
  .cifre-incasso dd { text-align: right; overflow-wrap: anywhere; min-width: 0; }
}
.voce .netto { text-align: right; flex: none; }
.voce .netto-etichetta { display: block; font-size: 12px; color: var(--testo-2); font-weight: 600; text-align: right; }
@media (min-width: 900px) {
  .incassi .voce { display: grid; grid-template-columns: 100px minmax(0, 1fr) 120px 100px 120px 132px; align-items: center; gap: 14px; padding: 14px 18px; }
  .incassi .voce * { margin: 0; }
  .incassi .voce .voce-riga, .incassi .voce .sinistra, .incassi .voce .cifre-incasso { display: contents; }
  .incassi .voce .cifre-incasso dd, .incassi .voce .netto .importo { font-size: 16px; }
  .incassi .voce .cifre-incasso div { padding: 0; background: none; text-align: right; }
  .incassi .voce .cifre-incasso dt { display: none; }
  .incassi .voce .cifre .euro { margin-right: 0.28em; }
  .incassi .voce .data-incasso { order: -2; color: var(--testo-2); font-weight: 600; }
  .incassi .voce .descr-incasso { order: -1; }
  .incassi .voce .netto { order: 10; }
  .incassi .voce .netto-etichetta { display: none; }
  .incassi .voce .titolo { font-size: 16px; font-weight: 600; }
  .intestazione-incassi { display: grid !important; grid-template-columns: 100px minmax(0, 1fr) 120px 100px 120px 132px; gap: 14px; padding: 0 18px 8px; color: var(--testo-2); font-size: 13px; font-weight: 700; }
  .intestazione-incassi span:nth-child(n+3) { text-align: right; }
}
.intestazione-incassi { display: none; }

/* movimenti */
.icona-movimento { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accento-tenue); color: var(--accento-testo); }
.icona-movimento--addebito { background: var(--magenta-tenue); color: var(--magenta); }
.voce-movimento { display: flex; gap: 14px; align-items: flex-start; }
.voce-movimento > .corpo { flex: 1; min-width: 0; }

/* il segnalino del socio: tocca per girare 0 → 1 → 2 → 0 */
.segnalino {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 14px 0 8px; border-radius: 999px; border: 0;
  background: var(--fondo); color: var(--testo-2);
  font-weight: 700; font-size: 14px;
  transition: background-color 0.15s, color 0.15s, opacity 0.15s;
}
.segnalino .cerchio { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--testo-3); }
.segnalino .cerchio .i { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.segnalino[data-segnalino="1"] { background: var(--verde-tenue); color: var(--verde); }
.segnalino[data-segnalino="1"] .cerchio { background: var(--verde); border-color: var(--verde); color: var(--fondo); }
.segnalino[data-segnalino="2"] { background: var(--rosso-tenue); color: var(--rosso); }
.segnalino[data-segnalino="2"] .cerchio { background: var(--rosso); border-color: var(--rosso); color: var(--fondo); }
.segnalino[data-segnalino="1"] .cerchio .segno-1, .segnalino[data-segnalino="2"] .cerchio .segno-2 { opacity: 1; }
.segnalino .cerchio .i { grid-area: 1 / 1; }
.segnalino[aria-busy="true"] { opacity: 0.5; pointer-events: none; }
.segnalino[disabled] { cursor: default; }
.segnalino:not([disabled]):active { transform: scale(0.96); }

.altri { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; color: var(--testo-2); font-size: 14px; }

/* ------------------------------------------------------------------ vuoti, errori, scheletri */
.vuoto { text-align: center; padding: 40px 16px; border-radius: var(--tondo); background: var(--bolla); }
.vuoto .tondo-icona { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--fondo); color: var(--accento-vivo); }
.vuoto .tondo-icona .i { width: 30px; height: 30px; }
.vuoto h2, .vuoto h3 { font-size: 18px; font-weight: 700; }
.vuoto p { color: var(--testo-2); margin: 6px auto 0; max-width: 36ch; }
.vuoto .pulsante { margin-top: 18px; }
.errore-pagina .tondo-icona { color: var(--rosso); }

.scheletro { border-radius: var(--tondo-piccolo); background: linear-gradient(90deg, var(--scheletro) 0%, var(--scheletro-luce) 50%, var(--scheletro) 100%); background-size: 200% 100%; animation: luccica 1.3s ease-in-out infinite; }
@keyframes luccica { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.scheletro--eroe { height: 214px; border-radius: 24px; }
.scheletro--tessere { height: 150px; margin-top: 12px; }
.scheletro--titolo { height: 34px; width: 55%; margin: 14px 0 24px; border-radius: 10px; }
.scheletro--voce { height: 120px; margin-bottom: 10px; }

/* ------------------------------------------------------------------ fogli (moduli che salgono dal basso) */
dialog.foglio {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%;
  max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 24px 24px 0 0;
  background: var(--fondo); color: var(--testo);
  box-shadow: var(--ombra-foglio);
  overflow: auto; overscroll-behavior: contain;
}
dialog.foglio::backdrop { background: var(--velo); }
dialog.foglio[open] { animation: sale 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.foglio[open]::backdrop { animation: vela 0.3s ease-out; }
dialog.foglio.chiude { animation: scende 0.2s ease-in forwards; }
dialog.foglio.chiude::backdrop { animation: svela 0.2s ease-in forwards; }
@keyframes sale { from { transform: translateY(100%); } }
@keyframes scende { to { transform: translateY(100%); } }
@keyframes vela { from { opacity: 0; } }
@keyframes svela { to { opacity: 0; } }
.foglio-dentro { padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); }
.foglio-maniglia { width: 40px; height: 5px; border-radius: 999px; background: var(--bolla-forte); margin: 0 auto 10px; }
.foglio-capo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.foglio-capo h2 { font-size: 22px; font-weight: 800; }
.foglio .sotto { color: var(--testo-2); margin-bottom: 18px; }
.chiudi { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--bolla); color: var(--testo-2); flex: none; }
.chiudi:hover { background: var(--bolla-forte); color: var(--testo); }
@media (min-width: 900px) {
  dialog.foglio { inset: 0; margin: auto; width: min(520px, calc(100vw - 48px)); max-height: calc(100dvh - 64px); border-radius: 24px; }
  dialog.foglio[open] { animation: appare 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
  dialog.foglio.chiude { animation: sparisce 0.16s ease-in forwards; }
  .foglio-maniglia { display: none; }
  .foglio-dentro { padding: 24px 28px 28px; }
  @keyframes appare { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
  @keyframes sparisce { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
}
.saldo-nel-foglio { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--tondo-piccolo); background: var(--accento-tenue); margin-bottom: 18px; }
.saldo-nel-foglio span { color: var(--accento-testo); font-weight: 600; font-size: 15px; }
.saldo-nel-foglio strong { font-size: 20px; font-weight: 800; }

/* ------------------------------------------------------------------ campi */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo label { font-weight: 700; font-size: 15px; }
.campo .facoltativo { font-weight: 500; color: var(--testo-2); }
.campo input, .campo textarea {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border-radius: var(--tondo-piccolo); border: 2px solid transparent;
  background: var(--bolla); color: var(--testo);
  font-size: 17px; line-height: 1.4;
  transition: border-color 0.15s, background-color 0.15s;
}
.campo textarea { resize: vertical; min-height: 110px; }
.campo input::placeholder, .campo textarea::placeholder { color: var(--testo-3); }
.campo input:focus, .campo textarea:focus { outline: none; border-color: var(--accento-vivo); background: var(--fondo); }
.campo .aiuto { font-size: 14px; color: var(--testo-2); }
.campo .errore-campo { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; color: var(--rosso); font-weight: 600; }
.campo .errore-campo .i { width: 18px; height: 18px; margin-top: 1px; }
.campo.sbagliato input, .campo.sbagliato textarea { border-color: var(--rosso); }
.con-euro { position: relative; }
.con-euro input { padding-left: 38px; font-variant-numeric: tabular-nums; font-weight: 700; }
.con-euro::before { content: "€"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--testo-2); font-weight: 700; font-size: 17px; pointer-events: none; }
.riga-campo { display: flex; gap: 8px; align-items: center; }
.riga-campo .con-euro { flex: 1; }
.con-occhio { position: relative; }
.con-occhio input { padding-right: 56px; }
.con-occhio button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--testo-2); display: grid; place-items: center; }
.con-occhio button:hover { background: var(--bolla-forte); }
.messaggio { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--tondo-piccolo); margin-bottom: 16px; font-weight: 600; font-size: 15px; }
.messaggio--errore { background: var(--rosso-tenue); color: var(--rosso); }
.messaggio--info { background: var(--accento-tenue); color: var(--accento-testo); }
.messaggio--ok { background: var(--verde-tenue); color: var(--verde); }
.messaggio .i { margin-top: 1px; }
.messaggio a { color: inherit; }

/* ------------------------------------------------------------------ accesso */
.accesso { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.accesso-scheda { width: 100%; max-width: 400px; animation: entra 0.35s ease-out both; }
.accesso-marchio { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; }
.accesso-marchio img { width: 84px; height: 84px; margin-bottom: 14px; }
.accesso-marchio h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.accesso-marchio p { color: var(--testo-2); margin-top: 6px; }
.accesso .pulsante--primario { margin-top: 6px; min-height: 52px; font-size: 17px; }
.accesso .dimenticata { text-align: center; color: var(--testo-2); font-size: 14px; margin-top: 20px; }
@media (min-width: 900px) {
  .accesso { background: var(--fondo-lato); }
  .accesso-scheda { background: var(--fondo); padding: 36px 36px 28px; border-radius: 28px; box-shadow: var(--ombra); }
}

/* ------------------------------------------------------------------ profilo */
.profilo-capo { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--tondo); background: var(--bolla); }
.profilo-capo .tondino { width: 64px; height: 64px; font-size: 24px; }
.profilo-capo .nome { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.profilo-capo .login { color: var(--testo-2); overflow-wrap: anywhere; }
.profilo-capo > div { min-width: 0; }
.gruppo { border-radius: var(--tondo); background: var(--bolla); padding: 20px; }
.gruppo h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.gruppo > p { color: var(--testo-2); margin-bottom: 16px; }
.gruppo .campo input { background: var(--fondo); }
.gruppo .pulsante:not(.pulsante--primario):not(.pulsante--pericolo) { background: var(--fondo); }
.gruppo .pulsante:not(.pulsante--primario):not(.pulsante--pericolo):hover { background: var(--bolla-forte); }
.gruppo .campo input:focus { background: var(--fondo); }
.azioni-profilo { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 600px) { .azioni-profilo { flex-direction: row; } }

/* ------------------------------------------------------------------ avviso che compare in basso */
.avvisi { position: fixed; left: 0; right: 0; bottom: calc(var(--barra-h) + 18px + env(safe-area-inset-bottom)); z-index: 60; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.avviso {
  display: flex; align-items: center; gap: 10px;
  max-width: 480px; padding: 12px 18px; border-radius: 999px;
  background: var(--testo); color: var(--fondo);
  font-weight: 600; font-size: 15px; box-shadow: var(--ombra);
  animation: avviso-entra 0.25s ease-out;
}
.avviso .i { color: var(--verde); }
.avviso.errore .i { color: var(--rosso); }
.avviso.esce { animation: avviso-esce 0.2s ease-in forwards; }
@keyframes avviso-entra { from { opacity: 0; transform: translateY(12px); } }
@keyframes avviso-esce { to { opacity: 0; transform: translateY(12px); } }
@media (prefers-color-scheme: dark) { .avviso .i { color: #137a3e; } .avviso.errore .i { color: #b42318; } }
@media (min-width: 900px) { .avvisi { bottom: 28px; padding-left: 264px; } }

/* ------------------------------------------------------------------ meno movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ schermate delle prove
   Le prove (test/e2e) mettono data-schermata su <html> solo mentre fotografano la pagina intera: testata, colonna e
   barra stanno al loro posto invece di restare ferme a metà foto, e gli avvisi non coprono niente. */
html[data-schermata] .testata, html[data-schermata] .lato, html[data-schermata] .barra { position: static !important; }
html[data-schermata] .avvisi { display: none !important; }
