/* Uzuki: stile comune del layout (prima era dentro views/layout/header.php). Il colore del workspace resta in pagina. */
:root {
    --bg: #f7f8fb;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --border: #e2e6ed;
    --border-strong: #7c8798;
    --text: #1a1f29;
    --text-muted: #5b6472;
    --accent: #4f63e0;
    --accent-text-on: #ffffff;
    --accent-h: #3f52c9;
    --accent-wash: rgba(79, 99, 224, .08);
    --danger: #dc2626;
    --danger-wash: rgba(220, 38, 38, .08);
    --success: #15803d;
    --warning: #b45309;
    --alert-error-bg: #fde8e8;
    --alert-error-text: #b91c1c;
    --alert-success-bg: #e7f6ec;
    --alert-success-text: #106b30;
    --shadow: 0 1px 2px rgba(20, 24, 34, .04), 0 8px 24px rgba(20, 24, 34, .06);
    --shadow-lift: 0 4px 10px rgba(20, 24, 34, .06), 0 16px 32px rgba(20, 24, 34, .1);
    --shadow-pop: 0 10px 30px rgba(20, 24, 34, .14);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b0e14;
        --surface: #141922;
        --surface-2: #1b212c;
        --border: #262e3a;
        --border-strong: #5b6b82;
        --text: #eef1f6;
        --text-muted: #94a1b3;
        --accent: #7c9eff;
        --accent-text-on: #0b0e14;
        --accent-h: #97b3ff;
        --accent-wash: rgba(124, 158, 255, .12);
        --danger: #ff6b6b;
        --danger-wash: rgba(255, 107, 107, .1);
        --success: #4ade80;
        --warning: #fbbf24;
        --alert-error-bg: #2a1416;
        --alert-error-text: #ff8080;
        --alert-success-bg: #12261a;
        --alert-success-text: #4ade80;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
        --shadow-lift: 0 4px 12px rgba(0, 0, 0, .35), 0 16px 36px rgba(0, 0, 0, .4);
        --shadow-pop: 0 14px 36px rgba(0, 0, 0, .5);
    }
}

:root[data-theme="dark"] {
    --bg: #0b0e14;
    --surface: #141922;
    --surface-2: #1b212c;
    --border: #262e3a;
    --border-strong: #5b6b82;
    --text: #eef1f6;
    --text-muted: #94a1b3;
    --accent: #7c9eff;
    --accent-text-on: #0b0e14;
    --accent-h: #97b3ff;
    --accent-wash: rgba(124, 158, 255, .12);
    --danger: #ff6b6b;
    --danger-wash: rgba(255, 107, 107, .1);
    --success: #4ade80;
    --warning: #fbbf24;
    --alert-error-bg: #2a1416;
    --alert-error-text: #ff8080;
    --alert-success-bg: #12261a;
    --alert-success-text: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 4px 12px rgba(0, 0, 0, .35), 0 16px 36px rgba(0, 0, 0, .4);
    --shadow-pop: 0 14px 36px rgba(0, 0, 0, .5);
}

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

/* Spazio della barra di scorrimento sempre riservato: passando da una pagina corta (senza
   barra) a una lunga la larghezza utile non cambia e il contenuto non si sposta di lato. */
html { scrollbar-gutter: stable; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---------- pulsanti / form / alert / card (usati in tutte le viste) ---------- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); }
.btn-primary:hover { background: var(--brand-h, var(--accent-h)); }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    padding: 0.3rem 0.85rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-full { width: 100%; text-align: center; }
/* Spento (es. "Prossima pratica" senza pratiche); non durante l'invio di un modulo (data-spento-invio, uzuki.js). */
.btn:disabled:not([data-spento-invio]) { opacity: .45; cursor: not-allowed; }
.btn-primary:disabled:not([data-spento-invio]):hover { background: var(--brand, var(--accent)); }

/* Riga in fondo ai form: azione principale a tutta larghezza + Annulla */
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.form-actions .btn-primary { flex: 1; text-align: center; }
.form-actions .btn-ghost { padding: 0.5rem 1.25rem; font-size: 0.9rem; text-align: center; }

/* "← Torna a ..." sopra il titolo delle pagine di dettaglio */
/* Ritorno alla pagina superiore: pillola con freccia + nome della pagina (es. "‹ Lavorazioni"). */
.back-link {
    display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1rem;
    padding: .32rem .8rem .32rem .65rem; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text-muted); font-size: .82rem; font-weight: 600; text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.back-link::before {
    content: ""; width: 6px; height: 6px; flex: none; margin-left: 3px;
    border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.back-link:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.back-link:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }

.center-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.form-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); }

/* ---------- tendine (.tendina, uzuki.js): al posto del menu grezzo delle <select class="form-input"> ---------- */
.tendina { position: relative; width: 100%; }
.tendina.is-compatta { display: inline-block; width: auto; }
.tendina[hidden] { display: none; }
/* La select vera resta sotto il pulsante: si invia col modulo e i messaggi di "obbligatorio" compaiono al posto giusto. */
.tendina-nativa { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.tendina-btn {
    display: flex; align-items: center; gap: .55rem; text-align: left; cursor: pointer;
    font-family: inherit; font-weight: 500; line-height: 1.35;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.tendina-btn:hover:not(:disabled) { border-color: var(--brand, var(--accent)); }
.tendina-btn:focus-visible, .tendina.is-aperta .tendina-btn { border-color: var(--brand, var(--accent)); box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.tendina-btn:disabled { opacity: .55; cursor: not-allowed; }
.tendina-valore { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tendina-freccia { display: flex; flex: none; color: var(--text-muted); transition: transform .15s ease; }
.tendina.is-aperta .tendina-freccia { transform: rotate(180deg); color: var(--text); }
.tendina.is-invalida .tendina-btn { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash); }
.tendina-pannello {
    position: fixed; z-index: 1000; max-width: min(440px, calc(100vw - 16px)); padding: .35rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop);
    animation: picker-in .12s ease-out;
}
.tendina-pannello.is-sopra { animation-name: tendina-su; }
@keyframes tendina-su { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tendina-cerca {
    width: 100%; padding: .5rem .7rem; margin-bottom: .3rem; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; outline: none;
}
.tendina-cerca:focus { border-color: var(--brand, var(--accent)); }
.tendina-lista { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.tendina-gruppo { padding: .6rem .65rem .3rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.tendina-gruppo:first-child { padding-top: .3rem; }
.tendina-voce { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border-radius: 8px; cursor: pointer; font-size: .92rem; line-height: 1.3; color: var(--text); }
.tendina-voce.is-attiva { background: var(--surface-2); }
.tendina-voce[aria-selected="true"] { background: var(--brand-wash, var(--accent-wash)); color: var(--text); font-weight: 650; }   /* colore del workspace solo sullo sfondo: il testo resta leggibile con ogni colore */
.tendina-voce-testo { flex: 1; min-width: 0; }
.tendina-spunta { display: flex; flex: none; opacity: 0; }
.tendina-voce[aria-selected="true"] .tendina-spunta { opacity: 1; }
.tendina-voce.is-off { opacity: .45; cursor: default; }
.tendina-vuoto { padding: .7rem .65rem; color: var(--text-muted); font-size: .88rem; }

.alert { padding: 0.75rem 1rem; border-radius: 7px; font-size: 0.88rem; margin-bottom: 1.25rem; }
.alert-error   { background: var(--alert-error-bg); border: 1px solid var(--alert-error-bg); color: var(--alert-error-text); }
.alert-success { background: var(--alert-success-bg); border: 1px solid var(--alert-success-bg); color: var(--alert-success-text); }
/* link dentro un avviso ("Vai a Esiti"): grassetto con la freccia disegnata, mai caratteri come → */
.alert-link { display: inline-flex; align-items: center; gap: .15rem; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.alert-link svg { flex: none; transition: transform .15s ease; }
.alert-link:hover svg { transform: translateX(2px); }
/* esito positivo breve con la spunta disegnata ("Pronta per l'import") */
.ok-riga { display: flex; align-items: center; gap: .4rem; color: var(--success); font-weight: 600; font-size: .9rem; }
.ok-riga svg { flex: none; }
/* campo che non si puo' cambiare (es. prefisso di una lavorazione con pratiche) */
.form-input.is-bloccato { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }

.page { padding: 2rem; }
.page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; box-shadow: var(--shadow); }
.info-card-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 600; }
.info-card-value { font-size: 1.05rem; font-weight: 600; }

/* ---------- popup (dialog nativo): .modal + header/body/footer ---------- */
dialog.modal {
    margin: auto; padding: 0; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-pop);
}
/* ---------- conferme e avvisi di Uzuki (dialog.conferma, uzuki.js: uzukiConferma / uzukiAvviso / data-conferma) ---------- */
dialog.conferma {
    width: min(440px, calc(100vw - 2rem)); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 16px;
    background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(10, 13, 20, .28);
}
dialog.conferma[open] { animation: conferma-in .16s ease-out; }
@keyframes conferma-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog.conferma::backdrop { background: rgba(10, 13, 20, .45); backdrop-filter: blur(2px); }
.conferma-corpo { display: flex; gap: 1rem; align-items: flex-start; padding: 1.5rem 1.5rem 1.1rem; }
.conferma-icona { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-wash, var(--accent-wash)); color: var(--brand, var(--accent)); }
.conferma.is-pericolo .conferma-icona { background: var(--danger-wash); color: var(--danger); }
.conferma.is-info .conferma-icona { background: var(--surface-2); color: var(--text-muted); }
.conferma-titolo { font-size: 1.05rem; font-weight: 750; line-height: 1.3; margin-top: .55rem; }
.conferma-testo { font-size: .9rem; color: var(--text-muted); line-height: 1.5; margin-top: .4rem; }
.conferma-azioni { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.5rem 1.25rem; }
.conferma-azioni .btn { padding: .55rem 1.15rem; font-size: .92rem; font-weight: 650; }
.conferma-azioni .btn-ghost { font-size: .92rem; }
.btn-pericolo { background: var(--danger); color: #fff; }
.btn-pericolo:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.conferma-azioni .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.conferma-azioni .btn-pericolo:focus-visible { box-shadow: 0 0 0 3px var(--danger-wash); }

/* Scheda utente nella finestra dell'elenco Utenti: la pagina sta in un iframe che riempie il popup */
dialog.modal.modal-utente { width: min(980px, calc(100vw - 2rem)); height: min(88vh, 900px); display: none; flex-direction: column; overflow: hidden; }
dialog.modal.modal-utente[open] { display: flex; }
.modal-utente-frame { flex: 1; width: 100%; border: 0; background: var(--surface); }
dialog.modal::backdrop { background: rgba(10, 13, 20, .45); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); }
/* La barra del titolo serve da maniglia per spostare il popup (footer.php). */
.modal-header { cursor: move; user-select: none; touch-action: none; }
.modal-header button { cursor: pointer; }
dialog.modal.is-dragging { opacity: .96; }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.3rem; line-height: 1; padding: .2rem .4rem; border-radius: 6px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 1.25rem 1.4rem; overflow-y: auto; }
.modal-footer { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.4rem; border-top: 1px solid var(--border); }
.modal-footer .spacer { flex: 1; }

/* ---------- pannello laterale a destra (.drawer), es. richiami dell'operatore ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 13, 20, .35); z-index: 60; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(420px, 100vw);
    background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
    display: flex; flex-direction: column; transform: translateX(100%);
    /* chiuso = anche invisibile, così i link interni non prendono il focus col Tab */
    visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s;
}
.drawer.open { transform: translateX(0); visibility: visible; transition: transform .2s ease; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: .75rem; }
.count-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.35rem;
    padding: 0 .35rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
    background: var(--danger); color: var(--accent-text-on); /* bianco nel tema chiaro, scuro nel tema scuro: contrasto AA */
}

