/* =============================================
   its-shell.css
   Blocchi comuni alle pagine del design system:
   shell full-height, sidebar con sezioni, area
   principale, card, empty state, drawer slide-in.

   Estratti da AnagraficaDettaglio / LiveChat / Chat2Bot,
   dove erano ripetuti tre volte con prefissi diversi
   (--ad-*, --lc2-*, --bot2-*). Le pagine nuove usano
   queste classi e mettono nel proprio CSS scoped solo
   ciò che è davvero loro.

   Colori e misure vengono da its-variables.css.
   ============================================= */

/* =============================================
   SHELL
   ============================================= */

.its-shell {
    display: flex;
    height: var(--its-shell-h);
    overflow: hidden;
    background: var(--its-bg);
    font-family: var(--its-font);
    color: var(--its-text);
}

/* Accento della pagina: le pagine amministrative aggiungono
   .its-shell--admin, le operative non aggiungono nulla. */
.its-shell {
    --its-page-accent: var(--its-accent);
    --its-page-accent-light: var(--its-accent-light);
}

.its-shell--admin {
    --its-page-accent: var(--its-admin);
    --its-page-accent-light: var(--its-admin-light);
}

/* =============================================
   SIDEBAR
   ============================================= */

.its-sidebar {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: var(--its-surface);
    border-right: 1px solid var(--its-border);
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.its-sidebar--collapsed {
    width: 64px !important;
    min-width: 64px !important;
}

/* Compressa resta solo la colonna delle icone: tutto ciò che ha bisogno di
   larghezza sparisce. Stava scritto tre volte nei CSS scoped delle schede
   (cliente, azienda, utente) con tre prefissi diversi. */
.its-sidebar--collapsed .its-sidebar__header,
.its-sidebar--collapsed .its-sidebar__title,
.its-sidebar--collapsed .its-sidebar__subtitle,
.its-sidebar--collapsed .its-section-item__label,
.its-sidebar--collapsed .its-section-item__meta,
.its-sidebar--collapsed .its-section-item__count,
.its-sidebar--collapsed .its-snapshot {
    display: none;
}

.its-sidebar--collapsed .its-section-item {
    justify-content: center;
    padding: 9px;
}

.its-sidebar__header {
    height: 64px;
    padding: 0 var(--its-space-3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--its-space-1);
    border-bottom: 1px solid var(--its-border);
    flex-shrink: 0;
}

.its-sidebar__title {
    font-size: var(--its-fs-label);
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--its-text-muted);
}

.its-sidebar__subtitle {
    font-size: var(--its-fs-base);
    font-weight: 600;
    color: var(--its-text);
    line-height: 1.2;
    word-break: break-word;
}

.its-sidebar__subtitle--placeholder {
    color: var(--its-text-dim);
    font-style: italic;
    font-weight: 500;
}

/* ── Elenco di sezioni o di voci ── */

.its-section-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--its-space-2) 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.its-section-list::-webkit-scrollbar { width: 4px; }
.its-section-list::-webkit-scrollbar-thumb { background: var(--its-border); border-radius: var(--its-radius-sm); }

.its-section-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--its-radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
    user-select: none;
}

.its-section-item:hover {
    background: var(--its-surface2);
}

.its-section-item--active {
    background: var(--its-page-accent-light);
    color: var(--its-page-accent);
}

/* Barretta sul bordo sinistro: con la sidebar compressa è l'unico segno che
   resta della sezione aperta, perché etichetta e conteggio spariscono. */
.its-section-item--active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--its-page-accent);
    border-radius: 0 3px 3px 0;
}

/* Sezione che esiste ma non è ancora raggiungibile (per esempio in creazione,
   finché l'entità non è salvata). */
