/* CoParentManager 135_01 — layout autenticato e leggibilità.
   Non influisce su demo, pagine pubbliche, stampa o componenti di stato
   che non sono esplicitamente indicati qui. */

/* Footer a fondo viewport per le pagine corte; dopo il contenuto per le pagine lunghe.
   Il brand banner e la topbar restano nella normale sequenza del documento.
   Non usare position:fixed o position:sticky sul footer. */
body.app-sidebar-desktop {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
body.app-sidebar-desktop > .app-layout-content {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    min-width: 0;
}
body.app-sidebar-desktop > .app-layout-content > main {
    flex: 1 0 auto;
    min-width: 0;
}
body.app-sidebar-desktop > .app-layout-content > footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* Footer condiviso: contrasto esplicito anche se una pagina specifica
   imposta stili chiari in conflitto con il tema scuro. */
html[data-bs-theme="dark"] body.app-sidebar-desktop .app-layout-content > footer.bg-light {
    background-color: var(--cpm-surface, #1b2935) !important;
    color: var(--cpm-text, #eff4fa) !important;
    border-top-color: var(--cpm-border, #3c5062) !important;
}
html[data-bs-theme="dark"] body.app-sidebar-desktop .app-layout-content > footer .text-muted {
    color: var(--cpm-text-secondary, #c5d1dd) !important;
}
html[data-bs-theme="dark"] body.app-sidebar-desktop .app-layout-content > footer a:not(.btn) {
    color: #a9caff;
}

/* Il badge del genitore nel contesto Family usa bg-danger: in tema scuro
   --bs-danger-rgb e' una tinta pastello, insufficiente con testo bianco.
   Conserva il significato rosso (stato/ruolo), scurendo solo la superficie. */
html[data-bs-theme="dark"] body.app-sidebar-desktop .app-layout-content .badge.bg-danger {
    background-color: #9d3046 !important;
    color: #fff !important;
}

/* 135_01_01: esclusivamente Chat Family.
   La pagina Chat puo' avere una gerarchia DOM diversa da quella delle pagine
   tradizionali: non fare affidamento sul figlio diretto di app-layout-content.
   Il selettore :has e' supportato dai browser moderni del progetto.
   Nessuna modifica a Fatture, Lettere, altre pagine, demo o card interne. */
html[data-bs-theme="dark"] body.app-sidebar-desktop:has(.chat-main-wrapper) footer.bg-light:not(.card-footer) {
    background: #1b2935 !important;
    background-color: #1b2935 !important;
    color: #edf3ff !important;
    border-top-color: #455e77 !important;
}
html[data-bs-theme="dark"] body.app-sidebar-desktop:has(.chat-main-wrapper) footer.bg-light:not(.card-footer) .text-muted {
    color: #c5d1dd !important;
}
html[data-bs-theme="dark"] body.app-sidebar-desktop:has(.chat-main-wrapper) footer.bg-light:not(.card-footer) a:not(.btn) {
    color: #b7d4ff !important;
}
/* La fascia del percorso, quando presente nella Chat, non deve restare chiara. */
html[data-bs-theme="dark"] body.app-sidebar-desktop:has(.chat-main-wrapper) .app-layout-content > .border-bottom.bg-light.py-2 {
    background-color: #1b2935 !important;
    color: #edf3ff !important;
    border-bottom-color: #455e77 !important;
}
html[data-bs-theme="dark"] body.app-sidebar-desktop:has(.chat-main-wrapper) .app-layout-content > .border-bottom.bg-light.py-2 .breadcrumb-item {
    color: #d5e2f0;
}

/* Contrasto globale degli sfondi verdi di successo */
html body .bg-success:not([class*="bg-opacity-"]),
html body .text-bg-success,
html body .cpm-studio-workspace .badge.bg-success {
    background-color: #166534 !important;
    color: #ffffff !important;
}