/* ---------- selettore con ricerca (.picker, comportamento in footer.php) ---------- */
.picker { position: relative; }
.picker-trigger {
    width: 100%; display: flex; align-items: center; gap: .65rem; text-align: left;
    padding: .8rem 1rem; border-radius: 12px; border: 1.5px solid var(--border-strong);
    background: var(--bg); color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.picker-trigger:hover { border-color: var(--brand, var(--accent)); }
.picker-trigger[aria-expanded="true"] { border-color: var(--brand, var(--accent)); box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.picker-trigger .picker-placeholder { color: var(--text-muted); font-weight: 500; }
.picker-trigger .picker-chevron { margin-left: auto; color: var(--text-muted); transition: transform .15s ease; }
.picker-trigger[aria-expanded="true"] .picker-chevron { transform: rotate(180deg); }
.picker.is-invalid .picker-trigger { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash); }
.picker-panel {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop);
    padding: .5rem; animation: picker-in .12s ease-out;
}
@keyframes picker-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
/* Dentro un popup i pannelli si sovrappongono al contenuto, ancorati al pulsante (uzukiAncora in uzuki.js). */
.is-ancorato { position: fixed; right: auto; bottom: auto; margin: 0; z-index: 1000; }
.picker-search {
    width: 100%; padding: .55rem .75rem; margin-bottom: .4rem; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: .92rem; outline: none;
}
.picker-search:focus { border-color: var(--brand, var(--accent)); }
.picker-list { max-height: 320px; overflow-y: auto; }
.picker-option {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 8px;
    cursor: pointer; font-size: .93rem;
}
.picker-option.is-active { background: var(--surface-2); }
.picker-option[aria-selected="true"] { font-weight: 700; }
.picker-option .badge { min-width: 3.1rem; text-align: center; }
.picker-option kbd, .picker-hint kbd {
    margin-left: auto; font: inherit; font-size: .72rem; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 5px; padding: .05rem .4rem; background: var(--bg);
}
.picker-empty { padding: .8rem .6rem; color: var(--text-muted); font-size: .88rem; }
.picker-hint { display: flex; gap: .9rem; flex-wrap: wrap; padding: .45rem .6rem .15rem; font-size: .74rem; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: .35rem; }
.picker-hint kbd { margin-left: 0; }

/* ---------- calendario + orari (.slotpicker, comportamento in footer.php) ---------- */
.slotpicker { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-title { font-weight: 700; font-size: .95rem; text-transform: capitalize; }
.cal-nav {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); cursor: pointer; font-size: 1rem; line-height: 1;
}
.cal-nav:hover:not([disabled]) { border-color: var(--border-strong); }
.cal-nav[disabled] { opacity: .35; cursor: not-allowed; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; }
.cal-dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--text-muted); padding: .2rem 0; }
.cal-day {
    aspect-ratio: 1; border-radius: 9px; border: 1px solid transparent; background: var(--surface);
    color: var(--text); font-size: .88rem; font-weight: 600; cursor: pointer; padding: 0;
}
.cal-day:hover:not([disabled]) { border-color: var(--brand, var(--accent)); }
.cal-day[disabled] { background: var(--surface-2); color: var(--text-muted); opacity: .45; cursor: not-allowed; font-weight: 400; }
.cal-day.is-today { border-color: var(--border-strong); }
.cal-day.is-selected { background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); border-color: transparent; }
.cal-day.is-empty { visibility: hidden; }
.slot-title { font-weight: 700; font-size: .88rem; margin-bottom: .5rem; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .35rem; }
.slot {
    padding: .45rem 0; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: .85rem; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.slot:hover:not([disabled]) { border-color: var(--brand, var(--accent)); }
.slot[disabled] { background: var(--surface-2); color: var(--text-muted); opacity: .45; cursor: not-allowed; font-weight: 400; }
.slot.is-selected { background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); border-color: transparent; }
.slot-empty { font-size: .85rem; color: var(--text-muted); }
.slotpicker-summary { grid-column: 1 / -1; font-size: .9rem; }
.slotpicker.is-invalid .slotpicker-summary { color: var(--danger); font-weight: 600; }

/* ---------- scelte a "pillola" (.choice): radio o checkbox nascosti dentro una label ---------- */
.choice-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.choice > span {
    display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: .88rem; font-weight: 600; cursor: pointer; user-select: none; transition: border-color .12s, background .12s;
}
.choice > span:hover { border-color: var(--border-strong); }
.choice input:checked + span { background: var(--brand-wash, var(--accent-wash)); border-color: var(--brand, var(--accent)); color: var(--brand, var(--accent)); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); border-color: var(--brand, var(--accent)); }
.choice input:disabled + span { opacity: .45; cursor: not-allowed; }
.choice input[type="checkbox"] + span::before { content: ""; width: .8rem; height: .8rem; border-radius: 3px; border: 1.5px solid currentColor; opacity: .55; flex: none; }
.choice input[type="checkbox"]:checked + span::before { opacity: 1; background: currentColor; box-shadow: inset 0 0 0 2px var(--surface); }
.choice-grid.is-invalid .choice > span { border-color: var(--danger); }

/* ---------- selettore a segmenti (.segmented): radio nascosti, una sola scelta ---------- */
.segmented { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented span { display: block; padding: .4rem .85rem; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20, 24, 34, .12); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }

dialog.modal.modal-wide { width: min(720px, calc(100vw - 2rem)); }
.modal-section { border-top: 1px solid var(--border); margin: 1.25rem -1.4rem 0; padding: 1.1rem 1.4rem 0; }
.modal-section-title { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-bottom: .75rem; }
.field-hint { font-size: .78rem; color: var(--text-muted); margin-top: .35rem; }

