/* CoParentManager 90_05_06 — solo contrasto e Dark Mode aree indicate.
   Nessuna modifica a URL, JS operativo o autorizzazioni. */

/* Badge semantici: sfondo verde SCURO con testo chiaro, anche in Light Mode. */
.cpm-studio-workspace .badge.cpm-studio-mediator-badge,
.cpm-studio-workspace .badge.cpm-studio-active-badge {
    background-color: #135a40 !important;
    color: #ffffff !important;
    border: 1px solid #277b5d !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

/* Assistente: testo scuro su superfici chiare in Light Mode. */
.contextual-assistant-modal .modal-title { color: #192b3c !important; }
.contextual-assistant-modal .contextual-assistant-disclaimer,
.contextual-assistant-modal .form-text { color: #4b5a68 !important; opacity: 1 !important; }
.contextual-assistant-modal .contextual-assistant-question.btn-outline-primary {
    background-color: #eef4ff !important;
    color: #174c96 !important;
    border-color: #557eb8 !important;
    opacity: 1 !important;
}
.contextual-assistant-modal .contextual-assistant-question.btn-outline-primary:is(:hover, :focus-visible) {
    background-color: #214f93 !important;
    border-color: #214f93 !important;
    color: #fff !important;
}
.contextual-assistant-modal .contextual-assistant-bubble { color: #223242 !important; }
.contextual-assistant-modal .contextual-assistant-message--user .contextual-assistant-bubble { color: #fff !important; }

/* Assistente: la finestra è fuori da app-layout-content; serve uno scope globale. */
html[data-bs-theme="dark"] body .contextual-assistant-modal .modal-content,
html[data-bs-theme="dark"] body .contextual-assistant-modal .modal-header,
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-form {
    background: #1e3040 !important;
    color: #f1f6ff !important;
    border-color: #4b667e !important;
}
html[data-bs-theme="dark"] body .contextual-assistant-modal .modal-title,
html[data-bs-theme="dark"] body .contextual-assistant-modal .form-label { color: #f1f6ff !important; }
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-disclaimer,
html[data-bs-theme="dark"] body .contextual-assistant-modal .form-text { color: #ceddec !important; }
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-messages,
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-questions { background: #223548 !important; }
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-bubble {
    background: #344b62 !important; color: #f3f8ff !important; border-color: #55718d !important;
}
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-message--user .contextual-assistant-bubble {
    background: #265db0 !important; color: white !important;
}
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-question.btn-outline-primary {
    background: #274763 !important; color: #ecf5ff !important; border-color: #7b9fc2 !important;
}
html[data-bs-theme="dark"] body .contextual-assistant-modal .contextual-assistant-question.btn-outline-primary:is(:hover, :focus-visible) {
    background: #315d90 !important; color: #fff !important;
}
html[data-bs-theme="dark"] body .contextual-assistant-modal .form-control {
    background: #192c3b !important; color: #f0f5fc !important; border-color: #7792ac !important;
}
html[data-bs-theme="dark"] body .contextual-assistant-modal .form-control::placeholder { color: #c4d4e4 !important; }
html[data-bs-theme="dark"] body .contextual-assistant-modal .btn-close { filter: invert(1) grayscale(1); opacity: .95; }

/* Archivio: neutralizza le superfici bianche presenti negli stili inline originali. */
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.archive-card, .archive-stat, .archive-search, .archive-result, .archive-result-selected, .archive-lock),
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.archive-card, .archive-stat, .archive-search, .archive-result, .archive-result-selected, .archive-lock):is(:hover, :focus-within) {
    background: #223547 !important; color: #f0f6fe !important; border-color: #52718f !important;
}
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.archive-card, .archive-stat, .archive-search, .archive-result, .archive-result-selected, .archive-lock) :is(h1, h2, h3, h4, h5, h6, .fw-bold, .text-dark) { color: #f1f7ff !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.archive-card, .archive-stat, .archive-search, .archive-result, .archive-result-selected, .archive-lock) :is(.small, .text-muted, p, label) { color: #d1dfed !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.form-control, .form-select, input[type="text"], input[type="search"]) {
    background: #1b2e3e !important; color: #f5f9ff !important; border-color: #7794b1 !important;
}
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(input, textarea)::placeholder { color: #bccfe0 !important; opacity: 1; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-blue { color: #a9caff !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-green { color: #8ce7b2 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-cyan { color: #8ee9f0 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-orange { color: #ffd591 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-case-badge { color: #edf6ff !important; background: #274b6d !important; border-color: #668cad !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-privacy-note { color: #d4f9e4 !important; background: #1b4637 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-studio-doc { color: #f2e7ff !important; background: #54316c !important; border-color: #9677b5 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .studio-archive-hero .bg-white.bg-opacity-10 { background: rgba(8,30,51,.62) !important; color: #fff !important; }

/* Chat Studio: layout, allegati e area di composizione, desktop e mobile. */
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.chat-sidebar, .chat-sidebar-header, .chat-sidebar-list, .chat-studio-wrapper, .chat-studio-container, .studio-form-actions, .studio-form-scroll, .card-header, .card-footer) {
    background: #203345 !important; color: #edf5ff !important; border-color: #4e6b84 !important;
}
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .chat-sidebar-item { color: #eaf4ff !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .chat-sidebar-item:is(.active, :hover, :focus-visible) { background: #304e6a !important; color: #fff !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .chat-sidebar-item :is(.fw-bold, .small, .text-muted),
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.text-muted, .studio-meta, .form-text) { color: #c9dbeb !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-message:not(.mine) .studio-bubble,
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-message:not(.mine):is(:hover, :focus-within) .studio-bubble {
    background: #344e66 !important; color: #f1f6ff !important;
}
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-message.mine .studio-bubble,
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-message.mine:is(:hover, :focus-within) .studio-bubble {
    background: #1f59aa !important; color: #fff !important;
}
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-bubble :is(p, span, .small, .text-muted) { color: inherit !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-reply-bar,
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout .studio-reply-preview { background: #2d475c !important; color: #ecf5ff !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.form-control, textarea, select) {
    background: #192e40 !important; color: #eef6ff !important; border-color: #7290ae !important;
}
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.form-control, textarea)::placeholder { color: #c7d6e4 !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.bg-white, .bg-light, .alert-light) {
    background: #2a4155 !important; color: #eff6ff !important;
}
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.btn-outline-primary, .btn-outline-success, .btn-outline-secondary) { color: #d4e6fa !important; border-color: #82a3c7 !important; }
html[data-bs-theme="dark"] .app-layout-content .chat-studio-layout :is(.btn-outline-primary, .btn-outline-success, .btn-outline-secondary):is(:hover, :focus-visible) { color: #fff !important; background: #315a82 !important; }