.its-section-item--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.its-section-item__label {
    flex: 1;
    min-width: 0;
    font-size: var(--its-fs-base);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.its-section-item--active .its-section-item__label {
    font-weight: 600;
}

.its-section-item__meta {
    font-size: var(--its-fs-caption);
    color: var(--its-text-muted);
    flex-shrink: 0;
}

/* Conteggio in pastiglia: quando il numero è il dato della sezione (note,
   documenti, contatti) e non un'informazione di contorno come __meta. */
.its-section-item__count {
    font-size: var(--its-fs-caption);
    font-weight: 600;
    background: var(--its-surface2);
    color: var(--its-text-dim);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.its-section-item--active .its-section-item__count {
    background: var(--its-page-accent);
    color: #fff;
}

/* =============================================
   AREA PRINCIPALE
   ============================================= */

.its-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.its-main__header {
    height: 64px;
    display: flex;
    align-items: center;
    gap: var(--its-space-3);
    padding: 0 var(--its-space-5);
    background: var(--its-surface);
    border-bottom: 1px solid var(--its-border);
    flex-shrink: 0;
}

/* Il titolo si prende quello che gli serve, non tutto lo spazio: così un
   campo di ricerca elastico nelle azioni può davvero allargarsi. */
.its-main__header-title {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.its-main__header-title h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--its-text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.its-main__header-title small {
    font-size: var(--its-fs-caption);
    font-family: var(--its-font-mono);
    color: var(--its-text-muted);
}

.its-main__header-actions {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--its-space-2);
    min-width: 0;
}

.its-main__body {
    flex: 1;
    overflow-y: auto;
    padding: var(--its-space-5);
    background: var(--its-bg);
    max-width: 100%;
}

.its-main__body::-webkit-scrollbar { width: 8px; }
.its-main__body::-webkit-scrollbar-thumb { background: var(--its-border); border-radius: var(--its-radius-sm); }

/* =============================================
   CARD
   ============================================= */

.its-card {
    background: var(--its-surface);
    border: 1px solid var(--its-border);
    border-radius: var(--its-radius-lg);
    padding: 18px var(--its-space-5);
    margin-bottom: var(--its-space-4);
}

.its-card__title {
    font-size: var(--its-fs-caption);
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--its-text-muted);
    margin: 0 0 var(--its-space-3);
    display: flex;
    align-items: center;
    gap: var(--its-space-2);
}

.its-card__title-divider {
    flex: 1;
    height: 1px;
    background: var(--its-border);
}

/* Icona-azione in fondo al titolo (aggiungi, apri, aiuto). */
.its-card__title-action {
    color: var(--its-text-muted);
    transition: color 120ms ease;
}

.its-card__title-action:hover {
    color: var(--its-page-accent);
}

/* =============================================
   BADGE DI STATO
   ============================================= */

.its-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--its-radius-pill);
    font-size: var(--its-fs-caption);
    font-weight: 600;
    background: var(--its-surface2);
    color: var(--its-text-dim);
    white-space: nowrap;
}

.its-badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.its-badge--on { background: var(--its-accent-light); color: #128a45; }
.its-badge--warn { background: var(--its-warning-bg); color: var(--its-warning-text); }
.its-badge--off { background: var(--its-surface2); color: var(--its-text-muted); }
.its-badge--danger { background: #fdecea; color: #b3261e; }
.its-badge--info { background: var(--its-admin-light); color: var(--its-admin); }

/* =============================================
   BARRE DI FILTRO E CAMPI

   I componenti MudBlazor non si lasciano misurare dall'esterno come un
   elemento qualunque: MudSelect avvolge il campo in un div.mud-select in più,
   e la classe che gli si passa con Class="" finisce su un figlio. La larghezza
   scritta lì veste il contenuto mentre il contenitore continua a crescere per
   conto suo (flex: 1 1 auto), e nella riga si aprono buchi.

   Qui la misura si dà a un contenitore nostro — .its-campo — che poi impone la
   larghezza a qualunque cosa Mud gli metta dentro. Vale per select, campi di
   testo e selettori di data allo stesso modo, oggi e dopo un aggiornamento
   della libreria.

   Questo file NON è scoped: le regole arrivano al markup dei componenti senza
   bisogno di ::deep.
   ============================================= */

.its-filtri {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--its-space-2);
    margin-bottom: var(--its-space-3);
}

.its-filtri__label {
    font-size: var(--its-fs-label);
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--its-text-muted);
    margin-right: var(--its-space-1);
}

/* Separa gruppi di filtri diversi (scorciatoie / selezioni) senza spingerli
   ai due estremi della riga: un filo, non un vuoto. */
.its-filtri__divisore {
    width: 1px;
    align-self: stretch;
    min-height: 24px;
    background: var(--its-border);
    margin: 0 var(--its-space-1);
}