/* ---------- indicatori (.stat-tiles > .stat): numero grande + etichetta + nota ---------- */
.stat-tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1.1rem; box-shadow: var(--shadow); }
.stat-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat-note { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ---------- tabella dati (.data-table): numeri allineati a destra, riga totale ---------- */
.data-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.25rem; }
.data-card-title { padding: .8rem 1rem; font-weight: 700; font-size: .92rem; border-bottom: 1px solid var(--border); }
.data-card-scroll { overflow-x: auto; position: relative; }   /* riferimento per gli elementi posizionati della tabella: restano dentro lo scorrimento */
/* barra di scorrimento sopra le tabelle larghe (uzuki.js), sincronizzata con quella sotto */
.scroll-sopra { overflow-x: auto; overflow-y: hidden; height: 14px; border-bottom: 1px solid var(--border); }
.scroll-sopra[hidden] { display: none; }
.scroll-sopra > div { height: 1px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
/* le intestazioni vanno a capo invece di allargare la tabella */
.data-table th { text-align: right; vertical-align: bottom; padding: .55rem .7rem; font-size: .7rem; font-weight: 700; line-height: 1.25; text-transform: uppercase; letter-spacing: .35px; color: var(--text-muted); background: var(--surface-2); }
.data-table td { text-align: right; padding: .5rem .7rem; border-top: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table tbody tr:hover td { background: var(--accent-wash); }
.data-table tfoot td { font-weight: 800; border-top: 2px solid var(--border-strong); }
.data-table .is-zero { color: var(--text-muted); }
/* elenchi di testo (esiti, lavorazioni, storico import...): tutto a sinistra, le colonne numeriche con .num */
.data-table.is-testo th, .data-table.is-testo td { text-align: left; }
.data-table.is-testo th.num, .data-table.is-testo td.num { text-align: right; }
.data-table.is-testo td.azioni { text-align: right; width: 1%; }
.data-table tr.is-off td { color: var(--text-muted); }
.data-empty { padding: .9rem 1rem; color: var(--text-muted); font-size: .88rem; }
/* percentuale con barra sottile (0–100%) */
.meter { display: inline-flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.meter-bar { width: 40px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--brand, var(--accent)); }

/* ---------- selettore di periodo (.daterange, views/layout/daterange.php + footer.php) ---------- */
.daterange { position: relative; display: inline-block; max-width: 100%; }
.dr-trigger {
    display: inline-flex; align-items: center; gap: .55rem; min-height: 40px; max-width: 100%; padding: .45rem .8rem;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
    font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-align: left;
}
.dr-trigger:hover, .dr-trigger[aria-expanded="true"] { border-color: var(--brand, var(--accent)); }
.dr-trigger[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.dr-trigger > svg { color: var(--text-muted); flex: none; }
.dr-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-label small { font-weight: 500; color: var(--text-muted); font-size: .82rem; margin-left: .35rem; }
.dr-trigger[aria-expanded="true"] .dr-chevron { transform: rotate(180deg); }
.dr-panel {
    position: absolute; z-index: 70; top: calc(100% + 6px); left: 0; display: flex; width: max-content; max-width: calc(100vw - 2rem);
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden;
}
.dr-panel[hidden] { display: none; }
.dr-panel.is-right { left: auto; right: 0; }
.dr-side { width: 200px; flex: none; border-right: 1px solid var(--border); padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.dr-search { width: 100%; padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: .86rem; outline: none; }
.dr-search:focus { border-color: var(--brand, var(--accent)); }
.dr-presets { overflow-y: auto; max-height: 360px; display: flex; flex-direction: column; gap: 1px; }
.dr-preset { text-align: left; padding: .45rem .6rem; border: none; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; }
.dr-preset:hover, .dr-preset:focus-visible { background: var(--surface-2); outline: none; }
.dr-preset.is-active { background: var(--brand-wash, var(--accent-wash)); color: var(--brand, var(--accent)); font-weight: 700; }
.dr-empty { font-size: .84rem; color: var(--text-muted); padding: .4rem .6rem; }
.dr-main { padding: .9rem 1rem .8rem; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
.dr-months { display: flex; gap: 1.25rem; align-items: flex-start; }
.dr-month { width: 252px; }
.dr-month-head { display: flex; gap: .35rem; justify-content: center; margin-bottom: .5rem; }
.dr-month-head select { padding: .3rem .45rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.dr-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 2px; }
.dr-dow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--text-muted); padding: .2rem 0 .35rem; text-transform: uppercase; }
.dr-day { height: 34px; border: none; background: none; color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; border-radius: 0; padding: 0; font-variant-numeric: tabular-nums; }
.dr-day:hover { background: var(--surface-2); border-radius: 8px; }
.dr-day.is-today { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.dr-day.in-range { background: var(--brand-wash, var(--accent-wash)); }
.dr-day.is-start, .dr-day.is-end { background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); font-weight: 700; }
.dr-day.is-start { border-radius: 8px 0 0 8px; }
.dr-day.is-end { border-radius: 0 8px 8px 0; }
.dr-day.is-start.is-end { border-radius: 8px; }
.dr-blank { height: 34px; }
.dr-nav { width: 30px; height: 30px; flex: none; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.05rem; line-height: 1; margin-top: 1px; }
.dr-nav:hover { border-color: var(--border-strong); }
.dr-inputs { display: flex; gap: 1rem; }
.dr-inputs label { flex: 1; display: flex; flex-direction: column; gap: .3rem; font-size: .76rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.dr-inputs .form-input { padding: .4rem .6rem; font-size: .88rem; text-transform: none; letter-spacing: 0; font-weight: 500; }
.dr-footer { display: flex; align-items: center; gap: .6rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.dr-hint { flex: 1; font-size: .82rem; color: var(--text-muted); }
/* schermi stretti: un mese solo, preimpostati sopra */
@media (max-width: 760px) {
    .dr-panel { flex-direction: column; position: fixed; top: 4rem; left: 1rem; right: 1rem; width: auto; max-height: calc(100vh - 5rem); overflow-y: auto; }
    .dr-side { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .dr-presets { flex-direction: row; flex-wrap: wrap; max-height: none; }
    .dr-month + .dr-month { display: none; }
    .dr-month { width: auto; flex: 1; }
    .dr-grid { grid-template-columns: repeat(7, 1fr); }
}

/* ---------- schede interne di una sezione (views/layout/subtabs.php) ---------- */
.subtabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.5rem; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
    padding: .6rem 1rem; margin-bottom: -1px; border-bottom: 2px solid transparent;
    color: var(--text-muted); font-size: .9rem; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--brand, var(--accent)); }

/* ---------- badge (es. macrocategorie esiti) ---------- */
.badge {
    display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .03em;
    padding: .12rem .55rem; border-radius: 999px; border: 1px solid currentColor; background: transparent;
}
/* Su --surface tutti i colori badge superano 4.5:1 (AA) in entrambi i temi:
   niente sfondo grigio, che abbasserebbe il contrasto del rosso. */
.badge-success { color: var(--success); }
.badge-danger  { color: var(--danger); }
.badge-accent  { color: var(--accent); }
.badge-warning { color: var(--warning); }
.badge-muted   { color: var(--text-muted); }
.badge-ft      { color: #7c3aed; }   /* fuori target */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-ft { color: #a78bfa; } }
:root[data-theme="dark"] .badge-ft { color: #a78bfa; }

.placeholder {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* ---------- shell: topbar + sidebar + content ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 0 1.1rem; background: var(--surface); border-bottom: 1px solid var(--border);
    position: relative; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: .9rem; min-width: 0; flex: 1; }

.brand { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; text-decoration: none; }
.logomark {
    width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, #7c6bff, var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 800;
}
.brand-word { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); }

/* ---------- testata del workspace in cima alla sidebar (logo + nome, cambia workspace) ---------- */
.ws-switch { position: relative; }
/* Solo il logo (o l'iniziale): cliccandolo si cambia workspace. */
.ws-head {
    display: flex; align-items: center; align-self: flex-start; max-width: 100%; padding: 4px 6px; border-radius: 10px;
    border: none; background: none; cursor: pointer; font: inherit; transition: background .15s ease;
}
.ws-head:hover, .ws-head[aria-expanded="true"] { background: var(--surface-2); }
.ws-head:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
.ws-head-badge {
    width: 36px; height: 36px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center;
    background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); font-weight: 800; font-size: .95rem;
}
/* Logo caricato: altezza fissa, larghezza secondo le proporzioni (anche loghi "a striscia"). */
.ws-head-logo { height: 48px; max-width: 100%; display: flex; align-items: center; }
.ws-head-logo img { max-height: 100%; max-width: 100%; width: auto; height: auto; }
/* doppia freccia: fa capire che il logo apre il selettore */
.ws-head { gap: .4rem; }
.ws-head-logo { min-width: 0; flex: 0 1 auto; }
.ws-head-chevron { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.ws-head:hover .ws-head-chevron, .ws-head[aria-expanded="true"] .ws-head-chevron { color: var(--text); }
/* solo per i lettori di schermo: ancorato in alto a sinistra, cosi' non allarga mai la pagina (es. in fondo a una tabella larga) */
.visually-hidden { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.ws-popover { left: 0; right: auto; width: 260px; transform-origin: top left; max-height: 70vh; overflow-y: auto; }
.ws-mini {
    width: 24px; height: 24px; border-radius: 6px; flex: none; display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text-muted); font-size: .75rem; font-weight: 800;
}
.dropdown-item.is-current { font-weight: 700; }
.dropdown-item.is-current svg { color: var(--brand, var(--accent)); }

.topbar-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

.icon-btn {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent;
    background: none; cursor: pointer; color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.popover {
    position: absolute; top: calc(100% + 8px); right: 0; width: 300px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-pop); padding: .5rem; z-index: 40;
    opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none;
    transition: opacity .14s ease, transform .14s ease; transform-origin: top right;
}
.popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.popover-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .5rem .6rem .3rem; }
.notif-empty { padding: .8rem .6rem 1rem; font-size: .84rem; color: var(--text-muted); }

.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #7c6bff, var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 700; flex-shrink: 0;
}

.dropdown-profile { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem .6rem; }
.dropdown-profile .user-name { font-size: .88rem; font-weight: 600; }
.dropdown-profile .user-email { font-size: .76rem; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: .3rem 0; }

.dropdown-item {
    display: flex; align-items: center; gap: .65rem; width: 100%;
    padding: .55rem .6rem; border-radius: 8px; border: none; background: none;
    font-size: .86rem; font-weight: 500; color: var(--text); cursor: pointer; text-align: left;
    text-decoration: none;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-muted); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-wash); }
.dropdown-item .grow { flex: 1; }
.dropdown-item .chevron { width: 14px !important; height: 14px !important; }
.dropdown-item.is-disabled { cursor: default; color: var(--text-muted); }
.dropdown-item.is-disabled:hover { background: none; }
.soon-tag {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: .15rem .5rem; flex-shrink: 0;
}

.workspace-row { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: .3rem; }
.workspace-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ws-row-label { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.ws-row-name { display: block; font-size: .89rem; font-weight: 700; color: var(--text); margin-top: 1px; }

.switch-track { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); position: relative; flex-shrink: 0; }
.switch-thumb { position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform .18s ease, background .18s ease; }
.switch-thumb.is-dark { transform: translateX(14px); background: var(--accent); }

.body-row { display: flex; flex: 1; min-height: 0; }

.sidebar {
    width: 236px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 1.1rem .9rem; gap: 1rem;
}

.nav-group { position: relative; display: flex; flex-direction: column; gap: .1rem; }
.nav-indicator {
    position: absolute; left: 0; width: 100%; border-radius: 8px; background: var(--brand-wash, var(--accent-wash));
    transition: transform .22s cubic-bezier(.22, 1, .36, 1), height .22s cubic-bezier(.22, 1, .36, 1);
    z-index: 0;
}
.nav-link {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px;
    font-size: .87rem; font-weight: 500; color: var(--text-muted); text-decoration: none;
    transition: color .15s ease;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); font-weight: 600; }

