/* ==========================================================================
   DARK MODE - SISTEMA DE SAÚDE
   CSS não-intrusivo de alta fidelidade para adaptação de páginas Tailwind/HTML
   ========================================================================== */

/* Suavização de transições de cor */
html.dark,
html.dark body,
html.dark .bg-white,
html.dark [class*="bg-white"],
html.dark .bg-gray-50,
html.dark .bg-slate-50,
html.dark .bg-gray-100,
html.dark .bg-slate-100,
html.dark .bg-slate-200,
html.dark .bg-gray-200,
html.dark aside,
html.dark header,
html.dark footer,
html.dark nav,
html.dark input,
html.dark select,
html.dark textarea,
html.dark table {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Base Body e HTML */
html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #0b1120 !important;
  color: #e2e8f0 !important;
}

/* Backgrounds utilitários claros -> Tons escuros elegantes */
html.dark .bg-white,
html.dark [class*="bg-white/"],
html.dark .bg-gray-50,
html.dark [class*="bg-gray-50/"],
html.dark .bg-slate-50,
html.dark [class*="bg-slate-50/"] {
  background-color: #151f32 !important;
}

html.dark .bg-gray-100,
html.dark [class*="bg-gray-100/"],
html.dark .bg-slate-100,
html.dark [class*="bg-slate-100/"] {
  background-color: #1e293b !important;
}

html.dark .bg-gray-200,
html.dark [class*="bg-gray-200/"],
html.dark .bg-slate-200,
html.dark [class*="bg-slate-200/"] {
  background-color: #334155 !important;
}

/* Gradientes de fundo claros em cards/páginas */
html.dark [class*="from-slate-100"],
html.dark [class*="from-gray-100"],
html.dark [class*="from-slate-50"] {
  background-image: none !important;
  background-color: #0b1120 !important;
}

/* Textos principais e cabeçalhos */
html.dark h1:not([class*="text-white"]):not([class*="text-saude-"]):not([class*="text-emerald-"]):not([class*="text-green-"]):not([class*="text-blue-"]):not([class*="text-red-"]),
html.dark h2:not([class*="text-white"]):not([class*="text-saude-"]):not([class*="text-emerald-"]):not([class*="text-green-"]):not([class*="text-blue-"]):not([class*="text-red-"]),
html.dark h3:not([class*="text-white"]):not([class*="text-saude-"]):not([class*="text-emerald-"]):not([class*="text-green-"]):not([class*="text-blue-"]):not([class*="text-red-"]),
html.dark h4,
html.dark h5,
html.dark h6 {
  color: #f8fafc !important;
}

html.dark .text-gray-900,
html.dark .text-slate-900,
html.dark .text-gray-800,
html.dark .text-slate-800,
html.dark .text-gray-700,
html.dark .text-slate-700 {
  color: #e2e8f0 !important;
}

html.dark .text-gray-600,
html.dark .text-slate-600,
html.dark .text-gray-500,
html.dark .text-slate-500 {
  color: #94a3b8 !important;
}

html.dark .text-gray-400,
html.dark .text-slate-400 {
  color: #64748b !important;
}

/* Bordas e divisores */
html.dark .border,
html.dark [class*="border-gray-"],
html.dark [class*="border-slate-"],
html.dark hr,
html.dark .divide-y > *,
html.dark .divide-x > * {
  border-color: #2a374f !important;
}