/* Contenitore di un campo: è lui a portare la misura. */
.its-campo {
    flex: 0 0 auto;
    min-width: 0;
}

.its-campo > .mud-select,
.its-campo > .mud-input-control,
.its-campo > .mud-picker,
.its-campo > .mud-autocomplete {
    width: 100%;
    margin-top: 0;
}

/* Taglie: poche e riconoscibili, così due pagine che mostrano la stessa cosa
   la mostrano larga uguale. */
.its-campo--xs { width: 130px; }
.its-campo--sm { width: 170px; }
.its-campo--md { width: 220px; }
.its-campo--lg { width: 280px; }
.its-campo--xl { width: 360px; }

/* Un campo che deve prendersi lo spazio avanzato invece di una misura fissa.
   Il tetto serve solo sugli schermi molto larghi, dove una ricerca di 900px
   non aiuta nessuno. */
.its-campo--elastico {
    flex: 1 1 220px;
    width: auto;
    max-width: 560px;
}

/* Stessa regola nella testata, dove stanno ricerca e azioni. */
.its-main__header-actions > .mud-select,
.its-main__header-actions > .mud-input-control,
.its-main__header-actions > .mud-picker,
.its-main__header-actions > .mud-autocomplete {
    flex: 0 0 auto;
    margin-top: 0;
}

/* =============================================
   EMPTY STATE
   ============================================= */

.its-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--its-space-2);
    padding: 40px var(--its-space-5);
    color: var(--its-text-muted);
    text-align: center;
    background: var(--its-surface);
    border: 1px dashed var(--its-border);
    border-radius: var(--its-radius-lg);
}

.its-empty__icon {
    font-size: 36px;
    opacity: 0.5;
}

.its-empty__text {
    font-size: var(--its-fs-base);
    font-weight: 500;
}

/* =============================================
   DRAWER destro (slide-in)
   ============================================= */

.its-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: var(--its-overlay);
    backdrop-filter: blur(2px);
    z-index: 1200;
    animation: its-drawer-fade 0.18s ease;
}

.its-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 520px;
    max-width: 100vw;
    background: var(--its-surface);
    border-left: 1px solid var(--its-border);
    box-shadow: -12px 0 36px rgba(0, 0, 0, 0.22);
    z-index: 1201;
    display: flex;
    flex-direction: column;
    animation: its-drawer-slide 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-family: var(--its-font);
}

/* Drawer largo: serve a chi dentro ci mette una tabella da scegliere, non un form.
   ⚠️ Modificatore e non larghezza nuova per tutti: il drawer stretto è quello giusto
   per i form, e allargarlo ovunque farebbe sparire mezza pagina dietro. */
.its-drawer--largo {
    width: 900px;
    max-width: 96vw;
}

@keyframes its-drawer-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes its-drawer-slide {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.its-drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--its-space-4);
    padding: 18px 22px var(--its-space-3);
    border-bottom: 1px solid var(--its-border);
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--its-surface) 0%, #f8faff 100%);
}

.its-drawer__title-wrap { flex: 1; min-width: 0; }

.its-drawer__title {
    font-size: var(--its-fs-lg);
    font-weight: 700;
    color: var(--its-text);
    margin: 0;
    letter-spacing: -0.2px;
}

.its-drawer__subtitle {
    font-size: var(--its-fs-sm);
    color: var(--its-text-muted);
    margin-top: 3px;
    line-height: 1.4;
}

.its-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: var(--its-space-5) 22px;
    background: var(--its-bg);
}

.its-drawer__body::-webkit-scrollbar { width: 6px; }
.its-drawer__body::-webkit-scrollbar-thumb { background: var(--its-border); border-radius: var(--its-radius-sm); }

.its-drawer__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--its-space-2);
    padding: var(--its-space-3) 22px;
    border-top: 1px solid var(--its-border);
    background: var(--its-surface);
    flex-shrink: 0;
}

.its-drawer__section {
    background: var(--its-surface);
    border: 1px solid var(--its-border);
    border-radius: 10px;
    padding: var(--its-space-4);
    margin-bottom: var(--its-space-3);
}

.its-drawer__section-title {
    font-size: var(--its-fs-label);
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--its-text-muted);
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* =============================================
   GRIGLIA a 12 colonne
   ============================================= */

.its-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--its-space-3);
}

