/* HORIZON SGE 29.9 — Dark Mode de escopo isolado
   O tema é aplicado apenas em #horizon-sge-app, evitando repintura do WordPress/tema externo. */
#horizon-sge-app.hsg-dark{
 --hsg-dark-bg:#07111f;--hsg-dark-bg-2:#0b1727;--hsg-dark-surface:#101e30;--hsg-dark-surface-2:#15263a;
 --hsg-dark-surface-3:#1a2e45;--hsg-dark-border:#2c4259;--hsg-dark-text:#edf5fd;--hsg-dark-muted:#9fb1c5;
 --hsg-dark-blue:#5ba9ef;color-scheme:dark;background:var(--hsg-dark-bg);color:var(--hsg-dark-text);
}
#horizon-sge-app.hsg-dark #system-container{
 --ws-bg:var(--hsg-dark-bg);--ws-surface:var(--hsg-dark-surface);--ws-surface-2:var(--hsg-dark-surface-2);
 --ws-surface-3:var(--hsg-dark-surface-3);--ws-text:var(--hsg-dark-text);--ws-muted:var(--hsg-dark-muted);--ws-border:var(--hsg-dark-border);
 background:var(--hsg-dark-bg)!important;color:var(--hsg-dark-text)!important;
}
#horizon-sge-app.hsg-dark :where(.main-content,.content-area,.view-section){background:var(--hsg-dark-bg)!important;color:var(--hsg-dark-text)!important}
#horizon-sge-app.hsg-dark #landing-page{background:radial-gradient(circle at 18% 14%,rgba(26,117,211,.16),transparent 34%),linear-gradient(135deg,#050b14,#0a1626 55%,#0d2036)!important;color:var(--hsg-dark-text)!important}
#horizon-sge-app.hsg-dark #landing-page :where(.login-card,.role-option,.login-section,.institution-brand-login){background:var(--hsg-dark-surface)!important;color:var(--hsg-dark-text)!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark #landing-page .role-option.active{background:#163a60!important;border-color:#4f9ee5!important;color:#fff!important}
#horizon-sge-app.hsg-dark #landing-page :where(h1,h2,h3,strong,label){color:var(--hsg-dark-text)!important}
#horizon-sge-app.hsg-dark #landing-page :where(p,small,.field-hint,.actions,.remember-me){color:var(--hsg-dark-muted)!important}
#horizon-sge-app.hsg-dark :where(input:not([type=checkbox]):not([type=radio]),select,textarea){background:#0b1727!important;color:var(--hsg-dark-text)!important;border-color:#344b63!important;box-shadow:none!important}
#horizon-sge-app.hsg-dark :where(input,textarea)::placeholder{color:#71869b!important;opacity:1}
#horizon-sge-app.hsg-dark option{background:#0b1727!important;color:var(--hsg-dark-text)!important}
#horizon-sge-app.hsg-dark :where(.top-header,.profile-dropdown,.h29-notification-panel,.h29-appearance-panel){background:var(--hsg-dark-surface)!important;color:var(--hsg-dark-text)!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark :where(.menu-toggle,.hx-search,.h29-notification-trigger,#hsgThemeToggle,.profile-trigger,.icon-btn){background:var(--hsg-dark-surface-2)!important;color:#dcecff!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark :where(#page-title,.profile-name,.profile-dropdown button,h1,h2,h3,h4,h5,h6,strong,b){color:var(--hsg-dark-text)!important}
#horizon-sge-app.hsg-dark :where(p,small,label,.muted,.hsg28-eyebrow,.form-hint,.profile-name small){color:var(--hsg-dark-muted)!important}