/* Inputs, Selects, Textareas e formulários */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
html.dark select,
html.dark textarea {
  background-color: #101726 !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

html.dark select option {
  background-color: #151f32 !important;
  color: #f8fafc !important;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: #22c55e !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25) !important;
}

/* Tabelas e listagens */
html.dark table {
  background-color: #151f32 !important;
  border-color: #2a374f !important;
}

html.dark thead,
html.dark thead th,
html.dark th {
  background-color: #101726 !important;
  color: #cbd5e1 !important;
  border-color: #2a374f !important;
}

html.dark tbody tr {
  background-color: #151f32 !important;
}

html.dark tbody tr:nth-child(even) {
  background-color: #121c2e !important;
}

html.dark tbody tr:hover {
  background-color: #1e2d47 !important;
}

html.dark td {
  border-color: #2a374f !important;
  color: #e2e8f0 !important;
}

/* Modais, Dropdowns e Popups */
html.dark #perfilDropdown,
html.dark [id*="Dropdown"],
html.dark [id*="dropdown"],
html.dark [id*="modal"],
html.dark .modal-content,
html.dark [role="dialog"] {
  background-color: #151f32 !important;
  border-color: #334155 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5) !important;
}

/* ==========================================================================
   COMPONENTES BOOTSTRAP NO DARK MODE
   Garante suporte a Cards, Forms, Modais e Listas do Bootstrap
   ========================================================================== */
html.dark,
html[data-bs-theme="dark"] {
  --bs-body-color: #e2e8f0;
  --bs-body-color-rgb: 226, 232, 240;
  --bs-body-bg: #0b1120;
  --bs-body-bg-rgb: 11, 17, 32;
  --bs-secondary-color: #94a3b8;
  --bs-secondary-color-rgb: 148, 163, 184;
  --bs-tertiary-color: #64748b;
  --bs-border-color: #2a374f;
  --bs-card-bg: #151f32;
  --bs-card-border-color: #2a374f;
  --bs-card-color: #e2e8f0;
}

html.dark .card {
  background-color: #151f32 !important;
  border-color: #2a374f !important;
  color: #e2e8f0 !important;
}

html.dark .card-body {
  background-color: #151f32 !important;
  color: #e2e8f0 !important;
}

html.dark .card-header {
  background: #101726 !important;
  border-bottom-color: #2a374f !important;
  color: #f8fafc !important;
}

html.dark .card-footer {
  background-color: #101726 !important;
  border-top-color: #2a374f !important;
  color: #94a3b8 !important;
}

html.dark .form-label,
html.dark label {
  color: #cbd5e1 !important;
}

html.dark .form-text,
html.dark .text-muted,
html.dark .text-secondary,
html.dark [class*="text-muted"],
html.dark .text-black-50,
html.dark small.text-muted {
  color: #94a3b8 !important;
}

html.dark .form-check-label {
  color: #e2e8f0 !important;
}

html.dark .form-control-plaintext {
  color: #e2e8f0 !important;
}

/* Checkboxes e Switches Bootstrap no Dark Mode */
html.dark .form-check-input {
  background-color: #1e293b !important;
  border: 1px solid #475569 !important;
}

html.dark .form-check-input:checked {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
}

html.dark .form-check-input:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.25) !important;
}

html.dark .form-switch .form-check-input {
  background-color: #334155 !important;
  border-color: #475569 !important;
}

html.dark .form-switch .form-check-input:checked {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
}

html.dark input.form-control:disabled,
html.dark input.form-control[readonly],
html.dark select.form-select:disabled {
  background-color: #1a2538 !important;
  border-color: #2a374f !important;
  color: #cbd5e1 !important;
  opacity: 0.9 !important;
}

html.dark .list-group-item {
  background-color: #151f32 !important;
  border-color: #2a374f !important;
  color: #e2e8f0 !important;
}

html.dark .list-group-item-action:hover,
html.dark .list-group-item-action:focus {
  background-color: #1e2d47 !important;
  color: #f8fafc !important;
}

html.dark fieldset {
  border-color: #2a374f !important;
}

html.dark legend {
  color: #94a3b8 !important;
}

/* Sombras no Dark Mode */
html.dark .shadow,
html.dark .shadow-sm,
html.dark .shadow-md,
html.dark .shadow-lg,
html.dark .shadow-xl {
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5) !important;
}

/* Rodapés globais */
html.dark footer {
  background-color: #101726 !important;
  border-color: #2a374f !important;
}

html.dark footer span,
html.dark footer p {
  color: #94a3b8 !important;
}

/* Adaptação de Badges e Alertas comuns (Flash Messages e Cards) */
html.dark .bg-green-100 {
  background-color: rgba(34, 197, 94, 0.18) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
}
html.dark .bg-green-50 {
  background-color: rgba(34, 197, 94, 0.12) !important;
}
html.dark .border-green-200,
html.dark .border-green-300 {
  border-color: rgba(34, 197, 94, 0.3) !important;
}
html.dark .text-green-700,
html.dark .text-green-800 {
  color: #86efac !important;
}