.sidebar-spacer { flex: 1; }
/* Titoli dei gruppi del menu e separatore tra workspace e piattaforma. */
/* Titolo del gruppo: pulsante che apre/chiude le sue voci (footer.php). */
.nav-section {
    display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: .6rem; padding: .3rem .5rem .3rem .75rem;
    border: none; border-radius: 7px; background: none; cursor: pointer; font: inherit; text-align: left;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted);
}
.nav-section:first-of-type { margin-top: 0; }
.nav-section:hover { color: var(--text); background: var(--surface-2); }
.nav-section:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 1px; }
.nav-section-chevron { width: 14px; height: 14px; flex: none; opacity: .7; transition: transform .15s ease; }
.nav-section[aria-expanded="false"] .nav-section-chevron { transform: rotate(-90deg); }
.nav-items { display: flex; flex-direction: column; gap: .1rem; }
.nav-items[hidden] { display: none; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Contatore accanto alla voce (es. richiami da fare ora). */
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem;
    border-radius: 999px; font-size: .7rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
    background: var(--danger); color: var(--accent-text-on);
}
.nav-divider { height: 1px; background: var(--border); margin: .9rem .5rem .1rem; }

.content { flex: 1; min-width: 0; }
.content-inner { max-width: 1080px; margin: 0 auto; }
/* Pagine con molti dati (es. Reportistica): $wideLayout = true prima di includere il layout. */
.content-inner.content-wide { max-width: 1680px; }

@media (max-width: 860px) {
    .body-row { flex-direction: column; }
    .sidebar { width: auto; flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--border); padding: .7rem 1rem; }
    .ws-switch { flex: none; }
    .ws-head { padding: .2rem; }
    .ws-head-logo { height: 32px; }
    .nav-group { flex-direction: row; overflow-x: auto; }
    .nav-link { white-space: nowrap; }
    .nav-section { display: none; }
    .nav-items, .nav-items[hidden] { display: contents; }
    .nav-divider { width: 1px; height: auto; margin: .3rem .4rem; }
    .nav-indicator { display: none; }
    .sidebar-spacer { display: none; }
    .popover { right: -60px; width: 260px; }
}
@media (max-width: 560px) {
    .topbar .brand-word { display: none; }
}

/* ---------- paginazione (.pager, views/layout/pager.php) ---------- */
.pager { display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap; margin-top: 1rem; font-size: .86rem; color: var(--text-muted); }
.pager-top { margin: 0 0 .75rem; }
.pager-size { display: inline-flex; align-items: center; gap: .5rem; margin-right: auto; }
.pager-size .form-input { width: auto; height: 34px; padding: .25rem 1.9rem .25rem .6rem; font-size: .86rem; }
.pager-info strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.pager-nav { display: inline-flex; align-items: center; gap: .3rem; }
.pager-page { padding: 0 .45rem; white-space: nowrap; }
.pager-page strong { color: var(--text); }
.pager-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text);
    text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.pager-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.pager-btn:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
.pager-btn.is-disabled { color: var(--text-muted); opacity: .4; cursor: default; }
.pager-btn.is-disabled:hover { background: var(--surface); border-color: var(--border); }
@media (max-width: 560px) { .pager { justify-content: center; } .pager-size { margin-right: 0; } }

/* ---------- nota di un passaggio nello storico della pratica (.ev-note) ---------- */
.ev-note { margin-top: .35rem; padding: .45rem .65rem; border-radius: 8px; background: var(--surface-2); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.ev-note-label { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-bottom: .1rem; }
/* ultima nota in evidenza in cima alla pratica */
.nota-recente { margin: 0 0 1rem; padding: .7rem .85rem; border-radius: 10px; border: 1px solid var(--border); border-left: 3px solid var(--brand, var(--accent)); background: var(--surface-2); font-size: .88rem; }
.nota-recente-testo { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.nota-recente-meta { font-size: .76rem; color: var(--text-muted); margin-bottom: .25rem; }
/* I textarea non ereditano il carattere della pagina: stessi caratteri degli altri campi. */
textarea.form-input { font-family: inherit; line-height: 1.45; resize: vertical; }

/* ---------- pulsanti a icona nelle righe delle tabelle (.row-actions > .row-btn) ---------- */
.row-actions { display: inline-flex; align-items: center; gap: .25rem; }
.row-actions form { display: contents; }
.row-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-muted);
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.row-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.row-btn:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
.row-btn-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-wash); }
.row-btn.is-disabled { opacity: .35; cursor: not-allowed; }
.row-btn.is-disabled:hover { background: var(--surface); border-color: var(--border); color: var(--text-muted); }
/* .segmented anche come filtro a link (<nav class="segmented"><a class="is-active">…</a>) */
.segmented a { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.segmented a:hover { color: var(--text); }
.segmented a.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20, 24, 34, .12); }
.segmented a:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 1px; }
.segmented-count { font-size: .74rem; font-weight: 700; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: .05rem .45rem; font-variant-numeric: tabular-nums; }
.segmented a.is-active .segmented-count { background: var(--brand-wash, var(--accent-wash)); color: var(--text); }
/* .badge imposta display: senza questa regola un badge con hidden resterebbe visibile. */
.badge[hidden] { display: none; }

/* Intestazione di sezione con azioni a destra (es. export): altezza fissa, cosi' le
   schede di una sezione non si spostano tra una pagina con pulsanti e una senza. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; min-height: 2.5rem; margin-bottom: .5rem; }
.section-head .page-title { margin: 0; }
.section-head-actions { display: flex; gap: .5rem; }
.section-head-actions .btn { padding: .45rem 1rem; font-size: .9rem; }

/* ---------- spiegazione a richiesta: pulsante "?" + popup (views/layout/aiuto.php) ---------- */
.aiuto-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; padding: 0;
    border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text-muted);
    font: 700 .72rem/1 system-ui, sans-serif; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.aiuto-btn:hover { color: var(--brand, var(--accent)); border-color: var(--brand, var(--accent)); background: var(--brand-wash, var(--accent-wash)); }