/* Tutte e dodici, non solo quelle servite finora: una misura che manca finisce
   sempre in una classe scoped di pagina, che è come non averla. */
.its-col-1 { grid-column: span 1; }
.its-col-2 { grid-column: span 2; }
.its-col-3 { grid-column: span 3; }
.its-col-4 { grid-column: span 4; }
.its-col-5 { grid-column: span 5; }
.its-col-6 { grid-column: span 6; }
.its-col-7 { grid-column: span 7; }
.its-col-8 { grid-column: span 8; }
.its-col-9 { grid-column: span 9; }
.its-col-10 { grid-column: span 10; }
.its-col-11 { grid-column: span 11; }
.its-col-12 { grid-column: span 12; }

@media (max-width: 900px) {
    .its-col-1, .its-col-2, .its-col-3, .its-col-4, .its-col-5 { grid-column: span 6; }
    .its-col-7, .its-col-8, .its-col-9, .its-col-10, .its-col-11 { grid-column: span 12; }
}

/* Dentro un drawer la griglia sta in 520px, non nella pagina intera: un terzo di
   quello spazio non regge un campo con la sua etichetta ("Numero WhatsApp dedicato"
   andava a capo dentro il bordo). Le colonne strette diventano metà, le larghe
   intere — le media query non bastano, guardano la finestra e non il contenitore. */
.its-drawer .its-col-1,
.its-drawer .its-col-2,
.its-drawer .its-col-3,
.its-drawer .its-col-4,
.its-drawer .its-col-5 { grid-column: span 6; }
.its-drawer .its-col-7,
.its-drawer .its-col-8,
.its-drawer .its-col-9,
.its-drawer .its-col-10,
.its-drawer .its-col-11 { grid-column: span 12; }

@media (max-width: 720px) {
    .its-col-1, .its-col-2, .its-col-3, .its-col-4, .its-col-5, .its-col-6,
    .its-col-7, .its-col-8, .its-col-9, .its-col-10, .its-col-11 { grid-column: span 12; }
}

/* =============================================
   DETTAGLIO ENTITÀ — blocchi delle pagine "una
   entità, tante sezioni" (cliente, azienda, …).
   Nati scoped in AnagraficaDettaglio.razor.css e
   promossi qui quando è servito riusarli: lo
   scoped tiene solo ciò che è di quella pagina.
   ============================================= */

/* ── Snapshot: riquadro di stato in fondo alla sidebar ── */

.its-snapshot {
    padding: 12px 14px;
    border-top: 1px solid var(--its-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.its-snapshot__title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--its-text-muted);
}

.its-snapshot__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.its-snapshot__label {
    color: var(--its-text-muted);
}

.its-snapshot__value {
    color: var(--its-text);
    font-weight: 500;
    text-align: right;
}

/* ── Hero: testata di riepilogo con avatar e numeri ── */

.its-hero {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f7f9fd 60%, #eef2fb 100%);
    border: 1px solid var(--its-border);
    border-radius: 14px;
    padding: 22px 24px 18px;
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: 0 1px 0 var(--its-shadow);
}

.its-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--its-admin) 0%, #7c3aed 100%);
}

.its-hero::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(26, 86, 219, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.its-hero__main {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    position: relative;
}

.its-hero__avatar {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--its-admin) 0%, #7c3aed 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--its-font);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(26, 86, 219, 0.28);
}