html.dark .bg-red-100 {
  background-color: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
html.dark .bg-red-50,
html.dark .bg-rose-50 {
  background-color: rgba(239, 68, 68, 0.12) !important;
}
html.dark .border-red-200,
html.dark .border-red-300 {
  border-color: rgba(239, 68, 68, 0.3) !important;
}
html.dark .text-red-700,
html.dark .text-red-800 {
  color: #fca5a5 !important;
}

html.dark .bg-yellow-100 {
  background-color: rgba(234, 179, 8, 0.18) !important;
  border-color: rgba(234, 179, 8, 0.3) !important;
}
html.dark .bg-yellow-50,
html.dark .bg-amber-50 {
  background-color: rgba(234, 179, 8, 0.12) !important;
}
html.dark .border-yellow-200,
html.dark .border-yellow-300 {
  border-color: rgba(234, 179, 8, 0.3) !important;
}
html.dark .text-yellow-700,
html.dark .text-yellow-800 {
  color: #fde047 !important;
}

html.dark .bg-blue-100,
html.dark .bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.18) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}
html.dark .text-blue-700,
html.dark .text-blue-800 {
  color: #93c5fd !important;
}

html.dark .bg-pink-100,
html.dark .bg-pink-50 {
  background-color: rgba(236, 72, 153, 0.15) !important;
  border-color: rgba(236, 72, 153, 0.3) !important;
}
html.dark .text-pink-700,
html.dark .text-pink-800 {
  color: #f472b6 !important;
}

html.dark .bg-indigo-100,
html.dark .bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}
html.dark .text-indigo-700,
html.dark .text-indigo-800 {
  color: #a5b4fc !important;
}

html.dark .bg-violet-100,
html.dark .bg-violet-50 {
  background-color: rgba(139, 92, 246, 0.15) !important;
  border-color: rgba(139, 92, 246, 0.3) !important;
}
html.dark .text-violet-700,
html.dark .text-violet-800 {
  color: #c4b5fd !important;
}

html.dark .bg-cyan-100,
html.dark .bg-cyan-50 {
  background-color: rgba(6, 182, 212, 0.15) !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
}
html.dark .text-cyan-700,
html.dark .text-cyan-800 {
  color: #67e8f9 !important;
}

html.dark .bg-sky-100,
html.dark .bg-sky-50 {
  background-color: rgba(14, 165, 233, 0.15) !important;
  border-color: rgba(14, 165, 233, 0.3) !important;
}
html.dark .text-sky-700,
html.dark .text-sky-800 {
  color: #7dd3fc !important;
}

html.dark .bg-orange-100,
html.dark .bg-orange-50 {
  background-color: rgba(249, 115, 22, 0.15) !important;
  border-color: rgba(249, 115, 22, 0.3) !important;
}
html.dark .text-orange-700,
html.dark .text-orange-800 {
  color: #fdba74 !important;
}

html.dark .bg-amber-100,
html.dark .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
html.dark .text-amber-700,
html.dark .text-amber-800 {
  color: #fcd34d !important;
}

html.dark .bg-rose-100,
html.dark .bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.15) !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}
html.dark .text-rose-700,
html.dark .text-rose-800 {
  color: #fda4af !important;
}

html.dark .bg-emerald-100,
html.dark .bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
html.dark .text-emerald-700,
html.dark .text-emerald-800 {
  color: #6ee7b7 !important;
}

/* Scrollbar refinada no Dark Mode */
html.dark ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
html.dark ::-webkit-scrollbar-track {
  background: #0b1120;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #2a374f;
  border-radius: 5px;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #3b4e70;
}

/* ==========================================================================
   BOTÃO FLUTUANTE DE ALTERNÂNCIA (TOGGLE SUN/MOON)
   Inspirado no conceito SunMoonThemeToggle (21st.dev)
   Apresentação refinada, orbital e com alta performance (transform + opacity)
   ========================================================================== */