.aiuto-btn:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
dialog.modal.aiuto-dialog { width: min(460px, calc(100vw - 2rem)); }
.aiuto-body { font-size: .9rem; line-height: 1.55; }
.aiuto-body p + p, .aiuto-body p + ul, .aiuto-body ul + p { margin-top: .6rem; }
.aiuto-body ul { padding-left: 1.2rem; }
.aiuto-body li + li { margin-top: .2rem; }
/* Pannello operatore: lavorazione fuori orario di contatto (regole outbound) */
.contatto-chiuso { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; padding: .55rem .7rem; border-radius: 10px;
                   background: var(--warning-wash, var(--surface-2)); color: var(--text); font-size: .84rem; line-height: 1.4; }
.contatto-chiuso svg { flex: none; margin-top: 1px; color: var(--warning); }
/* Pannello operatore: nessuna pratica da lavorare (stessa forma, tono neutro) */
.coda-vuota { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; padding: .55rem .7rem; border-radius: 10px;
              background: var(--surface-2); color: var(--text-muted); font-size: .84rem; line-height: 1.4; }
.coda-vuota strong { display: block; color: var(--text); font-weight: 600; }
.coda-vuota svg { flex: none; margin-top: 1px; color: var(--text-muted); }
/* Azione in fondo a una scheda (es. Panoramica della lavorazione): riga con icona, testo e freccia */
.card-with-foot { display: flex; flex-direction: column; }
.card-foot { margin-top: auto; padding-top: .85rem; }
.card-foot::before { content: ""; display: block; height: 1px; background: var(--border); margin-bottom: .6rem; }
.card-cta { display: flex; align-items: center; gap: .65rem; margin: 0 -.55rem; padding: .4rem .55rem; border-radius: 10px;
            color: var(--text); font-size: .86rem; font-weight: 600; text-decoration: none; transition: background .15s ease; }
.card-cta-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
                 background: var(--surface-2); color: var(--text-muted); transition: background .15s ease, color .15s ease; }
.card-cta-chev { margin-left: auto; color: var(--text-muted); transition: transform .15s ease, color .15s ease; }
.card-cta:hover { background: var(--surface-2); }
.card-cta:hover .card-cta-icon { background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); }
.card-cta:hover .card-cta-chev { transform: translateX(3px); color: var(--text); }
.card-cta:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .card-cta, .card-cta-icon, .card-cta-chev { transition: none; } }
/* Scheda Distribuzione della lavorazione: ordine della coda (passi numerati) e regole */
.distr-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 900px; }
.distr-card { display: flex; flex-direction: column; padding: 1.25rem 1.4rem; }
.distr-title { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-bottom: 1rem; }
.distr-steps { list-style: none; margin: 0; padding: 0; }
.distr-steps li { position: relative; display: flex; gap: .75rem; padding-bottom: 1.1rem; font-size: .9rem; line-height: 1.4; }
.distr-steps li:last-child { padding-bottom: 0; }
.distr-steps li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--border); }
.distr-step-num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
                  background: var(--surface-2); color: var(--text-muted); font-size: .8rem; font-weight: 800; }
.distr-step-text { display: block; color: var(--text-muted); font-size: .82rem; margin-top: .1rem; }
.distr-steps li.is-current .distr-step-num { background: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); }

/* Tetto ai tentativi WIP (scheda Distribuzione): due modalita' a scelta, in riquadri */
.tetto-opzioni { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tetto-opzione { border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; transition: border-color .15s ease, box-shadow .15s ease; }
.tetto-opzione.is-on { border-color: var(--brand, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--accent)) 22%, transparent); }
.tetto-opzione-head { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; font-size: .9rem; }
.tetto-opzione-head input { margin-top: .2rem; accent-color: var(--brand, var(--accent)); }
.tetto-opzione-text { display: block; color: var(--text-muted); font-size: .8rem; line-height: 1.4; margin-top: .15rem; }
.tetto-opzione-body { display: flex; margin-top: .75rem; padding-left: 1.6rem; }
.tetto-opzione:not(.is-on) .tetto-opzione-body { opacity: .5; }
.tetto-opzioni.is-off .tetto-opzione { opacity: .55; }
.tetto-opzioni.is-off .tetto-opzione-head { cursor: default; }

/* Pannello operatore: ultimo tentativo della pratica (tetto WIP) */
.tetto-avviso { display: flex; gap: .55rem; align-items: flex-start; margin-bottom: 1rem; padding: .65rem .8rem; border-radius: 10px;
                background: color-mix(in srgb, var(--warning) 10%, var(--surface)); border: 1px solid var(--warning); font-size: .86rem; line-height: 1.4; }
.tetto-avviso svg { flex: none; margin-top: 1px; color: var(--warning); }

/* ---------- selettore a scelta multipla (.multipicker, [data-multipicker]): come .picker, con checkbox e gruppi ---------- */
.multipicker .picker-trigger { min-height: 3.1rem; padding: .55rem 1rem; }
.multipicker .picker-value { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-width: 0; }
.multipicker-chip { display: inline-flex; align-items: center; padding: .2rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600;
                    background: color-mix(in srgb, var(--brand, var(--accent)) 16%, var(--surface)); border: 1px solid var(--brand, var(--accent)); color: var(--text); }
.multipicker-more { font-size: .82rem; font-weight: 700; color: var(--text-muted); }
.multipicker-group + .multipicker-group { margin-top: .35rem; padding-top: .35rem; border-top: 1px solid var(--border); }
.multipicker-group-head { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem .25rem; font-size: .72rem; font-weight: 700;
                          text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.multipicker-group-head .badge { min-width: 2.6rem; text-align: center; }
.multipicker-option { position: relative; }
.multipicker-option:hover { background: var(--surface-2); }
.multipicker-option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.multipicker-check { flex: none; width: 1.05rem; height: 1.05rem; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--bg);
                     transition: background .12s ease, border-color .12s ease; }