.its-hero__avatar--lead {
    background: linear-gradient(135deg, #6d28d9 0%, #a78bfa 100%);
    box-shadow: 0 6px 18px rgba(109, 40, 217, 0.28);
}

.its-hero__avatar--top {
    background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
    box-shadow: 0 6px 18px rgba(21, 128, 61, 0.25);
}

.its-hero__avatar--forn {
    background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
    box-shadow: 0 6px 18px rgba(14, 116, 144, 0.28);
}

.its-hero__avatar--neutro {
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
    box-shadow: 0 6px 18px rgba(100, 116, 139, 0.25);
}

.its-hero__identity {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.its-hero__name {
    font-family: var(--its-font);
    font-size: 22px;
    font-weight: 700;
    color: var(--its-text);
    letter-spacing: -0.4px;
    line-height: 1.15;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.its-hero__subtitle {
    font-size: 12.5px;
    color: var(--its-text-muted);
    font-weight: 500;
}

.its-hero__subtitle strong {
    color: var(--its-text-dim);
    font-weight: 600;
}

.its-hero__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 11.5px;
    color: var(--its-text-muted);
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Partita IVA, codice fiscale, identificativi: numeri lunghi che si leggono
   carattere per carattere, e spesso a voce.

   ⚠️ Erano illeggibili per tre cose insieme, nessuna delle quali è «il font
   sbagliato»: **peso 600** su un monospazio piccolo ne ingrossa i tratti fino a
   chiuderli, **11,5px** è sotto la soglia in cui un mono resta nitido, e
   **letter-spacing: 0** incolla le cifre — su «00000000000» il risultato è una
   massa scura in cui non si contano nemmeno gli zeri.

   Peso 500, corpo un po' più grande (il mono ha x-height minore del sans, quindi
   alla stessa misura appare più piccolo) e aria fra i caratteri. `slashed-zero`
   dove il font la offre — Consolas ce l'ha — così lo zero non si confonde con la
   O; `tabular-nums` tiene le cifre incolonnate. */
.its-hero__meta-value {
    font-family: var(--its-font-codici);
    color: var(--its-text);
    font-weight: 500;
    font-size: 12.5px;
    text-transform: none;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums slashed-zero;
    margin-left: 5px;
}

.its-hero__meta-divider {
    width: 1px;
    height: 11px;
    background: var(--its-border);
}

.its-hero__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 10px;
}

.its-hero__contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--its-text-dim);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.its-hero__contact:hover {
    color: var(--its-admin);
}

/* Numeri di telefono: si leggono a gruppi, quindi vale la stessa spaziatura. */
.its-hero__contact--mono {
    font-family: var(--its-font-codici);
    letter-spacing: 0.035em;
    font-variant-numeric: tabular-nums slashed-zero;
}

.its-hero__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.its-hero__id {
    font-family: var(--its-font-codici);
    font-size: 11px;
    color: var(--its-text-muted);
    background: var(--its-surface2);
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums slashed-zero;
}

.its-hero__stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--its-border);
    position: relative;
}

.its-hero__stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 16px;
    border-right: 1px solid var(--its-border);
    min-width: 0;
}

.its-hero__stat:first-child {
    padding-left: 0;
}

.its-hero__stat:last-child {
    border-right: none;
    padding-right: 0;
}

.its-hero__stat-label {
    font-family: var(--its-font);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--its-text-muted);
}

.its-hero__stat-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--its-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Date e numeri negli indicatori: stessa cura del meta qui sopra. */
.its-hero__stat-value--mono {
    font-family: var(--its-font-codici);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.035em;
    font-variant-numeric: tabular-nums slashed-zero;
}

.its-hero__stat-value--empty {
    color: var(--its-text-muted);
    font-style: italic;
    font-weight: 500;
}

.its-hero__stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.1px;
}

.its-hero__stat-pill__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.6);
}

@media (max-width: 1100px) {
    .its-hero__stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px 0;
    }
    .its-hero__stat:nth-child(2) {
        border-right: none;
        padding-right: 0;
    }
    .its-hero__stat:nth-child(3) {
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .its-hero {
        padding: 16px 16px 14px;
    }
    .its-hero__main {
        flex-direction: column;
        gap: 14px;
    }
    .its-hero__badges {
        flex-direction: row;
        align-self: stretch;
        justify-content: space-between;
    }
    .its-hero__name {
        font-size: 19px;
    }
    .its-hero__stats {
        grid-template-columns: 1fr;
    }
    .its-hero__stat {
        border-right: none;
        border-bottom: 1px solid var(--its-border);
        padding: 6px 0;
    }
    .its-hero__stat:last-child {
        border-bottom: none;
    }
}

/* ── Chip di stato con pallino ── */

.its-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
}

.its-status-chip__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 0 6px rgba(255,255,255,0.6);
}

/* Acceso / spento, quando il colore non arriva da un dato (lo stato di un
   cliente porta il suo colore in uno style inline; un interruttore no). */
.its-status-chip--on { background: var(--its-success); }
.its-status-chip--off { background: var(--its-text-muted); }

/* Variante compatta, dentro le righe di elenco */
.its-status-chip--inline {
    padding: 2px 8px;
    font-size: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-weight: 700;
}

