html {
  /* Boa prática para evitar 'salto' de tela quando o scrollbar aparece/desaparece */
  overflow-y: scroll;
}

:root {
  /* ========================================================================= */
  /* 1. TEMA LIGHT (Padrão) */
  /* ========================================================================= */
  --bg-body: #f8f9fa;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-hero: #ffffff;
  --bg-illustration: #f8f9fa;
  --text-primary: #222;
  --text-secondary: #666;
  --text-muted: #999;
  --border-light: #e0e7ff;
  --shadow-light: rgba(0,0,0,0.04);
  --shadow-hover: rgba(0,0,0,0.08);
  --shadow-hero: rgba(0,0,0,0.03);
  --btn-outline-color: #222;
  --btn-outline-border: #ccc;
  --btn-outline-hover-bg: #f0f0f0;
  --badge-light-bg: #f0f4ff;
  --badge-light-border: #c7d2fe;

  /* Cores das ferramentas (Base para o tema Light) */
  --color-qr: #3B82F6;
  --color-calculadora: #EF4444;
  --color-sorteador: #10B981;
  --color-editor: #8B5CF6;
  --color-whatsapp: #25D366;
  
  /* Cores de Framework (Tabler/Bootstrap) */
  --tblr-primary: var(--color-qr);
  --tblr-success: var(--color-sorteador);
  --tblr-danger: var(--color-calculadora);
  --tblr-warning: #f59e0b; /* Amarelo padrão */
  --tblr-info: #06b6d4;     /* Ciano padrão */
}

/* ========================================================================= */
/* 2. TEMA DARK (Override via data-theme="dark") */
/* ========================================================================= */
[data-theme="dark"] {
  /* PALETA PRINCIPAL OTIMIZADA */
  --bg-body: #0f1116;
  --bg-card: #1a1d24;
  --bg-header: #0f1116;
  --bg-hero: #0f1116;
  --bg-illustration: #25282f;
  --text-primary: #f8f9fa;
  --text-secondary: #e9ecef;
  --text-muted: #adb5bd;
  --border-light: #495057;
  --shadow-light: rgba(0,0,0,0.3);
  --shadow-hover: rgba(0,0,0,0.5);
  --shadow-hero: rgba(0,0,0,0.3);
  --btn-outline-color: #e9ecef;
  --btn-outline-border: #6c757d;
  --btn-outline-hover-bg: #343a40;
  --badge-light-bg: #25282f;
  --badge-light-border: #495057;
  
  /* CORES DE FERRAMENTAS MAIS VIBRANTES (Redefinindo as variáveis 'color') */
  --color-qr: #3b82f6; 
  --color-calculadora: #ef4444; 
  --color-sorteador: #10b981;
  --color-editor: #8B5CF6;
  --color-whatsapp: #25D366;
  
  /* Cores de Framework (Tabler/Bootstrap) */
  --tblr-primary: var(--color-qr); 
  --tblr-success: var(--color-sorteador);
  --tblr-danger: var(--color-calculadora);
  --tblr-warning: #f59e0b;
  --tblr-info: #06b6d4;
}

/* ========================================================================= */
/* 3. RESET & BASE (Estilos que usam as variáveis) */
/* ========================================================================= */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, p, a {
  margin: 0;
  padding: 0;
  text-decoration: none;
  color: inherit;
}

/* ===== Topbar & Dropdown ===== */
.navbar {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  background: var(--bg-header);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  padding: 0.75rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
}

.nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  margin: 0 8px;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary) !important;
}

.btn-outline-secondary {
  color: var(--btn-outline-color);
  border-color: var(--btn-outline-border);
  transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
  background: var(--btn-outline-hover-bg);
  color: var(--text-primary) !important;
}

.tools-dropdown .dropdown-menu {
  min-width: 220px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border: none;
  padding: 0.5rem 0;
}

.tools-dropdown .dropdown-item {
  padding: 0.75rem 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 8px;
  margin: 0 0.5rem;
  transition: background 0.2s ease;
}