.multipicker-option input:checked ~ .multipicker-check {
    border-color: var(--brand, var(--accent));
    background: var(--brand, var(--accent)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m2.5 6.2 2.3 2.3 4.7-4.9' fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/80% no-repeat;
}
.multipicker-option input:checked ~ .picker-label { font-weight: 700; }
.multipicker-option input:focus-visible ~ .multipicker-check { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.multipicker-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem .4rem .1rem; margin-top: .35rem; border-top: 1px solid var(--border); }
.multipicker-clear { background: none; border: 0; padding: .3rem .2rem; color: var(--text-muted); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.multipicker-clear:hover { color: var(--text); text-decoration: underline; }
.multipicker-done { padding: .45rem 1.1rem; font-size: .86rem; }
.picker-trigger:disabled { cursor: not-allowed; opacity: .6; }
.picker-trigger:disabled:hover { border-color: var(--border-strong); }
.tetto-opzione-body > .picker { flex: 1; min-width: 0; }

/* Utenti: riquadro "Accesso e sicurezza" della scheda e registro accessi */
.sicurezza-card { max-width: 640px; padding: 1.25rem 1.5rem; }
.sicurezza-dl { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: .55rem 1rem; margin: 0; font-size: .9rem; align-items: baseline; }
.sicurezza-dl dt { color: var(--text-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.sicurezza-dl dd { margin: 0; }
.sicurezza-muted { color: var(--text-muted); font-size: .84rem; }
.sicurezza-azioni { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.sicurezza-link { margin-left: auto; font-size: .86rem; font-weight: 600; color: var(--accent); }
.accessi-table td { text-align: left; }
.accessi-table th { text-align: left; }
.accessi-nome { display: block; font-weight: 600; color: var(--text); text-decoration: none; }
.accessi-nome:hover { text-decoration: underline; }
.accessi-nome.is-ignoto { color: var(--text-muted); font-weight: 500; font-style: italic; }
.accessi-email { display: block; font-size: .8rem; color: var(--text-muted); }
.accessi-ip { font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* Riga di filtri sopra una tabella (Registro accessi e simili) */
.filtri-riga { display: flex; gap: .75rem 1rem; flex-wrap: wrap; align-items: flex-end; }
.filtri-riga .form-group { margin-bottom: 0; }
/* Riquadro filtri (form.card.filtri): tutti i controlli alti 40px, allineati in basso; .filtri-piede = pulsanti */
.filtri { padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.filtri .form-input { height: 40px; padding: .45rem .7rem; font-size: .9rem; border-radius: 10px; background: var(--surface); }
.filtri .dr-trigger, .filtri .choice > span { border-color: var(--border-strong); }
.filtri .choice > span { min-height: 40px; }
.filtri .segmented { min-height: 40px; }
.filtri-cerca { flex: 1 1 220px; }
.filtri-piede { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.filtri-piede .spacer { flex: 1; }
.filtri-piede .btn { padding: .5rem 1rem; font-size: .9rem; }
.filtri-riga > .btn { height: 40px; padding: 0 1.1rem; font-size: .9rem; }
/* Utenti > Account */
.utenti-table td, .utenti-table th { text-align: left; }
.utenti-table td.utenti-azioni { text-align: right; white-space: nowrap; }
/* Tabella stabile: colonne fisse (colgroup) e testi lunghi con i puntini, mai a capo */
.utenti-table { table-layout: fixed; width: 100%; }
.utenti-table th, .utenti-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utenti-table td:has(.utenti-ws) { overflow: visible; }
/* La riga del titolo ha sempre la stessa altezza, con o senza "Azzera filtri" */
.data-card-title.utenti-titolo .utenti-azzera { margin: -.4rem 0; }   /* non allunga la riga */
.utenti-nome { font-weight: 600; color: var(--text); text-decoration: none; }
.utenti-nome:hover { text-decoration: underline; }
.utenti-muted { color: var(--text-muted); }
.utenti-table tr.is-off .utenti-nome { color: var(--text-muted); }
/* Utenti: filtri (ricerca, stato con i numeri, ordinamento) e intestazioni ordinabili */
.utenti-cerca { flex: 1 1 240px; max-width: 360px; }
.seg-num { display: inline-block; font-style: normal; min-width: 1.4em; margin-left: .25rem; padding: 0 .35rem; border-radius: 999px; background: var(--border); color: var(--text-muted);
           font-size: .74rem; font-weight: 700; line-height: 1.45; text-align: center; font-variant-numeric: tabular-nums; }
.segmented input:checked + span .seg-num { background: var(--brand-wash, var(--accent-wash)); color: var(--text); }
.utenti-azzera { font-weight: 500; }
/* Utenti: permesso Admin di sistema (badge nell'elenco, casella nella scheda) */
.utenti-sys { margin-left: .45rem; vertical-align: 1px; }
.utenti-nome.is-secondario { font-weight: 500; }
/* Colonna "WS attivi": numero in un cerchietto, al passaggio i workspace con i profili */
.utenti-ws { position: relative; display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.9rem; padding: 0 .45rem; border-radius: 999px;
             background: var(--brand-wash, var(--accent-wash)); color: var(--text); font-weight: 700; font-size: .88rem; cursor: default; font-variant-numeric: tabular-nums; }
.utenti-ws[tabindex] { cursor: help; }
.utenti-ws[tabindex]:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
.utenti-ws.is-zero { background: var(--surface-2); color: var(--text-muted); }
.utenti-ws-tip { position: fixed; z-index: 1000; display: none; min-width: 220px; max-width: 320px; padding: .55rem .7rem; text-align: left;
                 background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop);
                 font-size: .84rem; font-weight: 500; white-space: normal; }
.utenti-ws-tip.is-visibile { display: grid; gap: .4rem; animation: picker-in .1s ease-out; }
.utenti-ws-riga { display: grid; gap: .05rem; }
.utenti-ws-riga + .utenti-ws-riga { padding-top: .4rem; border-top: 1px solid var(--border); }
.utenti-ws-riga strong { font-weight: 700; }
.utenti-ws-riga span { color: var(--text-muted); }
.check-riga { display: flex; align-items: flex-start; gap: .65rem; margin: .25rem 0 1.1rem; padding: .75rem .85rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.check-riga:hover { border-color: var(--border-strong); }
.check-riga input { flex: none; width: 1.05rem; height: 1.05rem; margin-top: .15rem; accent-color: var(--brand, var(--accent)); cursor: pointer; }
.check-riga input:disabled { cursor: not-allowed; }
.check-riga strong { display: block; font-size: .92rem; }
.check-riga .field-hint { margin-top: .15rem; }
.utenti-sottotitolo { margin-left: .4rem; font-weight: 500; font-size: .84rem; color: var(--text-muted); }
.utenti-table .sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.utenti-table .sort:hover { color: var(--text); }
.utenti-table .sort::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0; transition: opacity .12s ease; }
.utenti-table .sort:hover::after { opacity: .45; }
.utenti-table .sort.is-asc::after  { border-top: 0; border-bottom: 5px solid currentColor; opacity: 1; }
.utenti-table .sort.is-desc::after { opacity: 1; }
.utenti-table .sort.is-asc, .utenti-table .sort.is-desc { color: var(--text); }
/* Distribuzione: giorni di chiusura (elenco e modulo per aggiungerne) */
.chiusure-vuoto { color: var(--text-muted); font-size: .88rem; padding: .2rem 0 .4rem; }
.chiusure-lista { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.chiusure-lista li { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; }
.chiusure-lista li + li { border-top: 1px solid var(--border); }
.chiusure-lista li.is-passata { opacity: .55; }
.chiusure-icona { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); }
.chiusure-testo { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .9rem; }
.chiusure-testo span { color: var(--text-muted); font-size: .82rem; }
.chiusure-form { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.chiusure-form-title { font-size: .86rem; font-weight: 700; margin-bottom: .6rem; }
.chiusure-campi { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(158px, 1fr) minmax(158px, 1fr) auto auto; gap: .75rem 1rem; align-items: end; }
@media (max-width: 1100px) { .chiusure-campi { display: flex; flex-wrap: wrap; } .chiusure-campi .form-group:first-child { flex: 1 1 100%; } }
.chiusure-campi .form-group { margin: 0; }
.chiusure-campi .btn, .chiusure-campi .form-input { height: 2.6rem; }
.chiusure-campi .btn { padding: 0 1.2rem; }
.chiusure-facolt { text-transform: none; font-weight: 500; letter-spacing: 0; font-size: inherit; color: var(--text-muted); }

/* Reportistica: analisi per mese (riga del mese con il "+", giorni sotto) */
.data-card-title.has-azioni { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.mesi-nota { color: var(--text-muted); font-weight: 500; font-size: .84rem; }
.mesi-tutti { background: none; border: 0; padding: .2rem .1rem; font: inherit; font-size: .84rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.mesi-tutti:hover { text-decoration: underline; }
.mese-riga td { font-weight: 700; cursor: pointer; }
.mese-riga:hover td { background: var(--accent-wash); }
.mese-cella { display: flex; align-items: center; gap: .55rem; }
.mese-toggle { flex: none; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border-radius: 6px; cursor: pointer;
               border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); transition: background .15s ease, border-color .15s ease; }
.mese-toggle:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; }
.mese-toggle .mese-plus-v { transition: opacity .15s ease; }
.mese-gruppo.is-open .mese-toggle { background: var(--brand, var(--accent)); border-color: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on)); }
.mese-gruppo.is-open .mese-plus-v { opacity: 0; }
.mese-giorni { font-weight: 500; font-size: .78rem; color: var(--text-muted); }
.mese-giorno td { font-size: .84rem; background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.mese-giorno td:first-child { padding-left: 2.6rem; }
.mese-gruppo.is-open .mese-riga td { border-bottom: 1px solid var(--border-strong); }

/* Tabelle ordinabili ([data-ordinabile]): intestazioni cliccabili con la freccia del verso */
.th-ordina { display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: none; cursor: pointer;
             font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; text-align: inherit; }
.th-ordina:hover { color: var(--text); }
.th-ordina:focus-visible { outline: 2px solid var(--brand, var(--accent)); outline-offset: 2px; border-radius: 3px; }
.th-freccia { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0; transition: opacity .12s ease, transform .12s ease; }
.th-ordina:hover .th-freccia { opacity: .45; }
th[aria-sort="descending"] .th-ordina, th[aria-sort="ascending"] .th-ordina { color: var(--text); }
th[aria-sort="descending"] .th-freccia { opacity: 1; }
th[aria-sort="ascending"] .th-freccia { opacity: 1; transform: rotate(180deg); }

/* ---------- Profili (views/profiles/index.php) ---------- */
.prof-nome { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.prof-nome:hover { text-decoration: underline; }
.utenti-table tr.is-off .prof-nome { color: var(--text-muted); }
.prof-ws { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; }
.prof-ws-ico { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); font-size: .75rem; font-weight: 800; }

/* Finestra Nuovo / Modifica profilo: campi in alto, tabella dei permessi che scorre */
dialog.modal.modal-profilo { width: min(940px, calc(100vw - 2rem)); max-height: min(92vh, 980px); display: none; flex-direction: column; overflow: hidden; }
dialog.modal.modal-profilo[open] { display: flex; }
.modal-profilo form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal-profilo .modal-body { flex: 1; min-height: 0; }
.prof-campi { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.perm-testa { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .35rem 0 .35rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.perm-titolo { font-size: .98rem; font-weight: 750; }
.perm-copia { flex: none; width: 230px; }
/* Tabella: Sezione | Livello | Vista, colonne allineate; le righe senza accesso mostrano solo "Nessun accesso" */
.perm-tabella { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: .6rem; }
.perm-intesta, .perm-riga { display: grid; grid-template-columns: minmax(0, 1fr) 176px 150px; gap: 0 1rem; padding-left: 1rem; padding-right: 1rem; }
.perm-intesta { padding-top: .55rem; padding-bottom: .55rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
                font-size: .7rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); }
.perm-gruppo-titolo { padding: .9rem 1rem .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--brand, var(--accent)); }
.perm-riga { align-items: center; padding-top: .7rem; padding-bottom: .75rem; transition: background-color .15s; }
.perm-riga + .perm-riga, .perm-riga + .perm-gruppo-titolo { border-top: 1px solid var(--border); }
.perm-riga:not(.is-on) .perm-hint { display: none; }
.perm-riga:hover { background: var(--surface-2); }
.perm-info { min-width: 0; }
.perm-sez { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; max-width: 100%; cursor: pointer; }
.perm-sez input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.perm-check { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface);
              transition: background-color .15s, border-color .15s; }
.perm-sez input:checked + .perm-check { background: var(--brand, var(--accent)); border-color: var(--brand, var(--accent)); }
.perm-sez input:checked + .perm-check::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--brand-text-on, var(--accent-text-on)); border-bottom: 2px solid var(--brand-text-on, var(--accent-text-on)); transform: translateY(-1px) rotate(-45deg); }
.perm-sez input:focus-visible + .perm-check { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.perm-nome { font-size: .92rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.perm-riga:not(.is-on) .perm-nome { color: var(--text-muted); font-weight: 600; }
.perm-hint { display: flex; flex-direction: column; gap: .15rem; margin-top: .3rem; padding-left: calc(18px + .6rem); font-size: .78rem; line-height: 1.4; color: var(--text-muted); }
.perm-hint b { color: var(--text); font-weight: 650; }
.perm-scelta .tendina-btn { padding-top: .42rem; padding-bottom: .42rem; font-size: .86rem; }
.perm-novista { display: block; padding: .42rem .1rem; font-size: .82rem; color: var(--text-muted); cursor: help; }
.perm-off { grid-column: 2 / 4; font-size: .84rem; color: var(--text-muted); }
.perm-riga.is-on .perm-off, .perm-riga:not(.is-on) .perm-scelta { display: none; }
.perm-vuoto { padding: 1rem 1.1rem; border-radius: 12px; background: var(--surface-2); color: var(--text-muted); font-size: .88rem; line-height: 1.5; }
.perm-conta { font-size: .84rem; color: var(--text-muted); }
@media (max-width: 760px) {
    .prof-campi { grid-template-columns: 1fr; }
    .perm-testa { flex-direction: column; align-items: stretch; }
    .perm-copia { width: auto; }
    .perm-intesta { display: none; }
    .perm-riga { grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
    .perm-info, .perm-off { grid-column: 1 / -1; }
    .perm-off { padding-left: calc(18px + .6rem); }
}
/* Livello del profilo nella sezione (uzuki.js, body data-livello): azioni spente e avviso di sola lettura */
.is-livello-off, .btn.is-livello-off, .row-btn.is-livello-off { opacity: .42; cursor: not-allowed; box-shadow: none; }
.btn.is-livello-off:hover, .row-btn.is-livello-off:hover { transform: none; filter: none; }
.livello-avviso { display: flex; align-items: center; gap: .55rem; margin: 1.5rem 2rem -.75rem; padding: .55rem .85rem; border-radius: 10px;
                  background: var(--surface-2); color: var(--text-muted); font-size: .84rem; line-height: 1.4; }
.livello-avviso svg { flex: none; color: var(--accent); }
.livello-avviso strong { color: var(--text); font-weight: 650; }
.livello-avviso.is-attenzione { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); color: var(--text); }
.livello-avviso.is-attenzione svg { color: var(--warning); }
.livello-avviso a { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* Azioni massive su una tabella (Anagrafiche, Utenti): colonna di spunta, righe scelte e barra
   flottante in fondo allo schermo, centrata sui contenuti. Non occupa spazio: la tabella non si sposta. */
th.sel, td.sel { width: 1%; padding-right: 0; }
.sel input { width: 16px; height: 16px; margin: 2px 0 0; cursor: pointer; accent-color: var(--brand, var(--accent)); }
tr.is-selected td { background: var(--brand-wash, var(--accent-wash)); }
.bulk-bar { position: fixed; z-index: 40; bottom: 1.25rem; left: calc(236px + (100vw - 236px) / 2); transform: translateX(-50%);
            width: min(980px, calc(100vw - 236px - 3rem)); display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; padding: .65rem .9rem;
            border: 1px solid var(--brand, var(--accent)); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-pop); font-size: .9rem;
            animation: bulk-in .18s ease-out; }
@keyframes bulk-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .bulk-bar { animation: none; } }
@media (max-width: 860px) { .bulk-bar { left: 50%; width: calc(100vw - 2rem); } }   /* senza sidebar laterale */
.bulk-bar[hidden] { display: none; }
/* spazio in fondo mentre la barra e' aperta, perche' non copra le ultime righe */
.page.has-bulk { padding-bottom: 6rem; }
.bulk-bar strong { font-variant-numeric: tabular-nums; }
.bulk-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.bulk-bar .spacer { flex: 1; }
.bulk-bar .btn { padding: .45rem .95rem; font-size: .88rem; }
/* Utenti: finestra "Assegna workspace e profilo" */
.assegna-intro { margin: 0 0 1rem; font-size: .9rem; line-height: 1.5; color: var(--text-muted); }
.assegna-intro strong { color: var(--text); }
.assegna-riepilogo { margin: .25rem 0 0; padding: .7rem .9rem .7rem 2rem; border-radius: 10px; background: var(--surface-2); font-size: .86rem; line-height: 1.6; }
.assegna-riepilogo:empty { display: none; }
.assegna-riepilogo .is-muto { color: var(--text-muted); }
.assegna-riepilogo .is-avviso { color: var(--warning); list-style: none; margin-left: -1.1rem; }

/* Azione di riga non disponibile (es. disattivare il proprio account): visibile ma spenta, il motivo al passaggio del mouse */
.row-btn.is-spento { opacity: .35; cursor: not-allowed; }

/* Verifica in due passaggi: codice al login (views/auth/verifica.php) e attivazione (views/sistema/verifica.php) */
.mfa-codice { font-size: 1.35rem; letter-spacing: .45em; text-align: center; font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mfa-codice.is-recupero { letter-spacing: .12em; font-size: 1.1rem; }
.mfa-codice::placeholder { color: var(--border-strong); }
.mfa-altri { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin-top: 1.1rem; }
.link-btn { padding: .2rem .3rem; border: 0; background: none; color: var(--accent); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; border-radius: 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.is-muted { color: var(--text-muted); font-weight: 500; }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-card { max-width: 640px; padding: 1.75rem 2rem; }   /* Impostazioni account: stessa misura in ogni scheda */
.mfa-card-sola { width: 100%; max-width: 560px; }
.mfa-testo { margin: .2rem 0 0; font-size: .86rem; line-height: 1.5; color: var(--text-muted); }
.mfa-testo strong { color: var(--text); }
.mfa-vuoto { padding: 1rem 1.1rem; border-radius: 12px; background: var(--surface-2); color: var(--text-muted); font-size: .88rem; line-height: 1.5; }
.mfa-passi { list-style: none; counter-reset: passo; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.35rem; }
.mfa-passi > li { counter-increment: passo; position: relative; padding-left: 2.4rem; }
.mfa-passi > li::before { content: counter(passo); position: absolute; left: 0; top: -.05rem; display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 50%;
                          background: var(--accent-wash); color: var(--accent); font-size: .82rem; font-weight: 750; }
.mfa-passo-titolo { font-size: .95rem; font-weight: 700; }
.mfa-qr-riga { display: flex; align-items: center; gap: 1.25rem; margin-top: .7rem; }
.mfa-qr { flex: none; width: 168px; height: 168px; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }   /* sfondo bianco anche col tema scuro: le app leggono il nero su bianco */
.mfa-qr svg { display: block; width: 100%; height: 100%; }
.mfa-chiave { display: block; margin: .45rem 0; padding: .5rem .7rem; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: .92rem; letter-spacing: .06em; word-break: break-all; user-select: all; }
.mfa-conferma { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .7rem; }
.mfa-conferma .mfa-codice { width: 11rem; }
.mfa-titolo { display: flex; align-items: center; gap: .55rem; font-size: 1.02rem; font-weight: 750; }
.mfa-spunta { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.mfa-codici { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem .75rem; margin: 1rem 0; padding: .9rem 1rem; border-radius: 12px; background: var(--surface-2); list-style: none; }
.mfa-codici code { font-size: .98rem; letter-spacing: .08em; color: var(--text); }
.mfa-azioni { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.mfa-azioni .btn-primary { margin-left: auto; }
.mfa-righe { display: flex; flex-direction: column; }
.mfa-riga { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; align-items: center; padding: .8rem 0; font-size: .9rem; }
.mfa-riga + .mfa-riga { border-top: 1px solid var(--border); }
.mfa-etichetta { color: var(--text-muted); font-size: .84rem; }
.mfa-nota { margin-left: .55rem; color: var(--text-muted); font-size: .82rem; }
.mfa-poco { color: var(--warning); font-weight: 600; }
.mfa-riga-azione { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mfa-piccolo { padding: .35rem .75rem; font-size: .82rem; }
.mfa-pericolo:hover { color: var(--danger); border-color: var(--danger); }
.mfa-gestisci { margin-top: 1.1rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
@media (max-width: 560px) {
    .mfa-qr-riga { flex-direction: column; align-items: flex-start; }
    .mfa-riga { grid-template-columns: 1fr; gap: .25rem; }
    .mfa-codici { grid-template-columns: 1fr; }
}
.mfa-nota.is-sotto { display: block; margin: .15rem 0 0; }
.mfa-riga:first-child { padding-top: 0; }
.mfa-piccolo { white-space: nowrap; }
.mfa-conferma .form-input, .mfa-conferma .btn { height: 2.75rem; }
.mfa-conferma .btn { display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }

/* Requisiti della password (views/sistema/password.php): si spuntano mentre si scrive */
.pw-requisiti { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem 1rem; margin: .55rem 0 .2rem; padding: 0; list-style: none; font-size: .8rem; color: var(--text-muted); }
.pw-requisiti li { display: flex; align-items: center; gap: .45rem; transition: color .15s; }
.pw-requisiti li::before { content: ""; flex: none; width: .95rem; height: .95rem; border-radius: 50%; border: 1.5px solid var(--border-strong); transition: background-color .15s, border-color .15s; }
.pw-requisiti li.is-ok { color: var(--text); }
.pw-requisiti li.is-ok::before { border-color: var(--success); background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 10.5 3.2 3.2L15 7'/%3E%3C/svg%3E") center / 75% no-repeat; }
@media (max-width: 480px) { .pw-requisiti { grid-template-columns: 1fr; } }

/* Impostazioni account > Panoramica (views/sistema/account.php): sola lettura */
.acc-testa { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.2rem; }
.acc-avatar { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--brand-wash, var(--accent-wash)); color: var(--brand, var(--accent)); font-size: 1.3rem; font-weight: 800; }
.acc-nome { font-size: 1.1rem; font-weight: 750; }
.acc-ruolo { margin-top: .3rem; }
.acc-dati { display: grid; grid-template-columns: 11rem 1fr; margin: 0; font-size: .9rem; }
.acc-dati dt, .acc-dati dd { margin: 0; padding: .7rem 0; border-top: 1px solid var(--border); }
.acc-dati dt { color: var(--text-muted); font-size: .84rem; }
.acc-dati dd { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .5rem; }
.acc-dati code { font-size: .9rem; color: var(--text); }
.acc-muted { color: var(--text-muted); font-size: .84rem; }
.acc-link { margin-left: auto; color: var(--accent); font-size: .84rem; font-weight: 600; text-decoration: none; }
.acc-link:hover { text-decoration: underline; }
.acc-sezione { display: flex; align-items: center; gap: .45rem; margin: 1.6rem 0 .6rem; font-size: .72rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); }
.acc-conta { padding: .05rem .45rem; border-radius: 999px; background: var(--surface-2); font-size: .72rem; }
.acc-ws { display: flex; flex-direction: column; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.acc-ws li { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; }
.acc-ws-ico { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #fff; font-size: .8rem; font-weight: 800; }
.acc-ws-nome { font-weight: 650; font-size: .92rem; }
.acc-ws-profilo { margin-left: auto; display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.acc-vuoto { padding: .8rem .9rem; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text-muted); font-size: .88rem; }
@media (max-width: 560px) {
    .acc-dati { grid-template-columns: 1fr; }
    .acc-dati dd { border-top: 0; padding-top: 0; }
}
.acc-dati dd:has(.acc-link) { flex-wrap: nowrap; }
.acc-val { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; }
.acc-link { flex: none; }

/* Impostazioni account > Accessi e sicurezza (views/sistema/accessi.php) */
.acc-dati-prima > dt:first-of-type, .acc-dati-prima > dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.acc-dati-prima > dd:last-of-type, .acc-dati-prima > dt:last-of-type { padding-bottom: 0; }
.acc-storico { margin-top: 1.25rem; }
.acc-storico .data-card-title .acc-muted { font-weight: 500; margin-left: .4rem; }
.acc-quando { white-space: nowrap; font-variant-numeric: tabular-nums; }
.acc-disp { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.acc-disp svg { flex: none; color: var(--text-muted); }
.acc-adesso { display: block; margin-top: .2rem; font-size: .74rem; color: var(--accent); font-weight: 600; }
.accessi-table tr.is-attuale td { background: var(--brand-wash, var(--accent-wash)); }
.account-card.acc-larga { max-width: none; }

/* Workspace (views/workspaces/index.php): logo o iniziale, slug, numeri che portano a Utenti e Profili filtrati */
.ws-nome-link { text-decoration: none; min-width: 0; }
.ws-nome-link .utenti-nome { overflow: hidden; text-overflow: ellipsis; }
.ws-nome-link:hover .utenti-nome { text-decoration: underline; }
.prof-ws-ico.ws-logo { background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.prof-ws-ico.ws-logo img { width: 100%; height: 100%; object-fit: contain; }
.ws-slug { font-size: .84rem; color: var(--text-muted); }
.ws-tipo { font-size: .88rem; }
a.utenti-ws { text-decoration: none; cursor: pointer; transition: box-shadow .12s ease; }
a.utenti-ws:hover { box-shadow: 0 0 0 2px var(--brand-wash, var(--accent-wash)); }

/* Campi file (uzuki.js): zona "Trascina qui o scegli dal computer" al posto del pulsante del browser */
.file-scelta { position: relative; display: flex; align-items: center; gap: .85rem; width: 100%; padding: .9rem 1.1rem; border: 1.5px dashed var(--border-strong); border-radius: 12px;
               background: var(--surface); cursor: pointer; transition: border-color .12s ease, background-color .12s ease; }
.file-scelta:hover, .file-scelta.is-sopra { border-color: var(--brand, var(--accent)); background: var(--brand-wash, var(--accent-wash)); }
.file-scelta:focus-within { border-color: var(--brand, var(--accent)); box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.file-scelta.has-file { border-style: solid; }
.file-scelta.is-invalida { border-color: var(--danger); }
.file-scelta-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-scelta-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2); color: var(--brand, var(--accent)); }
.file-scelta.has-file .file-scelta-ico { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.file-scelta-testo { display: flex; flex-direction: column; gap: .15rem; min-width: 0; font-size: .9rem; }
.file-scelta-testo strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-scelta-testo u { color: var(--brand, var(--accent)); text-decoration: none; }
.file-scelta-info { font-size: .8rem; color: var(--text-muted); }
/* Riquadro con l'icona del workspace (WorkspaceProvider::badge): l'immagine riempie il quadrato */
.ha-icona { background: var(--surface) !important; padding: 0 !important; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.ha-icona img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- tessere selezionabili (.tessera: checkbox nascosta + casella disegnata, nome, note) e barra di salvataggio (.salva-barra) ---------- */
.tessere { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tessera { position: relative; display: flex; gap: .65rem; align-items: flex-start; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px;
           background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.tessera:hover { border-color: var(--border-strong); }
.tessera input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tessera-box { flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: .1rem; border-radius: 5px;
               border: 1.5px solid var(--border-strong); color: transparent; transition: background .15s, border-color .15s; }
.tessera-nome { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.tessera-note { display: flex; flex-direction: column; gap: .05rem; margin-top: .2rem; font-size: .75rem; line-height: 1.35; color: var(--text-muted); }
.tessera-note .is-avviso { color: var(--warning); }
.tessera:has(input:checked) { border-color: var(--brand, var(--accent)); background: var(--brand-wash, var(--accent-wash)); }
.tessera input:checked + .tessera-box { background: var(--brand, var(--accent)); border-color: var(--brand, var(--accent)); color: var(--brand-text-on, var(--accent-text-on, #fff)); }
.tessera input:focus-visible + .tessera-box { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
.tessera.is-bloccata { cursor: not-allowed; }
.tessera.is-bloccata .tessera-box { opacity: .75; }
.tessera-lucchetto { display: none; margin-left: auto; color: var(--text-muted); flex: none; }
.tessera.is-bloccata .tessera-lucchetto { display: block; }
.tessera-note:not(:has(> span:not([hidden]))) { display: none; }
.tessera.is-spento .tessera-nome { color: var(--text-muted); }

/* barra di salvataggio: resta in vista in fondo allo schermo */
.salva-barra { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
               padding: .8rem 1.25rem; margin-top: -1px; border-top: 1px solid var(--border); background: var(--surface); }
.salva-barra .salva-info { font-size: .88rem; color: var(--text-muted); }
.salva-barra .salva-info strong { color: var(--text); }
.salva-barra .salva-modificato { font-size: .82rem; font-weight: 600; color: var(--warning); }
.salva-barra .spacer { flex: 1; }

/* ---------- interruttore (.interruttore: checkbox a levetta, per i flag in tabella) ---------- */
.interruttore { position: relative; display: inline-flex; flex: none; width: 36px; height: 20px; vertical-align: middle; }
.interruttore input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.interruttore span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.interruttore span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
                            box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.interruttore input:checked + span { background: var(--brand, var(--accent)); }
.interruttore input:checked + span::after { transform: translateX(16px); }
.interruttore input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-wash, var(--accent-wash)); }
@media (prefers-reduced-motion: reduce) { .interruttore span, .interruttore span::after { transition: none; } }