#dark-mode-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  width: 3.1rem;
  height: 3.1rem;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(254, 243, 199, 0.55) 50%, rgba(240, 249, 255, 0.92) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08), 0 0 14px rgba(245, 158, 11, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  overflow: hidden;
  color: #d97706; /* Âmbar / dourado suave e acolhedor para o sol diurno */
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1),
              box-shadow 0.4s ease,
              background 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.4s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html.dark #dark-mode-toggle {
  background: linear-gradient(135deg, #0b1329 0%, #172554 55%, #1e1b4b 100%);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.16);
  color: #e2e8f0; /* Prata lunar límpida com contraste ideal */
}

/* Foco acessível por teclado */
#dark-mode-toggle:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 4px 18px rgba(0, 0, 0, 0.15);
}

#dark-mode-toggle:focus:not(:focus-visible) {
  outline: none;
}

/* Estados interativos: Hover e Active */
#dark-mode-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.24), 0 3px 10px rgba(0, 0, 0, 0.1);
}

html.dark #dark-mode-toggle:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.28);
}

#dark-mode-toggle:active {
  transform: scale(0.93);
}

/* Camada atmosférica noturna com micro-estrelas estáticas */
.theme-toggle-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark .theme-toggle-sky {
  opacity: 1;
  transform: scale(1);
}

.theme-star {
  position: absolute;
  background: #f1f5f9;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 3px rgba(241, 245, 249, 0.9);
}

.theme-star-1 {
  top: 9px;
  left: 10px;
  width: 2.5px;
  height: 2.5px;
}

.theme-star-2 {
  top: 13px;
  left: 20px;
  width: 1.5px;
  height: 1.5px;
  opacity: 0.75;
}

.theme-star-3 {
  bottom: 10px;
  right: 11px;
  width: 2px;
  height: 2px;
  opacity: 0.85;
}

/* Envoltórios para animação orbital com aceleração por GPU */
.theme-icon-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  will-change: transform, opacity;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ícones SVG */
#dark-mode-toggle svg {
  width: 1.45rem;
  height: 1.45rem;
  display: block;
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Estado Diurno (Claro): Sol em destaque, Lua oculta na órbita inferior */
.theme-icon-sun {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

.theme-icon-moon {
  opacity: 0;
  transform: translate3d(-18px, 20px, 0) rotate(-60deg) scale(0.45);
}

/* Estado Noturno (Escuro): Lua em destaque, Sol em arco para órbita superior */
html.dark .theme-icon-sun {
  opacity: 0;
  transform: translate3d(20px, -20px, 0) rotate(60deg) scale(0.45);
}

html.dark .theme-icon-moon {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

/* Micro-rotação interativa no hover */
#dark-mode-toggle:hover .theme-icon-sun svg {
  transform: rotate(20deg);
}

html.dark #dark-mode-toggle:hover .theme-icon-moon svg {
  transform: rotate(-12deg);
}

/* Acessibilidade: Desativação de movimento orbital com prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #dark-mode-toggle,
  #dark-mode-toggle:hover,
  #dark-mode-toggle:active,
  .theme-icon-wrapper,
  .theme-toggle-sky,
  #dark-mode-toggle svg {
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    transform: none !important;
  }

  .theme-icon-sun {
    opacity: 1 !important;
    transform: none !important;
  }

  .theme-icon-moon {
    opacity: 0 !important;
    transform: none !important;
  }

  html.dark .theme-icon-sun {
    opacity: 0 !important;
    transform: none !important;
  }

  html.dark .theme-icon-moon {
    opacity: 1 !important;
  transform: none !important;
}
}

/* ==========================================================================
   PAINEL DE RISCO FAMILIAR - ADAPTAÇÃO MODO ESCURO
   ========================================================================== */