.tools-dropdown .dropdown-item:hover {
  background: var(--btn-outline-hover-bg);
}

.tool-icon-small {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* ===== Toggle Tema ===== */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.theme-switch {
  position: relative;
  width: 48px;
  height: 24px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #666;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

[data-theme="dark"] .slider {
  background-color: #666;
}

[data-theme="dark"] .slider:before {
  transform: translateX(24px);
  background-color: #e0e0e0;
}

.theme-icon svg {
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.theme-icon svg:hover {
  opacity: 1;
}

[data-theme="dark"] .moon-icon {
  stroke: #fff !important;
}

[data-theme="light"] .sun-icon {
  stroke: #333 !important;
}

/* ===== Hero Section ===== */
.hero-section {
  padding: 5rem 0 4rem;
  background: var(--bg-hero);
  transition: background 0.3s ease;
}

.hero-section h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  font-weight: 700;
}

.hero-section h1 .text-primary {
  color: var(--color-qr);
}

.hero-section .lead {
  font-size: 1.1rem;
  max-width: 90%;
  color: var(--text-secondary);
}

.hero-illustration {
  background: var(--bg-illustration);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 4px 20px var(--shadow-hero);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.hero-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ===== Componentes Gerais (Badges, Cards) ===== */
.badge-hub {
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--badge-light-bg);
  border: 1px solid var(--badge-light-border);
  transition: all 0.2s ease;
}

.badge-hub:hover {
  background: var(--btn-outline-hover-bg);
  transform: translateY(-1px);
  text-decoration: none;
}

.mini-tool-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px var(--shadow-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
  text-decoration: none;
  min-height: 130px;
}

.mini-tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-hover);
  text-decoration: none;
}

.mini-tool-icon {
  width: 56px;
  height: 56px;
  min-width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-right: 1.25rem;
}

.mini-tool-content h3 {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 0.25rem 0;
}

.mini-tool-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

.mini-tool-arrow svg {
  stroke: var(--text-muted);
  transition: stroke 0.2s ease;
}

.mini-tool-card:hover .mini-tool-arrow svg {
  stroke: var(--text-primary);
}

/* ===== Páginas de Ferramentas (Tool Page) ===== */
.tool-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.tool-header .container-xl {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

/* Garante que o ícone do cabeçalho da ferramenta seja grande e branco */
.tool-header .tool-icon-large .ti {
  color: white !important;
  font-size: 48px;
  stroke-width: 1.5;
}

.btn-back {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: var(--btn-outline-hover-bg);
  color: var(--text-primary);
  text-decoration: none;
}

.tool-title-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tool-icon-large {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

.tool-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.tool-description {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0;
  margin-bottom: 0;
}

.tool-container {
  padding: 2rem 0;
}

.tool-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 12px var(--shadow-light);
}

/* ===== Classes Utilitárias (Cores de Fundo) ===== */
.bg-qr { background: var(--color-qr); }
.bg-calculadora { background: var(--color-calculadora); }
.bg-sorteador { background: var(--color-sorteador); }
.bg-editor { background: var(--color-editor); }
.bg-whatsapp { background: var(--color-whatsapp); }

/* ========================================================================= */
/* 4. TEMA DARK - SOBRESCRITAS DE FRAMEWORK (ALTO CONTRASTE) */
/* ========================================================================= */

/* ===== TEXTOS PADRONIZAÇÃO (REDUÇÃO DE REPETIÇÃO) ===== */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .fw-bold,
[data-theme="dark"] .fw-semibold,
[data-theme="dark"] .text-dark,
[data-theme="dark"] .card-title {
  color: var(--text-primary) !important;
}

[data-theme="dark"] p,
[data-theme="dark"] .lead,
[data-theme="dark"] .card-text,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] .card-subtitle,
[data-theme="dark"] li,
[data-theme="dark"] .form-label {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text,
[data-theme="dark"] .form-hint {
  color: var(--text-muted) !important;
}

/* ===== CAMPOS E INPUTS ===== */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control:focus {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-light);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .form-control:focus {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  outline: none; /* Adicionado para garantir o foco visual adequado */
}

/* ===== BOTÕES ===== */
[data-theme="dark"] .btn {
  border-width: 2px;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
}

[data-theme="dark"] .btn-primary {
  background-color: var(--tblr-primary);
  border-color: var(--tblr-primary);
  color: white;
}

[data-theme="dark"] .btn-primary:hover {
  background-color: #2563eb; /* Um tom um pouco mais escuro para o hover */
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .btn-outline-primary {
  color: var(--tblr-primary);
  border-color: var(--tblr-primary);
  background: transparent;
}

[data-theme="dark"] .btn-outline-primary:hover {
  background-color: var(--tblr-primary);
  color: white;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border-light);
  background: transparent;
}

[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: var(--btn-outline-hover-bg);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ===== TABS (ABAS) ===== */
[data-theme="dark"] .nav-tabs {
  border-bottom-color: var(--border-light);
}

[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--text-secondary);
  border-color: transparent;
  background: transparent;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s ease;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-illustration);
  border-color: var(--border-light);
}