/* ── Interruttori a chip: acceso/spento ben distinguibili ── */

.its-chip-switch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.its-chip-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 11px;
    background: transparent;
    border: 1.5px solid var(--its-border);
    border-radius: 999px;
    font-family: var(--its-font);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--its-text-muted);
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1.4;
    user-select: none;
    white-space: nowrap;
}

.its-chip-switch:focus-visible {
    outline: 2px solid var(--its-admin);
    outline-offset: 2px;
}

.its-chip-switch__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid currentColor;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

/* OFF — tratteggiato muted */
.its-chip-switch--off {
    border-style: dashed;
}

.its-chip-switch--off:not(:disabled):hover {
    border-color: var(--its-text-dim);
    color: var(--its-text-dim);
    transform: translateY(-1px);
}

/* ON — pieno con gradient + ombra colorata + dot pieno bianco */
.its-chip-switch--on .its-chip-switch__dot {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}

/* Disabled — leggibile ma chiaramente inerte */
.its-chip-switch:disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.its-chip-switch--off:disabled {
    border-style: solid;
    border-color: #c0c6d4;
    background: #f4f6fb;
    color: #6c7796;
}

.its-chip-switch--on:disabled {
    filter: grayscale(0.55) brightness(0.95);
    opacity: 0.75;
    box-shadow: none;
}

.its-chip-switch--on:disabled .its-chip-switch__dot {
    box-shadow: none;
}

/* Varianti di colore per l'acceso */
.its-chip-switch--azienda.its-chip-switch--on {
    background: linear-gradient(135deg, var(--its-admin) 0%, #2563eb 100%);
    border-color: var(--its-admin);
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(26, 86, 219, 0.28);
}

.its-chip-switch--contratto.its-chip-switch--on {
    background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
    border-color: #15803d;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(21, 128, 61, 0.28);
}

.its-chip-switch--voipvoice.its-chip-switch--on {
    background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
    border-color: #0e7490;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(14, 116, 144, 0.28);
}

.its-chip-switch--h24.its-chip-switch--on {
    background: linear-gradient(135deg, #6d28d9 0%, #a78bfa 100%);
    border-color: #6d28d9;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(109, 40, 217, 0.28);
}

.its-chip-switch--ee.its-chip-switch--on {
    background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%);
    border-color: #b45309;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(180, 83, 9, 0.28);
}

.its-chip-switch--neutral.its-chip-switch--on {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    border-color: #475569;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(71, 85, 105, 0.25);
}

/* ── Righe di elenco dentro una sezione ── */

.its-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.its-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--its-surface);
    border: 1px solid var(--its-border);
    border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.its-list-item:hover {
    border-color: var(--its-text-muted);
    box-shadow: 0 1px 3px var(--its-shadow);
}

.its-list-item--clickable {
    cursor: pointer;
}

.its-list-item--clickable:hover {
    border-color: var(--its-admin);
    box-shadow: 0 2px 6px rgba(26, 86, 219, 0.08);
}

.its-list-item__icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--its-surface2);
    color: var(--its-text-dim);
}