html.dark .header-risco-r3 {
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
html.dark .header-risco-r2 {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
html.dark .header-risco-r1 {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
html.dark .header-risco-sem {
  background-color: rgba(148, 163, 184, 0.12) !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
}

/* Card Composição do Score */
html.dark .card-composicao-score {
  background-color: #101726 !important;
  border-color: #2a374f !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35) !important;
}

html.dark .card-composicao-score span.text-gray-800 {
  color: #f1f5f9 !important;
}

html.dark .card-composicao-score .border-t {
  border-top-color: #2a374f !important;
}

html.dark .card-composicao-score span.text-gray-600,
html.dark .card-composicao-score i.text-gray-500 {
  color: #94a3b8 !important;
}

/* Valor zerado (sem ocorrência) */
html.dark .card-composicao-score span.text-gray-400 {
  color: #64748b !important;
}

/* Badges com contagem positiva (> 0) */
html.dark .card-composicao-score .bg-red-100 {
  background-color: rgba(239, 68, 68, 0.22) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
}
html.dark .card-composicao-score .bg-indigo-100 {
  background-color: rgba(99, 102, 241, 0.22) !important;
  color: #a5b4fc !important;
  border: 1px solid rgba(99, 102, 241, 0.45) !important;
}
html.dark .card-composicao-score .bg-violet-100 {
  background-color: rgba(139, 92, 246, 0.22) !important;
  color: #c4b5fd !important;
  border: 1px solid rgba(139, 92, 246, 0.45) !important;
}
html.dark .card-composicao-score .bg-cyan-100 {
  background-color: rgba(6, 182, 212, 0.22) !important;
  color: #67e8f9 !important;
  border: 1px solid rgba(6, 182, 212, 0.45) !important;
}
html.dark .card-composicao-score .bg-pink-100 {
  background-color: rgba(236, 72, 153, 0.22) !important;
  color: #f472b6 !important;
  border: 1px solid rgba(236, 72, 153, 0.45) !important;
}
html.dark .card-composicao-score .bg-orange-100 {
  background-color: rgba(249, 115, 22, 0.22) !important;
  color: #fdba74 !important;
  border: 1px solid rgba(249, 115, 22, 0.45) !important;
}
html.dark .card-composicao-score .bg-yellow-100 {
  background-color: rgba(234, 179, 8, 0.22) !important;
  color: #fde047 !important;
  border: 1px solid rgba(234, 179, 8, 0.45) !important;
}
html.dark .card-composicao-score .bg-sky-100 {
  background-color: rgba(14, 165, 233, 0.22) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(14, 165, 233, 0.45) !important;
}
html.dark .card-composicao-score .bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.22) !important;
  color: #fcd34d !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
}
html.dark .card-composicao-score .bg-rose-100 {
  background-color: rgba(244, 63, 94, 0.22) !important;
  color: #fda4af !important;
  border: 1px solid rgba(244, 63, 94, 0.45) !important;
}
html.dark .card-composicao-score .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
}
html.dark .card-composicao-score .bg-slate-200 {
  background-color: #334155 !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
}

