/**
 * WorkManager — tema Material / Google (solo presentazione).
 * Si appoggia a Bootstrap 5: override di colori, superfici, ombre, spaziature.
 */

/* -------------------------------------------------------------------------- */
/* Token colore / elevazione (stile Google Workspace / Material)              */
/* -------------------------------------------------------------------------- */

body.wm-theme-material {
    --wm-primary: #1a73e8;
    --wm-primary-hover: #1557b0;
    --wm-on-primary: #ffffff;
    --wm-surface: #ffffff;
    --wm-surface-variant: #f8f9fa;
    --wm-background: #f1f3f4;
    --wm-outline: #dadce0;
    --wm-on-surface: #202124;
    --wm-on-surface-variant: #5f6368;

    --bs-primary: var(--wm-primary);
    --bs-primary-rgb: 26, 115, 232;
    --bs-link-color: var(--wm-primary);
    --bs-link-hover-color: var(--wm-primary-hover);
    --bs-body-color: var(--wm-on-surface);
    --bs-body-bg: var(--wm-background);
    --bs-secondary-bg: var(--wm-surface-variant);
    --bs-border-color: var(--wm-outline);
    --bs-border-radius: 0.5rem;
    --bs-border-radius-sm: 0.375rem;
    --bs-border-radius-lg: 0.75rem;

    --wm-elev-0: none;
    --wm-elev-1: 0 1px 2px rgba(60, 64, 67, 0.28), 0 1px 3px 1px rgba(60, 64, 67, 0.1);
    --wm-elev-2: 0 1px 3px rgba(60, 64, 67, 0.24), 0 4px 8px 3px rgba(60, 64, 67, 0.12);

    /* Bottoni: raggio sobrio (no pill su .btn generici) */
    --wm-btn-radius: 8px;
    --wm-btn-radius-sm: 6px;
    --wm-btn-radius-lg: 10px;

    font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

html,
body.wm-theme-material {
    height: 100%;
}

body.wm-theme-material {
    overflow: hidden;
    color: var(--wm-on-surface);
    background-color: var(--wm-background) !important;
}

/* -------------------------------------------------------------------------- */
/* Shell: sidebar + main (stesso comportamento scroll dell’inline precedente) */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .app-shell {
    height: 100vh;
    overflow: hidden;
}

body.wm-theme-material .app-sidebar.wm-sidebar {
    width: 100%;
    max-width: 16rem;
    background-color: var(--wm-surface) !important;
    border-right: 1px solid var(--wm-outline) !important;
}

body.wm-theme-material .app-sidebar .wm-sidebar-brand {
    border-bottom: 1px solid var(--wm-outline);
}

body.wm-theme-material .app-sidebar .wm-sidebar-brand a {
    color: var(--wm-on-surface) !important;
    letter-spacing: -0.02em;
}

body.wm-theme-material .app-sidebar .wm-sidebar-brand .text-muted {
    color: var(--wm-on-surface-variant) !important;
}

@media (min-width: 992px) {
    body.wm-theme-material .app-sidebar.wm-sidebar {
        height: 100vh;
        overflow-y: auto;
    }

    body.wm-theme-material .app-main {
        height: 100vh;
        overflow: hidden;
    }

    body.wm-theme-material .app-content-scroll {
        overflow-y: auto;
        min-height: 0;
    }
}

body.wm-theme-material .app-main {
    min-width: 0;
}

@media (max-width: 991.98px) {
    body.wm-theme-material {
        overflow: auto;
    }

    body.wm-theme-material .app-shell {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* Sotto lg la sidebar diventa offcanvas (drawer) e non occupa più spazio
       inline nell'app-shell. Bootstrap gestisce position/transform/backdrop;
       qui sovrascriviamo solo lo stile per allinearlo al tema Material. */
    body.wm-theme-material .app-sidebar.offcanvas-lg {
        --bs-offcanvas-width: 18rem;
        max-width: 18rem;
        background-color: var(--wm-surface) !important;
        border-right: 1px solid var(--wm-outline) !important;
        box-shadow: var(--wm-elev-2);
    }

    body.wm-theme-material .app-sidebar .offcanvas-header {
        background-color: var(--wm-surface);
        padding: 0.75rem 1rem;
        border-bottom-color: var(--wm-outline) !important;
        color: var(--wm-on-surface);
    }

    body.wm-theme-material .app-sidebar .offcanvas-title {
        color: var(--wm-on-surface);
        letter-spacing: -0.01em;
    }

    body.wm-theme-material .app-sidebar .offcanvas-body {
        overflow-y: auto;
    }
}

/* Hamburger nel topbar: solo sotto lg. La regola display globale vinceva sulla
   specificità di Bootstrap .d-lg-none e lasciava il toggle visibile anche su desktop. */
@media (min-width: 992px) {
    body.wm-theme-material .wm-sidebar-toggle {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    body.wm-theme-material .wm-sidebar-toggle {
        display: inline-flex;
    }
}

body.wm-theme-material .wm-sidebar-toggle {
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

body.wm-theme-material .wm-sidebar-toggle .wm-sidebar-toggle-icon {
    display: inline-block;
    font-size: 1.125rem;
    line-height: 1;
    vertical-align: middle;
}

body.wm-theme-material .wm-sidebar-toggle .wm-sidebar-toggle-text {
    font-weight: 500;
}

/* Da lg in su Bootstrap "smonta" l'offcanvas: ripristiniamo lo stile
   originale della sidebar fissa (no transition, no transform, layout
   inline). Bootstrap già lo fa di default, ma assicuriamoci che il nostro
   .offcanvas-body non aggiunga padding extra. */
@media (min-width: 992px) {
    body.wm-theme-material .app-sidebar.offcanvas-lg {
        background-color: var(--wm-surface) !important;
        border-right: 1px solid var(--wm-outline) !important;
    }

    body.wm-theme-material .app-sidebar .offcanvas-body {
        padding: 0;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
        overflow-y: auto;
    }

    body.wm-theme-material .app-sidebar .offcanvas-header {
        display: none !important;
    }
}

/* -------------------------------------------------------------------------- */
/* Sidebar nav (voci compatte, hover tipo lista Material)                     */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .app-sidebar .nav-link {
    color: var(--wm-on-surface);
    background-color: transparent;
    border: none;
    border-radius: var(--wm-btn-radius);
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

body.wm-theme-material .app-sidebar .nav-link:hover {
    color: var(--wm-primary);
    background-color: rgba(26, 115, 232, 0.08);
}

body.wm-theme-material .app-sidebar .nav-link.active,
body.wm-theme-material .app-sidebar .nav-link.active:hover {
    color: var(--wm-on-primary);
    background-color: var(--wm-primary);
    box-shadow: var(--wm-elev-1);
}

/* -------------------------------------------------------------------------- */
/* Topbar                                                                     */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .app-topbar.wm-topbar {
    background-color: var(--wm-surface) !important;
    border-bottom: 1px solid var(--wm-outline) !important;
    box-shadow: var(--wm-elev-1);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    min-height: 3.5rem;
    /* La topbar resta su una sola riga: search shrinkabile a sinistra,
       blocco utente compatto a destra. Il wrap caotico precedente
       (con la riga azioni che finiva sotto la search) è eliminato. */
    flex-wrap: nowrap;
}

body.wm-theme-material .app-topbar .wm-topbar-search {
    min-width: 0;
    max-width: 32rem;
}

body.wm-theme-material .app-topbar .wm-topbar-search .form-control {
    min-width: 0;
}

body.wm-theme-material .app-topbar .wm-topbar-user {
    min-width: 0;
}

body.wm-theme-material .app-topbar .wm-topbar-user-info {
    min-width: 0;
    line-height: 1.15;
}

/* Separatore visivo prima del bottone Esci: evita di trattarlo come una
   delle azioni "normali" e riduce il rischio di click per errore. */
body.wm-theme-material .app-topbar .wm-topbar-sep {
    width: 1px;
    height: 1.5rem;
    background-color: var(--wm-outline);
    align-self: center;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

body.wm-theme-material .app-topbar .form-control {
    border-radius: var(--wm-btn-radius);
    border-color: var(--wm-outline);
    padding-left: 1rem;
    padding-right: 1rem;
}

body.wm-theme-material .app-topbar .form-control:focus {
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

body.wm-theme-material .app-topbar .btn-primary {
    font-weight: 500;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

body.wm-theme-material .app-topbar .btn-outline-secondary {
    border-color: var(--wm-outline);
    color: var(--wm-on-surface);
    font-weight: 500;
}

body.wm-theme-material .app-topbar .btn-outline-secondary:hover {
    background-color: rgba(60, 64, 67, 0.06);
    border-color: var(--wm-outline);
    color: var(--wm-on-surface);
}

/* Logout: outline-danger per segnalare azione potenzialmente irreversibile,
   ma senza riempimento solido (resta sobrio nello stile Material). */
body.wm-theme-material .app-topbar .wm-logout-btn {
    font-weight: 500;
}

body.wm-theme-material .app-topbar .text-muted {
    color: var(--wm-on-surface-variant) !important;
}

body.wm-theme-material .app-topbar .text-dark {
    color: var(--wm-on-surface) !important;
}

body.wm-theme-material .app-topbar .badge.text-bg-danger,
body.wm-theme-material .app-topbar .badge.text-bg-secondary {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Su schermi stretti nascondiamo le info utente testuali (mostrate solo da
   md in su via .d-md-flex); il badge ruolo + il bottone Esci restano. */
@media (max-width: 575.98px) {
    body.wm-theme-material .app-topbar .wm-topbar-search .btn-primary {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Area contenuto                                                             */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .app-content-scroll.wm-content {
    background-color: var(--wm-background);
    padding: 1rem 1rem 1.5rem;
}

@media (min-width: 768px) {
    body.wm-theme-material .app-content-scroll.wm-content {
        padding: 1.25rem 1.5rem 2rem;
    }
}

body.wm-theme-material #app-content.container-fluid {
    max-width: 100%;
}

/* -------------------------------------------------------------------------- */
/* Card / pannelli (viste gestionali)                                         */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .card {
    border: 1px solid var(--wm-outline);
    border-radius: var(--bs-border-radius-lg);
    background-color: var(--wm-surface);
    box-shadow: var(--wm-elev-1);
    overflow: hidden;
}

body.wm-theme-material .card-header {
    background-color: var(--wm-surface) !important;
    border-bottom-color: var(--wm-outline);
    font-weight: 500;
    color: var(--wm-on-surface);
    padding: 0.875rem 1.25rem;
}

body.wm-theme-material .card-body {
    color: var(--wm-on-surface);
}

body.wm-theme-material .table {
    --bs-table-border-color: var(--wm-outline);
}

/* -------------------------------------------------------------------------- */
/* Bottoni (globale): raggio moderato; .rounded-pill su .btn → stesso schema   */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .btn {
    border-radius: var(--wm-btn-radius);
}

body.wm-theme-material .btn.btn-sm {
    border-radius: var(--wm-btn-radius-sm);
}

body.wm-theme-material .btn.btn-lg {
    border-radius: var(--wm-btn-radius-lg);
}

/* Se il markup usa ancora .rounded-pill su un .btn, usa lo stesso raggio moderato */
body.wm-theme-material .btn.rounded-pill {
    border-radius: var(--wm-btn-radius) !important;
}

body.wm-theme-material .btn.btn-sm.rounded-pill,
body.wm-theme-material .btn.rounded-pill.btn-sm {
    border-radius: var(--wm-btn-radius-sm) !important;
}

body.wm-theme-material .btn.btn-lg.rounded-pill,
body.wm-theme-material .btn.rounded-pill.btn-lg {
    border-radius: var(--wm-btn-radius-lg) !important;
}

body.wm-theme-material button:where(:not(.btn):not(.btn-close)) {
    border-radius: var(--wm-btn-radius);
}

body.wm-theme-material .btn-primary {
    --bs-btn-bg: var(--wm-primary);
    --bs-btn-border-color: var(--wm-primary);
    --bs-btn-hover-bg: var(--wm-primary-hover);
    --bs-btn-hover-border-color: var(--wm-primary-hover);
    font-weight: 500;
}

body.wm-theme-material .btn-outline-primary {
    color: var(--wm-primary);
    border-color: var(--wm-outline);
    font-weight: 500;
}

body.wm-theme-material .btn-outline-primary:hover {
    background-color: rgba(26, 115, 232, 0.08);
    border-color: var(--wm-primary);
    color: var(--wm-primary);
}

body.wm-theme-material .btn-outline-secondary,
body.wm-theme-material .btn-secondary {
    font-weight: 500;
}

/* -------------------------------------------------------------------------- */
/* Badge / chip: mantieni pill dove il markup usa .rounded-pill               */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .badge.rounded-pill {
    border-radius: var(--bs-border-radius-pill);
}

/* -------------------------------------------------------------------------- */
/* Modal (anteprima immagini ecc.)                                            */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .modal-content {
    border: 1px solid var(--wm-outline);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--wm-elev-2);
}

body.wm-theme-material .modal-header {
    border-bottom-color: var(--wm-outline);
}

body.wm-theme-material .modal-footer {
    border-top-color: var(--wm-outline);
}

body.wm-theme-material .btn-close:focus {
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

/* -------------------------------------------------------------------------- */
/* Alert / form comuni nel contenuto caricato via SPA                           */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .alert {
    border-radius: var(--bs-border-radius);
    border-width: 1px;
}

body.wm-theme-material .form-control,
body.wm-theme-material .form-select {
    border-radius: var(--bs-border-radius);
    border-color: var(--wm-outline);
}

body.wm-theme-material .form-control:focus,
body.wm-theme-material .form-select:focus {
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

/* ========================================================================== */
/* Layout pubblico (portale clienti: home + form reclamo)                     */
/* ========================================================================== */

/* Il tema Material gestionale forza overflow:hidden + height:100vh sull'app
   shell SPA. Sul layout pubblico vogliamo scroll naturale di pagina. */
body.wm-theme-material.wm-public-layout {
    overflow: visible;
    height: auto;
    min-height: 100vh;
    background-color: var(--wm-background) !important;
}

/* -------------------------------------------------------------------------- */
/* Header pubblico                                                            */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-public-header {
    background-color: var(--wm-surface);
    border-bottom: 1px solid var(--wm-outline);
    box-shadow: var(--wm-elev-1);
}

body.wm-theme-material .wm-public-header .wm-public-brand {
    color: var(--wm-on-surface);
    font-weight: 500;
    letter-spacing: -0.02em;
}

body.wm-theme-material .wm-public-header .wm-public-brand:hover {
    color: var(--wm-primary);
}

body.wm-theme-material .wm-public-header .wm-public-nav-link {
    color: var(--wm-on-surface-variant);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--wm-btn-radius);
    transition: background-color 0.15s ease, color 0.15s ease;
}

body.wm-theme-material .wm-public-header .wm-public-nav-link:hover {
    color: var(--wm-primary);
    background-color: rgba(26, 115, 232, 0.08);
}

body.wm-theme-material .wm-public-header .wm-public-nav-link.active {
    color: var(--wm-primary);
    background-color: rgba(26, 115, 232, 0.12);
}

/* -------------------------------------------------------------------------- */
/* Main pubblico                                                              */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-public-main {
    background-color: var(--wm-background);
}

/* -------------------------------------------------------------------------- */
/* Hero (home pubblica)                                                       */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-public-hero {
    background-color: var(--wm-surface);
    border: 1px solid var(--wm-outline);
    border-radius: 16px;
    box-shadow: var(--wm-elev-1);
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    body.wm-theme-material .wm-public-hero {
        padding: 3rem 2.5rem;
        margin-bottom: 2rem;
    }
}

body.wm-theme-material .wm-public-hero h1 {
    color: var(--wm-on-surface);
    letter-spacing: -0.02em;
}

body.wm-theme-material .wm-public-hero .lead {
    color: var(--wm-on-surface-variant) !important;
}

/* -------------------------------------------------------------------------- */
/* Card pubbliche (informative + form)                                        */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-public-card {
    background-color: var(--wm-surface);
    border: 1px solid var(--wm-outline) !important;
    border-radius: 14px !important;
    box-shadow: var(--wm-elev-1) !important;
    overflow: hidden;
}

body.wm-theme-material .wm-public-card .card-body {
    padding: 1.25rem;
}

@media (min-width: 768px) {
    body.wm-theme-material .wm-public-card .card-body {
        padding: 1.75rem;
    }
}

body.wm-theme-material .wm-public-card .card-title {
    color: var(--wm-on-surface);
    font-weight: 500;
}

body.wm-theme-material .wm-public-card .text-muted {
    color: var(--wm-on-surface-variant) !important;
}

/* Form reclamo: spaziatura e focus coerenti Material */
body.wm-theme-material .wm-public-card .form-label {
    color: var(--wm-on-surface);
    font-weight: 500;
    margin-bottom: 0.375rem;
}

body.wm-theme-material .wm-public-card .form-control,
body.wm-theme-material .wm-public-card .form-select {
    border-color: var(--wm-outline);
    border-radius: var(--bs-border-radius);
}

body.wm-theme-material .wm-public-card .form-control:focus,
body.wm-theme-material .wm-public-card .form-select:focus {
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

body.wm-theme-material .wm-public-card .form-text {
    color: var(--wm-on-surface-variant);
}

/* -------------------------------------------------------------------------- */
/* Alert nel layout pubblico                                                  */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-public-layout .alert {
    border-radius: var(--bs-border-radius-lg);
}

body.wm-theme-material .wm-public-layout .alert-light {
    background-color: var(--wm-surface-variant);
    border-color: var(--wm-outline);
    color: var(--wm-on-surface-variant);
}

/* -------------------------------------------------------------------------- */
/* Footer pubblico                                                            */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-public-footer {
    background-color: var(--wm-surface);
    border-top: 1px solid var(--wm-outline);
    color: var(--wm-on-surface-variant);
}

body.wm-theme-material .wm-public-footer .text-muted {
    color: var(--wm-on-surface-variant) !important;
}

/* ========================================================================== */
/* Viste elenco gestionale (.wm-page-header / .wm-list-card / .wm-table ...)  */
/* ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Header pagina                                                              */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    body.wm-theme-material .wm-page-header {
        margin-bottom: 1.25rem;
        gap: 1rem;
    }
}

body.wm-theme-material .wm-page-title {
    color: var(--wm-on-surface);
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 0.125rem;
}

body.wm-theme-material .wm-page-subtitle {
    color: var(--wm-on-surface-variant);
    margin-bottom: 0;
}

/* -------------------------------------------------------------------------- */
/* Card filtri (sopra l'elenco)                                               */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-filter-card {
    background-color: var(--wm-surface);
    border: 1px solid var(--wm-outline);
    border-radius: 14px;
    box-shadow: var(--wm-elev-1);
    margin-bottom: 1rem;
}

body.wm-theme-material .wm-filter-card > .card-body {
    padding: 0.875rem 1rem;
}

@media (min-width: 768px) {
    body.wm-theme-material .wm-filter-card > .card-body {
        padding: 1rem 1.25rem;
    }
}

body.wm-theme-material .wm-filter-card .form-label {
    color: var(--wm-on-surface-variant);
    font-weight: 500;
}

/* -------------------------------------------------------------------------- */
/* Card che contiene l'elenco (tabella o lista mobile)                        */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-list-card {
    background-color: var(--wm-surface);
    border: 1px solid var(--wm-outline);
    border-radius: 16px;
    box-shadow: var(--wm-elev-1);
    overflow: hidden;
}

body.wm-theme-material .wm-list-card > .card-body.p-0 {
    padding: 0 !important;
}

body.wm-theme-material .wm-list-card .table-responsive {
    border-radius: inherit;
}

/* -------------------------------------------------------------------------- */
/* Tabella stile Material                                                     */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-table {
    margin-bottom: 0;
    color: var(--wm-on-surface);
    --bs-table-hover-bg: rgba(26, 115, 232, 0.06);
    --bs-table-hover-color: var(--wm-on-surface);
    --bs-table-border-color: var(--wm-outline);
}

body.wm-theme-material .wm-table > thead {
    background-color: var(--wm-surface-variant);
}

body.wm-theme-material .wm-table > thead th {
    background-color: var(--wm-surface-variant);
    color: var(--wm-on-surface-variant);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--wm-outline);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

body.wm-theme-material .wm-table > tbody > tr > td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom-color: var(--wm-outline);
}

body.wm-theme-material .wm-table > tbody > tr:last-child > td {
    border-bottom: 0;
}

body.wm-theme-material .wm-table a:not(.btn) {
    color: var(--wm-primary);
    text-decoration: none;
    font-weight: 500;
}

body.wm-theme-material .wm-table a:not(.btn):hover {
    color: var(--wm-primary-hover);
    text-decoration: underline;
}

/* Celle con link principale (es. numero preventivo / nome cliente): l'intera
   cella diventa l'area cliccabile, così il puntatore può finire ovunque dentro
   il td senza che il click venga "perso" sul td stesso. Non si applica alle
   celle che contengono pulsanti d'azione: lì restano solo i singoli <a>/<button>
   con la propria hit-area, per non interferire con i click sui bottoni. */
body.wm-theme-material .wm-table td.wm-cell-link-cell {
    padding: 0;
}

body.wm-theme-material .wm-table td.wm-cell-link-cell > a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--wm-primary);
    text-decoration: none;
    font-weight: 500;
}

body.wm-theme-material .wm-table td.wm-cell-link-cell > a:hover,
body.wm-theme-material .wm-table td.wm-cell-link-cell > a:focus {
    background-color: rgba(26, 115, 232, 0.06);
    color: var(--wm-primary-hover);
    text-decoration: underline;
    outline: none;
}

/* -------------------------------------------------------------------------- */
/* Cella azioni                                                               */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: flex-end;
}

body.wm-theme-material .wm-table-actions > .btn {
    flex-shrink: 0;
}

/* -------------------------------------------------------------------------- */
/* Empty state                                                                */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-empty-state {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--wm-on-surface-variant);
}

body.wm-theme-material .wm-empty-state .wm-empty-state-title {
    color: var(--wm-on-surface);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

body.wm-theme-material .wm-empty-state p {
    margin-bottom: 0;
}

/* -------------------------------------------------------------------------- */
/* Wrapper paginazione (allineamento e stile Material)                        */
/* -------------------------------------------------------------------------- */

body.wm-theme-material .wm-pagination-wrap {
    margin-top: 1rem;
}

body.wm-theme-material .pagination .page-link {
    color: var(--wm-primary);
    border-color: var(--wm-outline);
    border-radius: var(--wm-btn-radius-sm);
    margin: 0 0.125rem;
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

body.wm-theme-material .pagination .page-link:hover {
    background-color: rgba(26, 115, 232, 0.08);
    color: var(--wm-primary);
    border-color: var(--wm-outline);
}

body.wm-theme-material .pagination .page-item.active .page-link {
    background-color: var(--wm-primary);
    border-color: var(--wm-primary);
    color: var(--wm-on-primary);
    box-shadow: var(--wm-elev-1);
}

body.wm-theme-material .pagination .page-item.disabled .page-link {
    color: var(--wm-on-surface-variant);
    background-color: var(--wm-surface-variant);
    border-color: var(--wm-outline);
}

/* ========================================================================== */
/* Viste elenco — responsive fixes (≤767.98px)                                 */
/* ========================================================================== */

/* La card lista usa overflow:hidden per arrotondare gli angoli della tabella.
   Lo scroll orizzontale deve quindi essere garantito dal .table-responsive
   interno, non dal contenitore card. */
body.wm-theme-material .wm-list-card .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: inherit;
}

/* Soglia minima per le tabelle elenco: sotto questa larghezza appare lo scroll
   orizzontale invece di comprimere testo/bottoni in modo illeggibile. La regola
   si applica solo a .wm-table (audit-log non usa tabelle, quindi non viene
   toccato). */
body.wm-theme-material .wm-list-card .wm-table {
    min-width: 760px;
}

/* Liste gestionali larghe: compatta le celle senza sacrificare le azioni
   principali, che devono restare leggibili su desktop stretto e tablet. */
body.wm-theme-material .wm-table.wm-table-compact > thead th,
body.wm-theme-material .wm-table.wm-table-compact > tbody > tr > td {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body.wm-theme-material .wm-table.wm-table-compact .wm-cell-link-cell > a {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body.wm-theme-material .wm-table-actions-primary {
    justify-content: flex-start;
    flex-wrap: nowrap;
    white-space: nowrap;
}

body.wm-theme-material .wm-table-actions-primary .btn {
    white-space: nowrap;
}

body.wm-theme-material .wm-next-action-cell {
    min-width: 10rem;
    max-width: 13rem;
    font-size: 0.875rem;
    line-height: 1.25;
}

body.wm-theme-material .wm-table-clients {
    min-width: 680px;
}

body.wm-theme-material .wm-table-quotes,
body.wm-theme-material .wm-table-invoices {
    min-width: 720px;
}

body.wm-theme-material .wm-table-products,
body.wm-theme-material .wm-table-stock {
    min-width: 820px;
}

body.wm-theme-material .wm-list-card .table-responsive::-webkit-scrollbar {
    height: 0.65rem;
}

body.wm-theme-material .wm-list-card .table-responsive::-webkit-scrollbar-thumb {
    background-color: rgba(95, 99, 104, 0.35);
    border-radius: 999px;
}

body.wm-theme-material .wm-list-card .table-responsive::-webkit-scrollbar-track {
    background-color: rgba(218, 220, 224, 0.45);
}

@media (max-width: 1199.98px) {
    body.wm-theme-material .wm-table.wm-table-compact .wm-col-secondary {
        display: none;
    }

    body.wm-theme-material .wm-table-clients,
    body.wm-theme-material .wm-table-quotes,
    body.wm-theme-material .wm-table-invoices {
        min-width: 560px;
    }

    body.wm-theme-material .wm-next-action-cell {
        min-width: 8rem;
        max-width: 10rem;
    }

    body.wm-theme-material .wm-table-products,
    body.wm-theme-material .wm-table-stock {
        min-width: 540px;
    }

    body.wm-theme-material .wm-table-products > thead th:first-child,
    body.wm-theme-material .wm-table-products > tbody > tr > td:first-child,
    body.wm-theme-material .wm-table-stock > thead th:first-child,
    body.wm-theme-material .wm-table-stock > tbody > tr > td:first-child {
        display: none;
    }

    body.wm-theme-material .wm-table-products .wm-table-actions-primary,
    body.wm-theme-material .wm-table-stock .wm-table-actions-primary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    body.wm-theme-material .wm-table-products .wm-table-actions-primary .btn,
    body.wm-theme-material .wm-table-stock .wm-table-actions-primary .btn {
        width: 100%;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Il <pre> del JSON tecnico in audit-log deve restare scrollabile sia in
   verticale (max-height) sia in orizzontale, e non deve mai eccedere il
   wrapper della card. */
body.wm-theme-material .wm-list-card pre {
    max-width: 100%;
    overflow: auto;
}

/* Filtri: i col Bootstrap devono poter restringersi sotto il contenuto
   (altrimenti gli input forzano il row a debordare). */
body.wm-theme-material .wm-filter-card .row > [class*="col-"] {
    min-width: 0;
}

/* Pagination: su schermi stretti deve wrappare senza fuoriuscire. */
body.wm-theme-material .wm-pagination-wrap .pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
}

body.wm-theme-material .wm-pagination-wrap .pagination .page-link {
    margin: 0;
}

@media (max-width: 767.98px) {
    /* Header pagina: titolo sopra, blocco azioni sotto a piena larghezza. */
    body.wm-theme-material .wm-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    /* Il blocco azioni (ultimo figlio se presente come <div>) si estende. */
    body.wm-theme-material .wm-page-header > div:last-child {
        width: 100%;
    }

    /* Tutti i bottoni/azioni dentro l'header occupano tutta la larghezza
       disponibile (gestisce sia il caso "una singola <a class=btn>" sia
       quello con wrapper flex contenente più bottoni). */
    body.wm-theme-material .wm-page-header > .btn,
    body.wm-theme-material .wm-page-header > a.btn,
    body.wm-theme-material .wm-page-header > button.btn,
    body.wm-theme-material .wm-page-header .btn-group {
        width: 100%;
    }

    body.wm-theme-material .wm-page-header > div:last-child .btn {
        flex: 1 1 auto;
    }

    /* Cella azioni in tabella: bottoni allineati a sinistra e in grado di
       crescere su mobile, per non rimanere schiacciati. */
    body.wm-theme-material .wm-table-actions {
        justify-content: flex-start;
    }

    body.wm-theme-material .wm-table-actions .btn {
        flex: 1 1 auto;
        min-width: max-content;
    }

    /* Filter card: i col-auto vanno in colonna piena con bottoni full-width. */
    body.wm-theme-material .wm-filter-card .row {
        --bs-gutter-y: 0.5rem;
    }

    body.wm-theme-material .wm-filter-card .col-auto {
        width: 100%;
    }

    body.wm-theme-material .wm-filter-card .col-auto .btn {
        width: 100%;
    }

    /* Empty state più compatto su mobile. */
    body.wm-theme-material .wm-empty-state {
        padding: 2rem 1rem;
    }
}

/* ============================================================
   Card Azioni del dettaglio fattura (gruppi visivamente separati)
   ============================================================ */
body.wm-theme-material .wm-action-group {
    border: 1px solid var(--wm-outline, #dadce0);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    background-color: #fff;
}

body.wm-theme-material .wm-action-group-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #5f6368;
    margin-bottom: 0.25rem;
}

/* ============================================================
   Mini-recap importi nella sezione "Stato fattura"
   ============================================================ */
body.wm-theme-material .wm-status-recap {
    border: 1px solid var(--wm-outline, #dadce0);
    border-radius: 12px;
    padding: 0.25rem 1rem;
    background-color: #f8f9fb;
}

body.wm-theme-material .wm-status-recap-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.wm-theme-material .wm-status-recap-row:last-child {
    border-bottom: 0;
}

/* ============================================================
   Lista step guidati della sezione "Fatturazione elettronica"
   ============================================================ */
body.wm-theme-material .wm-fe-steps > li {
    line-height: 1.5;
}

body.wm-theme-material .wm-fe-steps > li::marker {
    font-weight: 600;
    color: var(--wm-primary, #1a73e8);
}

body.wm-theme-material .wm-fe-steps > li a {
    margin-left: 0.25rem;
}

/* ============================================================
   Dashboard: gerarchia visiva tra azioni rapide, KPI primari
   (Da incassare / Fatture da incassare / Scadenze) e numeri
   secondari di sintesi.
   ============================================================ */
body.wm-theme-material .wm-dashboard-actions .card-body {
    align-items: center;
}

body.wm-theme-material .wm-dashboard-actions .btn {
    min-width: 9rem;
}

body.wm-theme-material .wm-kpi-card {
    border-top: 4px solid var(--wm-primary, #1a73e8);
}

body.wm-theme-material .wm-kpi-card.wm-kpi-money {
    border-top-color: #1e8e3e;
}

body.wm-theme-material .wm-kpi-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #5f6368;
    margin-bottom: 0.5rem;
}

body.wm-theme-material .wm-kpi-value {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

body.wm-theme-material .wm-kpi-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

body.wm-theme-material .wm-kpi-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.wm-theme-material .wm-kpi-list li:last-child {
    border-bottom: 0;
}

body.wm-theme-material .wm-stat-card {
    color: inherit;
    border: 1px solid var(--wm-outline, #dadce0);
    border-radius: 12px;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

body.wm-theme-material .wm-stat-card:hover {
    box-shadow: 0 2px 6px rgba(60, 64, 67, 0.15);
}

body.wm-theme-material .wm-stat-card .card-body {
    padding: 0.875rem 1rem;
}

body.wm-theme-material .wm-stat-title {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #5f6368;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

body.wm-theme-material .wm-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.1;
    color: #202124;
}

body.wm-theme-material .wm-stat-value-money {
    font-size: 1.125rem;
}

/* ============================================================
   Sidebar: sotto-menu gerarchico (es. "Da incassare" sotto "Fatture").

   Struttura HTML attesa:
     <a class="nav-link" href="...">Voce padre</a>
     <div class="wm-sidebar-submenu">
       <a class="nav-link wm-sidebar-subitem" href="...">Sotto-voce</a>
       ...
     </div>

   Si disegna una linea verticale continua sul lato sinistro del
   contenitore .wm-sidebar-submenu e, per ogni sotto-voce, un piccolo
   "braccetto" orizzontale (effetto albero └).
   ============================================================ */
body.wm-theme-material .wm-sidebar-submenu {
    position: relative;
    padding-left: 0.5rem;
    margin: 0.125rem 0 0.25rem 0;
}

body.wm-theme-material .wm-sidebar-submenu::before {
    content: "";
    position: absolute;
    left: 1.1rem;
    top: -0.125rem;
    bottom: 0.5rem;
    width: 2px;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 1px;
}

body.wm-theme-material .wm-sidebar-subitem {
    position: relative;
    padding-left: 2rem;
    font-size: 0.875rem;
}

/* Braccetto orizzontale che parte dalla linea verticale del submenu
   e arriva fino al testo della sotto-voce. */
body.wm-theme-material .wm-sidebar-subitem::before {
    content: "";
    position: absolute;
    left: 1.1rem;
    top: 50%;
    width: 0.6rem;
    height: 2px;
    background-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-50%);
    border-radius: 1px;
}

/* Sotto-voce attiva o in hover: linea verticale + braccetto si
   colorano in primary per dare feedback visivo immediato. */
body.wm-theme-material .wm-sidebar-submenu:has(.wm-sidebar-subitem.active)::before,
body.wm-theme-material .wm-sidebar-subitem.active::before,
body.wm-theme-material .wm-sidebar-subitem:hover::before {
    background-color: var(--wm-primary, #1a73e8);
}

/* Banner modalità demo (sola lettura) sotto la topbar */
body.wm-theme-material .wm-readonly-banner {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