/* Superfícies do sistema — agrupadas por componentes, sem seletores globais sobre o site inteiro. */
#horizon-sge-app.hsg-dark :where(
 .card,.stat-card,.dashboard-card,.content-card,.widget,.panel,.panel-card,.section-card,.list-card,.form-card,
 .table-wrapper,.table-container,.action-bar,.calendar-container,.calendar-event-item,.comunicado-card,.risk-summary,.risk-summary-item,
 .ia-chat-container,.detail-item,.empty-state,.modal,.modal-content,.hsg15-card,.hsg16-card,.hsg17-card,.hsg18-card,.hsg19-card,
 .hsg20-card,.hsg20-panel,.hsg21-card,.hsg21-panel,.hsg23-panel,.hsg24-panel,.hsg24-k,.hsg28-card,.hsg28-shell,.hsg28-toolbar,
 .hsg28-profile-section,.hsg281-doc-card,.hsg281-hub-section,.hsg282-master-card,.h32-dialog,.h32-note,.h34-filters,.h32-archive,
 .library-source-intro,.library-toolbar,.library-card,.library-empty,.library-editor,.library-editor>header,.library-editor form>footer,
 .hsg18-doc-preview,.carteirinha,.hsg18-student-card,.digital-card,.tonico-panel,.tonico-messages,.tonico-form,
 .h38-attachments,.h38-photo-card,.h38-doc-card,.h38-file-row
){background:var(--hsg-dark-surface)!important;color:var(--hsg-dark-text)!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark :where(.h32-note,.h34-filters,.h32-archive,.library-cover,.library-upload-label,.h38-attachments,.h38-photo-card,.h38-doc-card,.h38-file-row){background:var(--hsg-dark-surface-2)!important}
#horizon-sge-app.hsg-dark :where(.hsg28-card,.library-card,.stat-card,.dashboard-card,.content-card){box-shadow:0 7px 20px rgba(0,0,0,.14)!important}
#horizon-sge-app.hsg-dark table{background:var(--hsg-dark-surface)!important;color:var(--hsg-dark-text)!important}
#horizon-sge-app.hsg-dark table :where(th,td){border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark table th{background:var(--hsg-dark-surface-3)!important;color:#bed0e1!important}
#horizon-sge-app.hsg-dark table td{background:var(--hsg-dark-surface)!important;color:#dce7f3!important}
#horizon-sge-app.hsg-dark table tbody tr:hover td{background:var(--hsg-dark-surface-2)!important}
#horizon-sge-app.hsg-dark :where(.h32-actions button,.h32-archive footer button,.h32-cancel,.h34-filters button,.tonico-quick button){background:var(--hsg-dark-surface-3)!important;color:#dbeaff!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark .library-meta>span{background:#172a42!important;color:#bed0e1!important}
#horizon-sge-app.hsg-dark .hsg18-card-stage{background:linear-gradient(135deg,#0e1c2e,#13273e)!important;border-color:#29435d!important}
#horizon-sge-app.hsg-dark .digital-card-footer{background:#162b43!important;color:#8cc6fa!important;border-color:#2b4863!important}
#horizon-sge-app.hsg-dark .hsg18-code{background:#172a42!important;color:#b8c8d8!important}
#horizon-sge-app.hsg-dark .tonico-safety{background:#102b35!important;color:#bde4df!important;border-color:#214a4b!important}
#horizon-sge-app.hsg-dark :where(.h38-doc-icon,.h38-upload-btn,.h38-section-head>span){background:#17314c!important;color:#8ec8fb!important;border-color:#31536f!important}
#horizon-sge-app.hsg-dark .h38-photo-preview{background:#172a42!important;border-color:#31506a!important;color:#86a2bc!important}

/* Corrige componentes legados que ainda imprimem fundo branco inline. Escopo limitado ao aplicativo. */
#horizon-sge-app.hsg-dark #system-container [style*="background:#fff"],
#horizon-sge-app.hsg-dark #system-container [style*="background: #fff"],
#horizon-sge-app.hsg-dark #system-container [style*="background:white"],
#horizon-sge-app.hsg-dark #system-container [style*="background: white"]{background:var(--hsg-dark-surface)!important;color:var(--hsg-dark-text)!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark #system-container.h29-high-contrast{--ws-bg:#050b13;--ws-surface:#0d1928;--ws-text:#fff;--ws-border:#5c7188}
/* Componentes de acesso administrativo que em versões anteriores dependiam de body.hsg-dark. */
#horizon-sge-app.hsg-dark ~ .hsg295-profile-overlay .hsg295-profile-dialog,
#horizon-sge-app.hsg-dark .hsg295-profile-dialog{background:var(--hsg-dark-surface)!important;color:var(--hsg-dark-text)!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark ~ .hsg295-profile-overlay .hsg295-profile-card,
#horizon-sge-app.hsg-dark .hsg295-profile-card{background:var(--hsg-dark-surface-2)!important;color:var(--hsg-dark-text)!important;border-color:var(--hsg-dark-border)!important}
#horizon-sge-app.hsg-dark ~ .hsg295-profile-overlay .hsg295-profile-card small,
#horizon-sge-app.hsg-dark .hsg295-profile-card small{color:var(--hsg-dark-muted)!important}
