/* =========================================================================
   Modo escuro do SAT — camada de correções (carregada depois de custom-theme.css, via ThemeAsset).
   Convenção: tudo aqui é escopado em html[data-theme="dark"]; nada afeta o modo claro.
   Paleta (mesma do restante do tema escuro):
     fundo da página #0b1220 · superfície #111827 · superfície 2 #0f172a · linha #273244 / #1f2937
     texto #e5e7eb · texto forte #f1f5f9 · texto suave #94a3b8 · texto fraco #64748b · destaque #60a5fa
   ========================================================================= */

/* ---- Breadcrumb: os links vinham em #444 sobre fundo escuro ---- */
html[data-theme="dark"] .breadcrumb > li > a { color: #94a3b8; }
html[data-theme="dark"] .breadcrumb > li > a:hover { color: #e5e7eb; }
html[data-theme="dark"] .breadcrumb > .active { color: #e5e7eb; }

/* ---- Botões: o link claro global (a { color: #93c5fd; }) vazava para dentro dos botões em <a> ---- */
html[data-theme="dark"] .btn.btn-primary, html[data-theme="dark"] a.btn.btn-primary { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }
html[data-theme="dark"] .btn.btn-primary:hover, html[data-theme="dark"] .btn.btn-primary:focus { background: var(--ui-accent-dark); border-color: var(--ui-accent-dark); color: #fff; }
html[data-theme="dark"] .btn.btn-success, html[data-theme="dark"] a.btn.btn-success { background: #15803d; border-color: #15803d; color: #fff; }
html[data-theme="dark"] .btn.btn-success:hover, html[data-theme="dark"] .btn.btn-success:focus { background: #166534; border-color: #166534; color: #fff; }
html[data-theme="dark"] .btn.btn-danger, html[data-theme="dark"] a.btn.btn-danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
html[data-theme="dark"] .btn.btn-danger:hover, html[data-theme="dark"] .btn.btn-danger:focus { background: #991b1b; border-color: #991b1b; color: #fff; }
html[data-theme="dark"] .btn.btn-warning, html[data-theme="dark"] a.btn.btn-warning { background: #b45309; border-color: #b45309; color: #fff; }
html[data-theme="dark"] .btn.btn-warning:hover, html[data-theme="dark"] .btn.btn-warning:focus { background: #92400e; border-color: #92400e; color: #fff; }
html[data-theme="dark"] .btn.btn-info, html[data-theme="dark"] a.btn.btn-info { background: #0e7490; border-color: #0e7490; color: #fff; }
html[data-theme="dark"] .btn.btn-info:hover, html[data-theme="dark"] .btn.btn-info:focus { background: #155e75; border-color: #155e75; color: #fff; }
html[data-theme="dark"] a.btn.btn-default { color: #e5e7eb; }

/* ---- Painel do Assistente de Ajuda (aparece em todas as telas) ---- */
html[data-theme="dark"] #hcw-panel { background: #111827; border-left: 1px solid #273244; color: #e5e7eb; }
html[data-theme="dark"] .hcw-head { border-bottom-color: #1f2937; }
html[data-theme="dark"] .hcw-head .t { color: #f1f5f9; }
html[data-theme="dark"] .hcw-head .t small { color: #fbbf24; }
html[data-theme="dark"] .hcw-head a, html[data-theme="dark"] .hcw-head button { color: #94a3b8; }
html[data-theme="dark"] .hcw-head a:hover, html[data-theme="dark"] .hcw-head button:hover { color: #f1f5f9; }
html[data-theme="dark"] .hcw-log { background: #0b1220; }
html[data-theme="dark"] .hcw-msg.user .b { background: var(--ui-accent); color: #fff; }
html[data-theme="dark"] .hcw-msg.bot .b { background: #1f2937; color: #e5e7eb; }
html[data-theme="dark"] .hcw-msg .b code { background: #0f172a; color: #e5e7eb; }
html[data-theme="dark"] .hcw-note, html[data-theme="dark"] .hcw-typing { color: #94a3b8; }
html[data-theme="dark"] .hcw-sugg button { background: #0f172a; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .hcw-in { border-top-color: #1f2937; }
html[data-theme="dark"] .hcw-in textarea { background: #0f172a; border-color: #334155; color: #e5e7eb; }
html[data-theme="dark"] .hcw-in textarea:focus { border-color: #60a5fa; }
html[data-theme="dark"] .hcw-in button { background: var(--ui-accent); }

/* ---- Etiquetas (AdminLTE usa !important nos fundos) ---- */
html[data-theme="dark"] .label-success { background-color: #15803d !important; color: #fff !important; }
html[data-theme="dark"] .label-danger { background-color: #b91c1c !important; color: #fff !important; }
html[data-theme="dark"] .label-warning { background-color: #b45309 !important; color: #fff !important; }
html[data-theme="dark"] .label-info, html[data-theme="dark"] .label-primary { background-color: var(--ui-accent-dark) !important; color: #fff !important; }
html[data-theme="dark"] .label-default { background-color: #475569 !important; color: #f1f5f9 !important; }
html[data-theme="dark"] .badge { background-color: #334155; color: #f1f5f9; }

/* ---- Caixas coloridas do AdminLTE (small-box / info-box / callout) ---- */
html[data-theme="dark"] .bg-aqua, html[data-theme="dark"] .bg-aqua-active { background-color: #0e7490 !important; color: #fff !important; }
html[data-theme="dark"] .bg-green, html[data-theme="dark"] .bg-green-active { background-color: #15803d !important; color: #fff !important; }
html[data-theme="dark"] .bg-yellow, html[data-theme="dark"] .bg-yellow-active { background-color: #b45309 !important; color: #fff !important; }
html[data-theme="dark"] .bg-red, html[data-theme="dark"] .bg-red-active { background-color: #b91c1c !important; color: #fff !important; }
html[data-theme="dark"] .bg-blue, html[data-theme="dark"] .bg-light-blue, html[data-theme="dark"] .bg-light-blue-active { background-color: var(--ui-accent-dark) !important; color: #fff !important; }
html[data-theme="dark"] .bg-purple { background-color: #7e22ce !important; color: #fff !important; }
html[data-theme="dark"] .bg-teal { background-color: #0f766e !important; color: #fff !important; }
html[data-theme="dark"] .small-box h3, html[data-theme="dark"] .small-box p, html[data-theme="dark"] .small-box .icon, html[data-theme="dark"] .small-box-footer { color: #fff !important; }
html[data-theme="dark"] .callout { background-color: #111827 !important; border-color: #273244; color: #e5e7eb !important; }
html[data-theme="dark"] .callout h4, html[data-theme="dark"] .callout p { color: inherit; }
html[data-theme="dark"] .callout.callout-info { border-left-color: #0e7490; }
html[data-theme="dark"] .callout.callout-warning { border-left-color: #b45309; }
html[data-theme="dark"] .callout.callout-danger { border-left-color: #b91c1c; }
html[data-theme="dark"] .callout.callout-success { border-left-color: #15803d; }
html[data-theme="dark"] .alert-success, html[data-theme="dark"] .alert-info, html[data-theme="dark"] .alert-warning, html[data-theme="dark"] .alert-danger { color: #f1f5f9 !important; }

/* ---- Código ---- */
html[data-theme="dark"] code, html[data-theme="dark"] kbd, html[data-theme="dark"] samp { background-color: #1f2937; color: #fca5a5; border: 0; }
html[data-theme="dark"] pre { background-color: #0f172a; color: #e5e7eb; border-color: #273244; }

/* ---- Gráficos (ApexCharts) ---- */
html[data-theme="dark"] .apexcharts-text, html[data-theme="dark"] .apexcharts-xaxis-label, html[data-theme="dark"] .apexcharts-yaxis-label, html[data-theme="dark"] .apexcharts-datalabel-label, html[data-theme="dark"] .apexcharts-legend-text { fill: #94a3b8 !important; color: #cbd5e1 !important; }
html[data-theme="dark"] .apexcharts-title-text, html[data-theme="dark"] .apexcharts-datalabel-value { fill: #e5e7eb !important; }
html[data-theme="dark"] .apexcharts-gridline, html[data-theme="dark"] .apexcharts-xaxis-tick, html[data-theme="dark"] .apexcharts-xaxis line { stroke: #273244 !important; }
html[data-theme="dark"] .apexcharts-tooltip { background: #111827 !important; border-color: #273244 !important; color: #e5e7eb !important; box-shadow: 0 6px 20px rgba(0,0,0,.5) !important; }
html[data-theme="dark"] .apexcharts-tooltip-title { background: #0f172a !important; border-bottom-color: #273244 !important; color: #e5e7eb !important; }
html[data-theme="dark"] .apexcharts-xaxistooltip, html[data-theme="dark"] .apexcharts-yaxistooltip { background: #111827 !important; border-color: #273244 !important; color: #e5e7eb !important; }
html[data-theme="dark"] .apexcharts-menu { background: #111827 !important; border-color: #273244 !important; }
html[data-theme="dark"] .apexcharts-menu-item:hover { background: #1f2937 !important; }

/* ---- Select2 (tema krajee-bs3 usado nos formulários) ---- */
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection, html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection--single, html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection--multiple { background-color: #0f172a; border-color: #334155; color: #e5e7eb; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection--single .select2-selection__rendered { color: #e5e7eb; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection__placeholder, html[data-theme="dark"] .select2-selection__placeholder { color: #64748b !important; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection--single .select2-selection__arrow b, html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: #94a3b8 transparent transparent transparent; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-dropdown, html[data-theme="dark"] .select2-container--krajee-bs3 .select2-results__option { background-color: #111827; color: #e5e7eb; border-color: #334155; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-results__option--highlighted[aria-selected], html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--ui-accent); color: #fff; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-selection--multiple .select2-selection__choice { background-color: #1f2937; border-color: #334155; color: #e5e7eb; }
html[data-theme="dark"] .select2-container--krajee-bs3 .select2-search--dropdown .select2-search__field { background: #0f172a; color: #e5e7eb; border-color: #334155; }

/* ---- Calendário (bootstrap-datepicker) ---- */
html[data-theme="dark"] .datepicker-dropdown, html[data-theme="dark"] .datepicker.dropdown-menu { background: #111827; border-color: #273244; color: #e5e7eb; }
html[data-theme="dark"] .datepicker-dropdown:before, html[data-theme="dark"] .datepicker-dropdown:after { border-bottom-color: #111827; border-top-color: #111827; }
html[data-theme="dark"] .datepicker table tr td, html[data-theme="dark"] .datepicker table tr th { color: #e5e7eb; }
html[data-theme="dark"] .datepicker table tr th.dow { color: #94a3b8; }
html[data-theme="dark"] .datepicker table tr td.old, html[data-theme="dark"] .datepicker table tr td.new, html[data-theme="dark"] .datepicker table tr td.old.day, html[data-theme="dark"] .datepicker table tr td.new.day { color: #7c8aa0 !important; }
html[data-theme="dark"] .datepicker table tr td.disabled, html[data-theme="dark"] .datepicker table tr td.disabled:hover, html[data-theme="dark"] .datepicker table tr td.disabled.day { color: #64748b !important; background: transparent !important; }
html[data-theme="dark"] .datepicker table tr td.day:hover, html[data-theme="dark"] .datepicker table tr td.focused, html[data-theme="dark"] .datepicker .datepicker-switch:hover, html[data-theme="dark"] .datepicker .prev:hover, html[data-theme="dark"] .datepicker .next:hover, html[data-theme="dark"] .datepicker tfoot tr th:hover { background: #1f2937 !important; color: #fff !important; }
html[data-theme="dark"] .datepicker table tr td.today { background: #422006 !important; color: #fcd34d !important; }
html[data-theme="dark"] .datepicker table tr td.active, html[data-theme="dark"] .datepicker table tr td.active:hover, html[data-theme="dark"] .datepicker table tr td.active.active { background: var(--ui-accent) !important; color: #fff !important; text-shadow: none; }
html[data-theme="dark"] .datepicker table tr td span.month:hover, html[data-theme="dark"] .datepicker table tr td span.year:hover { background: #1f2937; }
html[data-theme="dark"] .datepicker table tr td span.active, html[data-theme="dark"] .datepicker table tr td span.active:hover { background: var(--ui-accent); color: #fff; }

/* ---- Mural (Notice): a prévia e o quadro usam --bg/--c definidos por nível (info/aviso/urgente) ---- */
html[data-theme="dark"] .pv { background: color-mix(in srgb, var(--c, #2563eb) 14%, #0b1220); }
html[data-theme="dark"] .pv .ok { background: #0f172a; }

/* ---- Mural de recados: a tela redefine --ink/--mut/--line localmente (.nb) e os cartões usam --c/--bg por nível ---- */
html[data-theme="dark"] .nb { --ink: #e5e7eb; --mut: #9ca3af; --line: #273244; --brand: #60a5fa; }
html[data-theme="dark"] .mr-card, html[data-theme="dark"] .pv { background: color-mix(in srgb, var(--c, #2563eb) 14%, #0b1220); }
html[data-theme="dark"] .mr-ok { background: #0f172a; }
html[data-theme="dark"] .mr-h, html[data-theme="dark"] .nb-side h2 { color: #94a3b8; }
html[data-theme="dark"] .nb-sw i, html[data-theme="dark"] .tp-sw i { background: #475569; }
html[data-theme="dark"] .nb-sw input:checked + i { background: #059669; }
html[data-theme="dark"] .tp.live .tp-sw i { background: #16a34a; }

/* ---- Selos de situação (texto branco sobre verde/cinza precisa de fundo mais escuro) ---- */
html[data-theme="dark"] .st-ok, html[data-theme="dark"] .st-badge.st-ok, html[data-theme="dark"] .proc-sit.on { background-color: #15803d !important; color: #fff !important; }
html[data-theme="dark"] .st-off, html[data-theme="dark"] .st-badge.st-off, html[data-theme="dark"] .proc-sit.off { background-color: #475569 !important; color: #f1f5f9 !important; }
html[data-theme="dark"] .pd-n { color: #94a3b8; }

/* ---- Mural: botão principal e seleção segmentada mantêm o azul sólido (o --brand claro é só para texto) ---- */
html[data-theme="dark"] .nb-btn { background: var(--ui-accent); color: #fff; }
html[data-theme="dark"] .nb-btn:hover { background: var(--ui-accent-dark); }
html[data-theme="dark"] .nb-seg input:checked + span { background: var(--lc, #2563eb); border-color: var(--lc, #2563eb); color: #fff; }

/* ---- Mural: botões secundários/destrutivos e contador da página inicial ---- */
html[data-theme="dark"] .nb-btn.ghost { background: var(--ui-surface-2); color: var(--ui-ink-2); border-color: var(--ui-line-strong); }
html[data-theme="dark"] .nb-btn.ghost:hover { background: var(--ui-surface-3); color: var(--ui-ink); }
html[data-theme="dark"] .nb-btn.red { background: var(--ui-surface-2); color: var(--ui-danger-ink); border-color: var(--ui-danger-line); }
html[data-theme="dark"] .nb-btn.red:hover { background: var(--ui-danger); color: #fff; }
html[data-theme="dark"] b.pd-n { color: #94a3b8; }

/* bordas claras que sobravam no escuro: assistente de ajuda (cabeçalho, rodapé, campo) e edição rápida (.qe) */
html[data-theme="dark"] .hcw-head { border-bottom-color: var(--ui-line); }
html[data-theme="dark"] .hcw-in { border-top-color: var(--ui-line); }
html[data-theme="dark"] .hcw-in textarea { border-color: var(--ui-line-strong); }
html[data-theme="dark"] .qe { border-bottom-color: var(--ui-line-strong); }

/* links que são botões coloridos: o estilo geral de link do escuro não pode pintar o texto de azul claro */
html[data-theme="dark"] a.btn-success, html[data-theme="dark"] a.btn-danger, html[data-theme="dark"] a.btn-warning,
html[data-theme="dark"] a.btn-info, html[data-theme="dark"] a.btn-success:hover, html[data-theme="dark"] a.btn-danger:hover,
html[data-theme="dark"] a.btn-warning:hover, html[data-theme="dark"] a.btn-info:hover { color: #fff; }