[data-theme="dark"] .nav-tabs .nav-link.active {
  color: var(--tblr-primary);
  background-color: var(--bg-card);
  border-color: var(--border-light) var(--border-light) var(--bg-card);
  font-weight: 600;
  position: relative;
}

[data-theme="dark"] .nav-tabs .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--tblr-primary);
}

/* ===== PILLS NAVIGATION ===== */
[data-theme="dark"] .nav-pills .nav-link {
  color: var(--text-secondary);
  background-color: var(--bg-illustration);
  border: 2px solid transparent;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  margin: 0.25rem;
  transition: all 0.2s ease;
}

[data-theme="dark"] .nav-pills .nav-link:hover {
  color: var(--text-primary);
  background-color: #343a40;
  border-color: var(--border-light);
}

[data-theme="dark"] .nav-pills .nav-link.active {
  color: white;
  background-color: var(--tblr-primary);
  border-color: var(--tblr-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ===== CHECKBOXES & RADIO BUTTONS ===== */
[data-theme="dark"] .form-check-input {
  background-color: var(--bg-card);
  border-color: var(--border-light);
  border-width: 2px;
}

[data-theme="dark"] .form-check-input:checked {
  background-color: var(--tblr-primary);
  border-color: var(--tblr-primary);
}

[data-theme="dark"] .form-check-input:focus {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  outline: none;
}

[data-theme="dark"] .form-check-label {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== SELECT GROUP (Radio Button Group) ===== */
[data-theme="dark"] .form-selectgroup {
  gap: 0.5rem;
}

[data-theme="dark"] .form-selectgroup-item {
  border-color: var(--border-light);
  border-radius: 8px;
  overflow: hidden;
}

[data-theme="dark"] .form-selectgroup-label {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-light);
  padding: 1rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-width: 2px;
}

[data-theme="dark"] .form-selectgroup-input:checked + .form-selectgroup-label {
  background: var(--tblr-primary);
  color: white;
  border-color: var(--tblr-primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .form-selectgroup-input:not(:checked):hover + .form-selectgroup-label {
  background: var(--bg-illustration);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* ===== RANGE SLIDERS ===== */
[data-theme="dark"] .form-range::-webkit-slider-track {
  background-color: var(--bg-illustration);
  border-radius: 10px;
  height: 8px;
}

[data-theme="dark"] .form-range::-webkit-slider-thumb {
  background-color: var(--tblr-primary);
  border: 3px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  width: 20px;
  height: 20px;
}

[data-theme="dark"] .form-range::-moz-range-track {
  background-color: var(--bg-illustration);
  border-radius: 10px;
  height: 8px;
  border: none;
}

[data-theme="dark"] .form-range::-moz-range-thumb {
  background-color: var(--tblr-primary);
  border: 3px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  width: 20px;
  height: 20px;
}

/* ===== CARDS E CONTAINERS ===== */
[data-theme="dark"] .card {
  background-color: var(--bg-card);
  border-color: var(--border-light);
  box-shadow: 0 4px 12px var(--shadow-light);
}

[data-theme="dark"] .card-header {
  background-color: var(--bg-illustration);
  border-bottom-color: var(--border-light);
  color: var(--text-primary);
  font-weight: 600;
}

[data-theme="dark"] .card-footer {
  background-color: var(--bg-illustration);
  border-top-color: var(--border-light);
}

[data-theme="dark"] .tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 12px var(--shadow-light);
}

/* ===== BADGES E TAGS ===== */
[data-theme="dark"] .badge {
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

/* Estilo padrão para badges sem cor específica (inclui badge.bg-gray-lt) */
[data-theme="dark"] .badge:not([class*="bg-"]),
[data-theme="dark"] .bg-gray-lt {
  background-color: var(--bg-illustration) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-light);
}

[data-theme="dark"] .badge-hub {
  background: var(--badge-light-bg);
  border: 2px solid var(--badge-light-border);
  color: var(--text-primary);
  font-weight: 600;
  transition: all 0.2s ease-in-out;
}

[data-theme="dark"] .badge-hub:hover {
  background: var(--btn-outline-hover-bg);
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

/* ===== ALERTAS E MENSAGENS ===== */
[data-theme="dark"] .alert {
  border-width: 2px;
  font-weight: 500;
}

[data-theme="dark"] .alert-info {
  background-color: rgba(6, 182, 212, 0.1);
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.3);
}

[data-theme="dark"] .alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ===== RESULTADOS E OUTPUTS ===== */
[data-theme="dark"] .sorteio-item {
  background: linear-gradient(135deg, var(--bg-illustration), var(--bg-card));
  border: 2px solid var(--border-light);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.5rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

[data-theme="dark"] .bg-light {
  background-color: var(--bg-illustration) !important;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

/* ===== EDITOR SUMMERNOTE ===== */
[data-theme="dark"] .note-editor.note-frame {
  border-color: var(--border-light);
}
[data-theme="dark"] .note-toolbar {
  background-color: var(--bg-illustration);
  border-bottom-color: var(--border-light);
}
[data-theme="dark"] .note-editor .note-btn {
  background-color: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-light);
}
[data-theme="dark"] .note-editor .note-btn:hover {
  background-color: #3e3f44;
  color: var(--text-primary);
}
[data-theme="dark"] .note-editable {
  background-color: var(--bg-card);
  color: var(--text-primary);
}
[data-theme="dark"] .note-statusbar {
  background-color: var(--bg-illustration);
  border-top-color: var(--border-light);
}
[data-theme="dark"] .note-statusbar .note-status-output {
  color: var(--text-muted);
}
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .note-dropdown-menu {
  background-color: var(--bg-card);
  border-color: var(--border-light);
}
[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .note-dropdown-item {
  color: var(--text-primary);
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .note-dropdown-item:hover {
  background-color: var(--bg-illustration);
}

/* ===== TOOLTIPS E POPOVERS ===== */
[data-theme="dark"] .tooltip .tooltip-inner {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  font-weight: 500;
}

[data-theme="dark"] .popover {
  background-color: var(--bg-card);
  border-color: var(--border-light);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

[data-theme="dark"] .popover-header {
  background-color: var(--bg-illustration);
  border-bottom-color: var(--border-light);
  color: var(--text-primary);
  font-weight: 600;
}

[data-theme="dark"] .popover-body {
  color: var(--text-primary);
}

/* ===== SCROLLBARS PERSONALIZADOS (Apenas no Dark Mode) ===== */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg-illustration);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== ESTADOS DE FOCO MELHORADOS (Acessibilidade e Visual) ===== */
[data-theme="dark"] .btn:focus,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-check-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* ===== INDICADORES VISUAIS PARA ESTADOS ===== */
[data-theme="dark"] .form-control:invalid {
  border-color: var(--tblr-danger);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .form-control:valid {
  border-color: var(--tblr-success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

/* ===== CORES PARA CLASSES DE ÍCONES E TEXTO (Melhoria de Especificidade) ===== */

[data-theme="dark"] .text-blue,
[data-theme="dark"] .form-label .text-blue {
  color: var(--tblr-primary) !important;
}

[data-theme="dark"] .text-orange,
[data-theme="dark"] h6 .text-orange {
  color: var(--tblr-warning) !important;
}

[data-theme="dark"] .text-green,
[data-theme="dark"] li.mb-2 .text-success {
  color: var(--tblr-success) !important;
}

[data-theme="dark"] .text-red {
  color: var(--tblr-danger) !important;
}

[data-theme="dark"] .text-purple {
  color: var(--color-editor) !important;
}

/* ========================================================================= */
/* 5. COMPONENTES ESPECÍFICOS E AJUSTES FINAIS */
/* ========================================================================= */

/* ===== AJUSTES DE ÍCONES (Mantido) ===== */
.mini-tool-icon .ti,
.tool-icon-small .ti,
.hero-icon-box .ti {
  color: white;
  stroke-width: 1.5;
}

.mini-tool-icon .ti {
  font-size: 32px;
}
.tool-icon-small .ti {
  font-size: 20px;
}
.hero-icon-box .ti {
  font-size: 40px;
}

/* Grade de abas QR Code */
.nav-tabs[data-bs-toggle="tabs"] {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.25rem;
}
.nav-tabs[data-bs-toggle="tabs"] .nav-item {
  flex: 0 0 25%;
  padding: 0 0.25rem;
  margin-bottom: 0.5rem;
}

/* Resultado do sorteador */
.sorteio-item {
  font-size: 1.5rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  text-align: center;
}

/* Card compacto para home */
.tool-card-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 2px 8px var(--shadow-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  height: 100%;
}
.tool-card-compact:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px var(--shadow-hover);
  text-decoration: none;
}
.tool-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: white;
}
.tool-card-icon .ti {
  font-size: 32px;
  stroke-width: 1.5;
}
.tool-card-name {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* LÓGICA DE TROCA DE LOGO (Mantido, mas reorganizado para o final) */
.d-block-dark { display: none; }
.d-none-dark { display: block; }
[data-theme="dark"] .d-block-dark { display: block; }
[data-theme="dark"] .d-none-dark { display: none; }

/* ===== Responsividade ===== */
@media (max-width: 992px) {
  .hero-section h1 { font-size: 2rem; }
  .tool-header .container-xl { flex-wrap: wrap; }
  .tool-title-wrapper { width: 100%; flex-wrap: wrap; gap: 0.75rem; }
  .tool-icon-large { width: 56px; height: 56px; }
  .tool-title { font-size: 1.5rem; }
}

@media (max-width: 768px) {
  .hero-section { padding: 3rem 0; }
  .hero-section h1 { font-size: 1.75rem; }
  .hero-illustration { padding: 1.5rem; }
  .hero-icon-box { width: 60px; height: 60px; }
  .mini-tool-card { flex-direction: column; text-align: center; padding: 1.5rem; }
  .mini-tool-icon { margin-right: 0; margin-bottom: 1rem; }
  .mini-tool-arrow { margin-top: 1rem; }
  .tools-dropdown .dropdown-menu { 
      inset: 0 0 auto !important; 
      margin: 0; 
      width: 100% !important; 
      border-radius: 0; 
      box-shadow: none; 
      border-top: 1px solid var(--border-light); 
  }
  .navbar-nav .nav-item { margin-right: 1rem; }
  
  /* Responsividade para componentes de alto contraste */
  [data-theme="dark"] .nav-tabs .nav-link {
      padding: 0.5rem 1rem;
      font-size: 0.9rem;
  }
  
  [data-theme="dark"] .nav-pills .nav-link {
      padding: 0.6rem 1rem;
      font-size: 0.9rem;
  }
  
  [data-theme="dark"] .form-selectgroup-label {
      padding: 0.75rem 1rem;
  }
}

@media (max-width: 576px) {
  .hero-section .lead { font-size: 1rem; }
  .theme-switch-wrapper { margin-left: 0; }
  .tool-header .container-xl { padding: 0 1rem; }
}