/* Tokens de tema — claro / escuro */
html[data-theme="dark"] {
  --bg: #0b1122;
  --card: #111a2e;
  --border: #1f2a47;
  --text: #f2f4fa;
  --text-soft: #e6e9f2;
  --text-muted: #a9b0c3;
  --accent: #5b7fff;
  --positive: #34d6a8;
  --alert: #ff8a75;
  --field-bg: #16213a;
  --field-text: #f2f4fa;
  --field-border: rgba(91, 127, 255, 0.42);
  --field-placeholder: #c2cadc;
  --field-empty-border: rgba(91, 127, 255, 0.55);
  --field-disabled-bg: #1a2338;
  --field-disabled-text: #7f8aa6;
  --surface-nested: #0d1428;
  --nav-dot-idle: #26314f;
  --positive-soft: rgba(52, 214, 168, 0.1);
  --positive-muted: #d5efe6;
  --accent-light: #8fa6ff;
  --accent-gradient-end: #3fa9f5;
  --text-deck-body: #c9d0e0;
  --text-on-accent: #ffffff;
  --alert-soft: rgba(255, 138, 117, 0.08);
  --alert-border-soft: rgba(255, 138, 117, 0.35);
  --alert-label: #ffb4a5;
  --selo-icms-bg: #3a56c9;
  --selo-ibs-bg: #5b7fff;
  --selo-cbs-bg: #8fa6ff;
  --deck-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --surface-elevated: #16213a;
  --accent-soft-box: rgba(91, 127, 255, 0.1);
  --positive-border-soft: rgba(52, 214, 168, 0.28);
  --warn-soft: rgba(255, 176, 46, 0.12);
  --warn-border-soft: rgba(255, 176, 46, 0.35);
  --warn-text: #ffb4a5;
  --warn-text-strong: #ff8a75;
  --table-row-highlight: rgba(91, 127, 255, 0.12);
  --doc-surface: #0b1222;
  --doc-text: #e6e9f2;
  --doc-text-strong: #f2f4fa;
  --doc-border: rgba(91, 127, 255, 0.38);
  --doc-scrollbar-track: rgba(15, 23, 42, 0.35);
  --doc-scrollbar-thumb: rgba(91, 127, 255, 0.45);
  --slider-track: #2a3a5e;
}

html[data-theme="light"] {
  --bg: #ecf1f8;
  --card: #ffffff;
  --border: #d7e3f0;
  --text: #0d3c56;
  --text-soft: #1f2937;
  --text-muted: #4b6b80;
  --accent: #06b6d4;
  --positive: #10b981;
  --alert: #f59e0b;
  --field-bg: #ffffff;
  --field-text: #0d3c56;
  --field-border: #b8d4e8;
  --field-placeholder: #64748b;
  --field-empty-border: #b8d4e8;
  --surface-elevated: #ffffff;
  --accent-soft-box: rgba(6, 182, 212, 0.08);
  --positive-soft: rgba(16, 185, 129, 0.12);
  --positive-border-soft: rgba(56, 178, 172, 0.22);
  --icon-tile-bg: #e6f4fa;
  --surface-muted: #dbe6f0;
  --text-on-muted: #7a90a3;
  --text-on-accent: #ffffff;
  --card-shadow: 0 8px 28px rgba(13, 60, 86, 0.08);
  --warn-soft: #fffbeb;
  --warn-border-soft: #fcd34d;
  --warn-text: #92400e;
  --warn-text-strong: #78350f;
  --table-row-highlight: #eff6ff;
  --doc-surface: #ffffff;
  --doc-text: #1f2937;
  --doc-text-strong: #1f2937;
  --doc-border: #c5d0dc;
  --doc-scrollbar-track: #eef2f7;
  --doc-scrollbar-thumb: #94a3b8;
}

/* Botão alternar tema (mesma linha visual dos botões do cabeçalho) */
.botaoTema {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 8px 12px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.12s, color 0.12s;
}

.botaoTema:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.botaoTema:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.botaoTema-icone {
  display: block;
}

/* Tela de login: visual fixo — não acompanha alternância claro/escuro */
html[data-theme="light"] body.login-ativo,
html[data-theme="dark"] body.login-ativo {
  background:
    radial-gradient(ellipse 65% 50% at 12% -5%, rgba(91, 127, 255, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 45% at 90% 105%, rgba(52, 214, 168, 0.1), transparent 50%),
    linear-gradient(165deg, #070b14 0%, #0a1120 45%, #060a13 100%) !important;
  background-attachment: scroll !important;
  color: #f3f5fb !important;
}

html[data-theme="light"] body.login-ativo .login-brand,
html[data-theme="dark"] body.login-ativo .login-brand {
  color: #8b9bb5 !important;
}

html[data-theme="light"] body.login-ativo .login-sub,
html[data-theme="dark"] body.login-ativo .login-sub {
  color: #9aa6c7 !important;
}

html[data-theme="light"] body.login-ativo .login-foot,
html[data-theme="dark"] body.login-ativo .login-foot,
html[data-theme="light"] body.login-ativo .botaoPreview,
html[data-theme="dark"] body.login-ativo .botaoPreview,
html[data-theme="light"] body.login-ativo .site-footer-copy,
html[data-theme="dark"] body.login-ativo .site-footer-copy {
  color: #6b7797 !important;
}

html[data-theme="light"] body.login-ativo .botaoLogin,
html[data-theme="dark"] body.login-ativo .botaoLogin {
  background: #fff !important;
  color: #0e1526 !important;
  border-color: #d7ddec !important;
}
