/* People Welfare — CSS puro, nessun framework. */

/* Brand PeopleWelfare.it: navy #0D1B2E, teal #0FA3B1, menta #7EDBD1,
   tint #E6F4F7, sfondo #F7F9FA (i colori restano i nostri).
   Stile ispirato a docs.italia.it (Bootstrap Italia): Titillium Web per
   l'interfaccia, Lora per i testi lunghi, Roboto Mono per il codice, angoli
   quasi squadrati, ombre leggere, campi con la sola linea inferiore.
   Caratteri serviti da qui (licenza SIL OFL): nessuna chiamata a Google. */
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 400; font-display: swap; src: url('font/titillium-web-400-latin.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: 'Titillium Web'; font-style: normal; font-weight: 400; font-display: swap; src: url('font/titillium-web-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Titillium Web'; font-style: italic; font-weight: 400; font-display: swap; src: url('font/titillium-web-400-italic-latin.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: 'Titillium Web'; font-style: italic; font-weight: 400; font-display: swap; src: url('font/titillium-web-400-italic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Titillium Web'; font-style: normal; font-weight: 600; font-display: swap; src: url('font/titillium-web-600-latin.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: 'Titillium Web'; font-style: normal; font-weight: 600; font-display: swap; src: url('font/titillium-web-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Titillium Web'; font-style: normal; font-weight: 700; font-display: swap; src: url('font/titillium-web-700-latin.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: 'Titillium Web'; font-style: normal; font-weight: 700; font-display: swap; src: url('font/titillium-web-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Lora'; font-style: normal; font-weight: 400; font-display: swap; src: url('font/lora-400-latin.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: 'Lora'; font-style: normal; font-weight: 400; font-display: swap; src: url('font/lora-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Lora'; font-style: italic; font-weight: 400; font-display: swap; src: url('font/lora-400-italic-latin.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: 'Lora'; font-style: italic; font-weight: 400; font-display: swap; src: url('font/lora-400-italic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Lora'; font-style: normal; font-weight: 600; font-display: swap; src: url('font/lora-600-latin.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: 'Lora'; font-style: normal; font-weight: 600; font-display: swap; src: url('font/lora-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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: 'Roboto Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('font/roboto-mono-400-latin.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: 'Roboto Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('font/roboto-mono-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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; }

:root {
  --navy: #0D1B2E;
  --teal: #0FA3B1;
  --mint: #7EDBD1;
  --brand: #0FA3B1;
  --brand-strong: #0b7782;
  --brand-tint: #E6F4F7;
  /* Varianti leggibili del colore di marca (WCAG AA): il gestionale le ricalcola
     per il colore di ogni azienda; qui i valori per il turchese predefinito. */
  --brand-testo: #0b7c87;
  --brand-azione: #0c828e;
  --brand-azione-hover: #0a6b74;
  --bg: #F7F9FA;
  --surface: #ffffff;
  --surface-2: #F1F5F7;
  --border: #E3E9EC;
  --border-strong: #C9D3D8;
  --border-campo: #8D9497; /* bordi dei campi: almeno 3:1 sullo sfondo (WCAG 1.4.11) */
  --text: #0D1B2E;
  --text-soft: #45505C;
  --muted: #667179;
  --ok-bg: #E3F7EE; --ok-text: #0d7f50;
  --err-bg: #FBEAEA; --err-text: #B3261E;
  --warn-bg: #FFF4E0; --warn-text: #8A5A07;
  --radius: 4px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(13,27,46,.05), 0 2px 8px rgba(13,27,46,.05);
  --shadow-hover: 0 2px 4px rgba(13,27,46,.08), 0 6px 18px rgba(13,27,46,.09);
  --sidebar-w: 248px;
  --font: 'Titillium Web', Geneva, Tahoma, -apple-system, "Segoe UI", sans-serif;
  --font-testo: 'Lora', Georgia, 'Times New Roman', serif;
  --font-mono: 'Roboto Mono', ui-monospace, Menlo, Consolas, monospace;
  /* Tavolozza qualitativa per i grafici: navy/teal/menta del brand + toni di
     supporto, leggibili sia in chiaro sia in scuro senza ridefinizioni. */
  --chart-1: #0FA3B1;
  --chart-2: #7EDBD1;
  --chart-3: #0D1B2E;
  --chart-4: #3D6EA8;
  --chart-5: #C98A2C;
  --chart-6: #6B5B95;
  --chart-7: #45505C;
  --chart-8: #A7C7CE;
}

:root[data-theme="dark"] {
  --bg: #0B1420;
  --surface: #101C2B;
  --surface-2: #172433;
  --border: #22364A;
  --border-strong: #2E4560;
  --border-campo: #5E7189;
  --text: #EAF1F6;
  --text-soft: #B7C4CF;
  --muted: #8394A2;
  --brand-tint: #12293A;
  --brand-testo: #0FA3B1;
  --brand-strong: #0FA3B1;
  --ok-bg: #0F3328; --ok-text: #5FD3A0;
  --err-bg: #3A1A1C; --err-text: #F2A19B;
  --warn-bg: #3A2C12; --warn-text: #F0C46A;
  --chart-1: #17B5C4;
  --chart-2: #7EDBD1;
  --chart-3: #6FA8C9;
  --chart-4: #5F92C9;
  --chart-5: #DBA24A;
  --chart-6: #8B7CB8;
  --chart-7: #B7C4CF;
  --chart-8: #A7C7CE;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand-testo, var(--brand)); text-decoration: none; }
a:hover { text-decoration: underline; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6em .7em; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { white-space: nowrap; }
tbody tr { transition: background-color .1s ease; }
tbody tr:hover { background: var(--surface-2); }
a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.nav-link:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
tr.riga-link { cursor: pointer; }
tr[hidden] { display: none; }
.tab-filtro { display: flex; align-items: center; gap: .8em; margin: 0 0 .8em; }
.tab-filtro input { max-width: 280px; padding: .45em .7em; font-size: .88rem; }
label.obbl::after { content: ' *'; color: var(--err-text); font-weight: 700; }
.btn.in-corso { opacity: .65; cursor: progress; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: var(--surface-2); }
.tabla-scroll { overflow-x: auto; }
input, select, textarea {
  font-family: inherit; font-size: 1rem; padding: .55em .75em;
  border: 1px solid var(--border-campo); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--brand-testo, var(--brand)); box-shadow: 0 0 0 2px var(--brand-testo, var(--brand));
}
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3em; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4em; box-shadow: var(--shadow); margin-bottom: 1.2em;
  transition: box-shadow .15s ease;
}
.card.clicca { cursor: pointer; }
.card.clicca:hover { box-shadow: var(--shadow-hover); }
.riga { display: flex; gap: 1em; flex-wrap: wrap; margin-bottom: 1em; }
.riga > * { flex: 1; min-width: 200px; }
/* I pulsanti in una riga non si allargano come i campi (paginazione, barre di azioni). */
.riga > .btn { flex: 0 0 auto; min-width: 0; }
.schede { display: flex; gap: .2em; border-bottom: 1px solid var(--border); margin-bottom: 1.4em; overflow-x: auto; }
.schede a {
  padding: .65em 1em; color: var(--text-soft); font-weight: 600; font-size: .92rem; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.schede a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.schede a[aria-current="page"] { color: var(--brand-strong); border-bottom-color: var(--brand); }
:root[data-theme="dark"] .schede a[aria-current="page"] { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; gap: .4em;
  background: var(--brand-azione, var(--brand)); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: .6em 1.1em; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: background-color .12s ease, box-shadow .12s ease, transform .06s ease;
}
.btn:hover { background: var(--brand-azione-hover, var(--brand-strong)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.btn.sec { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn.sec:hover { background: var(--border); }
.btn.ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--err-text); }
.btn.sm { padding: .4em .7em; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.salta { position: absolute; left: .8em; top: -4em; z-index: 200; padding: .6em 1em; border-radius: var(--radius-sm); background: var(--navy); color: #fff; font-weight: 700; }
.salta:focus { top: .8em; outline: 2px solid var(--mint); outline-offset: 2px; text-decoration: none; }
main.content:focus, main.auth-card:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.avviso-sessione { position: fixed; right: 1em; bottom: 1em; z-index: 300; max-width: 360px; padding: 1em 1.2em; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-left: 4px solid var(--warn-text); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); }
.avviso-sessione p { margin: 0 0 .8em; }
.flash { padding: .8em 1.2em; text-align: center; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.errore { background: var(--err-bg); color: var(--err-text); }

.badge { display: inline-flex; align-items: center; gap: .3em; padding: .2em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.errore { background: var(--err-bg); color: var(--err-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .55; flex-shrink: 0; }

.chip { display: inline-block; padding: .3em .8em; border-radius: 999px; background: var(--brand-tint); color: var(--brand-strong); font-weight: 700; font-size: .85rem; }
.muto { color: var(--muted); font-size: .9rem; }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-strong); font-weight: 700; font-size: .8rem; }

.briciole { color: var(--muted); font-size: .82rem; font-weight: 600; margin-bottom: .6em; }
.briciole span { padding: 0 .4em; opacity: .6; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1em; margin-bottom: 1.4em; flex-wrap: wrap; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; margin: 0 0 .2em; }
.hactions { display: flex; gap: .6em; flex-wrap: wrap; }

.emptypro { text-align: center; padding: 3em 1em; color: var(--muted); }
.emptypro svg { color: var(--border-strong); margin-bottom: .6em; }
.emptypro-titolo { font-size: 1.05rem; margin: 0 0 .4em; color: var(--text); }

/* Grafici SVG inline (barre, ciambella, andamento): stessa card, niente
   librerie esterne. .chart-row rende leggibili donut+legenda affiancati
   anche stretti, .chart-scroll evita lo scroll orizzontale della pagina
   quando il grafico è più largo del riquadro. */
.chart-scroll { overflow-x: auto; }
.chart-row { display: flex; gap: 2em; flex-wrap: wrap; align-items: center; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5em; min-width: 180px; }
.chart-legend li { display: flex; align-items: center; gap: .6em; font-size: .88rem; }
.chart-legend .puntino { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.chart-legend .etichetta { flex: 1; color: var(--text-soft); }
.chart-legend .valore { font-weight: 700; }
.donut-centro { font-weight: 800; }
.donut-centro-lbl { fill: var(--muted); font-weight: 600; }

.progress { background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }
.progress.warn > span { background: var(--warn-text); }
.progress.errore > span { background: var(--err-text); }

.stat-grid { display: flex; gap: 1em; flex-wrap: wrap; margin-bottom: 1.4em; }
.stat {
  display: flex; align-items: center; gap: .8em; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1em 1.2em; flex: 1; min-width: 160px;
  transition: box-shadow .15s ease;
}
.stat:hover { box-shadow: var(--shadow-hover); }
.stat svg { background: var(--brand-tint); color: var(--brand-strong); border-radius: 10px; padding: .5em; box-sizing: content-box; flex-shrink: 0; }
.stat-val { display: block; font-size: 1.4rem; font-weight: 800; line-height: 1.2; }
.stat-lbl { display: block; color: var(--muted); font-size: .82rem; }

/* Shell applicativa */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--navy); padding: 1.2em .8em 2em;
  /* Il menu resta fermo e scorre per conto suo: con 50 voci non si perde scorrendo la pagina. */
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.brand-mark { display: flex; align-items: center; gap: .5em; font-weight: 800; font-size: 1.05rem; padding: .4em .5em 1.1em; color: #fff; }
.brand-mark .logo-p { flex-shrink: 0; }
.brand-mark .wm-mint { color: var(--mint); }
.nav-grp { color: rgba(255,255,255,.6); text-transform: uppercase; font-size: .72rem; font-weight: 700; letter-spacing: .05em; padding: 1em .6em .3em; }
.nav-sez + .nav-sez { margin-top: .15em; }
.menu-cerca { position: relative; display: flex; align-items: center; margin: 0 .2em .6em; }
.menu-cerca > svg { position: absolute; left: .7em; color: rgba(255,255,255,.62); pointer-events: none; }
.menu-cerca input {
  width: 100%; padding: .55em 2.2em .55em 2.1em; border-radius: var(--radius-sm); font: inherit; font-size: .85rem;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: #fff;
}
.menu-cerca input::placeholder { color: rgba(255,255,255,.62); }
.menu-cerca input:focus { outline: none; border-color: var(--mint); background: rgba(255,255,255,.11); }
.menu-cerca input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }
.menu-cerca kbd {
  position: absolute; right: .6em; font: 700 .7rem/1 var(--font); color: rgba(255,255,255,.65);
  border: 1px solid rgba(255,255,255,.2); border-radius: 5px; padding: .2em .4em; pointer-events: none;
}
.menu-cerca input:focus ~ kbd, .menu-cerca input:not(:placeholder-shown) ~ kbd { display: none; }
.nav-link[hidden], .nav-sez[hidden] { display: none; }
.nav-link svg { flex-shrink: 0; }
.nav-link { display: flex; align-items: center; gap: .7em; padding: .55em .6em; border-radius: var(--radius-sm); color: rgba(255,255,255,.72); font-weight: 600; font-size: .92rem; transition: background-color .1s ease; }
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav-link.attivo { background: rgba(15,163,177,.22); color: #fff; }
.nav-link svg { opacity: .85; }
.nav-link.attivo svg { color: var(--mint); opacity: 1; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1em 1.6em; border-bottom: 1px solid var(--border); background: var(--surface); gap: 1em; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.ctx { display: flex; align-items: center; gap: .8em; flex-wrap: wrap; }
.utente { display: flex; align-items: center; gap: .6em; }
.content { padding: 1.6em; max-width: 1200px; }
.piede { margin-top: 2.5em; padding-top: 1em; border-top: 1px solid var(--border); color: var(--muted); font-size: .78rem; display: flex; justify-content: space-between; gap: 1em; flex-wrap: wrap; }

.menu-toggle { display: none; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5em; color: var(--text); cursor: pointer; flex-shrink: 0; }
.menu-toggle:hover { background: var(--surface-2); }
.sidebar-overlay { display: none; }

.tema-toggle .icona-scuro { display: inline-flex; }
.tema-toggle .icona-chiaro { display: none; }
:root[data-theme="dark"] .tema-toggle .icona-scuro { display: none; }
:root[data-theme="dark"] .tema-toggle .icona-chiaro { display: inline-flex; }

/* Shell autenticazione: due colonne su schermi larghi (pannello di
   presentazione + card di accesso), una sola colonna sotto i 760px. */
.auth { min-height: 100vh; display: flex; }
.auth-vetrina {
  flex: 1.1; display: flex; flex-direction: column; justify-content: center; gap: 1.6em;
  padding: 3em 4em; color: #fff;
  background: linear-gradient(155deg, var(--navy) 0%, #123B4A 46%, var(--teal) 100%);
}
.auth-vetrina .brand-mark { padding: 0; color: #fff; font-size: 1.3rem; }
.auth-vetrina h1 { font-size: 1.9rem; max-width: 20ch; margin: 0; }
.auth-vetrina p.claim { color: rgba(255,255,255,.85); max-width: 34ch; margin: 0; }
.auth-vantaggi { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1em; }
.auth-vantaggi li { display: flex; align-items: flex-start; gap: .8em; }
.auth-vantaggi svg { flex-shrink: 0; background: rgba(255,255,255,.15); border-radius: 10px; padding: .5em; box-sizing: content-box; }
.auth-vantaggi strong { display: block; font-size: .95rem; }
.auth-vantaggi span { color: rgba(255,255,255,.8); font-size: .85rem; }
.auth-colonna { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 1em; background: var(--bg); }
.auth-tema-toggle { position: absolute; top: 1.4em; right: 1.4em; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.2em; width: 100%; max-width: 380px; }
.auth-card .brand-mark { padding: 0 0 1em; text-align: center; }
.auth-card .brand-mark.solo-mobile { display: none; }

/* ---- Home: riquadri cliccabili, da fare, accesso rapido, credito ---- */
a.stat { color: inherit; text-decoration: none; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
a.stat:focus-visible, .scorciatoia:focus-visible, .dafare a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.home-colonne { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.2em; align-items: start; }
.home-colonne > .card { margin-bottom: 0; }
.home-colonne + .card, .home-colonne + * { margin-top: 1.2em; }
.card-testa { display: flex; justify-content: space-between; align-items: center; gap: 1em; flex-wrap: wrap; margin-bottom: .8em; }
.card-testa h2 { margin: 0; }

.scorciatoie { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7em; }
.scorciatoia {
  display: flex; align-items: center; gap: .75em; padding: .8em .9em; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); background: var(--surface); transition: border-color .12s ease, background-color .12s ease;
}
.scorciatoia:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-tint); }
.scorciatoia > svg { flex-shrink: 0; color: var(--brand); background: var(--brand-tint); border-radius: 9px; padding: .45em; box-sizing: content-box; }
.scorciatoia:hover > svg { background: var(--surface); }
.scorciatoia strong { display: block; font-size: .92rem; line-height: 1.25; }
.scorciatoia small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.3; margin-top: .1em; }

.dafare ul { list-style: none; margin: 0; padding: 0; }
.dafare li + li { border-top: 1px solid var(--border); }
.dafare a { display: flex; align-items: center; gap: .8em; padding: .7em .2em; color: var(--text); }
.dafare a:hover { text-decoration: none; color: var(--brand-strong); }
.dafare a:hover > svg { transform: translateX(2px); }
.dafare a > span:nth-child(2) { flex: 1; }
.dafare a > svg { color: var(--muted); transition: transform .12s ease; }
.dafare-n { min-width: 2em; text-align: center; padding: .15em .5em; border-radius: 999px; background: var(--brand-tint); color: var(--brand-strong); font-weight: 800; font-size: .88rem; }
.dafare-n.warn { background: var(--warn-bg); color: var(--warn-text); }
.dafare-n.errore { background: var(--err-bg); color: var(--err-text); }
.dafare-vuoto { display: flex; align-items: center; gap: .5em; color: var(--ok-text); margin: 0; }

.credito-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 1.2em; flex-wrap: wrap;
  padding: 1.5em 1.6em; margin-bottom: 1.4em; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, #12364A 60%, var(--brand) 140%);
}
.credito-hero .eyebrow { color: rgba(255,255,255,.65); }
.credito-importo { font-size: 2.4rem; font-weight: 800; line-height: 1.1; margin: .1em 0 .15em; letter-spacing: -.01em; }
.credito-nota { margin: 0; color: rgba(255,255,255,.78); font-size: .92rem; }
.credito-hero.in-scadenza .credito-nota { color: #FFD58A; font-weight: 600; }
.credito-azioni { display: flex; gap: .6em; flex-wrap: wrap; }
.credito-hero .btn.sec { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.28); }
.credito-hero .btn.sec:hover { background: rgba(255,255,255,.18); }

.stat.warn svg { background: var(--warn-bg); color: var(--warn-text); }
tr.riga-attenzione td:first-child { box-shadow: inset 3px 0 0 var(--warn-text); }

/* ---- Catalogo del dipendente ---- */
.striscia-credito { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; padding: .75em 1em; margin-bottom: 1em; border-radius: var(--radius-sm); background: var(--brand-tint); color: var(--text); }
.striscia-credito svg { color: var(--brand); }
.striscia-credito a { margin-left: auto; font-weight: 600; }
.cat-strumenti { display: flex; flex-direction: column; gap: .7em; margin-bottom: 1.2em; }
.cat-strumenti input[type=search] { max-width: 520px; }
.chip-filtri { display: flex; gap: .4em; flex-wrap: wrap; }
.chip-filtro { font: inherit; font-size: .84rem; font-weight: 600; padding: .4em .85em; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); cursor: pointer; }
.chip-filtro:hover { border-color: var(--brand); color: var(--text); }
.chip-filtro[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .chip-filtro[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); }
.chip-filtro:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1em; margin-bottom: 1.4em; }
.cat-scheda { display: flex; flex-direction: column; gap: .35em; padding: 1.1em 1.2em; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease; }
.cat-scheda:hover { text-decoration: none; box-shadow: var(--shadow-hover); border-color: var(--brand); transform: translateY(-1px); }
.cat-scheda:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cat-scheda[hidden] { display: none; }
.cat-categoria { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-testo, var(--brand)); }
.cat-nome { font-size: 1.02rem; line-height: 1.3; }
.cat-descr { color: var(--text-soft); font-size: .88rem; line-height: 1.45; flex: 1; }
.cat-piede { display: flex; justify-content: space-between; align-items: baseline; gap: .6em; flex-wrap: wrap; margin-top: .5em; padding-top: .6em; border-top: 1px solid var(--border); font-size: .84rem; }
.cat-importo { font-weight: 800; color: var(--text); }
.cat-non-disponibili summary { cursor: pointer; }
.cat-non-disponibili ul { margin: .8em 0 0; padding-left: 1.2em; }
.cat-non-disponibili li { margin-bottom: .4em; }

.console-barra { display: flex; gap: .6em; flex-wrap: wrap; align-items: center; margin-bottom: 1em; }
.console-barra input[type=search] { flex: 1 1 260px; max-width: 420px; }
.console-barra select { flex: 0 1 240px; width: auto; }
.accesso-chip { display: inline-block; font-size: .78rem; padding: .15em .55em; margin: .1em .2em .1em 0; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); white-space: nowrap; }
.accesso-chip.spento { text-decoration: line-through; opacity: .6; }
form.in-linea { display: inline-flex; gap: .3em; align-items: center; margin: 0 .2em .2em 0; }
form.in-linea select { width: auto; padding: .3em .5em; font-size: .85rem; }
.elenco-azioni { display: flex; flex-direction: column; gap: .9em; }
.elenco-azioni form { display: flex; align-items: center; gap: .7em; flex-wrap: wrap; }
.elenco-azioni .muto { font-size: .84rem; }
.zona-rischio { border-color: color-mix(in srgb, var(--err-text) 30%, var(--border)); }
.cella-utente { display: flex; align-items: center; gap: .6em; min-width: 200px; }
.cella-utente > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.cella-utente small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.scheda-utente-testa { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; }
.scheda-utente-testa .avatar, .scheda-utente-testa > span:first-child { flex-shrink: 0; }
.scheda-utente-dati { display: flex; flex-direction: column; gap: .3em; flex: 1; min-width: 220px; }
.scheda-utente-dati .muto { font-size: .85rem; }
.griglia-schede { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2em; margin-bottom: 1.4em; }
.griglia-schede > .card { margin-bottom: 0; }
.griglia-schede h2 { margin-top: 0; }
.dettaglio-colonne { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2em; align-items: start; }
.dettaglio-colonne > .card { margin-bottom: 0; }
.dettaglio-descr { font-size: 1rem; line-height: 1.6; }
.azione-benefit { position: sticky; top: 5.5em; }
.azione-credito { display: flex; flex-direction: column; margin: 1em 0 .1em; color: var(--muted); font-size: .85rem; }
.azione-credito strong { color: var(--text); font-size: 1.6rem; line-height: 1.2; }
.btn.grande { display: flex; justify-content: center; width: 100%; padding: .85em 1em; font-size: 1rem; margin-top: 1em; box-sizing: border-box; }
.avviso-passo { display: flex; gap: .8em; align-items: flex-start; border-left: 4px solid var(--brand); }
.avviso-passo > svg { color: var(--brand); flex-shrink: 0; margin-top: .15em; }
.nota-passo { display: flex; gap: .5em; align-items: flex-start; font-size: .84rem; color: var(--text-soft); background: var(--surface-2); border-radius: var(--radius-sm); padding: .6em .7em; margin: 1em 0 0; }
.nota-passo svg { flex-shrink: 0; margin-top: .1em; color: var(--brand); }
ol.passi { counter-reset: passo; list-style: none; padding: 0; margin: 0 0 1.4em; }
ol.passi li { counter-increment: passo; position: relative; padding: .35em 0 .35em 2.4em; }
ol.passi li::before { content: counter(passo); position: absolute; left: 0; top: .25em; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--brand-tint); color: var(--brand-strong); font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center; }

@media (max-width: 1100px) {
  .home-colonne { grid-template-columns: minmax(0, 1fr); }
  .dettaglio-colonne { grid-template-columns: minmax(0, 1fr); }
  .azione-benefit { position: static; order: -1; }
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .content { padding: 1.2em; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 101;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-hover);
    overflow-y: auto; padding-bottom: 2em; height: auto;
  }
  .app.menu-aperto .sidebar { transform: translateX(0); }
  .app.menu-aperto .sidebar-overlay { display: block; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(10,12,8,.45); z-index: 100; }
  .menu-toggle { display: inline-flex; }
  /* Barra in alto su una riga: menu, azienda, azioni. Ruolo e nome sono già nel menu/profilo. */
  .topbar { flex-wrap: nowrap; padding: .6em .9em; gap: .6em; }
  .ctx { flex: 1; min-width: 0; flex-wrap: nowrap; gap: .5em; }
  .ctx .chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .ruolo-etichetta, .utente-nome, .solo-desktop { display: none; }
  .utente { gap: .3em; flex-shrink: 0; }
  .utente .btn.sm { padding: .4em .5em; }
}

@media (max-width: 480px) {
  .topbar .logo-chip, .topbar .tema-toggle { display: none; }
}

/* Tabelle su telefono: ogni riga diventa una scheda "etichetta: valore"
   (le etichette arrivano dall'intestazione, via data-label impostato dal layout). */
@media (max-width: 640px) {
  table.a-schede thead { display: none; }
  table.a-schede, table.a-schede tbody, table.a-schede tfoot { display: block; }
  table.a-schede tr { display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .7em; padding: .35em 0; background: var(--surface); }
  table.a-schede tbody tr:hover { background: var(--surface); }
  table.a-schede td { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; border: 0; padding: .3em .8em; text-align: right; }
  table.a-schede td::before { content: attr(data-label); flex-shrink: 0; color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; text-align: left; }
  table.a-schede td:not([data-label])::before, table.a-schede td[data-label=""]::before { content: none; }
  table.a-schede td:not([data-label]), table.a-schede td[data-label=""] { justify-content: flex-end; }
  table.a-schede td:first-child { font-weight: 700; }
  .tabla-scroll { overflow-x: visible; }
  .tabla-scroll:has(table:not(.a-schede)) { overflow-x: auto; }
}

@media (max-width: 760px) {
  .auth { flex-direction: column; }
  .auth-vetrina { flex: none; padding: 2.4em 1.6em; gap: 1em; }
  .auth-vetrina h1 { font-size: 1.4rem; }
  .auth-vantaggi { display: none; }
  .auth-card .brand-mark.solo-mobile { display: block; }
}

/* ---- Sistema: semafori, righe di diagnostica, log aggiornamento ---- */
.sema { display: inline-flex; align-items: center; gap: .45em; font-weight: 600; }
.lamp { width: 10px; height: 10px; border-radius: 999px; background: var(--muted); flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.sema.ok { color: var(--ok-text); } .sema.ok .lamp { background: #17a673; }
.sema.warn { color: var(--warn-text); } .sema.warn .lamp { background: #e0a100; }
.sema.err { color: var(--err-text); } .sema.err .lamp { background: #d93a3a; }
.sema.in_corso .lamp { background: var(--brand); animation: pw-pulsa 1s ease-in-out infinite; }
@keyframes pw-pulsa { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.diag { display: flex; gap: .8em; align-items: flex-start; padding: .55em 0; border-top: 1px solid var(--border); }
.diag:first-of-type { border-top: 0; }
.diag .dx { display: flex; flex-direction: column; gap: .15em; min-width: 0; }
.diag .dx b { font-weight: 600; }
.diag .dx span { color: var(--muted); font-size: .86rem; word-break: break-word; }
.diag-grp { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.2em; align-items: start; }
.sema-globale { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; padding: 1em 1.2em; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin-bottom: 1.4em; }
.sema-globale .lamp { width: 16px; height: 16px; }
.sema-globale .agg-ora { margin-left: auto; color: var(--muted); font-size: .82rem; }
.log-errori { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: .8em 1em; border-radius: var(--radius-sm); max-height: 320px; overflow: auto; }
.agg-passi .diag .dx span { font-size: .84rem; }
.agg-barra { margin: .8em 0 1.2em; }
.agg-barra .progress { height: 12px; }
.agg-percento { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-bottom: .35em; }
.cron-cmd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; background: var(--surface-2); padding: .5em .8em; border-radius: var(--radius-sm); display: block; overflow-x: auto; white-space: nowrap; margin: .3em 0 .8em; }
.scadenzario td.num.attenzione { color: var(--warn-text); font-weight: 700; }

/* ---- People Welfare Card e convenzioni ---- */
.conv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1em; }
.card.conv { display: flex; flex-direction: column; gap: .35em; text-decoration: none; color: inherit; }
.card.conv h3 { margin: 0; font-size: 1.05rem; }
.conv-testa { display: flex; gap: .4em; flex-wrap: wrap; }
.conv-sconto { font-size: 1.5rem; font-weight: 800; color: var(--brand-strong); letter-spacing: -.01em; }
.conv-descr { margin: 0; font-size: .88rem; color: var(--muted); }
.pwcard { flex: 0 1 420px; aspect-ratio: 1.586; border-radius: 18px; padding: 1.3em 1.5em; color: #fff; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(135deg, var(--navy, #0D1B2E) 0%, #123B4A 55%, var(--teal, #0FA3B1) 100%); box-shadow: 0 14px 40px rgba(13,27,46,.25); position: relative; overflow: hidden; }
.pwcard::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(126,219,209,.14); }
.pwcard.sospesa { filter: grayscale(1); opacity: .75; }
.pwcard-testa { display: flex; justify-content: space-between; align-items: center; }
.pwcard-tipo { font-size: .7rem; letter-spacing: .18em; font-weight: 700; opacity: .85; }
.pwcard-nome { font-size: 1.35rem; font-weight: 700; margin-top: .6em; }
.pwcard-azienda { font-size: .9rem; opacity: .85; }
.pwcard-piede { display: flex; justify-content: space-between; align-items: flex-end; gap: 1em; }
.pwcard-lbl { display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.pwcard-numero { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.25rem; letter-spacing: .12em; margin: .15em 0; }
.pwcard-qr { background: #fff; padding: 6px; border-radius: 10px; line-height: 0; }
.pwcard-qr svg { width: 96px; height: 96px; display: block; }
@media print { .sidebar, .topbar, .piede, .hactions, .briciole, .flash { display: none !important; } .pwcard { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---- Loghi (aziende e partner) ---- */
.logo-chip { height: 30px; width: auto; max-width: 110px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }
.logo-mini { height: 22px; width: 22px; object-fit: contain; border-radius: 5px; vertical-align: middle; background: #fff; border: 1px solid var(--border); }
.logo-anteprima { height: 64px; width: auto; max-width: 200px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); background: #fff; padding: 4px; vertical-align: middle; }
.conv-logo { height: 44px; width: auto; max-width: 140px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); padding: 3px; }
.conv-logo.grande { height: 72px; max-width: 220px; margin-bottom: .6em; }
.pwcard-logo { height: 20px; width: 20px; object-fit: contain; border-radius: 4px; background: #fff; vertical-align: middle; margin-right: .3em; }

/* =====================================================================
   Grammatica di docs.italia.it (Bootstrap Italia), con i colori di
   People Welfare. Strato finale: sovrascrive le regole sopra.
   ===================================================================== */

/* Tipografia: Titillium con pesi netti, titoli compatti e decisi. */
body { font-weight: 400; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: 0; line-height: 1.2; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
.card > h2:first-child, .card h2 { font-size: 1.25rem; }
code, kbd, .cron-cmd { font-family: var(--font-mono); font-size: .88em; }
strong, b { font-weight: 700; }

/* Testi lunghi (privacy, termini, accessibilità): Lora come i documenti. */
.testo-lungo p:not(.eyebrow):not(.muto), .testo-lungo li { font-family: var(--font-testo); font-size: 1.05rem; line-height: 1.7; color: var(--text-soft); }
.testo-lungo h1 { font-size: 2.2rem; }
.testo-lungo h2 { margin-top: 1.4em; }

/* Link nel testo sottolineati, come in Bootstrap Italia. */
main p a:not(.btn), main li a:not(.btn):not(.dafare a), .testo-lungo a:not(.btn), .muto a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
.dafare a, .dafare a:hover { text-decoration: none; }
main p a:not(.btn):hover, main li a:not(.btn):hover { text-decoration-thickness: 2px; }

/* Testata a fasce: barra sottile scura (contesto e utente), come la
   "slim header" di docs.italia.it. */
.topbar { background: var(--navy); color: #fff; border-bottom: 0; padding: .5em 1.6em; min-height: 52px; }
.topbar .chip { background: rgba(255,255,255,.12); color: #fff; border-radius: var(--radius-sm); font-weight: 600; }
.topbar .muto { color: rgba(255,255,255,.78); }
.topbar .btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.32); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.1); }
.topbar .btn:focus-visible, .topbar a:focus-visible { outline-color: var(--mint); }
.topbar .avatar { background: var(--mint); color: var(--navy); }
.topbar .utente-nome { font-weight: 600; }
.topbar .menu-toggle { color: #fff; border-color: rgba(255,255,255,.32); }
.topbar .menu-toggle:hover { background: rgba(255,255,255,.1); }
.topbar .logo-chip { background: #fff; border-radius: var(--radius-sm); }

/* Intestazione della pagina come fascia bianca a tutta larghezza:
   percorso, titolo, azioni (come la testata dei documenti). */
.content > .briciole, .content > .pagehead {
  background: var(--surface);
  box-shadow: 0 0 0 100vmax var(--surface);
  clip-path: inset(0 -100vmax 0 0);
}
.content > .briciole { margin: -1.6em -1.6em 0; padding: 1.1em 1.6em .2em; }
.content > .briciole + .pagehead { margin-top: 0; padding-top: .3em; }
.content > .pagehead { margin: -1.6em -1.6em 1.8em; padding: 1.4em 1.6em 1.4em; border-bottom: 1px solid var(--border); box-shadow: 0 0 0 100vmax var(--surface), 0 1px 0 100vmax var(--border); }
.content > .pagehead h1 { margin: 0; }
.briciole { font-size: .88rem; font-weight: 600; }
.briciole a { text-decoration: underline; text-underline-offset: 2px; }
.eyebrow { font-weight: 700; letter-spacing: .08em; }

/* Menu laterale come l'indice dei contenuti: etichette in maiuscoletto,
   voce attiva con la barra a sinistra e il testo in grassetto. */
.nav-grp { font-size: .74rem; letter-spacing: .08em; padding: 1.1em .7em .35em; color: rgba(255,255,255,.66); border-top: 1px solid rgba(255,255,255,.08); margin-top: .4em; }
.nav-sez:first-child .nav-grp, .nav-cima + .nav-sez .nav-grp { border-top: 0; }
.nav-link { border-radius: 0; font-weight: 400; font-size: .95rem; border-left: 4px solid transparent; padding: .5em .6em .5em .7em; color: rgba(255,255,255,.82); }
.nav-link:hover { background: rgba(255,255,255,.06); }
.nav-link.attivo { background: rgba(255,255,255,.08); border-left-color: var(--mint); font-weight: 700; }

/* Riquadri: angoli quasi squadrati, ombra appena accennata. */
.card { border-radius: var(--radius); }
.stat, .scorciatoia, .cat-scheda, .chip-filtro { border-radius: var(--radius-sm); }
.stat svg, .scorciatoia > svg { border-radius: var(--radius-sm); }

/* Pulsanti: primario pieno, secondario "a contorno" (outline di
   Bootstrap Italia), testo in grassetto, angoli 4px. */
.btn { font-size: 1rem; font-weight: 600; padding: .6em 1.3em; letter-spacing: .01em; }
.btn.sm { font-size: .88rem; padding: .35em .8em; }
.btn.sec { background: transparent; color: var(--brand-testo, var(--brand)); border: 0; box-shadow: inset 0 0 0 2px var(--brand-testo, var(--brand)); }
.btn.sec:hover { background: var(--brand-tint); color: var(--brand-testo, var(--brand)); }
.btn.ghost { border-radius: var(--radius-sm); }
.credito-hero .btn.sec { box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); color: #fff; }
.credito-hero .btn.sec:hover { background: rgba(255,255,255,.12); }

/* Campi con la sola linea inferiore (form di Bootstrap Italia); le aree di
   testo restano incorniciate. Il focus è un contorno ben visibile. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not(.menu-cerca input), select {
  border: 0; border-bottom: 1px solid var(--border-campo); border-radius: 0; background-color: transparent; padding-left: .3em; padding-right: .3em;
}
textarea { border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus, input:focus-visible, select:focus-visible, textarea:focus-visible {
  box-shadow: none; outline: 2px solid var(--brand-testo, var(--brand)); outline-offset: 2px;
}
label { font-size: .9rem; font-weight: 600; color: var(--text); }
.menu-cerca input { border-radius: var(--radius-sm); }

/* Tabelle: intestazioni in tondo e in grassetto, linea più marcata. */
th { text-transform: none; letter-spacing: 0; font-size: .88rem; color: var(--text); font-weight: 700; border-bottom: 2px solid var(--border-strong); }

/* Passaggi numerati nei riquadri quadrati, come i capitoli ("4."). */
ol.passi li::before { border-radius: var(--radius-sm); background: var(--brand-azione, var(--brand)); color: #fff; font-weight: 700; }

/* Pulsante "torna su" in basso a destra, come in docs.italia.it. */
.torna-su { position: fixed; right: 1.2em; bottom: 1.2em; z-index: 90; width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--brand-azione, var(--brand)); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-hover); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.torna-su.visibile { opacity: 1; pointer-events: auto; }
.torna-su:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.torna-su svg { transform: rotate(-90deg); }

/* Piè di pagina: fascia separata. */
.piede { border-top: 1px solid var(--border-strong); }

@media (max-width: 860px) {
  .content > .briciole { margin: -1.2em -1.2em 0; padding: 1em 1.2em .2em; }
  .content > .pagehead { margin: -1.2em -1.2em 1.4em; padding: 1.1em 1.2em; }
  .content > .briciole + .pagehead { margin-top: 0; }
  h1 { font-size: 1.6rem; }
}

/* Controlli nativi (calendario, frecce dei menu, barre di scorrimento) nel tema scelto. */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Logo ufficiale: la versione chiara cede il posto a quella per sfondi scuri nel tema scuro. */
.logo-img { display: block; max-width: 100%; }
.logo-tema-scuro { display: none; }
:root[data-theme="dark"] .logo-tema-chiaro { display: none; }
:root[data-theme="dark"] .logo-tema-scuro { display: block; }
.brand-mark { padding: .3em .4em 1.1em; }

/* Barra della demo "Prova subito": profilo attuale, cambio profilo, uscita. */
.barra-demo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6em 1.2em; padding: .6em 1.2em; background: var(--mint); color: var(--navy); font-size: .9rem; }
.barra-demo-nota { opacity: .85; }
.barra-demo-profili { display: flex; flex-wrap: wrap; align-items: center; gap: .35em; margin: 0; }
.barra-demo-profili button { font: inherit; font-size: .84rem; font-weight: 600; padding: .25em .7em; border-radius: var(--radius-sm); border: 1px solid rgba(13,27,46,.35); background: rgba(255,255,255,.55); color: var(--navy); cursor: pointer; }
.barra-demo-profili button:hover { background: #fff; }
.barra-demo-profili button[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); cursor: default; opacity: 1; }
.barra-demo-profili button.esci { background: transparent; border-color: transparent; text-decoration: underline; }
.barra-demo-profili a { color: var(--navy); font-weight: 700; text-decoration: underline; margin: 0 .4em; }
.barra-demo-profili button:focus-visible, .barra-demo-profili a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
@media (max-width: 640px) {
  .barra-demo { padding: .5em .8em; gap: .4em; font-size: .85rem; }
  .barra-demo-nota { display: none; }
  .barra-demo-profili { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: .2em; scrollbar-width: thin; }
  .barra-demo-profili button, .barra-demo-profili a { white-space: nowrap; flex-shrink: 0; }
}