.its-list-item__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.its-list-item__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--its-text);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.its-list-item__text {
    font-size: 13px;
    color: var(--its-text-dim);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.its-list-item__meta {
    font-size: 11.5px;
    color: var(--its-text-muted);
    font-family: var(--its-font-mono);
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 2px;
}

.its-list-item__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Striscia colorata di categoria sul bordo sinistro */
.its-list-item--cat {
    border-left: 4px solid var(--its-border);
}
.its-list-item--cat-generica   { border-left-color: #4f8ef7; }
.its-list-item--cat-sollecito  { border-left-color: #a78bfa; }
.its-list-item--cat-assistenza { border-left-color: var(--its-admin); }
.its-list-item--cat-wiki       { border-left-color: #6d28d9; }
.its-list-item--cat-richieste  { border-left-color: #f59e0b; }

/* ── Riga del paginatore: pagine + "per pagina" ── */

.its-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--its-space-4);
    margin-top: var(--its-space-4);
}

/* ── Etichette compatte dentro le righe ── */

.its-mini-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.4;
}
.its-mini-chip--generica   { background: #e6efff; color: #1a40a3; }
.its-mini-chip--sollecito  { background: #ede4ff; color: #5a2d99; }
.its-mini-chip--assistenza { background: #e6f8ec; color: #1a7a3a; }
.its-mini-chip--wiki       { background: #f0e8ff; color: #4a2087; }
.its-mini-chip--richieste  { background: #fff3d6; color: #92520a; }

.its-mini-chip--positive   { background: #e6f8ec; color: #1a7a3a; }
.its-mini-chip--negative   { background: #fde5e4; color: #a83232; }
.its-mini-chip--neutro     { background: var(--its-surface2); color: var(--its-text-muted); }

/* =============================================
   BLOCCHI RICORRENTI
   Erano scritti uguali in due o più pagine, ognuna
   col suo prefisso. Qui una volta sola: la pagina
   che vuole discostarsi scrive solo la differenza.
   ============================================= */

/* ── Cornice della griglia (MudDataGrid, MudTable) ──
   Serve globale e non scoped: la classe finisce su un componente figlio,
   dove il CSS di pagina arriverebbe solo con ::deep — e chi se lo dimentica
   resta senza cornice senza capire perché. */

.its-griglia {
    background: var(--its-surface);
    border: 1px solid var(--its-border);
    border-radius: var(--its-radius-lg);
    overflow: hidden;
}

/* ── Nota esplicativa sotto un titolo ── */

.its-nota {
    margin: 0 0 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--its-text-dim);
    max-width: 80ch;
}

/* Sotto un campo invece che sopra un blocco: la nota segue quello che spiega. */
.its-nota--campo {
    margin: var(--its-space-2) 0 0;
}

/* ── Testata di una sezione nel corpo della pagina: titolo, conteggio,
      azioni a destra ── */

.its-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--its-space-3);
    margin-bottom: 14px;
}

.its-section-toolbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.its-section-toolbar__title {
    font-family: var(--its-font);
    font-size: var(--its-fs-lg);
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--its-text);
    margin: 0;
}

.its-section-toolbar__count {
    font-family: var(--its-font-mono);
    font-size: var(--its-fs-sm);
    color: var(--its-text-muted);
    background: var(--its-surface2);
    padding: 2px 9px;
    border-radius: var(--its-radius-pill);
    font-weight: 600;
}

/* ── Cella di elenco: nome con eventuali badge, sottotitolo sotto ── */

.its-nome {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--its-space-2);
}

.its-nome__testo {
    font-weight: 600;
    color: var(--its-text);
}

.its-sottotitolo {
    display: block;
    font-size: var(--its-fs-caption);
    color: var(--its-text-muted);
    margin-top: 1px;
}

/* ── Etichetta piccola maiuscola sopra un valore ── */

.its-etichetta {
    font-size: var(--its-fs-label);
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--its-text-muted);
}

/* ── Selettore a due o tre voci (segmented control) ── */

.its-segmento {
    display: inline-flex;
    border: 1px solid var(--its-border);
    border-radius: var(--its-radius);
    overflow: hidden;
    background: var(--its-surface);
}

.its-segmento__voce {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 5px 14px;
    font-family: inherit;
    font-size: var(--its-fs-sm);
    font-weight: 600;
    color: var(--its-text-muted);
    transition: background .15s ease, color .15s ease;
}

.its-segmento__voce:hover {
    background: var(--its-surface2);
    color: var(--its-text);
}

.its-segmento__voce + .its-segmento__voce {
    border-left: 1px solid var(--its-border);
}

.its-segmento__voce--attiva,
.its-segmento__voce--attiva:hover {
    background: var(--its-admin);
    color: #fff;
}

/* ── Formattazione WhatsApp resa da TestoWAFormatter ──
   Gli elementi nascono da un MarkupString e **non ricevono l'attributo di
   scope**: dal CSS di pagina si raggiungono solo con ::deep, da qui senza.
   Chi ha bisogno di un `code` diverso (fondo colorato della bolla, anteprima
   in riga) sovrascrive quella sola regola. */

.its-wa strong { font-weight: 700; }
.its-wa em { font-style: italic; }
.its-wa del { text-decoration: line-through; opacity: 0.8; }

.its-wa code {
    font-family: var(--its-font-mono);
    font-size: 0.9em;
    background: var(--its-surface2);
    border-radius: var(--its-radius-sm);
    padding: 1px 5px;
}
