/* ══════════ Tema escuro do portal (botão lua/sol na barra superior) ══════════
   Liga com <html data-tema="escuro">. A escolha fica salva no navegador (localStorage "tema").
   Só troca as cores de fundo/texto: o dourado de cada empresa continua o mesmo. */

html[data-tema="escuro"] {
  color-scheme: dark;
  --bg: #0F1115;
  --surface: #181B21;
  --text: #E8E6E1;
  --muted: #9C978D;
  --accent-dark: color-mix(in srgb, var(--accent) 82%, #fff);
  --line: color-mix(in srgb, var(--text) 13%, transparent);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.7), 0 2px 6px rgba(0,0,0,.35);
}
html[data-tema="escuro"] body { background: var(--bg); color: var(--text); }
html[data-tema="escuro"] .topbar { border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }

/* menu do usuário, login e pequenos ajustes do portal.css */
html[data-tema="escuro"] .tb-user .menu { background: #1E2128; color: var(--text); }
html[data-tema="escuro"] .tb-user .menu a:hover { background: #262A32; }
html[data-tema="escuro"] .menu-mail { color: var(--muted); border-bottom-color: #2C3039; }
html[data-tema="escuro"] .seg, html[data-tema="escuro"] .login-box .inp { background: var(--bg); }
html[data-tema="escuro"] .tag-off, html[data-tema="escuro"] .flash-error { background: #3A1E1C; color: #F2A79E; }
html[data-tema="escuro"] .flash-success { background: #1C3020; color: #A6D99A; }
html[data-tema="escuro"] .flash-warning { background: #3A2E14; color: #F0C977; }
html[data-tema="escuro"] .logo-circle { background: #F4F1EA; }   /* logos foram feitos para fundo claro */

/* campos e tabelas genéricos */
html[data-tema="escuro"] input, html[data-tema="escuro"] select, html[data-tema="escuro"] textarea { color: var(--text); }
html[data-tema="escuro"] .inp { background: var(--bg); border-color: color-mix(in srgb, var(--text) 16%, transparent); }
html[data-tema="escuro"] dialog { background: var(--surface); color: var(--text); }
html[data-tema="escuro"] dialog::backdrop { background: rgba(0,0,0,.65); }
html[data-tema="escuro"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-tema="escuro"] ::-webkit-scrollbar-thumb { background: #2E323B; border-radius: 8px; }
html[data-tema="escuro"] ::-webkit-scrollbar-track { background: transparent; }

/* botão do tema */
.tb-tema { cursor: pointer; background: none; font: inherit; padding: .45rem .6rem; }
.tb-tema .ms { width: 1.15rem; height: 1.15rem; }
.tb-tema .lua { display: inline; } .tb-tema .sol { display: none; }
html[data-tema="escuro"] .tb-tema .lua { display: none; }
html[data-tema="escuro"] .tb-tema .sol { display: inline; }
html.tema-trocando, html.tema-trocando * { transition: background-color .25s, color .25s, border-color .25s !important; }

/* cartões das empresas (página do Grupo) */
html[data-tema="escuro"] .card { border-color: rgba(255,255,255,.05); }
html[data-tema="escuro"] .card-head { background: #20232A; }
html[data-tema="escuro"] .st-pendente .card-head { background: #3A1E1C; }
html[data-tema="escuro"] .st-inativo .card-head { background: #24262B; }
html[data-tema="escuro"] .status b { color: #8BC97A; }
html[data-tema="escuro"] .status .bar { background: #6FB35E; }
html[data-tema="escuro"] .st-pendente .status b { color: #F0786C; }
html[data-tema="escuro"] .status small, html[data-tema="escuro"] .login-help, html[data-tema="escuro"] .login-secure { color: var(--muted); }
html[data-tema="escuro"] .tag-on { color: #A6D99A; background: #1C3020; }
html[data-tema="escuro"] .seg input:checked + label { background: #2A2D35; }