/* Ícones com cores vibrantes no escuro */
html.dark .card-composicao-score i.text-red-600 { color: #f87171 !important; }
html.dark .card-composicao-score i.text-indigo-600 { color: #818cf8 !important; }
html.dark .card-composicao-score i.text-violet-600 { color: #a78bfa !important; }
html.dark .card-composicao-score i.text-cyan-600 { color: #22d3ee !important; }
html.dark .card-composicao-score i.text-pink-600 { color: #f472b6 !important; }
html.dark .card-composicao-score i.text-orange-600 { color: #fb923c !important; }
html.dark .card-composicao-score i.text-yellow-600 { color: #facc15 !important; }
html.dark .card-composicao-score i.text-sky-600 { color: #38bdf8 !important; }
html.dark .card-composicao-score i.text-amber-600 { color: #fbbf24 !important; }
html.dark .card-composicao-score i.text-rose-600 { color: #fb7185 !important; }
html.dark .card-composicao-score i.text-emerald-600 { color: #34d399 !important; }
html.dark .card-composicao-score i.text-slate-600 { color: #94a3b8 !important; }

/* ==========================================================================
   ROTAS PÚBLICAS (CONSULTA UNIDADES, RUA E MEDICAMENTOS - PADRÃO FIBRO)
   ========================================================================== */
html.dark .fibro-hero {
  background-color: #0b1120 !important;
}

html.dark .fibro-search-card {
  background-color: #151f32 !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5) !important;
}

html.dark .fibro-search-card h2 {
  color: #60a5fa !important;
}

html.dark .fibro-subtitle {
  color: #94a3b8 !important;
}

html.dark .fibro-footer {
  background-color: #0f172a !important;
  border-top-color: #1e293b !important;
}

html.dark .fibro-footer-text {
  color: #94a3b8 !important;
}

/* Cards de Opção (consultamedicamentos/index) */
html.dark .fibro-option-card {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

html.dark .fibro-option-card:hover {
  background: #24344d !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4) !important;
}

html.dark .fibro-option-card h3 {
  color: #93c5fd !important;
}

html.dark .fibro-option-card p {
  color: #cbd5e1 !important;
}

html.dark .fibro-btn-option {
  background: #2563eb !important;
  color: #ffffff !important;
}

html.dark .fibro-btn-option:hover {
  background: #1d4ed8 !important;
}

/* Botão Voltar */
html.dark .fibro-btn-back-content {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

html.dark .fibro-btn-back-content:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
}

/* Containers de Formulário */
html.dark .fibro-form-container {
  background: #0f172a !important;
  border-color: #2563eb !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}

html.dark .fibro-form-group label,
html.dark .form-group label,
html.dark label {
  color: #cbd5e1 !important;
}

html.dark .fibro-form-group select,
html.dark .fibro-form-group input[type="text"],
html.dark .form-control,
html.dark select {
  background-color: #101726 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .fibro-form-group select:focus,
html.dark .fibro-form-group input[type="text"]:focus,
html.dark .form-control:focus,
html.dark select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

html.dark .fibro-form-group button,
html.dark .submit-btn {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

html.dark .fibro-form-group button:hover,
html.dark .submit-btn:hover {
  background-color: #1d4ed8 !important;
}

/* Resultados da Consulta de Medicamentos */
html.dark .fibro-result-wrapper h3 {
  color: #93c5fd !important;
}

html.dark .fibro-result-wrapper li {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html.dark .medicamento-item {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html.dark .medicamento-item h4 {
  color: #93c5fd !important;
}

html.dark .unidade-list li {
  color: #cbd5e1 !important;
  background: transparent !important;
}

html.dark .fibro-no-results {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fcd34d !important;
}

/* Detalhes de Unidade (consultaunidades) */
html.dark .unidade-details {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark .unidade-details h3 {
  color: #93c5fd !important;
  border-bottom-color: #2563eb !important;
}

html.dark .unidade-details p {
  color: #cbd5e1 !important;
}

html.dark .unidade-details strong {
  color: #60a5fa !important;
}

html.dark .btn-profissionais {
  background-color: #16a34a !important;
  color: #ffffff !important;
}

html.dark .btn-profissionais:hover {
  background-color: #15803d !important;
}

/* Lista de Profissionais (consultaunidades/profissionais_lista) */
html.dark .profissionais-list {
  border-top-color: #334155 !important;
}

html.dark .profissionais-list h3 {
  color: #93c5fd !important;
}

html.dark .profissionais-list .cbo-group {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark .profissionais-list .cbo-group h4 {
  background-color: #1e3a8a !important;
  color: #f8fafc !important;
}

html.dark .profissionais-list li {
  background-color: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.25) !important;
  color: #4ade80 !important;
}

html.dark .profissionais-list p.no-data {
  color: #94a3b8 !important;
}

html.dark .back-button {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .back-button:hover {
  background-color: #475569 !important;
}

/* Consulta de Rua (consultarua) */
html.dark .autocomplete-box {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

html.dark .autocomplete-item {
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}

html.dark .autocomplete-item:hover {
  background: #273549 !important;
  color: #60a5fa !important;
}

html.dark .helper-text {
  color: #94a3b8 !important;
}

html.dark .alert-error {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
}

html.dark .section-title {
  color: #93c5fd !important;
  border-bottom-color: #2563eb !important;
}

html.dark .rua-details {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark .rua-details h3 {
  color: #93c5fd !important;
}

html.dark .rua-details p {
  color: #cbd5e1 !important;
}

html.dark .unidade-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

html.dark .unidade-card:hover {
  border-color: #3b82f6 !important;
  background: #24344d !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4) !important;
}

html.dark .unidade-card h4 {
  color: #93c5fd !important;
}

html.dark .unidade-card p {
  color: #cbd5e1 !important;
}

html.dark .unidade-card strong {
  color: #60a5fa !important;
}

html.dark .equipes-lista li {
  color: #cbd5e1 !important;
}

html.dark .badge-equipe {
  background: rgba(37, 99, 235, 0.2) !important;
  color: #93c5fd !important;
}

html.dark .map-link {
  background: #2563eb !important;
  color: #ffffff !important;
}

html.dark .map-link:hover {
  background: #1d4ed8 !important;
}

html.dark #map {
  border-color: #334155 !important;
}

html.dark .empty-state {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

html.dark .leaflet-popup-content-wrapper,
html.dark .leaflet-popup-tip {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
}

html.dark .leaflet-popup-content strong {
  color: #93c5fd !important;
}

html.dark .leaflet-popup-content p,
html.dark .leaflet-popup-content li {
  color: #cbd5e1 !important;
}

html.dark .popup-link {
  color: #60a5fa !important;
}

/* ==========================================================================
   SYSPROJ - TEMA ESCURO SCOPADO (/sysadm/sysproj)
   Garante compatibilidade total e visual de alta fidelidade como /syscad/bi
   ========================================================================== */
html.dark .sp {
  color: #cbd5e1 !important;
}

html.dark .sp-card,
html.dark .sp fieldset {
  background: rgba(30, 41, 59, 0.85) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(51, 65, 85, 0.65) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4) !important;
  color: #cbd5e1 !important;
}

html.dark .sp-filter {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(51, 65, 85, 0.65) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4) !important;
}

html.dark .sp-filter label {
  color: #cbd5e1 !important;
}

html.dark .sp-cards .sp-card {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(51, 65, 85, 0.65) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4) !important;
}

html.dark .sp-cards .sp-card:hover {
  border-color: rgba(45, 212, 191, 0.4) !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.6) !important;
}

html.dark .sp-cards .sp-card h3 a {
  color: #f8fafc !important;
}

html.dark .sp-cards .sp-card h3 a:hover {
  color: #2dd4bf !important;
}

html.dark .sp-metrics .sp-card {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(51, 65, 85, 0.65) !important;
}

html.dark .sp-metrics strong {
  color: #f1f5f9 !important;
}

html.dark .sp-metrics small {
  color: #94a3b8 !important;
}

html.dark .sp-phases li {
  border-top-color: #334155 !important;
}

html.dark .sp-phases li strong {
  color: #f1f5f9 !important;
}

html.dark .sp-phase-number {
  background: rgba(13, 148, 136, 0.2) !important;
  color: #5eead4 !important;
  border-color: rgba(13, 148, 136, 0.4) !important;
}

html.dark .sp-deadline-title {
  color: #f1f5f9 !important;
}

html.dark .sp-deadline-start,
html.dark .sp-deadline-end {
  color: #cbd5e1 !important;
}

html.dark .sp-deadline-history strong {
  color: #f1f5f9 !important;
}

html.dark .sp-deadline-history small {
  color: #94a3b8 !important;
}

html.dark .sp-deadline-point {
  background: #ffffff !important;
  border-color: #0f172a !important;
  box-shadow: 0 0 0 1px #334155 !important;
}

html.dark .sp-table-scroll {
  border-color: rgba(51, 65, 85, 0.6) !important;
}

html.dark .sp table th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}

html.dark .sp table td {
  border-bottom-color: rgba(51, 65, 85, 0.4) !important;
  color: #cbd5e1 !important;
}

html.dark .sp tbody tr:hover {
  background: rgba(30, 41, 59, 0.7) !important;
}

html.dark .sp strong,
html.dark .sp .sp-strong {
  color: #f8fafc !important;
}

html.dark .sp-muted,
html.dark .sp small {
  color: #94a3b8 !important;
}

html.dark .sp-text {
  color: #cbd5e1 !important;
}

html.dark .sp-link {
  color: #2dd4bf !important;
}

html.dark .sp-link:hover {
  color: #5eead4 !important;
}

html.dark .sp-modal {
  border-color: #334155 !important;
  background: #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7) !important;
}



