/* ============================================================
   SISTEMA DE TEMAS — TOKENS UNIFICADOS (LIGHT / DARK)
   Padrão único: usar var(--token) em TODOS os componentes
   ============================================================ */
:root,
[data-theme="light"] {
  /* Backgrounds */
  --bg-app: linear-gradient(135deg, #f5f7fb 0%, #eef1f8 100%);
  --bg-app-solid: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-surface-2: #f9fafb;
  --bg-surface-3: #f3f4f6;
  --bg-surface-4: #e5e7eb;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(0,0,0,0.5);

  /* Texto */
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  --text-on-accent: #ffffff;

  /* Bordas */
  --border-color: #e5e7eb;
  --border-strong: #d1d5db;
  --border-soft: #f3f4f6;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.10);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.18);

  /* Inputs */
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-placeholder: #9ca3af;

  /* Tabela */
  --table-bg: #ffffff;
  --table-header-bg: #f9fafb;
  --table-header-text: #6b7280;
  --table-stripe: #f9fafb;
  --table-hover: #f3f4f6;
  --table-border: #f3f4f6;

  /* Modais e cartões */
  --modal-bg: #ffffff;
  --card-bg: #ffffff;
  --kpi-bg: #ffffff;
  --kpi-text: #1f2937;

  /* Chat */
  --chat-bg: #ffffff;
  --chat-bubble-bg: #f3f4f6;
  --chat-bubble-mine: #dcf8c6;
  --chat-bubble-text: #1f2937;

  /* Cores acentuadas (mesma em ambos os temas) */
  --accent-indigo: #6366f1;
  --accent-indigo-soft: rgba(99,102,241,0.08);
  --accent-indigo-bg: #eef2ff;
  --accent-indigo-text: #4f46e5;
  --accent-success: #10b981;
  --accent-success-bg: #ecfdf5;
  --accent-success-text: #065f46;
  --accent-warning: #f59e0b;
  --accent-warning-bg: #fffbeb;
  --accent-warning-text: #92400e;
  --accent-danger: #ef4444;
  --accent-danger-bg: #fef2f2;
  --accent-danger-text: #991b1b;
  --accent-info: #3b82f6;
  --accent-info-bg: #eff6ff;
  --accent-info-text: #1e40af;

  /* Hover/foco */
  --hover-overlay: rgba(0,0,0,0.04);
  --focus-ring: rgba(99,102,241,0.25);

  /* Sidebar (sempre escura para contraste com a área principal) */
  --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-border: rgba(255,255,255,0.08);
}

[data-theme="dark"] {
  /* Backgrounds */
  --bg-app: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-app-solid: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-2: #283549;
  --bg-surface-3: #334155;
  --bg-surface-4: #3d4a63;
  --bg-elevated: #243149;
  --bg-overlay: rgba(0,0,0,0.7);

  /* Texto */
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-muted: #64748b;
  --text-on-accent: #ffffff;

  /* Bordas */
  --border-color: #334155;
  --border-strong: #475569;
  --border-soft: #2c3a52;

  /* Sombras (mais fortes no escuro) */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.55);

  /* Inputs */
  --input-bg: #243149;
  --input-border: #3d4a63;
  --input-placeholder: #64748b;

  /* Tabela */
  --table-bg: #1e293b;
  --table-header-bg: #283549;
  --table-header-text: #94a3b8;
  --table-stripe: #243149;
  --table-hover: #2c3a52;
  --table-border: #2c3a52;

  /* Modais e cartões */
  --modal-bg: #1e293b;
  --card-bg: #1e293b;
  --kpi-bg: #283549;
  --kpi-text: #e2e8f0;

  /* Chat */
  --chat-bg: #1e293b;
  --chat-bubble-bg: #2c3a52;
  --chat-bubble-mine: #1e5a3a;
  --chat-bubble-text: #e2e8f0;

  /* Cores acentuadas — mais suaves no escuro */
  --accent-indigo: #818cf8;
  --accent-indigo-soft: rgba(129,140,248,0.12);
  --accent-indigo-bg: rgba(99,102,241,0.18);
  --accent-indigo-text: #c7d2fe;
  --accent-success: #34d399;
  --accent-success-bg: rgba(16,185,129,0.15);
  --accent-success-text: #6ee7b7;
  --accent-warning: #fbbf24;
  --accent-warning-bg: rgba(245,158,11,0.15);
  --accent-warning-text: #fcd34d;
  --accent-danger: #f87171;
  --accent-danger-bg: rgba(239,68,68,0.15);
  --accent-danger-text: #fca5a5;
  --accent-info: #60a5fa;
  --accent-info-bg: rgba(59,130,246,0.15);
  --accent-info-text: #93c5fd;

  /* Hover/foco */
  --hover-overlay: rgba(255,255,255,0.05);
  --focus-ring: rgba(129,140,248,0.35);

  /* Sidebar */
  --sidebar-bg: linear-gradient(180deg, #0b1220 0%, #060b16 100%);
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-border: rgba(255,255,255,0.06);
}

/* ===== Base ===== */
* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }

html, body {
  background: var(--bg-app);
  min-height: 100vh;
  color: var(--text-primary);
  transition: background 0.2s ease, color 0.2s ease;
}

/* ===== Sidebar ===== */
.sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  transition: width 0.25s ease, transform 0.25s ease;
  z-index: 100;
}

/* Sidebar Colapsada (apenas ícones) */
.sidebar.collapsed { width: 72px !important; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .user-info-block { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding-left: 0 !important; padding-right: 0 !important; }
.sidebar.collapsed .nav-item:hover { transform: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .logout-btn span { display: none; }
.sidebar.collapsed .logout-btn { justify-content: center; }
.sidebar.collapsed .user-avatar-mini { margin: 0 auto; }

main.main-content { transition: margin-left 0.25s ease; }
main.main-content.sidebar-collapsed { margin-left: 72px !important; }

/* (Removido: modo barra superior — sidebar é sempre lateral, com modos expandido/recolhido) */

/* Botão de toggle do sidebar */
.sidebar-toggle-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 110;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
}
.sidebar-toggle-btn:hover { transform: scale(1.05); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }

/* Controles de modo do sidebar (expandir/recolher) */
.sidebar-mode-controls {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.sidebar.collapsed .sidebar-mode-controls { flex-direction: column; padding: 0 8px 8px; }

.sidebar-mode-btn {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #cbd5e1;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.sidebar-mode-btn:hover { background: rgba(99,102,241,0.2); color: white; }
.sidebar-mode-btn.active { background: rgba(99,102,241,0.35); color: white; border-color: rgba(129,140,248,0.5); }

.nav-item {
  transition: all 0.25s ease;
  position: relative;
  border-radius: 10px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-left: 3px solid #818cf8;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #818cf8;
  border-radius: 50%;
  box-shadow: 0 0 12px #818cf8;
}

/* ===== Cards ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 32px rgba(31, 41, 55, 0.06);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.glass-card:hover {
  box-shadow: 0 12px 40px rgba(31, 41, 55, 0.1);
  transform: translateY(-2px);
}

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 24px;
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -40%;
  right: 10%;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.stat-card-content {
  position: relative;
  z-index: 2;
}

.gradient-receber { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.gradient-pagar { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.gradient-saldo { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.gradient-vencidos { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

/* ===== Buttons ===== */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-strong);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  border: none;
  cursor: pointer;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.btn-icon:hover { background: var(--bg-surface-3); }

.btn-icon-mini {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 11px;
  padding: 0;
  opacity: 0.6;
}

/* Linha selecionada nas tabelas */
.row-selected {
  background-color: #eef2ff !important;
  box-shadow: inset 3px 0 0 #6366f1;
}
[data-theme="dark"] .row-selected {
  background-color: rgba(99, 102, 241, 0.15) !important;
  box-shadow: inset 3px 0 0 #818cf8 !important;
}

/* Linha clicável em modo seleção (clique em qualquer parte) */
.row-selectable {
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.row-selectable:hover {
  background-color: rgba(99, 102, 241, 0.06) !important;
}
[data-theme="dark"] .row-selectable:hover {
  background-color: rgba(129, 140, 248, 0.10) !important;
}

/* Card clicável em modo seleção */
.card-selectable {
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card-selectable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

/* Drag-drop visual indicators */
.row-draggable {
  cursor: grab;
}
.row-draggable:active {
  cursor: grabbing;
}
.row-draggable td:first-child::before {
  content: "\f7a4"; /* fa-grip-vertical */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: #94a3b8;
  margin-right: 6px;
  opacity: 0.6;
}
.card-draggable {
  cursor: grab;
}
.card-draggable:active {
  cursor: grabbing;
}
.card-draggable::before {
  content: "\f7a4";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: #94a3b8;
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  opacity: 0.5;
}

/* Indicadores visuais durante drag */
.dragging-row {
  opacity: 0.4;
  background: rgba(99, 102, 241, 0.05) !important;
}
tr.drag-over-top {
  border-top: 3px solid #6366f1 !important;
  box-shadow: 0 -2px 0 #6366f1;
}
tr.drag-over-bottom {
  border-bottom: 3px solid #6366f1 !important;
  box-shadow: 0 2px 0 #6366f1;
}
.drag-over-card {
  outline: 3px solid #6366f1 !important;
  outline-offset: -3px;
}
[data-theme="dark"] tr.drag-over-top { border-top-color: #818cf8 !important; box-shadow: 0 -2px 0 #818cf8; }
[data-theme="dark"] tr.drag-over-bottom { border-bottom-color: #818cf8 !important; box-shadow: 0 2px 0 #818cf8; }
[data-theme="dark"] .drag-over-card { outline-color: #818cf8 !important; }

/* Pílulas de data no dashboard */
.dia-semana-pill, .data-completa-pill, .hora-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(99, 102, 241, 0.08);
  color: #4f46e5;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.dia-semana-pill { background: rgba(99, 102, 241, 0.12); }
.data-completa-pill { background: rgba(16, 185, 129, 0.10); color: #047857; }
.hora-pill { background: rgba(245, 158, 11, 0.12); color: #b45309; }
[data-theme="dark"] .dia-semana-pill { background: rgba(129, 140, 248, 0.18); color: #c7d2fe; }
[data-theme="dark"] .data-completa-pill { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
[data-theme="dark"] .hora-pill { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }

/* Sub-tabs (usado em Pedidos > Pedidos/Fornecedores) */
.sub-tabs-bar {
  border: 1px solid var(--border-color);
}
[data-theme="dark"] .sub-tabs-bar {
  background: #243149 !important;
  border-color: #3d4a63 !important;
}
[data-theme="dark"] .sub-tabs-bar button.bg-white {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}

/* Dropdown menu dark theme */
[data-theme="dark"] .dropdown-menu {
  background: #1e293b !important;
  border-color: #3d4a63 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .dropdown-item:hover {
  background: rgba(99, 102, 241, 0.15) !important;
}
.dropdown-item:hover {
  background: var(--bg-surface-3);
}
.btn-icon-mini:hover {
  background: #eef2ff;
  opacity: 1;
  transform: scale(1.1);
}
.btn-icon-mini.btn-copied {
  background: #d1fae5;
  opacity: 1;
}
[data-theme="dark"] .btn-icon-mini:hover {
  background: rgba(129, 140, 248, 0.15) !important;
}
[data-theme="dark"] .btn-icon-mini.btn-copied {
  background: rgba(16, 185, 129, 0.2) !important;
}

/* ===== Forms ===== */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  background: var(--bg-surface);
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: #ef4444;
}

/* ===== Modal (visual imersivo e moderno) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.22s ease;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: 18px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow:
    0 32px 64px -12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255,255,255,0.05) inset;
  animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

/* Tamanhos responsivos */
.modal-size-sm  { max-width: 560px; }
.modal-size-md  { max-width: 900px; }
.modal-size-lg  { max-width: 1280px; }
.modal-size-xl  { max-width: 1600px; }
.modal-size-full { max-width: 98vw; }

/* Em telas grandes (>= 1700px), maximize o aproveitamento */
@media (min-width: 1700px) {
  .modal-size-lg { max-width: 1400px; }
  .modal-size-xl { max-width: 1700px; }
}

/* Em telas pequenas, ocupa toda a largura disponivel */
@media (max-width: 768px) {
  .modal-overlay { padding: 8px; }
  .modal-content,
  .modal-size-sm,
  .modal-size-md,
  .modal-size-lg,
  .modal-size-xl,
  .modal-size-full {
    max-width: 100% !important;
    max-height: 95vh;
    border-radius: 14px;
  }
}

.modal-header {
  padding: 22px 32px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--bg-surface) 100%, transparent) 0%,
    color-mix(in srgb, var(--bg-surface) 96%, transparent) 100%);
  backdrop-filter: blur(6px);
  z-index: 10;
  border-radius: 18px 18px 0 0;
  gap: 16px;
}

.modal-header h2 {
  flex: 1;
  min-width: 0;
}

.modal-close-btn {
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
}
.modal-close-btn:hover {
  transform: rotate(90deg);
  background: var(--bg-surface-2);
}

.modal-body {
  padding: 28px 32px;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  padding: 18px 32px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-surface-2);
  border-radius: 0 0 18px 18px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== Status Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pendente { background: #fef3c7; color: #92400e; }
.badge-pago { background: #d1fae5; color: #065f46; }
.badge-recebido { background: #d1fae5; color: #065f46; }
.badge-vencido { background: #fee2e2; color: #991b1b; }
.badge-cancelado { background: var(--bg-surface-3); color: var(--text-secondary); }
.badge-conta { background: #e0e7ff; color: #3730a3; }
.badge-boleto { background: #fed7aa; color: #9a3412; }
.badge-imposto { background: #ede9fe; color: #5b21b6; }
.badge-obra { background: #fef3c7; color: #92400e; }

/* ===== Table ===== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  background: var(--bg-surface-2);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-soft);
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-surface-2);
}

/* ===== Calendar ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 10px;
  padding: 8px;
  background: var(--bg-surface-2);
  border: 1px solid #f3f4f6;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  min-height: 80px;
}

.calendar-day:hover { background: #eef2ff; border-color: #6366f1; }

.calendar-day.today { background: #eef2ff; border-color: #6366f1; font-weight: 700; }
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.has-event { border-color: #c7d2fe; }

.calendar-day-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.calendar-event-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 3px;
}

.calendar-event {
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 4px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.calendar-event.pagar { background: #fee2e2; color: #991b1b; }
.calendar-event.receber { background: #d1fae5; color: #065f46; }

.calendar-header-day {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding: 8px 0;
}

/* ============ CALENDÁRIO PROFISSIONAL ============ */
.cal-pro-wrapper {
  background: var(--bg-surface);
  border-radius: 18px;
  padding: 22px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.cal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}
.cal-toolbar-left {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cal-toolbar-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cal-today-btn {
  font-weight: 700;
  padding: 7px 14px !important;
}
.cal-nav-group {
  display: inline-flex;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.cal-nav-btn {
  background: var(--bg-surface);
  border: 0;
  padding: 7px 12px;
  cursor: pointer;
  color: #475569;
  font-size: 13px;
  transition: all 0.15s;
}
.cal-nav-btn:first-child { border-right: 1px solid #e2e8f0; }
.cal-nav-btn:hover { background: #f1f5f9; color: #4338ca; }
.cal-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  text-transform: capitalize;
  margin: 0 0 0 6px;
  letter-spacing: -0.01em;
}
.cal-view-switcher {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.cal-view-btn {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  cursor: pointer;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-view-btn:hover { color: #4338ca; }
.cal-view-btn.active {
  background: var(--bg-surface);
  color: #4338ca;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Cards de resumo */
.cal-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.cal-summary-card {
  background: var(--bg-surface);
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cal-sum-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.cal-sum-receber .cal-sum-icon { background: #d1fae5; color: #047857; }
.cal-sum-pagar .cal-sum-icon { background: #fee2e2; color: #b91c1c; }
.cal-sum-saldo .cal-sum-icon { background: #e0e7ff; color: #4338ca; }
.cal-sum-eventos .cal-sum-icon { background: #fef3c7; color: #b45309; }
.cal-sum-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; margin: 0 0 2px;
}
.cal-sum-value {
  font-size: 17px; font-weight: 800;
  color: #0f172a; margin: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Toggle de fontes */
.cal-sources {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  align-items: center;
}
.cal-sources-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b;
  margin-right: 4px;
  display: inline-flex; align-items: center; gap: 6px;
}
.cal-source-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--bg-surface);
  border: 1px solid #e2e8f0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-source-chip:hover { transform: translateY(-1px); }
.cal-source-chip.active {
  background: var(--src-color);
  color: white;
  border-color: var(--src-color);
  box-shadow: 0 4px 8px color-mix(in srgb, var(--src-color) 30%, transparent);
}

/* Vista de mês profissional */
.cal-pro-header .calendar-header-day {
  font-weight: 800; color: #475569; font-size: 12px;
  padding: 10px 0;
}
.cal-pro-grid { gap: 4px; }
.cal-pro-day {
  aspect-ratio: auto;
  min-height: 110px;
  background: var(--bg-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 8px 8px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.cal-pro-day.weekend { background: #fafbfc; }
.cal-pro-day.other-month { opacity: 0.45; background: #f8fafc; }
.cal-pro-day.today {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #6366f1;
  box-shadow: 0 0 0 1px #6366f1 inset;
}
.cal-pro-day.has-event { border-color: #c7d2fe; }
.cal-pro-day:hover {
  border-color: #6366f1;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.10);
}
.cal-pro-day.today:hover { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); }
.cal-day-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.calendar-day-number.today-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: #6366f1; color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.cal-day-count {
  font-size: 10px; font-weight: 800;
  background: #6366f1; color: white;
  padding: 1px 6px; border-radius: 999px;
  min-width: 18px; text-align: center;
}
.cal-day-events { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-pro-event {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ev-color) 15%, white);
  color: var(--ev-color);
  border-left: 2px solid var(--ev-color);
  overflow: hidden;
}
.cal-pro-event i { font-size: 8px; flex-shrink: 0; }
.cal-pro-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-more {
  font-size: 9px; color: #94a3b8;
  font-weight: 600;
  padding: 1px 5px;
}
.cal-day-totals {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #e2e8f0;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
}
.cal-tot-rec { color: #047857; }
.cal-tot-pag { color: #b91c1c; }

/* Vista de Semana */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  min-height: 500px;
}
.cal-week-col {
  background: #fafbfc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cal-week-col.today-col {
  background: linear-gradient(180deg, #eef2ff 0%, #ffffff 30%);
  border-color: #6366f1;
}
.cal-week-header {
  padding: 10px 8px;
  text-align: center;
  background: var(--bg-surface);
  border-bottom: 1px solid #e2e8f0;
}
.cal-week-day-name {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #94a3b8;
  margin: 0 0 2px;
}
.cal-week-day-num {
  font-size: 22px; font-weight: 800;
  color: #0f172a; margin: 0;
  line-height: 1;
}
.cal-week-col.today-col .cal-week-day-num { color: #4338ca; }
.cal-week-body {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 480px;
}
.cal-week-empty {
  text-align: center;
  font-size: 11px;
  color: #cbd5e1;
  margin: 16px 0;
}
.cal-week-event {
  display: flex;
  background: var(--bg-surface);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s;
  border: 1px solid #f1f5f9;
}
.cal-week-event:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.cal-week-event-bar {
  width: 3px;
  flex-shrink: 0;
}
.cal-week-event-content {
  padding: 6px 8px;
  flex: 1;
  min-width: 0;
}
.cal-week-event-title {
  font-size: 11px; font-weight: 700;
  color: #0f172a; margin: 0 0 2px;
  display: flex; align-items: center; gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-week-event-title i { font-size: 9px; color: var(--ev-color); flex-shrink: 0; }
.cal-week-event-sub {
  font-size: 10px; color: #64748b; margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Vista de Dia */
.cal-day-view {
  background: var(--bg-surface);
}
.cal-day-header-pro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid #c7d2fe;
  flex-wrap: wrap;
  gap: 16px;
}
.cal-day-date {
  font-size: 56px; font-weight: 800;
  color: #4338ca; line-height: 1;
  margin: 0;
  letter-spacing: -0.02em;
}
.cal-day-month {
  font-size: 14px; color: #475569;
  margin: 4px 0 0;
  text-transform: capitalize;
  font-weight: 600;
}
.cal-day-week {
  font-size: 12px; color: #94a3b8;
  margin: 2px 0 0;
  text-transform: capitalize;
}
.cal-day-stats {
  display: flex; gap: 24px;
  flex-wrap: wrap;
}
.cal-day-stat-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #94a3b8;
  margin: 0 0 4px;
}
.cal-day-stat-val {
  font-size: 18px; font-weight: 800;
  color: #0f172a; margin: 0;
  font-variant-numeric: tabular-nums;
}
.cal-day-events-list {
  display: flex; flex-direction: column; gap: 8px;
}
.cal-day-event-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--ev-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-day-event-card:hover {
  transform: translateX(2px);
  border-color: var(--ev-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.cal-day-event-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.cal-day-event-title {
  font-size: 14px; font-weight: 700;
  color: #0f172a; margin: 0 0 2px;
}
.cal-day-event-sub {
  font-size: 12px; color: #64748b;
  margin: 0;
}

/* Vista Agenda */
.cal-agenda {
  display: flex; flex-direction: column; gap: 14px;
}
.cal-agenda-group {
  display: flex; gap: 16px;
  background: var(--bg-surface);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}
.cal-agenda-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: 10px;
  min-width: 90px;
  position: relative;
}
.cal-agenda-date-num {
  font-size: 28px; font-weight: 800;
  color: #4338ca; line-height: 1;
}
.cal-agenda-date-month {
  font-size: 10px; font-weight: 700;
  color: #6366f1; margin: 4px 0 0;
}
.cal-agenda-date-week {
  font-size: 11px; color: #64748b;
  margin: 0;
  text-transform: capitalize;
}
.cal-agenda-today {
  position: absolute;
  top: -8px;
  background: #ef4444;
  color: white;
  font-size: 9px; font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-agenda-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-agenda-event {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: #fafbfc;
  border: 1px solid #f1f5f9;
  border-left: 3px solid var(--ev-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-agenda-event:hover {
  background: var(--bg-surface);
  border-color: var(--ev-color);
  transform: translateX(2px);
}
.cal-agenda-event-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.cal-agenda-event-title {
  font-size: 13px; font-weight: 700;
  color: #0f172a; margin: 0 0 2px;
}
.cal-agenda-event-sub {
  font-size: 11px; color: #64748b; margin: 0;
}

/* Responsivo do calendário */
@media (max-width: 900px) {
  .cal-week-grid { grid-template-columns: 1fr; min-height: auto; }
  .cal-week-col { min-height: auto; }
  .cal-week-body { max-height: none; }
  .cal-pro-day { min-height: 80px; }
  .cal-pro-event-title { display: none; }
  .cal-pro-event { justify-content: center; padding: 3px; }
}
@media (max-width: 600px) {
  .cal-toolbar-left, .cal-toolbar-right { width: 100%; justify-content: center; }
  .cal-title { font-size: 16px; }
  .cal-day-date { font-size: 40px; }
}
@media print {
  .sidebar, .cal-toolbar-right, .cal-sources { display: none !important; }
  .cal-pro-wrapper { box-shadow: none; border: 0; }
}

/* ===== Empresa Card ===== */
.empresa-card {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.empresa-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--empresa-color, #6366f1);
}

.empresa-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--empresa-color, #6366f1);
}

.empresa-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Logo da empresa nos cards */
.empresa-logo-card {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: var(--bg-surface);
  border: 2px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  flex-shrink: 0;
}

/* Preview do logo no modal */
.empresa-logo-preview {
  width: 110px;
  height: 110px;
  border-radius: 16px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f8fafc;
  border: 2px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.empresa-logo-placeholder {
  font-size: 42px;
  font-weight: 800;
  color: #94a3b8;
}

/* Logo no header da empresa aberta */
.empresa-header-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: var(--bg-surface);
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

/* ===== Tabs ===== */
.tab-list {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #f3f4f6;
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab:hover { color: var(--text-secondary); }
.tab.active { color: #6366f1; border-bottom-color: #6366f1; }

/* ===== Loading ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--bg-surface);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  z-index: 300;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid #6366f1;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Utilities ===== */
.text-gradient {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.divider {
  height: 1px;
  background: #e5e7eb;
  margin: 16px 0;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title i { color: #6366f1; }

/* ===== Forms Grid Section ===== */
.form-section {
  background: var(--bg-surface-2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title i { color: #6366f1; }

/* ===== Login Screen ===== */
.login-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
}

.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
}

/* ===== Filter Pills (avançado) ===== */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* ===== Selection ===== */
.row-selected { background: #eef2ff !important; }
.checkbox-pedido { cursor: pointer; }

/* ===== Print ===== */
@media print {
  .sidebar, .no-print, .btn-primary, .btn-secondary, .btn-icon { display: none !important; }
  main { margin-left: 0 !important; padding: 0 !important; }
  .glass-card { box-shadow: none !important; border: 1px solid var(--border-color) !important; }
}

/* ===== Status Clickable Menu ===== */
.status-clickable {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

/* Menu fixo (position:fixed) - posicionado por JS para nunca ser cortado */
.status-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
  z-index: 9999;
  min-width: 180px;
  max-width: 240px;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.status-menu.hidden { display: none; }

.status-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background 0.15s;
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.status-menu-item:hover {
  background: var(--bg-surface-3);
}

/* Permitir overflow visível em tabelas para que o status-menu fixo apareça por inteiro */
.data-table { overflow: visible !important; }
.overflow-x-auto:has(.status-menu:not(.hidden)) { overflow: visible !important; }

/* ===== Upload Dropzone ===== */
.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  transition: all 0.2s ease;
  cursor: pointer;
}
.upload-dropzone:hover {
  border-color: #818cf8;
  background: #eef2ff;
}

/* ===== Lista de Anexos ===== */
.anexos-list table.anexos-table th { background: #f8fafc; }
.anexos-table tbody tr td { vertical-align: middle; }

/* ===== Visual Profissional Aprimorado ===== */
.glass-card {
  border-radius: 16px;
  transition: all 0.2s ease;
}

.glass-card:hover {
  box-shadow: 0 12px 40px rgba(31, 41, 55, 0.08);
}

.btn-primary, .btn-secondary, .btn-success {
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.18s ease;
}

.btn-primary:hover, .btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.data-table th {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: #f8fafc !important;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title i {
  color: #6366f1;
  font-size: 20px;
}

.stat-card {
  border-radius: 18px;
  padding: 20px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,0.10);
}

.gradient-saldo { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.gradient-pagar { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.gradient-receber { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.gradient-vencidos { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

.empresa-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

/* ===== Print Landscape A4 ===== */
@page { size: A4 landscape; margin: 1cm; }

/* ===== Folder/Pasta cards ===== */
.pasta-item {
  transition: all 0.15s ease;
}

.pasta-item:hover {
  border-color: #6366f1;
  background: #eef2ff;
  transform: translateX(2px);
}

/* =================== DASHBOARD EXECUTIVO PROFISSIONAL =================== */
/* Header Executivo (substitui hero antigo) */
.exec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 4px 4px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.exec-header-left { flex: 1; min-width: 280px; }
.exec-breadcrumb {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}
.exec-breadcrumb i.fa-building { color: #6366f1; }
.exec-title {
  font-size: 28px; font-weight: 800;
  color: #0f172a; margin: 0 0 4px;
  letter-spacing: -0.025em; line-height: 1.1;
}
.exec-wave { display: inline-block; transform-origin: 70% 70%; animation: waveHand 2.4s ease-in-out infinite; }
@keyframes waveHand {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(14deg); }
  50% { transform: rotate(0deg); }
}
.exec-subtitle {
  font-size: 13px; color: #64748b;
  margin: 0;
}
.exec-header-right {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.exec-period-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4338ca;
  border-radius: 10px;
  font-size: 12px; font-weight: 700;
  text-transform: capitalize;
  border: 1px solid #c7d2fe;
}

/* KPI Grid - layout 1 grande + 3 médios */
.kpi-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* KPI Card Hero (Saldo) */
.kpi-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 24px 26px;
  color: white;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.kpi-card.kpi-positive {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
}
.kpi-card.kpi-negative {
  background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 45%, #b91c1c 100%);
}
.kpi-bg-pattern {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 80% 0%, rgba(255,255,255,0.18), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(255,255,255,0.10), transparent 55%);
}
.kpi-header {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.kpi-icon-circle {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  backdrop-filter: blur(8px);
}
.kpi-trend-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font-size: 11px; font-weight: 700;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
}
.kpi-trend-pill.trend-up { color: #6ee7b7; }
.kpi-trend-pill.trend-down { color: #fda4af; }
.kpi-label {
  position: relative; z-index: 2;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7);
  margin: 0 0 6px;
}
.kpi-value {
  position: relative; z-index: 2;
  font-size: 32px; font-weight: 800;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.kpi-footer {
  position: relative; z-index: 2;
  display: flex; gap: 18px; flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.kpi-meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: rgba(255,255,255,0.75);
}
.kpi-meta strong { color: white; font-weight: 700; }

/* KPI Card Mini */
.kpi-card-mini {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: all 0.25s ease;
  display: flex; flex-direction: column;
}
.kpi-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.08);
}
.kpi-mini-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.kpi-mini-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.kpi-receber .kpi-mini-icon { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #047857; }
.kpi-pagar .kpi-mini-icon { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #b91c1c; }
.kpi-vencidos .kpi-mini-icon { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
.kpi-mini-label {
  font-size: 12px; font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
}
.kpi-mini-badge {
  padding: 2px 8px;
  background: #f59e0b;
  color: white;
  font-size: 10px; font-weight: 800;
  border-radius: 999px;
  min-width: 22px; text-align: center;
}
.kpi-mini-value {
  font-size: 22px; font-weight: 800;
  color: #0f172a; margin: 0 0 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-mini-progress {
  height: 4px;
  background: #f1f5f9;
  border-radius: 2px; overflow: hidden;
  margin-bottom: 10px;
}
.kpi-mini-progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.kpi-mini-foot {
  font-size: 11px; color: #64748b;
  margin: 0;
  display: inline-flex; align-items: center; gap: 5px;
}
.kpi-mini-foot i { font-size: 10px; }
.kpi-alert { animation: pulseAlert 2.4s ease-in-out infinite; border-color: #fde68a; }

/* Section Divider Pro */
.section-divider {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}
.section-divider-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.section-divider-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, #e2e8f0, transparent);
}

/* Ops Cards Profissionais */
.ops-card-pro {
  position: relative;
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}
.ops-card-pro::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  transition: all 0.2s ease;
}
.ops-card-pro:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
}
.ops-card-pro:hover::before { background: linear-gradient(180deg, #6366f1, #4f46e5); }
.ops-card-pro:hover .ops-arrow { opacity: 1; transform: translateX(0); color: #6366f1; }
.ops-warning-pro {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}
.ops-icon-pro {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.10);
  flex-shrink: 0;
}
.ops-info-pro { flex: 1; min-width: 0; }
.ops-label-pro {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; margin: 0 0 4px;
}
.ops-value-pro {
  font-size: 22px; font-weight: 800;
  color: #0f172a; line-height: 1; margin: 0 0 4px;
  font-variant-numeric: tabular-nums;
}
.ops-suffix-pro {
  font-size: 11px; font-weight: 500;
  color: #94a3b8; margin-left: 6px;
}
.ops-trend-pro {
  font-size: 11px; color: #475569; margin: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
.ops-trend-pro i { font-size: 7px; }
.ops-arrow {
  position: absolute;
  right: 14px;
  font-size: 12px;
  color: #cbd5e1;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s ease;
}

/* Hero Header (mantido para compat) */
.dashboard-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  color: white;
  padding: 32px 36px;
  box-shadow: 0 20px 50px rgba(49, 46, 129, 0.25);
}
.dashboard-hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(168, 85, 247, 0.35), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(59, 130, 246, 0.3), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(236, 72, 153, 0.18), transparent 60%);
}
.dashboard-hero-content {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 24px;
}
.dashboard-greeting {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: #c7d2fe;
  background: rgba(255,255,255,0.1);
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 12px;
}
.dashboard-title {
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.025em; line-height: 1.1;
  margin: 0 0 6px;
}
.dashboard-subtitle {
  font-size: 13px; color: rgba(255,255,255,0.7);
  text-transform: capitalize;
}
.dashboard-hero-stats {
  display: flex; align-items: center; gap: 28px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 18px 28px; border-radius: 16px;
}
.hero-divider { width: 1px; height: 56px; background: rgba(255,255,255,0.15); }
.hero-stat-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.6); margin: 0 0 4px;
}
.hero-stat-value {
  font-size: 26px; font-weight: 800; line-height: 1; margin: 0 0 4px;
  font-variant-numeric: tabular-nums;
}
.hero-stat-value.positive { color: #6ee7b7; }
.hero-stat-value.negative { color: #fda4af; }
.hero-stat-trend {
  font-size: 11px; margin: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
.hero-stat-trend.positive { color: #6ee7b7; }
.hero-stat-trend.negative { color: #fda4af; }
.hero-progress {
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px; overflow: hidden;
  margin-top: 6px;
}
.hero-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #6ee7b7);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Métricas Principais */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.metric-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
  transition: all 0.25s ease;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.6;
}
.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.06), 0 16px 40px rgba(15, 23, 42, 0.08);
}
.metric-icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.metric-receber { color: #10b981; }
.metric-receber .metric-icon-wrap { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #047857; }
.metric-pagar { color: #ef4444; }
.metric-pagar .metric-icon-wrap { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #b91c1c; }
.metric-realizado { color: #6366f1; }
.metric-realizado .metric-icon-wrap { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4338ca; }
.metric-vencidos { color: #f59e0b; }
.metric-vencidos .metric-icon-wrap { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
.metric-alert { animation: pulseAlert 2.4s ease-in-out infinite; }
@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04); }
  50% { box-shadow: 0 4px 8px rgba(245, 158, 11, 0.18), 0 16px 40px rgba(245, 158, 11, 0.18); }
}
.metric-body { flex: 1; min-width: 0; }
.metric-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #64748b; margin: 0 0 6px;
}
.metric-value {
  font-size: 22px; font-weight: 800;
  color: #0f172a; margin: 0 0 6px;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.metric-detail {
  font-size: 11px; color: #64748b; margin: 0;
  display: inline-flex; align-items: center; gap: 5px;
}
.metric-detail i { font-size: 9px; color: currentColor; opacity: 0.5; }

/* Indicadores Operacionais */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.ops-card {
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
}
.ops-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}
.ops-card.ops-warning {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}
.ops-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.ops-info { flex: 1; min-width: 0; }
.ops-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; margin: 0 0 4px;
}
.ops-value {
  font-size: 22px; font-weight: 800;
  color: #0f172a; line-height: 1; margin: 0;
  font-variant-numeric: tabular-nums;
}
.ops-suffix {
  font-size: 11px; font-weight: 500;
  color: #94a3b8; margin-left: 6px;
}
.ops-trend {
  font-size: 11px; color: #475569; margin: 4px 0 0;
}

/* Painéis */
.dashboard-panel {
  background: var(--bg-surface);
  border-radius: 18px;
  padding: 24px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}
.panel-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.panel-title {
  font-size: 15px; font-weight: 700;
  color: #0f172a; margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.panel-subtitle {
  font-size: 11px; color: #94a3b8;
  margin: 4px 0 0;
}
.panel-legend {
  display: flex; gap: 14px; align-items: center;
  font-size: 11px; color: #64748b;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.panel-action {
  font-size: 12px; font-weight: 600;
  color: #6366f1; background: transparent;
  border: 0; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.panel-action:hover { background: #eef2ff; }

/* Performance Bars */
.performance-list { display: flex; flex-direction: column; gap: 14px; }
.performance-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center; gap: 12px;
}
.performance-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: #475569;
}
.performance-dot { width: 8px; height: 8px; border-radius: 50%; }
.performance-bar {
  height: 8px; background: #f1f5f9;
  border-radius: 4px; overflow: hidden;
}
.performance-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.6s ease;
}
.performance-value {
  font-size: 12px; font-weight: 700;
  color: #0f172a; margin: 0;
  font-variant-numeric: tabular-nums;
  min-width: 90px; text-align: right;
}
.performance-summary {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.summary-block { text-align: center; }
.summary-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #94a3b8; margin: 0 0 4px;
}
.summary-value {
  font-size: 20px; font-weight: 800;
  color: #4338ca; margin: 0;
  font-variant-numeric: tabular-nums;
}

/* Activity List */
.activity-list { display: flex; flex-direction: column; gap: 4px; }
.activity-item {
  display: flex; align-items: center;
  gap: 12px; padding: 12px;
  border-radius: 12px; cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.activity-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.activity-item.activity-overdue {
  background: linear-gradient(90deg, #fef2f2 0%, #ffffff 100%);
  border-color: #fecaca;
}
.activity-item.activity-overdue:hover { background: #fef2f2; }
.activity-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.activity-icon-red { background: #fee2e2; color: #b91c1c; }
.activity-icon-green { background: #d1fae5; color: #047857; }
.activity-icon-amber { background: #fef3c7; color: #b45309; }
.activity-content { flex: 1; min-width: 0; }
.activity-title {
  font-size: 13px; font-weight: 600;
  color: #0f172a; margin: 0 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-meta {
  font-size: 11px; color: #64748b;
  margin: 0; display: flex; gap: 6px;
  align-items: center; flex-wrap: wrap;
}
.activity-meta i { font-size: 9px; opacity: 0.6; }
.activity-divider { color: #cbd5e1; }
.activity-amount {
  font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Empty State */
.empty-state-mini {
  padding: 40px 20px; text-align: center;
  color: #94a3b8;
}
.empty-state-mini i {
  font-size: 36px; opacity: 0.4;
  margin-bottom: 10px; display: block;
}
.empty-state-mini p { font-size: 13px; margin: 0; }
.empty-state-success { color: #059669; }
.empty-state-success i { color: #10b981; opacity: 0.7; }

/* Responsive Dashboard */
@media (max-width: 768px) {
  .dashboard-hero { padding: 24px; }
  .dashboard-title { font-size: 24px; }
  .dashboard-hero-stats { width: 100%; padding: 14px 16px; gap: 16px; }
  .hero-stat-value { font-size: 20px; }
  .metric-value { font-size: 18px; }
  .ops-value { font-size: 18px; }
}

/* =================== View Toggle (Empresas card/list) =================== */
.view-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}
.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.view-toggle-btn:hover { color: #334155; background: #e2e8f0; }
.view-toggle-btn.active {
  background: var(--bg-surface);
  color: #4f46e5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* =================== Empresa list table =================== */
.empresa-list-table {
  border-collapse: collapse;
}
.empresa-list-table thead tr {
  background: linear-gradient(90deg, #f8fafc, #f1f5f9);
  border-bottom: 2px solid #e2e8f0;
}
.empresa-list-table thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.empresa-list-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.empresa-list-table tbody tr:hover { background: #f8fafc; }
.empresa-list-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: #334155;
  vertical-align: middle;
}
.empresa-logo-mini {
  width: 32px; height: 32px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: #e2e8f0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1;
}
.empresa-icon-mini {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1;
}

/* =================== Chat FAB & Widget =================== */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), 0 4px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 9000;
  transition: transform 0.18s, box-shadow 0.18s;
}
.chat-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 32px rgba(37, 211, 102, 0.55), 0 6px 12px rgba(0, 0, 0, 0.2);
}
.chat-fab:active { transform: scale(0.96); }
.chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(239,68,68,0.55), 0 0 0 4px rgba(239,68,68,0.18);
  animation: chatFabBadgePulse 1.6s ease-in-out infinite;
  z-index: 2;
}
@keyframes chatFabBadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(239,68,68,0.55), 0 0 0 4px rgba(239,68,68,0.18); }
  50%      { transform: scale(1.12); box-shadow: 0 4px 14px rgba(239,68,68,0.75), 0 0 0 6px rgba(239,68,68,0.10); }
}
.chat-fab.has-unread { animation: chatFabShake 2.2s ease-in-out infinite; }
@keyframes chatFabShake {
  0%, 88%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(-8deg); }
  92% { transform: rotate(8deg); }
  94% { transform: rotate(-6deg); }
  96% { transform: rotate(6deg); }
  98% { transform: rotate(0deg); }
}
[data-theme="dark"] .chat-fab-badge { border-color: #1e293b; }

.chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--bg-surface);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 8999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.chat-widget.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #128c7e, #075e54);
  color: #fff;
  flex-shrink: 0;
}
.chat-widget-header .chat-back-btn,
.chat-widget-header .chat-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s;
}
.chat-widget-header .chat-back-btn:hover,
.chat-widget-header .chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.chat-header-title {
  flex: 1;
  min-width: 0;
}
.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.chat-avatar-fallback {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.chat-widget-body {
  flex: 1;
  overflow-y: auto;
  background: #ece5dd;
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.chat-empty {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
}

/* Chat list */
.chat-list { background: var(--bg-surface); }
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.chat-list-item:hover { background: #f8fafc; }
.chat-list-item.has-unread { background: #f0fdf4; }
.chat-list-item.has-unread:hover { background: #dcfce7; }
.chat-list-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}
.chat-list-info { flex: 1; min-width: 0; }
.chat-list-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-preview {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.chat-list-time {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
}
.chat-unread-badge {
  background: #25d366;
  color: #fff;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Conversation */
.chat-conversation {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-day-divider {
  text-align: center;
  margin: 12px 0 6px;
}
.chat-day-divider span {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255,255,255,0.85);
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  word-wrap: break-word;
  word-break: break-word;
}
.chat-bubble.mine {
  align-self: flex-end;
  background: #dcf8c6;
  border-top-right-radius: 4px;
}
.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--bg-surface);
  border-top-left-radius: 4px;
}
.chat-bubble-text {
  font-size: 13px;
  color: #0f172a;
  line-height: 1.4;
  white-space: pre-wrap;
}
.chat-bubble-time {
  font-size: 10px;
  color: #64748b;
  text-align: right;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.chat-widget-footer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #f0f2f5;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.chat-msg-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 24px;
  border: 1px solid #cbd5e1;
  background: var(--bg-surface);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-msg-input:focus { border-color: #25d366; }
.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover { background: #128c7e; }
.chat-send-btn:active { transform: scale(0.93); }

/* ===== WhatsApp-like Features ===== */
/* Mensagem editada/excluída */
.chat-bubble.deleted .chat-bubble-text { font-style: italic; opacity: 0.7; }
.chat-bubble-edited { font-size: 9px; opacity: 0.65; font-style: italic; margin-right: 4px; }

/* Reply preview */
.chat-reply-preview {
  border-left: 3px solid #25d366;
  background: rgba(37, 211, 102, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 11px;
  cursor: pointer;
}
.chat-reply-preview .reply-sender { font-weight: 700; color: #128c7e; font-size: 10px; }
.chat-reply-preview .reply-text { color: var(--text-secondary, #475569); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Reply panel acima do input */
.chat-reply-panel {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: rgba(37, 211, 102, 0.08);
  border-top: 2px solid #25d366;
  border-left: 3px solid #25d366;
  font-size: 12px;
}
.chat-reply-panel .info { flex: 1; min-width: 0; }
.chat-reply-panel .label { font-weight: 700; color: #128c7e; font-size: 11px; }
.chat-reply-panel .text { color: var(--text-secondary, #475569); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-panel button { background: transparent; border: none; color: #94a3b8; cursor: pointer; font-size: 14px; padding: 4px; }

/* Reações */
.chat-bubble-reactions {
  position: absolute;
  bottom: -10px;
  display: flex;
  gap: 2px;
  background: var(--bg-surface, #fff);
  border-radius: 12px;
  padding: 2px 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  font-size: 12px;
}
.chat-bubble.mine .chat-bubble-reactions { right: 8px; }
.chat-bubble.theirs .chat-bubble-reactions { left: 8px; }
.chat-bubble-reactions .reaction-item { cursor: pointer; user-select: none; }
.chat-bubble-reactions .reaction-item.mine-react { background: rgba(37, 211, 102, 0.2); border-radius: 8px; padding: 0 2px; }
.chat-bubble-reactions .reaction-count { font-size: 10px; color: var(--text-secondary, #64748b); margin-left: 2px; }

/* Bubble margin para acomodar reações */
.chat-bubble.has-reactions { margin-bottom: 14px; }

/* Hover actions na bubble */
.chat-bubble { transition: background 0.15s; }
.chat-bubble-actions {
  position: absolute;
  top: -8px;
  display: none;
  gap: 1px;
  background: var(--bg-surface, #fff);
  border-radius: 16px;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 2;
}
.chat-bubble.mine .chat-bubble-actions { right: 4px; }
.chat-bubble.theirs .chat-bubble-actions { left: 4px; }
.chat-bubble:hover .chat-bubble-actions { display: flex; }
.chat-bubble-actions button {
  background: transparent;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary, #475569);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.chat-bubble-actions button:hover { background: var(--bg-surface-2, #f3f4f6); color: #25d366; }

/* Emoji picker quick */
.chat-emoji-picker {
  position: absolute;
  background: var(--bg-surface, #fff);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  padding: 6px 10px;
  display: flex;
  gap: 4px;
  z-index: 10;
  animation: fadeInScale 0.15s ease-out;
}
.chat-emoji-picker button {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  transition: transform 0.1s, background 0.12s;
}
.chat-emoji-picker button:hover { transform: scale(1.3); background: var(--bg-surface-2, #f3f4f6); }
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* Anexos na bubble */
.chat-bubble-attachment {
  margin: 4px 0;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
}
.chat-bubble-attachment img {
  max-width: 240px;
  max-height: 240px;
  display: block;
  border-radius: 8px;
  cursor: pointer;
}
.chat-bubble-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 8px;
  margin: 4px 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.chat-bubble-file:hover { background: rgba(0,0,0,0.08); }
.chat-bubble-file .icon { font-size: 28px; color: #128c7e; flex-shrink: 0; }
.chat-bubble-file .info { flex: 1; min-width: 0; }
.chat-bubble-file .name { font-weight: 600; font-size: 12px; color: var(--text-primary, #1f2937); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-bubble-file .size { font-size: 10px; color: var(--text-secondary, #64748b); }

/* Áudio bubble */
.chat-bubble-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  padding: 4px 0;
}
.chat-bubble-audio audio { flex: 1; height: 32px; }
.chat-bubble-audio .audio-icon { color: #128c7e; font-size: 18px; }

/* Footer com botões de anexo/audio */
.chat-widget-footer { align-items: center; }
.chat-footer-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.chat-footer-btn:hover { background: rgba(0,0,0,0.05); color: #128c7e; }
.chat-footer-btn.recording { background: #ef4444; color: white; animation: pulseRec 1s infinite; }
@keyframes pulseRec { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }

/* Menu attachment popup */
.chat-attach-menu {
  position: absolute;
  bottom: 60px;
  left: 12px;
  background: var(--bg-surface, #fff);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  padding: 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  animation: fadeInScale 0.15s ease-out;
}
.chat-attach-menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary, #1f2937);
  text-align: left;
  transition: background 0.12s;
}
.chat-attach-menu button:hover { background: var(--bg-surface-2, #f3f4f6); }
.chat-attach-menu button i { width: 24px; text-align: center; color: #128c7e; font-size: 16px; }

/* Gravando audio indicator */
.chat-recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fef2f2;
  border-radius: 24px;
  flex: 1;
  font-size: 13px;
  color: #dc2626;
}
.chat-recording-indicator .dot {
  width: 10px; height: 10px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulseRec 1s infinite;
}

/* Search bar no header */
.chat-search-bar {
  padding: 8px 12px;
  background: var(--bg-surface-2, #f3f4f6);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.chat-search-bar input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: 20px;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-surface, #fff);
  font-size: 12px;
  outline: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M15.5 14h-.79l-.28-.27a6.5 6.5 0 1 0-.7.7l.27.28v.79l5 4.99L20.49 19zM5 9.5C5 7 7 5 9.5 5S14 7 14 9.5 12 14 9.5 14 5 12 5 9.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 14px;
}

/* Indicador "digitando..." */
.chat-typing-indicator {
  font-size: 11px;
  color: #25d366;
  font-style: italic;
  padding: 0 12px 6px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-typing-indicator .dots {
  display: inline-flex;
  gap: 2px;
}
.chat-typing-indicator .dots span {
  width: 4px; height: 4px;
  background: #25d366;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.chat-typing-indicator .dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-indicator .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Dark mode adjustments */
[data-theme="dark"] .chat-bubble-actions { background: #1e293b; }
[data-theme="dark"] .chat-bubble-actions button { color: #cbd5e1; }
[data-theme="dark"] .chat-bubble-actions button:hover { background: #334155; }
[data-theme="dark"] .chat-emoji-picker { background: #1e293b; }
[data-theme="dark"] .chat-emoji-picker button:hover { background: #334155; }
[data-theme="dark"] .chat-attach-menu { background: #1e293b; }
[data-theme="dark"] .chat-attach-menu button { color: #e2e8f0; }
[data-theme="dark"] .chat-attach-menu button:hover { background: #334155; }
[data-theme="dark"] .chat-bubble-file { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .chat-bubble-file:hover { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .chat-recording-indicator { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .chat-bubble-reactions { background: #1e293b; }

/* Mobile chat */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    border-radius: 16px 16px 0 0;
  }
  .chat-fab {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
    font-size: 22px;
  }
}

/* =================== Admin Password Gate =================== */
.admin-pass-overlay {
  z-index: 10000 !important;
}
.admin-pass-warn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 8px;
  color: #991b1b;
}
.admin-pass-warn i {
  color: #dc2626;
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.admin-pass-warn p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: linear-gradient(135deg, #b91c1c, #991b1b); }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

/* =================== Profile / User photo =================== */
.profile-foto-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: #e2e8f0;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #cbd5e1, 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-foto-preview span {
  font-size: 36px;
  font-weight: 700;
  color: #64748b;
}

.user-list-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
}
.user-avatar-fallback {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

/* =================== Preview Modal =================== */
.preview-modal { padding: 4px; display: flex; flex-direction: column; gap: 14px; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.preview-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 0;
}
.preview-field.full { grid-column: 1 / -1; }
.preview-field.highlight {
  background: var(--accent-indigo-bg);
  border-color: var(--accent-indigo);
}
.preview-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.preview-value {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}
.preview-value.mono { font-family: 'Courier New', monospace; font-size: 11px; }
.preview-value.bold { font-weight: 700; font-size: 13px; }

/* Preview Sections */
.preview-section {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
}
.preview-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(90deg, var(--accent-indigo-soft), transparent);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-indigo-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.preview-section-header i { color: var(--accent-indigo); font-size: 12px; }
.preview-section .preview-grid { padding: 10px; }
.preview-section .overflow-x-auto { padding: 8px; }

/* =================== Form section title (for empresa modal extra) =================== */
.form-section {
  background: var(--bg-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
}
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #4f46e5;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

/* =================== Empresa logo preview (modal) =================== */
.empresa-logo-preview {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  background-color: #f1f5f9;
  border: 2px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.empresa-logo-placeholder {
  font-size: 40px;
  font-weight: 700;
  color: #94a3b8;
}

/* ===================== Tabela de Permissões Granulares ===================== */
.perm-table {
  border-collapse: collapse;
}
.perm-table th {
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-surface-2);
}
.perm-table td {
  vertical-align: middle;
}
.perm-table tbody tr:hover {
  background: var(--bg-surface-2);
}
.perm-table input[type="checkbox"] {
  accent-color: #6366f1;
  transition: transform 0.15s ease;
}
.perm-table input[type="checkbox"]:hover {
  transform: scale(1.15);
}
.perm-table input[type="checkbox"]:checked {
  accent-color: #4f46e5;
}

/* ============================================================
   TEMA LIGHT / DARK — variáveis CSS
   ============================================================ */
:root,
[data-theme="light"] {
  --bg-app: linear-gradient(135deg, #f5f7fb 0%, #eef1f8 100%);
  --bg-surface: #ffffff;
  --bg-surface-2: #f9fafb;
  --bg-surface-3: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: var(--border-color);
  --border-soft: #f3f4f6;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.18);
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --table-stripe: #f9fafb;
  --table-hover: #f3f4f6;
  --kpi-text: #1f2937;
  --modal-bg: #ffffff;
  --chat-bg: #ffffff;
  --chat-bubble-bg: #f3f4f6;
  --chat-bubble-mine: #dcf8c6;
  --hover-overlay: rgba(0,0,0,0.04);
  --accent-indigo: #6366f1;
}

[data-theme="dark"] {
  --bg-app: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-surface: #1e293b;
  --bg-surface-2: #283549;
  --bg-surface-3: #334155;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --border-soft: #2c3a52;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.55);
  --input-bg: #243149;
  --input-border: #3d4a63;
  --table-stripe: #243149;
  --table-hover: #2c3a52;
  --kpi-text: #e2e8f0;
  --modal-bg: #1e293b;
  --chat-bg: #1e293b;
  --chat-bubble-bg: #2c3a52;
  --chat-bubble-mine: #1e5a3a;
  --hover-overlay: rgba(255,255,255,0.05);
  --accent-indigo: #818cf8;
}

[data-theme="dark"] body {
  background: var(--bg-app);
  color: var(--text-primary);
}
[data-theme="dark"] .glass-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .ops-card-pro,
[data-theme="dark"] .filter-panel {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .modal-content { box-shadow: var(--shadow-modal) !important; }
[data-theme="dark"] .modal-header { border-bottom-color: var(--border-color) !important; }
[data-theme="dark"] .modal-footer { border-top-color: var(--border-color) !important; background: var(--bg-surface-2) !important; }
[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800 { color: var(--text-primary) !important; }
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600 { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-400 { color: var(--text-muted) !important; }
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .form-label { color: var(--text-secondary) !important; }
[data-theme="dark"] .data-table { background: var(--bg-surface) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .data-table thead th { background: var(--bg-surface-2) !important; color: var(--text-secondary) !important; border-bottom-color: var(--border-color) !important; }
[data-theme="dark"] .data-table tbody tr { border-bottom-color: var(--border-color) !important; }
[data-theme="dark"] .data-table tbody tr:hover { background: var(--table-hover) !important; }
[data-theme="dark"] .data-table tbody tr td { color: var(--text-primary) !important; }
[data-theme="dark"] .btn-secondary {
  background: var(--bg-surface-2) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .btn-secondary:hover { background: var(--bg-surface-3) !important; }
[data-theme="dark"] .btn-icon { background: var(--bg-surface-2) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .btn-icon:hover { background: var(--bg-surface-3) !important; }
[data-theme="dark"] .badge.bg-gray-100 { background: var(--bg-surface-3) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .perm-table { background: var(--bg-surface) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .perm-table thead th { background: var(--bg-surface-2) !important; color: var(--text-secondary) !important; }
[data-theme="dark"] .perm-table tbody tr:hover { background: var(--table-hover) !important; }
[data-theme="dark"] .bg-white { background: var(--bg-surface) !important; }
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100 { background: var(--bg-surface-2) !important; }
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-100 { border-color: var(--border-color) !important; }
[data-theme="dark"] .chat-widget { background: var(--chat-bg) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .chat-msg-bubble { background: var(--chat-bubble-bg) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .chat-bubble.mine,
[data-theme="dark"] .chat-msg-bubble.mine { background: var(--chat-bubble-mine) !important; }
[data-theme="dark"] .chat-list-item:hover { background: var(--bg-surface-2) !important; }
[data-theme="dark"] .empresa-card { background: var(--bg-surface) !important; color: var(--text-primary) !important; }
[data-theme="dark"] body { background: var(--bg-app); color: var(--text-primary); }

/* Botão de tema na sidebar */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 6px;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar.collapsed .theme-toggle-btn .theme-toggle-label { display: none; }

/* (Removido: CASCADE TABS — modo de barra superior não existe mais) */

/* ============================================================
   DRAG AND DROP — abas reordenáveis
   ============================================================ */
.nav-item[draggable="true"] { cursor: grab; position: relative; transition: transform 0.15s, box-shadow 0.15s; }
.nav-item[draggable="true"]:active { cursor: grabbing; }
.nav-item.dragging {
  opacity: 0.35;
  transform: scale(0.98);
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}
/* Linha guia ACIMA: indica que o item será posicionado antes deste */
.nav-item.drop-above {
  background: linear-gradient(to bottom, rgba(99,102,241,0.18), transparent 60%) !important;
}
.nav-item.drop-above::before {
  content: "";
  position: absolute;
  top: -2px; left: 6px; right: 6px;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(99,102,241,0.6);
  z-index: 5;
}
.nav-item.drop-above::after {
  content: "▼";
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  color: #6366f1;
  font-size: 10px;
  z-index: 6;
}
/* Linha guia ABAIXO: indica que o item será posicionado depois deste */
.nav-item.drop-below {
  background: linear-gradient(to top, rgba(99,102,241,0.18), transparent 60%) !important;
}
.nav-item.drop-below::before {
  content: "";
  position: absolute;
  bottom: -2px; left: 6px; right: 6px;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(99,102,241,0.6);
  z-index: 5;
}
.nav-item.drop-below::after {
  content: "▲";
  position: absolute;
  bottom: -10px; left: 50%;
  transform: translateX(-50%);
  color: #6366f1;
  font-size: 10px;
  z-index: 6;
}
.nav-item .drag-handle {
  display: none;
  margin-right: 6px;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  cursor: grab;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}
.nav-item .drag-handle:hover {
  color: #c7d2fe;
  background: rgba(255,255,255,0.08);
}
.nav-item .drag-handle:active { cursor: grabbing; }
.sidebar:not(.collapsed) .nav-item:hover .drag-handle { display: inline-block; }
/* Compatibilidade legacy - mantém o caso .drag-over neutro */
.nav-item.drag-over { background: rgba(129,140,248,0.10); }

/* ============================================================
   CHAT AVANÇADO — usuários online/offline, grupos, arquivadas
   ============================================================ */
.presence-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
  border: 2px solid #fff;
  flex-shrink: 0;
}
.presence-dot.online { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
.presence-dot.away { background: #f59e0b; }
.presence-dot.offline { background: #9ca3af; }

.chat-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-surface, #fff);
  position: sticky;
  top: 0;
  z-index: 4;
}
.chat-tab-btn {
  flex: 1;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
}
.chat-tab-btn.active { color: #6366f1; border-bottom-color: #6366f1; background: rgba(99,102,241,0.06); }
.chat-tab-btn:hover { background: rgba(99,102,241,0.05); color: #4f46e5; }
.chat-tab-badge {
  background: #ef4444; color: #fff; font-size: 9px;
  border-radius: 10px; padding: 1px 6px;
  font-weight: 700;
}

.chat-online-list-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft, #f3f4f6);
  transition: background 0.15s;
}
.chat-online-list-item:hover { background: var(--bg-surface-2, #f9fafb); }
.chat-online-list-item .ava {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,#818cf8,#6366f1);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center;
  flex-shrink: 0;
}
.chat-online-list-item .ava .presence-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 11px; height: 11px;
  border: 2px solid #fff;
}
.chat-online-list-item .info { flex: 1; min-width: 0; }
.chat-online-list-item .info .nm { font-weight: 600; font-size: 13px; color: var(--text-primary, #1f2937); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-online-list-item .info .st { font-size: 11px; color: var(--text-muted); }

.chat-conv-actions {
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-list-item:hover .chat-conv-actions { opacity: 1; }
.chat-conv-actions button {
  background: rgba(99,102,241,0.1);
  border: 0;
  width: 22px; height: 22px;
  border-radius: 5px;
  color: #6366f1;
  cursor: pointer;
  font-size: 10px;
}
.chat-conv-actions button:hover { background: rgba(99,102,241,0.25); }

.chat-list-item.fixada { background: rgba(255,235,180,0.4); }
[data-theme="dark"] .chat-list-item.fixada { background: rgba(120,90,30,0.3); }

.chat-conv-meta-icons {
  display: inline-flex; gap: 3px; margin-left: 4px;
  font-size: 9px; color: var(--text-muted);
}

.chat-search-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text-primary, #1f2937);
  margin: 8px;
  width: calc(100% - 16px);
}

/* ============================================================
   EMPRÉSTIMOS — KPIs e tabelas
   ============================================================ */
.kpi-emp {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
}
.kpi-emp .kpi-label { color: #92400e; }
.kpi-emp .kpi-value { color: #78350f; }
.kpi-emp .kpi-icon { background: #f59e0b; color: #fff; }

.kpi-emp-debt {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border: 1px solid #fca5a5;
}
.kpi-emp-debt .kpi-label { color: #991b1b; }
.kpi-emp-debt .kpi-value { color: #7f1d1d; }
.kpi-emp-debt .kpi-icon { background: #ef4444; color: #fff; }

.kpi-emp-paid {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 1px solid #6ee7b7;
}
.kpi-emp-paid .kpi-label { color: #065f46; }
.kpi-emp-paid .kpi-value { color: #064e3b; }
.kpi-emp-paid .kpi-icon { background: #10b981; color: #fff; }

.emp-status-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent; }
.emp-status-ativo { background: #dbeafe; color: #1e40af; }
.emp-status-quitado { background: #d1fae5; color: #065f46; }
.emp-status-em_atraso { background: #fee2e2; color: #991b1b; animation: pulseRed 1.6s infinite; }
.emp-status-cancelado { background: #f3f4f6; color: #374151; }
.emp-status-renegociado { background: #ede9fe; color: #5b21b6; }

/* DARK MODE: badges de empréstimo legíveis */
[data-theme="dark"] .emp-status-badge { border-color: rgba(255,255,255,0.12); }
[data-theme="dark"] .emp-status-ativo { background: rgba(59,130,246,0.22) !important; color: #93c5fd !important; }
[data-theme="dark"] .emp-status-quitado { background: rgba(16,185,129,0.22) !important; color: #6ee7b7 !important; }
[data-theme="dark"] .emp-status-em_atraso { background: rgba(239,68,68,0.25) !important; color: #fca5a5 !important; }
[data-theme="dark"] .emp-status-cancelado { background: rgba(148,163,184,0.20) !important; color: #cbd5e1 !important; }
[data-theme="dark"] .emp-status-renegociado { background: rgba(139,92,246,0.25) !important; color: #c4b5fd !important; }
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

.emp-card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.15s;
  cursor: pointer;
}
.emp-card:hover { border-color: #6366f1; box-shadow: 0 6px 20px rgba(99,102,241,0.12); transform: translateY(-2px); }
.emp-card.encerrado { opacity: 0.7; background: var(--bg-surface-2, #f9fafb); }

.emp-progress {
  height: 6px; background: #e5e7eb; border-radius: 3px;
  overflow: hidden; margin-top: 8px;
}
.emp-progress-bar {
  height: 100%; background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.parcelas-table { width: 100%; font-size: 12px; }
.parcelas-table th { background: var(--bg-surface-2, #f9fafb); padding: 8px; text-align: left; font-weight: 600; color: var(--text-secondary, #6b7280); border-bottom: 1px solid var(--border-color, #e5e7eb); }
.parcelas-table td { padding: 8px; border-bottom: 1px solid var(--border-soft, #f3f4f6); }
.parcelas-table tr.parcela-paga td { background: rgba(16,185,129,0.06); }
.parcelas-table tr.parcela-atrasada td { background: rgba(239,68,68,0.06); }

/* ============================================================
   PRÉ-VISUALIZAÇÃO COLABORADOR
   ============================================================ */
.colab-quickview-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 9000; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.colab-quickview {
  background: var(--bg-surface, #fff);
  border-radius: 16px;
  width: min(720px, 95vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  animation: slideUp 0.2s ease;
}
.colab-quickview-header {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  padding: 22px 24px;
  display: flex; align-items: center; gap: 16px;
}
.colab-quickview-header .ava {
  width: 64px; height: 64px;
  border-radius: 50%;
  background-size: cover; background-position: center;
  border: 3px solid rgba(255,255,255,0.4);
  background-color: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  flex-shrink: 0;
}
.colab-quickview-body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.colab-quickview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; margin-bottom: 16px; }
.colab-quickview-grid .item .lbl { font-size: 10px; text-transform: uppercase; color: var(--text-muted, #9ca3af); font-weight: 600; letter-spacing: 0.5px; }
.colab-quickview-grid .item .val { font-size: 13px; color: var(--text-primary, #1f2937); font-weight: 500; margin-top: 2px; }
.colab-quickview-footer { padding: 12px 24px; border-top: 1px solid var(--border-color, #e5e7eb); display: flex; justify-content: flex-end; gap: 8px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   MENU DE CONFIGURAÇÕES (sidebar gear)
   ============================================================ */
.config-btn {
  cursor: pointer;
  user-select: none;
}
.config-menu {
  background: var(--modal-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  padding: 8px;
  color: var(--text-primary, #1f2937);
  animation: fadeIn 0.12s ease-out;
}
.config-menu-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
}
.config-menu-divider {
  height: 1px;
  background: var(--border-color, #e5e7eb);
  margin: 4px 0;
}
.config-menu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary, #1f2937);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.config-menu-item:hover {
  background: var(--hover-overlay, rgba(0,0,0,0.05));
}
.config-menu-item.config-menu-danger {
  color: #dc2626;
}
.config-menu-item.config-menu-danger:hover {
  background: rgba(220,38,38,0.08);
}
[data-theme="dark"] .config-menu {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
}
[data-theme="dark"] .config-menu-item.config-menu-danger {
  color: #f87171;
}

/* ============================================================
   PAINEL DE ALERTAS (sino de notificações)
   ============================================================ */
.alerts-bell-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-surface-2, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary, #6b7280);
  transition: all 0.15s;
  cursor: pointer;
}
.alerts-bell-btn:hover {
  background: var(--bg-surface-3, #e5e7eb);
  color: var(--text-primary, #1f2937);
}
.alerts-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-surface, #fff);
}

/* ===== Sino de TAREFAS (separado do de alertas) ===== */
.tarefas-bell-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-surface-2, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary, #6b7280);
  transition: all 0.15s;
  cursor: pointer;
}
.tarefas-bell-btn:hover {
  background: var(--bg-surface-3, #e5e7eb);
  color: #ec4899;
}
.tarefas-bell-btn.has-tasks {
  color: #ec4899;
  animation: bellShake 1.4s ease-in-out infinite;
}
@keyframes bellShake {
  0%, 92%, 100% { transform: rotate(0); }
  94% { transform: rotate(-12deg); }
  96% { transform: rotate(10deg); }
  98% { transform: rotate(-6deg); }
}
.tarefas-bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ec4899;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-surface, #fff);
}
[data-theme="dark"] .tarefas-bell-btn { background: var(--bg-surface-3) !important; color: var(--text-secondary) !important; border-color: #334155 !important; }
[data-theme="dark"] .tarefas-bell-btn:hover { background: var(--bg-surface-2) !important; color: #f9a8d4 !important; }
[data-theme="dark"] .tarefas-bell-btn.has-tasks { color: #f9a8d4 !important; }
[data-theme="dark"] .tarefas-bell-badge { border-color: #1e293b !important; }

/* ===== Tarefas — KPI cards & badges ===== */
.kpi-pendente   .kpi-icon { background: linear-gradient(135deg, #94a3b8, #64748b); color: white; }
.kpi-andamento  .kpi-icon { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: white; }
.kpi-progresso  .kpi-icon { background: linear-gradient(135deg, #60a5fa, #3b82f6); color: white; }
.kpi-concluida  .kpi-icon { background: linear-gradient(135deg, #34d399, #10b981); color: white; }
.kpi-critica    .kpi-icon { background: linear-gradient(135deg, #f87171, #dc2626); color: white; }

.tarefa-prio-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(99,102,241,0.12);
  color: #4f46e5;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  margin: 2px 2px 2px 0;
}
.user-chip-more {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(99,102,241,0.18);
  color: #4f46e5;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
[data-theme="dark"] .user-chip { background: rgba(165,180,252,0.18); color: #c7d2fe; }
[data-theme="dark"] .user-chip-more { background: rgba(165,180,252,0.30); color: #c7d2fe; }

.usuarios-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  background: var(--bg-surface-2, #f8fafc);
}
.user-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-surface, #fff);
  border: 1.5px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--text-primary, #1f2937);
}
.user-check:hover { background: rgba(99,102,241,0.06); border-color: #a5b4fc; }
.user-check.checked { background: rgba(99,102,241,0.10); border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.18); }
.user-check input[type=checkbox] { accent-color: #6366f1; }
.user-check-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
[data-theme="dark"] .usuarios-checks { background: var(--bg-surface-3) !important; border-color: #334155 !important; }
[data-theme="dark"] .user-check { background: #1e293b !important; border-color: #334155 !important; color: #e2e8f0 !important; }
[data-theme="dark"] .user-check:hover { background: #2c3a52 !important; border-color: #6366f1 !important; }
[data-theme="dark"] .user-check.checked { background: rgba(99,102,241,0.20) !important; border-color: #818cf8 !important; }

/* Linha atrasada na tabela de tarefas */
.row-late { background: rgba(239,68,68,0.05) !important; }
[data-theme="dark"] .row-late { background: rgba(239,68,68,0.10) !important; }
.alerts-panel-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9990;
  animation: fadeIn 0.15s ease;
}
.alerts-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: var(--bg-surface, #fff);
  box-shadow: -8px 0 32px rgba(0,0,0,0.18);
  z-index: 9991;
  display: flex; flex-direction: column;
  animation: slideInRight 0.2s ease-out;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.alerts-panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.alerts-panel-body {
  flex: 1; overflow-y: auto;
  padding: 12px 16px 24px;
}
.alerts-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 12px 8px 6px;
  font-weight: 700;
}
.alert-item {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-left: 4px solid #6b7280;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-item.alert-overdue { border-left-color: #dc2626; }
.alert-item.alert-today { border-left-color: #f59e0b; }
.alert-item.alert-soon { border-left-color: #3b82f6; }
.alert-item .alert-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.alert-item .alert-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.alert-item .alert-value { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.alert-tag {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.alert-tag.tag-overdue { background: #fee2e2; color: #991b1b; }
.alert-tag.tag-today { background: #fef3c7; color: #92400e; }
.alert-tag.tag-soon { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .alert-tag.tag-overdue { background: rgba(220,38,38,0.15); color: #fca5a5; }
[data-theme="dark"] .alert-tag.tag-today { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .alert-tag.tag-soon { background: rgba(59,130,246,0.15); color: #93c5fd; }

/* ============================================================
   MODAL DE CAMPOS FALTANDO (validação detalhada)
   ============================================================ */
.missing-fields-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.missing-fields-modal {
  background: var(--bg-surface, #fff);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  max-width: 460px; width: calc(100% - 32px);
  padding: 24px;
  animation: slideUp 0.18s ease-out;
}
.missing-fields-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fef3c7;
  color: #d97706;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto 14px;
}
.missing-fields-list {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  list-style: none;
}
.missing-fields-list li {
  padding: 4px 0;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-primary);
  font-size: 14px;
}
.missing-fields-list li::before {
  content: "•";
  color: #dc2626;
  font-size: 18px;
  line-height: 1;
}

/* ============================================================
   FILTROS GRID (empréstimos, movimentos)
   ============================================================ */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 14px;
}
.form-label-sm {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.emp-preview-box {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: #3730a3;
}
[data-theme="dark"] .emp-preview-box {
  background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(79,70,229,0.1) 100%);
  border-color: rgba(99,102,241,0.3);
  color: #c7d2fe;
}

/* ============================================================
   UTILITÁRIOS DE COR / TEXTO
   ============================================================ */
.text-muted { color: var(--text-muted, #9ca3af); }
.text-indigo-strong { color: #4338ca; font-weight: 600; }
.text-rose-strong { color: #be123c; font-weight: 600; }
.text-emerald-strong { color: #047857; font-weight: 600; }
[data-theme="dark"] .text-indigo-strong { color: #a5b4fc; }
[data-theme="dark"] .text-rose-strong { color: #fda4af; }
[data-theme="dark"] .text-emerald-strong { color: #6ee7b7; }
.border-table { border-color: var(--border-color, #e5e7eb); }

/* ============================================================
   REFINAMENTOS DARK MODE EXTRAS
   ============================================================ */
[data-theme="dark"] .kpi-card .text-gray-500,
[data-theme="dark"] .kpi-card .text-gray-400 { color: var(--text-secondary) !important; }
[data-theme="dark"] .kpi-card .kpi-value,
[data-theme="dark"] .kpi-card h3 { color: var(--text-primary) !important; }
[data-theme="dark"] .glass-card .text-gray-700,
[data-theme="dark"] .glass-card .text-gray-600 { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-black { color: var(--text-primary) !important; }
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-gray-400 { border-color: var(--border-color) !important; }
[data-theme="dark"] .bg-gray-50\/50,
[data-theme="dark"] .bg-gray-100\/50 { background: var(--bg-surface-2) !important; }
[data-theme="dark"] .hover\:bg-gray-50:hover,
[data-theme="dark"] .hover\:bg-gray-100:hover { background: var(--table-hover) !important; }
[data-theme="dark"] .ring-gray-200,
[data-theme="dark"] .ring-gray-300 { --tw-ring-color: var(--border-color) !important; }
[data-theme="dark"] .divide-gray-200 > * + * { border-color: var(--border-color) !important; }
[data-theme="dark"] tr.parcela-row,
[data-theme="dark"] tr.even\:bg-gray-50:nth-child(even) { background: var(--table-stripe) !important; }
[data-theme="dark"] .filters-grid select,
[data-theme="dark"] .filters-grid input { background: var(--bg-surface-3) !important; }
[data-theme="dark"] .alert-item { background: var(--bg-surface-3); }
[data-theme="dark"] .alerts-bell-btn { background: var(--bg-surface-3); color: var(--text-secondary); }
[data-theme="dark"] .alerts-bell-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }
[data-theme="dark"] .emp-preview-box code { background: rgba(255,255,255,0.05); color: #e0e7ff; }
[data-theme="dark"] .stats-card,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .info-card {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.65) !important; }
[data-theme="dark"] .toast,
[data-theme="dark"] .notification {
  background: var(--bg-surface-3) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .text-gray-300 { color: var(--text-secondary) !important; }
[data-theme="dark"] .placeholder\:text-gray-400::placeholder { color: var(--text-muted) !important; }
[data-theme="dark"] hr { border-color: var(--border-color) !important; }
[data-theme="dark"] .stripe-row:nth-child(even) { background: var(--table-stripe); }
[data-theme="dark"] .empty-state { color: var(--text-muted); }
[data-theme="dark"] .breadcrumb { color: var(--text-secondary); }
[data-theme="dark"] .breadcrumb a { color: var(--accent-indigo); }
[data-theme="dark"] .tab-active { background: var(--bg-surface-3) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .tab-inactive { color: var(--text-muted); }
[data-theme="dark"] .tab-inactive:hover { background: var(--bg-surface-2); color: var(--text-secondary); }

/* ============================================================
   ATTACHMENTS / ANEXOS PREVIEW
   ============================================================ */
.attach-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px;
}
.attach-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-primary);
}
.attach-item img.thumb {
  width: 32px; height: 32px;
  object-fit: cover;
  border-radius: 4px;
}
.attach-item .att-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-item .att-remove {
  margin-left: 4px;
  color: #dc2626;
  cursor: pointer;
  font-size: 12px;
}
.attach-item .att-view {
  color: var(--accent-indigo);
  cursor: pointer;
}

/* ============================================================
   CAMPOS PERSONALIZADOS (banco custom)
   ============================================================ */
.custom-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 36px;
  gap: 8px;
  margin-bottom: 8px;
}
.custom-field-row .btn-remove-field {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fee2e2; color: #dc2626;
  border: none; border-radius: 6px;
  cursor: pointer;
}
[data-theme="dark"] .custom-field-row .btn-remove-field {
  background: rgba(220,38,38,0.15); color: #fca5a5;
}
.btn-add-field {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface-3);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-add-field:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

/* ============================================================
   DARK/LIGHT MODE — REFINAMENTO FINAL CONSOLIDADO
   Garante que TUDO siga o tema atual sem misturar superfícies
   ============================================================ */

/* === LIGHT MODE (default): superfícies sempre claras === */
[data-theme="light"] body,
[data-theme="light"] .main-content {
  background: var(--bg-app-solid);
  color: var(--text-primary);
}
[data-theme="light"] .glass-card,
[data-theme="light"] .stat-card-content,
[data-theme="light"] .modal-content,
[data-theme="light"] .modal-container,
[data-theme="light"] .kpi-card,
[data-theme="light"] .ops-card-pro,
[data-theme="light"] .filter-panel,
[data-theme="light"] .chart-container,
[data-theme="light"] .form-section,
[data-theme="light"] .stats-card,
[data-theme="light"] .summary-card,
[data-theme="light"] .info-card,
[data-theme="light"] .activity-item,
[data-theme="light"] .alerts-panel,
[data-theme="light"] .config-menu {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}
[data-theme="light"] .data-table,
[data-theme="light"] .perm-table {
  background: var(--bg-surface);
  color: var(--text-primary);
}
[data-theme="light"] .data-table thead th,
[data-theme="light"] .perm-table thead th {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="light"] .data-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
}
[data-theme="light"] .data-table tbody tr:hover {
  background: var(--bg-surface-2);
}
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea,
[data-theme="light"] input, [data-theme="light"] textarea, [data-theme="light"] select {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
[data-theme="light"] .filters-grid {
  background: var(--bg-surface-2);
  border-color: var(--border-color);
}

/* === DARK MODE: TUDO escuro de forma consistente === */
[data-theme="dark"] body,
[data-theme="dark"] .main-content,
[data-theme="dark"] html {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .glass-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-container,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .ops-card-pro,
[data-theme="dark"] .filter-panel,
[data-theme="dark"] .chart-container,
[data-theme="dark"] .form-section,
[data-theme="dark"] .stats-card,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .info-card,
[data-theme="dark"] .activity-item,
[data-theme="dark"] .alerts-panel,
[data-theme="dark"] .config-menu,
[data-theme="dark"] .empresa-card,
[data-theme="dark"] .colab-quickview {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .data-table,
[data-theme="dark"] .perm-table {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .data-table thead th,
[data-theme="dark"] .perm-table thead th {
  background: #283549 !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .data-table tbody tr,
[data-theme="dark"] .perm-table tbody tr {
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .data-table tbody tr:nth-child(even) {
  background: #243149 !important;
}
[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] .perm-table tbody tr:hover {
  background: #2c3a52 !important;
}
[data-theme="dark"] .data-table td {
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

/* =================== Empresas — DARK MODE FIX (cards + list + toggle) =================== */
/* Cards de empresas */
[data-theme="dark"] .empresa-card {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .empresa-card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45) !important;
}
[data-theme="dark"] .empresa-card h3,
[data-theme="dark"] .empresa-card .text-gray-900 {
  color: #f1f5f9 !important;
}
[data-theme="dark"] .empresa-card .text-gray-500,
[data-theme="dark"] .empresa-card .text-gray-600,
[data-theme="dark"] .empresa-card .text-gray-700 {
  color: #cbd5e1 !important;
}
[data-theme="dark"] .empresa-card .text-gray-400 {
  color: #94a3b8 !important;
}
[data-theme="dark"] .empresa-card .border-gray-100,
[data-theme="dark"] .empresa-card .border-t {
  border-color: #334155 !important;
}
[data-theme="dark"] .empresa-logo-card {
  background-color: #243149 !important;
  border-color: #334155 !important;
}

/* Pílulas/badges dentro do card e da lista (bg-indigo-50, bg-emerald-50, etc) */
[data-theme="dark"] .empresa-card .bg-indigo-50,
[data-theme="dark"] .empresa-list-table .bg-indigo-50 {
  background: rgba(99, 102, 241, 0.18) !important;
  color: #c7d2fe !important;
}
[data-theme="dark"] .empresa-card .text-indigo-700,
[data-theme="dark"] .empresa-list-table .text-indigo-700 {
  color: #c7d2fe !important;
}
[data-theme="dark"] .empresa-card .bg-emerald-50,
[data-theme="dark"] .empresa-list-table .bg-emerald-50 {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #6ee7b7 !important;
}
[data-theme="dark"] .empresa-card .text-emerald-700,
[data-theme="dark"] .empresa-list-table .text-emerald-700 {
  color: #6ee7b7 !important;
}
[data-theme="dark"] .empresa-card .text-indigo-600 {
  color: #a5b4fc !important;
}

/* Tabela de empresas (modo lista) */
[data-theme="dark"] .empresa-list-table {
  background: transparent !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .empresa-list-table thead tr {
  background: linear-gradient(90deg, #243149, #1e293b) !important;
  border-bottom: 2px solid #334155 !important;
}
[data-theme="dark"] .empresa-list-table thead th {
  color: #94a3b8 !important;
  background: transparent !important;
}
[data-theme="dark"] .empresa-list-table tbody tr {
  border-bottom-color: #334155 !important;
  background: transparent !important;
}
[data-theme="dark"] .empresa-list-table tbody tr:hover {
  background: #2c3a52 !important;
}
[data-theme="dark"] .empresa-list-table tbody td {
  color: #e2e8f0 !important;
}
[data-theme="dark"] .empresa-list-table .text-gray-400 {
  color: #64748b !important;
}
[data-theme="dark"] .empresa-logo-mini {
  background-color: #243149 !important;
  border-color: #1e293b !important;
  box-shadow: 0 0 0 1px #334155 !important;
}
[data-theme="dark"] .empresa-icon-mini {
  border-color: #1e293b !important;
  box-shadow: 0 0 0 1px #334155 !important;
}

/* Toggle de visualização (Cartões / Lista) */
[data-theme="dark"] .view-toggle {
  background: #243149 !important;
}
[data-theme="dark"] .view-toggle-btn {
  color: #94a3b8 !important;
  background: transparent !important;
}
[data-theme="dark"] .view-toggle-btn:hover {
  color: #e2e8f0 !important;
  background: #2c3a52 !important;
}
[data-theme="dark"] .view-toggle-btn.active {
  background: #1e293b !important;
  color: #a5b4fc !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.45) !important;
}

/* Estado vazio (glass-card centralizado) e título da página */
[data-theme="dark"] h1.text-gray-900 {
  color: #f1f5f9 !important;
}
[data-theme="dark"] .glass-card .bg-indigo-100 {
  background: rgba(99,102,241,0.18) !important;
}
[data-theme="dark"] .glass-card .text-indigo-600 {
  color: #a5b4fc !important;
}

/* Inputs no dark — tudo escuro */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea,
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="color"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #243149 !important;
  border-color: #3d4a63 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] input::placeholder {
  color: #64748b !important;
}
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  background: #2c3a52 !important;
  border-color: #818cf8 !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(129,140,248,0.2) !important;
}

/* Modal de empresa, conta, lançamento etc — fundo consistente */
[data-theme="dark"] .modal-overlay {
  background: rgba(0,0,0,0.75) !important;
}
[data-theme="dark"] .modal-header {
  background: linear-gradient(135deg, #1e293b 0%, #283549 100%) !important;
  border-bottom: 1px solid #334155 !important;
}
[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .modal-title {
  color: #e2e8f0 !important;
}
[data-theme="dark"] .modal-body {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .modal-footer {
  background: #283549 !important;
  border-top: 1px solid #334155 !important;
}

/* Botões secundários no dark */
[data-theme="dark"] .btn-secondary {
  background: #334155 !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}
[data-theme="dark"] .btn-secondary:hover {
  background: #3d4a63 !important;
  border-color: #64748b !important;
}
[data-theme="dark"] .btn-icon {
  background: #283549 !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .btn-icon:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

/* Badges e cores no dark */
[data-theme="dark"] .badge.bg-gray-100 { background: #334155 !important; color: #cbd5e1 !important; }
[data-theme="dark"] .badge-pendente { background: rgba(245,158,11,0.20) !important; color: #fcd34d !important; border: 1px solid rgba(245,158,11,0.35) !important; }
[data-theme="dark"] .badge-pago { background: rgba(16,185,129,0.22) !important; color: #6ee7b7 !important; border: 1px solid rgba(16,185,129,0.40) !important; }
[data-theme="dark"] .badge-recebido { background: rgba(16,185,129,0.22) !important; color: #6ee7b7 !important; border: 1px solid rgba(16,185,129,0.40) !important; }
[data-theme="dark"] .badge-vencido { background: rgba(239,68,68,0.22) !important; color: #fca5a5 !important; border: 1px solid rgba(239,68,68,0.40) !important; }
[data-theme="dark"] .badge-cancelado { background: rgba(148,163,184,0.20) !important; color: #cbd5e1 !important; border: 1px solid rgba(148,163,184,0.35) !important; }

/* Badges status com classes Tailwind hardcoded (Pedidos / Obras / Status botões) */
[data-theme="dark"] .badge.bg-yellow-100,
[data-theme="dark"] .badge.bg-amber-100,
[data-theme="dark"] span.bg-yellow-100,
[data-theme="dark"] span.bg-amber-100 { background: rgba(245,158,11,0.22) !important; color: #fcd34d !important; }
[data-theme="dark"] .badge.bg-yellow-100.text-yellow-800,
[data-theme="dark"] .badge.bg-amber-100.text-amber-800,
[data-theme="dark"] span.bg-yellow-100.text-yellow-800,
[data-theme="dark"] span.bg-amber-100.text-amber-800 { color: #fcd34d !important; }

[data-theme="dark"] .badge.bg-blue-100,
[data-theme="dark"] span.bg-blue-100 { background: rgba(59,130,246,0.22) !important; color: #93c5fd !important; }
[data-theme="dark"] .badge.bg-blue-100.text-blue-800,
[data-theme="dark"] span.bg-blue-100.text-blue-800 { color: #93c5fd !important; }

[data-theme="dark"] .badge.bg-purple-100,
[data-theme="dark"] span.bg-purple-100 { background: rgba(139,92,246,0.22) !important; color: #c4b5fd !important; }
[data-theme="dark"] .badge.bg-purple-100.text-purple-800,
[data-theme="dark"] span.bg-purple-100.text-purple-800 { color: #c4b5fd !important; }

[data-theme="dark"] .badge.bg-green-100,
[data-theme="dark"] .badge.bg-emerald-100,
[data-theme="dark"] span.bg-green-100,
[data-theme="dark"] span.bg-emerald-100 { background: rgba(16,185,129,0.22) !important; color: #6ee7b7 !important; }
[data-theme="dark"] .badge.bg-green-100.text-green-800,
[data-theme="dark"] .badge.bg-emerald-100.text-emerald-800,
[data-theme="dark"] span.bg-green-100.text-green-800,
[data-theme="dark"] span.bg-emerald-100.text-emerald-800 { color: #6ee7b7 !important; }

[data-theme="dark"] .badge.bg-orange-100,
[data-theme="dark"] span.bg-orange-100 { background: rgba(249,115,22,0.22) !important; color: #fdba74 !important; }
[data-theme="dark"] .badge.bg-orange-100.text-orange-800,
[data-theme="dark"] span.bg-orange-100.text-orange-800 { color: #fdba74 !important; }

[data-theme="dark"] .badge.bg-gray-100,
[data-theme="dark"] span.bg-gray-100 { background: rgba(148,163,184,0.20) !important; color: #cbd5e1 !important; }
[data-theme="dark"] .badge.bg-gray-100.text-gray-700,
[data-theme="dark"] .badge.bg-gray-100.text-gray-800,
[data-theme="dark"] span.bg-gray-100.text-gray-700,
[data-theme="dark"] span.bg-gray-100.text-gray-800 { color: #cbd5e1 !important; }

/* Obras status badge — dark mode legibilidade */
[data-theme="dark"] .obra-status-badge { border: 1px solid rgba(255,255,255,0.10) !important; }
[data-theme="dark"] .obra-status-planejamento { background: rgba(59,130,246,0.22) !important; color: #93c5fd !important; }
[data-theme="dark"] .obra-status-em-andamento { background: rgba(245,158,11,0.22) !important; color: #fcd34d !important; }
[data-theme="dark"] .obra-status-paralisada { background: rgba(249,115,22,0.22) !important; color: #fdba74 !important; }
[data-theme="dark"] .obra-status-concluida { background: rgba(16,185,129,0.22) !important; color: #6ee7b7 !important; }
[data-theme="dark"] .obra-status-cancelada { background: rgba(148,163,184,0.20) !important; color: #cbd5e1 !important; }

/* Botões status-clickable (Realizado / Vencido / Pendente) — dark mode */
[data-theme="dark"] .status-clickable .badge { box-shadow: 0 0 0 1px rgba(255,255,255,0.06); }
[data-theme="dark"] .status-clickable .badge .fa-caret-down { color: inherit !important; opacity: 0.85; }
[data-theme="dark"] .status-menu {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
}
[data-theme="dark"] .status-menu-item:hover { background: #243149 !important; }

/* Dashboard ícones (gradient cards) — força contraste em dark */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .stat-card-content,
[data-theme="dark"] .ops-card-pro {
  color: #ffffff !important;
}
[data-theme="dark"] .stat-card i,
[data-theme="dark"] .ops-card-pro i { color: #ffffff !important; opacity: 0.95 !important; }
[data-theme="dark"] .ops-card-pro .ops-icon-pro,
[data-theme="dark"] .ops-card-pro .ops-icon { color: #ffffff !important; }
[data-theme="dark"] .ops-card-pro h3,
[data-theme="dark"] .ops-card-pro p,
[data-theme="dark"] .ops-card-pro span { color: #ffffff !important; }

/* Glass-card icons that may have light bg-*-100 (like bg-purple-100, bg-indigo-100) */
[data-theme="dark"] .glass-card .bg-purple-100 { background: rgba(139,92,246,0.18) !important; }
[data-theme="dark"] .glass-card .bg-indigo-100 { background: rgba(99,102,241,0.18) !important; }
[data-theme="dark"] .glass-card .bg-emerald-100 { background: rgba(16,185,129,0.18) !important; }
[data-theme="dark"] .glass-card .bg-orange-100 { background: rgba(249,115,22,0.18) !important; }
[data-theme="dark"] .glass-card .text-purple-600 { color: #c4b5fd !important; }
[data-theme="dark"] .glass-card .text-indigo-600 { color: #a5b4fc !important; }
[data-theme="dark"] .glass-card .text-emerald-600 { color: #6ee7b7 !important; }
[data-theme="dark"] .glass-card .text-orange-600 { color: #fdba74 !important; }

/* Cores Tailwind hardcoded — força dark equivalents */
[data-theme="dark"] .bg-white { background: #1e293b !important; }
[data-theme="dark"] .bg-gray-50 { background: #243149 !important; }
[data-theme="dark"] .bg-gray-100 { background: #283549 !important; }
[data-theme="dark"] .bg-gray-200 { background: #334155 !important; }
[data-theme="dark"] .bg-indigo-50 { background: rgba(99,102,241,0.10) !important; }
[data-theme="dark"] .bg-indigo-100 { background: rgba(99,102,241,0.15) !important; }
[data-theme="dark"] .bg-emerald-50,
[data-theme="dark"] .bg-green-50 { background: rgba(16,185,129,0.10) !important; }
[data-theme="dark"] .bg-red-50,
[data-theme="dark"] .bg-rose-50 { background: rgba(239,68,68,0.10) !important; }
[data-theme="dark"] .bg-amber-50,
[data-theme="dark"] .bg-yellow-50 { background: rgba(245,158,11,0.10) !important; }
[data-theme="dark"] .bg-blue-50 { background: rgba(59,130,246,0.10) !important; }

[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-black { color: #e2e8f0 !important; }
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600 { color: #cbd5e1 !important; }
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-400,
[data-theme="dark"] .text-gray-300 { color: #94a3b8 !important; }

[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 { border-color: #334155 !important; }
[data-theme="dark"] .divide-gray-200 > * + * { border-color: #334155 !important; }

/* Hovers Tailwind hardcoded no dark */
[data-theme="dark"] .hover\:bg-gray-50:hover,
[data-theme="dark"] .hover\:bg-gray-100:hover,
[data-theme="dark"] .hover\:bg-gray-200:hover { background: #2c3a52 !important; }
[data-theme="dark"] .hover\:bg-indigo-50:hover { background: rgba(99,102,241,0.12) !important; }
[data-theme="dark"] .hover\:border-indigo-400:hover,
[data-theme="dark"] .hover\:border-indigo-500:hover { border-color: #818cf8 !important; }

/* Section titles */
[data-theme="dark"] .section-title { color: #e2e8f0 !important; }
[data-theme="dark"] .form-section-title { color: #cbd5e1 !important; border-bottom-color: #334155 !important; }
[data-theme="dark"] .form-label { color: #94a3b8 !important; }

/* Peer-checked colorida no dark — ajusta saturação */
[data-theme="dark"] input.peer:checked + div.peer-checked\:bg-emerald-50 { background: rgba(16,185,129,0.15) !important; }
[data-theme="dark"] input.peer:checked + div.peer-checked\:bg-red-50 { background: rgba(239,68,68,0.15) !important; }
[data-theme="dark"] input.peer:checked + div.peer-checked\:bg-orange-50 { background: rgba(249,115,22,0.15) !important; }
[data-theme="dark"] input.peer:checked + div.peer-checked\:bg-blue-50 { background: rgba(59,130,246,0.15) !important; }
[data-theme="dark"] input.peer:checked + div.peer-checked\:bg-green-50 { background: rgba(34,197,94,0.15) !important; }
[data-theme="dark"] input.peer:checked + div.peer-checked\:bg-indigo-50 { background: rgba(99,102,241,0.15) !important; }

/* Bordas ativas dos cards-peer */
[data-theme="dark"] .border-gray-200 { border-color: #334155 !important; }

/* Avisos / boxes especiais no dark */
[data-theme="dark"] .admin-pass-warn {
  background: rgba(245,158,11,0.10) !important;
  border-color: rgba(245,158,11,0.3) !important;
  color: #fcd34d !important;
}
[data-theme="dark"] .empty-state {
  color: #64748b !important;
}

/* PDF preview, anexos etc */
[data-theme="dark"] .anexos-table { background: #1e293b !important; }
[data-theme="dark"] .anexos-table tbody tr { border-bottom-color: #334155 !important; }
[data-theme="dark"] .anexos-table tbody tr:hover { background: #2c3a52 !important; }

/* Divisores e bordas finas */
[data-theme="dark"] hr,
[data-theme="dark"] .border-t,
[data-theme="dark"] .border-b,
[data-theme="dark"] .border { border-color: #334155 !important; }

/* Toast / notification no dark */
[data-theme="dark"] .toast {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}

/* Chat widget - garantir consistência */
[data-theme="dark"] .chat-widget,
[data-theme="dark"] .chat-conversations,
[data-theme="dark"] .chat-messages {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .chat-conv-item:hover { background: #2c3a52 !important; }
[data-theme="dark"] .chat-conv-item.active { background: #334155 !important; }

/* Sidebar SEMPRE escura (não muda com tema, é uma escolha de design) */
.sidebar { background: #1e293b !important; }

/* Light mode: glass-card sutilmente clara */
[data-theme="light"] .glass-card {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(8px);
}

/* Cores sólidas de gradient cards (saldo, receber, pagar, vencidos) — preservar */
.gradient-saldo, .gradient-receber, .gradient-pagar, .gradient-vencidos {
  color: #ffffff !important;
}
.gradient-saldo .text-gray-500,
.gradient-receber .text-gray-500,
.gradient-pagar .text-gray-500,
.gradient-vencidos .text-gray-500 { color: rgba(255,255,255,0.85) !important; }

/* Dark/light: sublinhados de tabelas e cards mais sutis */
[data-theme="light"] .border-table { border-color: #e5e7eb !important; }
[data-theme="dark"] .border-table { border-color: #334155 !important; }

/* ============================================================
   OVERRIDES UNIFICADOS — aplicam tokens em componentes globais
   Garante consistência total em modo claro/escuro
   ============================================================ */

/* Cards e superfícies */
.glass-card,
.bg-white,
[class*="bg-white"] {
  background: var(--card-bg) !important;
  color: var(--text-primary);
}
[data-theme="dark"] .bg-white { background: var(--card-bg) !important; }
[data-theme="dark"] .glass-card { background: var(--card-bg) !important; border-color: var(--border-color); }

/* Textos utilitários (Tailwind classes) */
.text-gray-900, .text-gray-800 { color: var(--text-primary) !important; }
.text-gray-700, .text-gray-600 { color: var(--text-secondary) !important; }
.text-gray-500 { color: var(--text-tertiary) !important; }
.text-gray-400, .text-gray-300 { color: var(--text-muted) !important; }

/* Bordas */
.border, .border-gray-200, .border-gray-100, .border-gray-300 {
  border-color: var(--border-color) !important;
}

/* Backgrounds utilitários */
.bg-gray-50 { background: var(--bg-surface-2) !important; }
.bg-gray-100 { background: var(--bg-surface-3) !important; }
.bg-gray-200 { background: var(--bg-surface-4) !important; }

/* Tabelas */
table { background: var(--table-bg); color: var(--text-primary); }
table thead, table thead tr, table thead th {
  background: var(--table-header-bg) !important;
  color: var(--table-header-text) !important;
}
table tbody tr { border-bottom: 1px solid var(--table-border); }
table tbody tr:nth-child(even) { background: var(--table-stripe); }
table tbody tr:hover { background: var(--table-hover); }
table td { color: var(--text-primary); }

/* Modais */
.modal-content, .modal-body, .modal-header, .modal-footer,
[role="dialog"] > div, .modal-panel {
  background: var(--modal-bg) !important;
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Inputs / forms */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select, textarea {
  background: var(--input-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--input-border) !important;
}
input::placeholder, textarea::placeholder { color: var(--input-placeholder) !important; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 1px;
  border-color: var(--accent-indigo) !important;
}

/* Labels */
label { color: var(--text-secondary); }

/* KPI / stat cards (não gradient) */
.kpi-card, .stat-block:not(.gradient-receber):not(.gradient-pagar):not(.gradient-saldo):not(.gradient-vencidos) {
  background: var(--kpi-bg);
  color: var(--kpi-text);
}

/* Badges */
.badge, .tag, .status-pill {
  background: var(--bg-surface-3);
  color: var(--text-secondary);
}

/* Botão secundário no escuro */
[data-theme="dark"] .btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--border-color);
}
[data-theme="dark"] .btn-secondary:hover {
  background: var(--bg-surface-3);
  border-color: var(--border-strong);
}

/* Sidebar toggle button no escuro */
[data-theme="dark"] .sidebar-toggle-btn {
  background: var(--bg-surface-2);
  border-color: var(--border-color);
  color: var(--text-primary);
}

/* Divisores e linhas de tabela mais sutis no escuro */
[data-theme="dark"] hr { border-color: var(--border-color); }

/* ============================================================
   TIPOGRAFIA — redução global -3px (mais info na tela)
   ============================================================ */
html { font-size: 13px; } /* base reduzida (era 16) */
body { font-size: 13px; }

/* Tailwind text size overrides (-3px) */
.text-xs { font-size: 9px !important; line-height: 13px !important; }
.text-sm { font-size: 11px !important; line-height: 16px !important; }
.text-base { font-size: 13px !important; line-height: 18px !important; }
.text-lg { font-size: 15px !important; line-height: 21px !important; }
.text-xl { font-size: 17px !important; line-height: 23px !important; }
.text-2xl { font-size: 21px !important; line-height: 27px !important; }
.text-3xl { font-size: 27px !important; line-height: 33px !important; }
.text-4xl { font-size: 33px !important; line-height: 39px !important; }

/* Tabelas mais densas */
table { font-size: 12px; }
table th { font-size: 10px; padding: 8px 10px !important; }
table td { padding: 7px 10px !important; }

/* Inputs mais compactos */
input, select, textarea, button {
  font-size: 12px !important;
}

/* Badges/tags ainda menores */
.badge, .tag, .status-pill { font-size: 10px !important; padding: 2px 6px !important; }

/* ============================================================
   MODAIS — larguras maiores para caber mais informação
   ============================================================ */
.modal-content, [role="dialog"] > div, .modal-panel {
  max-width: min(96vw, 1280px) !important;
  width: 100%;
}
.modal-sm { max-width: min(90vw, 560px) !important; }
.modal-md { max-width: min(94vw, 880px) !important; }
.modal-lg { max-width: min(96vw, 1280px) !important; }
.modal-xl { max-width: min(98vw, 1480px) !important; }

/* Tailwind max-w overrides para modais comuns */
.max-w-md { max-width: 640px !important; }
.max-w-lg { max-width: 800px !important; }
.max-w-xl { max-width: 960px !important; }
.max-w-2xl { max-width: 1100px !important; }
.max-w-3xl { max-width: 1240px !important; }
.max-w-4xl { max-width: 1380px !important; }
.max-w-5xl { max-width: 1480px !important; }
.max-w-6xl { max-width: 1560px !important; }
.max-w-7xl { max-width: 1640px !important; }


/* ============================================================
   THEME OVERRIDES AGRESSIVOS — garantir contraste total
   Dark = texto claro · Light = texto escuro
   ============================================================ */

/* DARK MODE — força texto claro em TODOS os lugares */
[data-theme="dark"] body,
[data-theme="dark"] .container,
[data-theme="dark"] main,
[data-theme="dark"] section,
[data-theme="dark"] article,
[data-theme="dark"] aside,
[data-theme="dark"] header:not(.gradient-saldo):not(.gradient-receber):not(.gradient-pagar):not(.gradient-vencidos),
[data-theme="dark"] footer,
[data-theme="dark"] div:not(.gradient-saldo):not(.gradient-receber):not(.gradient-pagar):not(.gradient-vencidos):not([class*="bg-indigo-"]):not([class*="bg-blue-"]):not([class*="bg-green-"]):not([class*="bg-red-"]):not([class*="bg-yellow-"]):not([class*="bg-purple-"]):not([class*="bg-pink-"]):not([class*="bg-orange-"]):not([class*="bg-emerald-"]):not([class*="bg-amber-"]):not([class*="bg-rose-"]):not([class*="bg-cyan-"]):not([class*="bg-teal-"]):not([class*="bg-violet-"]):not([class*="bg-fuchsia-"]):not([class*="bg-sky-"]):not([class*="bg-lime-"]):not([class*="from-"]):not([class*="to-"]):not([class*="via-"]) {
  color: var(--text-primary);
}

[data-theme="dark"] p,
[data-theme="dark"] span:not([class*="text-white"]):not([class*="text-indigo-"]):not([class*="text-blue-"]):not([class*="text-green-"]):not([class*="text-red-"]):not([class*="text-yellow-"]):not([class*="text-purple-"]):not([class*="text-pink-"]):not([class*="text-orange-"]):not([class*="text-emerald-"]):not([class*="text-amber-"]):not([class*="text-rose-"]):not([class*="text-cyan-"]):not([class*="text-teal-"]):not([class*="text-violet-"]),
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] dt,
[data-theme="dark"] dd,
[data-theme="dark"] label,
[data-theme="dark"] legend,
[data-theme="dark"] caption,
[data-theme="dark"] strong,
[data-theme="dark"] em,
[data-theme="dark"] small,
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: var(--text-primary);
}

/* Texto secundário no dark */
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-slate-500,
[data-theme="dark"] .text-slate-600,
[data-theme="dark"] .text-zinc-500,
[data-theme="dark"] .text-zinc-600,
[data-theme="dark"] .text-neutral-500,
[data-theme="dark"] .text-neutral-600 {
  color: var(--text-secondary) !important;
}

/* Texto terciário no dark */
[data-theme="dark"] .text-gray-400,
[data-theme="dark"] .text-gray-300,
[data-theme="dark"] .text-slate-400,
[data-theme="dark"] .text-slate-300,
[data-theme="dark"] .text-zinc-400,
[data-theme="dark"] .text-zinc-300 {
  color: var(--text-tertiary) !important;
}

/* Forçar texto preto/escuro virar claro no dark */
[data-theme="dark"] .text-black,
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .text-slate-800,
[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-zinc-900,
[data-theme="dark"] .text-zinc-800,
[data-theme="dark"] .text-zinc-700,
[data-theme="dark"] .text-neutral-900,
[data-theme="dark"] .text-neutral-800,
[data-theme="dark"] .text-neutral-700 {
  color: var(--text-primary) !important;
}

/* Ícones cinza no dark — clarear */
[data-theme="dark"] i.text-gray-400,
[data-theme="dark"] i.text-gray-500,
[data-theme="dark"] i.text-gray-600,
[data-theme="dark"] .fas.text-gray-400,
[data-theme="dark"] .fas.text-gray-500,
[data-theme="dark"] .fas.text-gray-600 {
  color: var(--text-tertiary) !important;
}

/* Inline color inline preto/escuro no dark — aproximar do branco */
[data-theme="dark"] [style*="color:#000"],
[data-theme="dark"] [style*="color: #000"],
[data-theme="dark"] [style*="color:#1f"],
[data-theme="dark"] [style*="color: #1f"],
[data-theme="dark"] [style*="color:#374"],
[data-theme="dark"] [style*="color: #374"],
[data-theme="dark"] [style*="color:rgb(0"],
[data-theme="dark"] [style*="color: rgb(0"],
[data-theme="dark"] [style*="color: black"] {
  color: var(--text-primary) !important;
}

/* Background de cards/seções no dark */
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-slate-50,
[data-theme="dark"] .bg-zinc-50,
[data-theme="dark"] .bg-neutral-50 {
  background: var(--bg-surface-2) !important;
}
[data-theme="dark"] .bg-gray-100,
[data-theme="dark"] .bg-slate-100,
[data-theme="dark"] .bg-zinc-100 {
  background: var(--bg-surface-3) !important;
}
[data-theme="dark"] .bg-gray-200,
[data-theme="dark"] .bg-slate-200 {
  background: var(--bg-surface-4) !important;
}

/* Force-text dentro de bg-white (que já vira card-bg) */
[data-theme="dark"] .bg-white *:not([class*="text-white"]):not([class*="text-indigo-"]):not([class*="text-blue-"]):not([class*="text-green-"]):not([class*="text-red-"]):not([class*="text-yellow-"]):not([class*="text-purple-"]):not([class*="text-pink-"]):not([class*="text-orange-"]):not([class*="text-emerald-"]):not([class*="text-amber-"]):not([class*="text-rose-"]):not([class*="text-cyan-"]):not([class*="text-teal-"]):not([class*="text-violet-"]):not(i):not(svg):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning) {
  color: var(--text-primary);
}

/* Form section no dark */
[data-theme="dark"] .form-section,
[data-theme="dark"] .form-section * {
  color: var(--text-primary);
}
[data-theme="dark"] .form-section .text-gray-400,
[data-theme="dark"] .form-section .text-gray-500 { color: var(--text-tertiary) !important; }
[data-theme="dark"] .form-section-title { color: var(--text-primary) !important; }

/* Inputs no dark — texto branco e placeholder claro */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color: var(--text-primary) !important;
  background: var(--input-bg) !important;
  border-color: var(--input-border) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--input-placeholder) !important; }
[data-theme="dark"] option { background: var(--input-bg); color: var(--text-primary); }

/* Botões secundários e cinzas no dark */
[data-theme="dark"] button:not([class*="bg-indigo"]):not([class*="bg-blue"]):not([class*="bg-green"]):not([class*="bg-red"]):not([class*="bg-yellow"]):not([class*="bg-purple"]):not([class*="bg-pink"]):not([class*="bg-orange"]):not([class*="bg-emerald"]):not([class*="bg-amber"]):not([class*="bg-rose"]):not([class*="bg-cyan"]):not([class*="bg-teal"]):not([class*="bg-violet"]):not([class*="from-"]):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning) {
  color: var(--text-primary);
}

/* Tabela no dark — texto sempre claro */
[data-theme="dark"] table,
[data-theme="dark"] table tr,
[data-theme="dark"] table td,
[data-theme="dark"] table th {
  color: var(--text-primary);
}
[data-theme="dark"] table thead th {
  color: var(--table-header-text) !important;
  background: var(--table-header-bg) !important;
}
[data-theme="dark"] table td .text-gray-700,
[data-theme="dark"] table td .text-gray-800,
[data-theme="dark"] table td .text-gray-900 { color: var(--text-primary) !important; }
[data-theme="dark"] table td .text-gray-500,
[data-theme="dark"] table td .text-gray-600 { color: var(--text-secondary) !important; }
[data-theme="dark"] table td .text-gray-400 { color: var(--text-tertiary) !important; }

/* Modais no dark */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .modal-content *:not([class*="text-white"]):not([class*="text-indigo-"]):not([class*="text-blue-"]):not([class*="text-green-"]):not([class*="text-red-"]):not([class*="text-yellow-"]):not([class*="text-purple-"]):not([class*="text-pink-"]):not(i):not(svg):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.text-orange-600):not(.text-amber-600):not(.text-rose-600) {
  color: var(--text-primary);
}
[data-theme="dark"] .modal-content .text-gray-400,
[data-theme="dark"] .modal-content .text-gray-500 { color: var(--text-tertiary) !important; }

/* Cards "glass" no dark */
[data-theme="dark"] .glass-card *:not([class*="text-white"]):not([class*="text-indigo-"]):not([class*="text-blue-"]):not([class*="text-green-"]):not([class*="text-red-"]):not([class*="text-yellow-"]):not([class*="text-purple-"]):not([class*="text-pink-"]):not(i):not(svg):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning) {
  color: var(--text-primary);
}

/* LIGHT MODE — garantir texto escuro */
[data-theme="light"] body,
:root body {
  color: var(--text-primary);
}
[data-theme="light"] .text-white:not([class*="bg-"]):not([class*="from-"]) { color: var(--text-primary) !important; }

/* Light: texto branco em fundos coloridos OK; em fundos brancos forçar escuro */
[data-theme="light"] .bg-white .text-white,
[data-theme="light"] .bg-gray-50 .text-white,
[data-theme="light"] .bg-gray-100 .text-white { color: var(--text-primary) !important; }

/* Sidebar — sempre tem texto claro independente do tema */
.sidebar, .sidebar * { color: var(--sidebar-text); }
.sidebar .nav-item.active, .sidebar .nav-item.active * { color: var(--sidebar-text-active) !important; }
.sidebar .sidebar-title { color: #ffffff !important; }

/* Badges coloridos preservam suas cores acentuadas */
.badge.badge-success, .badge-success { background: var(--accent-success-bg); color: var(--accent-success-text); }
.badge.badge-danger, .badge-danger { background: var(--accent-danger-bg); color: var(--accent-danger-text); }
.badge.badge-warning, .badge-warning { background: var(--accent-warning-bg); color: var(--accent-warning-text); }
.badge.badge-info, .badge-info { background: var(--accent-info-bg); color: var(--accent-info-text); }
.badge.badge-indigo { background: var(--accent-indigo-bg); color: var(--accent-indigo-text); }

/* ============================================================
   DROPZONE — Drag & drop visual feedback
   ============================================================ */
.upload-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--bg-surface-2);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.upload-dropzone:hover {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo-soft);
}
.upload-dropzone.dragover {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo-bg);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.upload-dropzone.dragover::before {
  content: 'Solte aqui';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-indigo-text);
  font-weight: 700;
  font-size: 14px;
  pointer-events: none;
  z-index: 5;
}

/* ============================================================
   KPI CARDS SOFISTICADOS — Total Emprestado / Saldo / Recebido
   ============================================================ */
.kpi-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card-modern {
  position: relative;
  border-radius: 14px;
  padding: 18px 20px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-card-modern::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--kpi-accent-from, #6366f1), var(--kpi-accent-to, #8b5cf6));
}
.kpi-card-modern.kpi-emprestado { --kpi-accent-from: #6366f1; --kpi-accent-to: #8b5cf6; }
.kpi-card-modern.kpi-devedor    { --kpi-accent-from: #f59e0b; --kpi-accent-to: #ef4444; }
.kpi-card-modern.kpi-recebido   { --kpi-accent-from: #10b981; --kpi-accent-to: #059669; }
.kpi-card-modern.kpi-info       { --kpi-accent-from: #3b82f6; --kpi-accent-to: #06b6d4; }
.kpi-card-modern.kpi-warning    { --kpi-accent-from: #f59e0b; --kpi-accent-to: #f97316; }

.kpi-card-modern .kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.kpi-card-modern .kpi-label {
  font-size: 11px !important;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}
.kpi-card-modern .kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: linear-gradient(135deg, var(--kpi-accent-from), var(--kpi-accent-to));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.kpi-card-modern .kpi-value {
  font-size: 26px !important;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  margin: 4px 0 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi-card-modern .kpi-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px !important;
  color: var(--text-secondary);
  margin: 0;
}
.kpi-card-modern .kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px !important;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-surface-3);
}
.kpi-card-modern .kpi-trend.up { background: var(--accent-success-bg); color: var(--accent-success-text); }
.kpi-card-modern .kpi-trend.down { background: var(--accent-danger-bg); color: var(--accent-danger-text); }
.kpi-card-modern .kpi-progress {
  margin-top: 10px;
  height: 6px;
  background: var(--bg-surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.kpi-card-modern .kpi-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--kpi-accent-from), var(--kpi-accent-to));
  border-radius: 3px;
  transition: width 0.6s ease;
}
.kpi-card-modern .kpi-mini-stats {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}
.kpi-card-modern .kpi-mini-stat {
  flex: 1;
  font-size: 10px !important;
  color: var(--text-tertiary);
}
.kpi-card-modern .kpi-mini-stat strong {
  display: block;
  font-size: 13px !important;
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 2px;
}

/* ============================================================
   COLUNAS ARRASTÁVEIS — drag & drop reorder
   ============================================================ */
table.cols-draggable thead th {
  position: relative;
  cursor: grab;
  user-select: none;
}
table.cols-draggable thead th:hover { background: var(--table-hover) !important; }
table.cols-draggable thead th.dragging {
  opacity: 0.5;
  cursor: grabbing;
}
table.cols-draggable thead th.col-drag-over {
  border-left: 3px solid var(--accent-indigo) !important;
  background: var(--accent-indigo-soft) !important;
}
table.cols-draggable thead th .col-grip {
  display: inline-block;
  margin-right: 4px;
  opacity: 0.3;
  font-size: 10px;
  cursor: grab;
}
table.cols-draggable thead th:hover .col-grip { opacity: 0.7; }

/* ============================================================
   ATTACHMENT BUTTON ROW — botão de anexo padrão
   ============================================================ */
.btn-attach-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-indigo);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  font-size: 11px;
}
.btn-attach-row:hover {
  background: var(--accent-indigo-soft);
  border-color: var(--accent-indigo);
  transform: translateY(-1px);
}
.btn-attach-row.has-anexos {
  background: var(--accent-indigo-bg);
  color: var(--accent-indigo-text);
  position: relative;
}
.btn-attach-row.has-anexos::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-success);
  border: 1.5px solid var(--card-bg);
}

/* Attach pill (coluna Comprovante) */
.btn-attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-attach-pill-has {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
  border-color: #10b981;
  box-shadow: 0 1px 3px rgba(16,185,129,0.25);
}
.btn-attach-pill-has:hover {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(16,185,129,0.35);
}
.btn-attach-pill-empty {
  background: rgba(99,102,241,0.08);
  color: #4f46e5;
  border-color: rgba(99,102,241,0.30);
  border-style: dashed;
}
.btn-attach-pill-empty:hover {
  background: rgba(99,102,241,0.15);
  border-style: solid;
  transform: translateY(-1px);
}
[data-theme="dark"] .btn-attach-pill-has {
  background: linear-gradient(135deg, rgba(16,185,129,0.20) 0%, rgba(16,185,129,0.10) 100%);
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.45);
}
[data-theme="dark"] .btn-attach-pill-has:hover {
  background: linear-gradient(135deg, rgba(16,185,129,0.30) 0%, rgba(16,185,129,0.18) 100%);
}
[data-theme="dark"] .btn-attach-pill-empty {
  background: rgba(99,102,241,0.15);
  color: #c7d2fe;
  border-color: rgba(99,102,241,0.45);
}
[data-theme="dark"] .btn-attach-pill-empty:hover {
  background: rgba(99,102,241,0.25);
}

/* Active selection toggle button highlighted */
.btn-active-sel {
  background: rgba(99,102,241,0.18) !important;
  border-color: #6366f1 !important;
  color: var(--text-primary) !important;
}

/* ============================================================
   CONFIRM DIRTY-NAVIGATION — banner + modal
   ============================================================ */
.dirty-warning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-warning-bg);
  color: var(--accent-warning-text);
  border: 1px solid var(--accent-warning);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px !important;
  font-weight: 600;
  margin-bottom: 10px;
}
.dirty-warning-banner i { color: var(--accent-warning); }

/* ============================================================
   COLUMN CONFIG — botão engrenagem + modal de ordem/visibilidade
   ============================================================ */
.overflow-x-auto:has(> table.data-table) { padding-top: 44px; position: relative; }
.col-cog-btn:hover { transform: rotate(60deg); }
.col-cfg-item:hover { border-color: var(--accent-primary, #6366f1) !important; background: var(--bg-surface-2) !important; }
.col-cfg-item[draggable="true"] { user-select: none; }

/* Indicador da engrenagem em dark */
[data-theme="dark"] .col-cog-btn { background: rgba(255,255,255,0.08) !important; color: rgba(255,255,255,0.85) !important; border-color: rgba(255,255,255,0.15) !important; }
[data-theme="dark"] .col-cog-btn:hover { background: var(--accent-primary, #6366f1) !important; color: #fff !important; }

/* ============================================================
   OCORRÊNCIAS — itens
   ============================================================ */
.ocorr-item { transition: all 0.18s; }
.ocorr-item:hover { transform: translateX(2px); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
[data-theme="dark"] .ocorr-item { background: rgba(255,255,255,0.04) !important; }
[data-theme="dark"] .ocorr-item:hover { background: rgba(255,255,255,0.07) !important; }

/* ============================================================
   CALENDÁRIO — correção dark mode
   ============================================================ */
[data-theme="dark"] .cal-day,
[data-theme="dark"] .calendar-day,
[data-theme="dark"] .cal-cell {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .cal-day-num,
[data-theme="dark"] .calendar-day-number {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .cal-day-today,
[data-theme="dark"] .calendar-day.today {
  background: rgba(99, 102, 241, 0.18) !important;
  border-color: #6366f1 !important;
}
[data-theme="dark"] .cal-day-out,
[data-theme="dark"] .calendar-day.outside-month {
  background: rgba(255,255,255,0.02) !important;
  opacity: 0.45 !important;
}
[data-theme="dark"] .cal-event,
[data-theme="dark"] .calendar-event {
  background: rgba(255,255,255,0.08) !important;
  color: var(--text-primary) !important;
  border-color: rgba(255,255,255,0.10) !important;
}
[data-theme="dark"] .cal-weekday,
[data-theme="dark"] .calendar-weekday-header {
  background: var(--bg-surface-2) !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .cal-grid,
[data-theme="dark"] .calendar-grid {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}
/* Pílulas/data do calendário */
[data-theme="dark"] .data-completa-pill,
[data-theme="dark"] .hora-pill {
  background: rgba(99,102,241,0.15) !important;
  color: #c7d2fe !important;
  border-color: rgba(99,102,241,0.3) !important;
}
/* Eventos do dashboard com bg-50/100 originais */
[data-theme="dark"] .bg-blue-50,
[data-theme="dark"] .bg-amber-50,
[data-theme="dark"] .bg-red-50,
[data-theme="dark"] .bg-green-50,
[data-theme="dark"] .bg-emerald-50,
[data-theme="dark"] .bg-rose-50,
[data-theme="dark"] .bg-purple-50,
[data-theme="dark"] .bg-yellow-50,
[data-theme="dark"] .bg-indigo-50,
[data-theme="dark"] .bg-orange-50,
[data-theme="dark"] .bg-pink-50,
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100,
[data-theme="dark"] .bg-slate-50,
[data-theme="dark"] .bg-slate-100 {
  background-color: rgba(255,255,255,0.06) !important;
}
[data-theme="dark"] .bg-blue-50 *,
[data-theme="dark"] .bg-amber-50 *,
[data-theme="dark"] .bg-red-50 *,
[data-theme="dark"] .bg-green-50 *,
[data-theme="dark"] .bg-emerald-50 *,
[data-theme="dark"] .bg-rose-50 *,
[data-theme="dark"] .bg-purple-50 *,
[data-theme="dark"] .bg-yellow-50 *,
[data-theme="dark"] .bg-indigo-50 *,
[data-theme="dark"] .bg-orange-50 *,
[data-theme="dark"] .bg-pink-50 *,
[data-theme="dark"] .bg-gray-50 *,
[data-theme="dark"] .bg-gray-100 *,
[data-theme="dark"] .bg-slate-50 *,
[data-theme="dark"] .bg-slate-100 * {
  color: var(--text-primary) !important;
}
/* Filter panel e cards específicos do calendário */
[data-theme="dark"] .filter-panel {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ============================================================
   CALENDÁRIO PRO — DARK MODE COMPLETO (cal-pro-*, cal-week-*, cal-day-*, cal-agenda-*)
   ============================================================ */
/* Mês — células */
[data-theme="dark"] .cal-pro-day {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .cal-pro-day.weekend { background: #243149 !important; }
[data-theme="dark"] .cal-pro-day.other-month {
  background: #182338 !important;
  opacity: 0.55 !important;
  color: #64748b !important;
}
[data-theme="dark"] .cal-pro-day.today {
  background: linear-gradient(135deg, rgba(99,102,241,0.25) 0%, rgba(99,102,241,0.15) 100%) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 1px #6366f1 inset !important;
}
[data-theme="dark"] .cal-pro-day.has-event { border-color: #4f46e5 !important; }
[data-theme="dark"] .cal-pro-day:hover {
  border-color: #818cf8 !important;
  background: #2c3a52 !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35) !important;
}
[data-theme="dark"] .cal-pro-day.today:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.32) 0%, rgba(99,102,241,0.22) 100%) !important;
}
[data-theme="dark"] .cal-pro-event {
  /* Mistura a cor do evento com fundo escuro (não branco) e texto claro legível */
  background: color-mix(in srgb, var(--ev-color, #6366f1) 25%, #1e293b) !important;
  color: color-mix(in srgb, var(--ev-color, #c7d2fe) 70%, #f1f5f9) !important;
  border-left-color: var(--ev-color, #6366f1) !important;
}
[data-theme="dark"] .cal-pro-event i { color: inherit !important; }
[data-theme="dark"] .cal-pro-event-title { color: inherit !important; }
[data-theme="dark"] .cal-day-totals { border-top-color: #334155 !important; }
[data-theme="dark"] .cal-tot-rec { color: #6ee7b7 !important; }
[data-theme="dark"] .cal-tot-pag { color: #fca5a5 !important; }
[data-theme="dark"] .cal-more { color: #94a3b8 !important; }
[data-theme="dark"] .cal-day-count {
  background: rgba(99,102,241,0.30) !important;
  color: #c7d2fe !important;
}
[data-theme="dark"] .cal-pro-header .calendar-header-day {
  background: #243149 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}

/* Semana */
[data-theme="dark"] .cal-week-col {
  background: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .cal-week-col.today-col {
  background: linear-gradient(180deg, rgba(99,102,241,0.18) 0%, #1e293b 30%) !important;
  border-color: #6366f1 !important;
}
[data-theme="dark"] .cal-week-header {
  background: #243149 !important;
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .cal-week-day-name { color: #94a3b8 !important; }
[data-theme="dark"] .cal-week-day-num { color: #f1f5f9 !important; }
[data-theme="dark"] .cal-week-col.today-col .cal-week-day-num { color: #c7d2fe !important; }
[data-theme="dark"] .cal-week-empty { color: #475569 !important; }
[data-theme="dark"] .cal-week-event {
  background: color-mix(in srgb, var(--ev-color, #6366f1) 18%, #1e293b) !important;
  border-color: color-mix(in srgb, var(--ev-color, #6366f1) 35%, #334155) !important;
}
[data-theme="dark"] .cal-week-event:hover {
  background: color-mix(in srgb, var(--ev-color, #6366f1) 28%, #1e293b) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45) !important;
}
[data-theme="dark"] .cal-week-event-title { color: #f1f5f9 !important; }
[data-theme="dark"] .cal-week-event-title i { color: var(--ev-color, #c7d2fe) !important; filter: brightness(1.4); }
[data-theme="dark"] .cal-week-event-sub { color: #cbd5e1 !important; }

/* Dia */
[data-theme="dark"] .cal-day-view { background: transparent !important; }
[data-theme="dark"] .cal-day-header-pro {
  background: linear-gradient(135deg, rgba(99,102,241,0.20) 0%, #1e293b 100%) !important;
  border-color: #4338ca !important;
}
[data-theme="dark"] .cal-day-date { color: #c7d2fe !important; }
[data-theme="dark"] .cal-day-month { color: #cbd5e1 !important; }
[data-theme="dark"] .cal-day-week { color: #94a3b8 !important; }
[data-theme="dark"] .cal-day-stat-label { color: #94a3b8 !important; }
[data-theme="dark"] .cal-day-stat-val { color: #f1f5f9 !important; }
[data-theme="dark"] .cal-day-event-card {
  background: color-mix(in srgb, var(--ev-color, #6366f1) 15%, #1e293b) !important;
  border-color: color-mix(in srgb, var(--ev-color, #6366f1) 35%, #334155) !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .cal-day-event-card:hover {
  background: color-mix(in srgb, var(--ev-color, #6366f1) 25%, #1e293b) !important;
  border-color: var(--ev-color, #6366f1) !important;
}
[data-theme="dark"] .cal-day-event-title { color: #f1f5f9 !important; }
[data-theme="dark"] .cal-day-event-sub { color: #cbd5e1 !important; }

/* Agenda */
[data-theme="dark"] .cal-agenda-group {
  background: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .cal-agenda-date {
  background: linear-gradient(135deg, rgba(99,102,241,0.22) 0%, rgba(99,102,241,0.10) 100%) !important;
}
[data-theme="dark"] .cal-agenda-date-num { color: #c7d2fe !important; }
[data-theme="dark"] .cal-agenda-date-month { color: #a5b4fc !important; }
[data-theme="dark"] .cal-agenda-date-week { color: #94a3b8 !important; }
[data-theme="dark"] .cal-agenda-event {
  background: color-mix(in srgb, var(--ev-color, #6366f1) 15%, #243149) !important;
  border-color: color-mix(in srgb, var(--ev-color, #6366f1) 30%, #334155) !important;
}
[data-theme="dark"] .cal-agenda-event:hover {
  background: color-mix(in srgb, var(--ev-color, #6366f1) 25%, #243149) !important;
  border-color: var(--ev-color, #6366f1) !important;
}
[data-theme="dark"] .cal-agenda-event-title { color: #f1f5f9 !important; }
[data-theme="dark"] .cal-agenda-event-sub { color: #cbd5e1 !important; }

/* Cards de resumo do calendário (cal-summary-*) */
[data-theme="dark"] .cal-summary-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .cal-sum-label { color: #cbd5e1 !important; }
[data-theme="dark"] .cal-sum-value { color: #f8fafc !important; }
[data-theme="dark"] .cal-sum-value.text-emerald-600 { color: #34d399 !important; }
[data-theme="dark"] .cal-sum-value.text-rose-600 { color: #fb7185 !important; }

/* Ícones dos KPIs do calendário (a receber/a pagar/saldo previsto/eventos) */
[data-theme="dark"] .cal-sum-receber .cal-sum-icon {
  background: rgba(16,185,129,0.20) !important;
  color: #6ee7b7 !important;
}
[data-theme="dark"] .cal-sum-pagar .cal-sum-icon {
  background: rgba(239,68,68,0.20) !important;
  color: #fca5a5 !important;
}
[data-theme="dark"] .cal-sum-saldo .cal-sum-icon {
  background: rgba(99,102,241,0.25) !important;
  color: #c7d2fe !important;
}
[data-theme="dark"] .cal-sum-eventos .cal-sum-icon {
  background: rgba(245,158,11,0.20) !important;
  color: #fcd34d !important;
}

/* Bloco "Mostrar" (cal-sources) — container externo escuro */
[data-theme="dark"] .cal-sources {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
}

/* Toggle de fontes (chips) e cal-view-btn (Mês/Semana/Dia/Agenda) */
[data-theme="dark"] .cal-source-chip {
  background: #243149 !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .cal-source-chip:hover {
  background: #2d3b54 !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .cal-source-chip.active {
  background: rgba(99,102,241,0.30) !important;
  border-color: #818cf8 !important;
  color: #ffffff !important;
}
/* Container do switcher (Mês/Semana/Dia/Agenda) — fundo escuro */
[data-theme="dark"] .cal-view-switcher {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}
[data-theme="dark"] .cal-view-btn {
  background: transparent !important;
  border: 0 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .cal-view-btn:hover {
  background: #2d3b54 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .cal-view-btn.active {
  background: rgba(99,102,241,0.35) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4) !important;
}
/* Painel de filtros do calendário — fundo escuro reforçado */
[data-theme="dark"] .cal-pro-wrapper .filter-panel,
[data-theme="dark"] #cal-view-area .filter-panel,
[data-theme="dark"] .cal-pro-wrapper > .filter-panel {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35) !important;
}
[data-theme="dark"] .cal-pro-wrapper .filter-panel h4,
[data-theme="dark"] .cal-pro-wrapper .filter-panel label {
  color: #e2e8f0 !important;
}
[data-theme="dark"] .cal-pro-wrapper .filter-panel .form-input,
[data-theme="dark"] .cal-pro-wrapper .filter-panel .form-select {
  background: #243149 !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .cal-pro-wrapper .filter-panel .form-input:focus,
[data-theme="dark"] .cal-pro-wrapper .filter-panel .form-select:focus {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18) !important;
}
[data-theme="dark"] .cal-sources-label { color: #cbd5e1 !important; }
[data-theme="dark"] .cal-sources-label i { color: #94a3b8 !important; }

/* Number do dia (não-hoje) */
[data-theme="dark"] .calendar-day-number { color: #e2e8f0 !important; }
[data-theme="dark"] .calendar-day-number.today-num {
  background: #6366f1 !important;
  color: #ffffff !important;
}

/* ============================================================
   VISUALIZAÇÃO DE LINHAS — Modal de seleção de registros visíveis
   ============================================================ */
.row-vis-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #fff);
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 4px;
}
.row-vis-btn:hover {
  color: #6366f1;
  border-color: #6366f1;
  background: rgba(99,102,241,0.06);
}
.row-vis-btn.has-hidden {
  color: #f59e0b;
  border-color: #f59e0b;
}
[data-theme="dark"] .row-vis-btn {
  background: #243149 !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .row-vis-btn:hover {
  background: #2c3a52 !important;
  border-color: #818cf8 !important;
  color: #c7d2fe !important;
}
[data-theme="dark"] .row-vis-btn.has-hidden {
  color: #fbbf24 !important;
  border-color: #fbbf24 !important;
}
.row-vis-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  padding: 6px;
}
.row-vis-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.row-vis-item:hover { background: rgba(99,102,241,0.06); }
.row-vis-item input[type=checkbox] { accent-color: #6366f1; }
.row-vis-item-text { flex: 1; font-size: 13px; min-width: 0; }
.row-vis-item-text strong { color: var(--text-primary, #1f2937); }
.row-vis-item-text small { color: var(--text-secondary, #64748b); display: block; font-size: 11px; }
[data-theme="dark"] .row-vis-list { border-color: #334155 !important; background: #1e293b !important; }
[data-theme="dark"] .row-vis-item:hover { background: rgba(99,102,241,0.15) !important; }
[data-theme="dark"] .row-vis-item-text strong { color: #f1f5f9 !important; }
[data-theme="dark"] .row-vis-item-text small { color: #94a3b8 !important; }

/* ============================================================
   AÇÕES PADRONIZADAS — alinhamento + cores fixas dos ícones
   ============================================================ */
table.data-table th:last-child,
table.data-table td:last-child { text-align: left; }
table.data-table td:last-child > .inline-flex,
table.data-table td:last-child > div { justify-content: flex-start !important; }

/* Ícones padrão para ações - cores fixas para identificação visual */
.btn-icon i.fa-eye        { color: #10b981; } /* verde - visualizar */
.btn-icon i.fa-paperclip  { color: #6366f1; } /* indigo - anexo */
.btn-icon i.fa-pen        { color: #6b7280; } /* cinza - editar */
.btn-icon i.fa-trash      { color: #ef4444; } /* vermelho - excluir */
.btn-icon i.fa-clipboard-list { color: #f97316; } /* laranja - ocorrência */
.btn-icon i.fa-id-card    { color: #6366f1; } /* indigo - detalhes */

/* Asterisco e label de obrigatório - padronizado em todo o sistema */
.required { color: #dc2626; font-weight: 800; margin-left: 2px; font-size: 1.05em; }
.required::after {
  content: " (obrigatório)";
  color: #94a3b8;
  font-weight: 500;
  font-size: 10px;
  font-style: italic;
  margin-left: 3px;
}
.label-required-hint { font-size: 10px; color: #94a3b8; font-weight: 500; margin-left: 4px; font-style: italic; }
[data-theme="dark"] .label-required-hint { color: #94a3b8 !important; }
[data-theme="dark"] .required { color: #f87171; }
[data-theme="dark"] .required::after { color: #94a3b8 !important; }

/* Auto-marcar inputs/selects com required nativo HTML5 */
.form-input[required] + .form-help::before,
.form-select[required] + .form-help::before { content: ""; }
/* Ring vermelho sutil em campos obrigatórios vazios após interação */
.form-input[required]:invalid:not(:focus):not(:placeholder-shown),
.form-select[required]:invalid:not(:focus) {
  border-color: rgba(220, 38, 38, 0.4);
}


/* ============================================================
   DASHBOARD: Personalizar widgets — modal items
   ============================================================ */
.dash-widgets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-surface-2);
}
.dash-widget-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s;
}
.dash-widget-item:hover { border-color: #6366f1; background: rgba(99,102,241,0.05); }
.dash-widget-item input[type="checkbox"] { accent-color: #6366f1; width: 16px; height: 16px; }
[data-theme="dark"] .dash-widget-item { background: var(--bg-surface-3); }
[data-theme="dark"] .dash-widget-item:hover { background: rgba(99,102,241,0.10); }

/* Filters header (movimentos bancários) */
.filters-header {
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
  padding:8px 12px;
  background:rgba(99,102,241,0.08);
  border:1px solid rgba(99,102,241,0.25);
  border-radius:8px;
}
[data-theme="dark"] .filters-header {
  background: rgba(99,102,241,0.18) !important;
  border-color: rgba(99,102,241,0.40) !important;
}

/* Chat unread badge (número vermelho como apps) */
.chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-surface, #fff), 0 2px 6px rgba(239,68,68,0.45);
  animation: chatBadgePulse 1.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}
@keyframes chatBadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px var(--bg-surface, #fff), 0 2px 6px rgba(239,68,68,0.45); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 2px var(--bg-surface, #fff), 0 0 0 4px rgba(239,68,68,0.18), 0 2px 8px rgba(239,68,68,0.55); }
}
[data-theme="dark"] .chat-unread-badge {
  box-shadow: 0 0 0 2px #1e293b, 0 2px 6px rgba(239,68,68,0.55);
}

/* Anexos: campo descrição */
.anexo-desc-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
}
.anexo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--bg-surface-2);
}
[data-theme="dark"] .anexo-row { background: var(--bg-surface-3); }

/* ============================================================
   TUTORIAL DO SISTEMA (Admin)
   ============================================================ */
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}
.tutorial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.2s;
}
.tutorial-card:hover { border-color: #6366f1; box-shadow: 0 4px 16px rgba(99,102,241,0.10); }
.tutorial-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.tutorial-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  flex-shrink: 0;
}
.tutorial-chevron {
  transition: transform 0.2s;
  color: var(--text-secondary);
}
.tutorial-card.open .tutorial-chevron { transform: rotate(180deg); }
.tutorial-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  border-top: 1px solid transparent;
  padding: 0 16px;
}
.tutorial-card.open .tutorial-card-body {
  max-height: 1000px;
  padding: 12px 16px 16px;
  border-top-color: var(--border-color);
}
.tutorial-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tutorial-list li {
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.tutorial-list li i { margin-top: 3px; flex-shrink: 0; }
[data-theme="dark"] .tutorial-card { background: var(--bg-surface-2); }
[data-theme="dark"] .tutorial-list li { color: #e2e8f0; }

/* ============================================================
   CALENDÁRIO DARK MODE — fix adicional para itens em branco
   ============================================================ */
[data-theme="dark"] .calendar-container,
[data-theme="dark"] .calendar-grid,
[data-theme="dark"] .cal-pro-grid,
[data-theme="dark"] .cal-month-view {
  background: transparent !important;
}
[data-theme="dark"] .calendar-day,
[data-theme="dark"] .cal-pro-day,
[data-theme="dark"] .cal-day {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .calendar-day:hover,
[data-theme="dark"] .cal-pro-day:hover,
[data-theme="dark"] .cal-day:hover {
  background: #243149 !important;
}
[data-theme="dark"] .calendar-day-event,
[data-theme="dark"] .cal-event,
[data-theme="dark"] .cal-pro-event {
  background: rgba(99,102,241,0.20) !important;
  color: #c7d2fe !important;
  border-color: rgba(99,102,241,0.35) !important;
}
[data-theme="dark"] .calendar-header,
[data-theme="dark"] .cal-header,
[data-theme="dark"] .cal-pro-header,
[data-theme="dark"] .cal-week-header,
[data-theme="dark"] .cal-month-header {
  background: #243149 !important;
  color: #f1f5f9 !important;
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] .cal-weekday,
[data-theme="dark"] .cal-pro-weekday,
[data-theme="dark"] .cal-month-weekday {
  color: #94a3b8 !important;
}
[data-theme="dark"] .cal-pro-day.outside,
[data-theme="dark"] .cal-day.outside,
[data-theme="dark"] .calendar-day.other-month {
  background: #0f172a !important;
  color: #475569 !important;
}
[data-theme="dark"] .cal-pro-day-number,
[data-theme="dark"] .cal-day-number,
[data-theme="dark"] .calendar-day-number {
  color: #f1f5f9 !important;
}
/* Texto branco em fundos brancos do calendário */
[data-theme="dark"] .calendar-container *,
[data-theme="dark"] .cal-pro-container *,
[data-theme="dark"] .cal-month-view * {
  color: inherit;
}
[data-theme="dark"] .calendar-container .text-white,
[data-theme="dark"] .calendar-container [style*="color: #fff"],
[data-theme="dark"] .calendar-container [style*="color:#fff"] {
  color: #f1f5f9 !important;
}
[data-theme="dark"] .calendar-container .bg-white,
[data-theme="dark"] .cal-month-view .bg-white {
  background: #1e293b !important;
}
[data-theme="dark"] .cal-pro-event-title,
[data-theme="dark"] .cal-event-title { color: #f1f5f9 !important; }
[data-theme="dark"] .cal-pro-event-time,
[data-theme="dark"] .cal-event-time { color: #cbd5e1 !important; }

/* Calendar nav buttons */
[data-theme="dark"] .cal-pro-nav-btn,
[data-theme="dark"] .cal-nav-btn {
  background: #243149 !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .cal-pro-nav-btn:hover,
[data-theme="dark"] .cal-nav-btn:hover {
  background: rgba(99,102,241,0.18) !important;
  color: #c7d2fe !important;
}

/* ============================================================
   DARK MODE — CORREÇÃO UNIVERSAL DE ÍCONES E TEXTO COLORIDO
   Garante legibilidade de todos os ícones Tailwind (text-*-NNN)
   utilizando tons mais claros (300/400) e !important para vencer
   especificidade das classes utilitárias inline.
   ============================================================ */

/* ---- Vermelhos / Rosa ---- */
[data-theme="dark"] .text-red-300,
[data-theme="dark"] .text-red-400,
[data-theme="dark"] .text-red-500,
[data-theme="dark"] .text-red-600,
[data-theme="dark"] .text-red-700,
[data-theme="dark"] .text-red-800,
[data-theme="dark"] .text-red-900   { color: #fca5a5 !important; }

[data-theme="dark"] .text-rose-300,
[data-theme="dark"] .text-rose-400,
[data-theme="dark"] .text-rose-500,
[data-theme="dark"] .text-rose-600,
[data-theme="dark"] .text-rose-700,
[data-theme="dark"] .text-rose-800,
[data-theme="dark"] .text-rose-900  { color: #fda4af !important; }

[data-theme="dark"] .text-pink-300,
[data-theme="dark"] .text-pink-400,
[data-theme="dark"] .text-pink-500,
[data-theme="dark"] .text-pink-600,
[data-theme="dark"] .text-pink-700,
[data-theme="dark"] .text-pink-800,
[data-theme="dark"] .text-pink-900  { color: #f9a8d4 !important; }

/* ---- Laranjas / Âmbar / Amarelo ---- */
[data-theme="dark"] .text-orange-300,
[data-theme="dark"] .text-orange-400,
[data-theme="dark"] .text-orange-500,
[data-theme="dark"] .text-orange-600,
[data-theme="dark"] .text-orange-700,
[data-theme="dark"] .text-orange-800,
[data-theme="dark"] .text-orange-900 { color: #fdba74 !important; }

[data-theme="dark"] .text-amber-300,
[data-theme="dark"] .text-amber-400,
[data-theme="dark"] .text-amber-500,
[data-theme="dark"] .text-amber-600,
[data-theme="dark"] .text-amber-700,
[data-theme="dark"] .text-amber-800,
[data-theme="dark"] .text-amber-900 { color: #fcd34d !important; }

[data-theme="dark"] .text-yellow-300,
[data-theme="dark"] .text-yellow-400,
[data-theme="dark"] .text-yellow-500,
[data-theme="dark"] .text-yellow-600,
[data-theme="dark"] .text-yellow-700,
[data-theme="dark"] .text-yellow-800,
[data-theme="dark"] .text-yellow-900 { color: #fde047 !important; }

/* ---- Verdes / Esmeralda / Lima / Teal ---- */
[data-theme="dark"] .text-green-300,
[data-theme="dark"] .text-green-400,
[data-theme="dark"] .text-green-500,
[data-theme="dark"] .text-green-600,
[data-theme="dark"] .text-green-700,
[data-theme="dark"] .text-green-800,
[data-theme="dark"] .text-green-900 { color: #86efac !important; }

[data-theme="dark"] .text-emerald-300,
[data-theme="dark"] .text-emerald-400,
[data-theme="dark"] .text-emerald-500,
[data-theme="dark"] .text-emerald-600,
[data-theme="dark"] .text-emerald-700,
[data-theme="dark"] .text-emerald-800,
[data-theme="dark"] .text-emerald-900 { color: #6ee7b7 !important; }

[data-theme="dark"] .text-lime-300,
[data-theme="dark"] .text-lime-400,
[data-theme="dark"] .text-lime-500,
[data-theme="dark"] .text-lime-600,
[data-theme="dark"] .text-lime-700,
[data-theme="dark"] .text-lime-800,
[data-theme="dark"] .text-lime-900  { color: #bef264 !important; }

[data-theme="dark"] .text-teal-300,
[data-theme="dark"] .text-teal-400,
[data-theme="dark"] .text-teal-500,
[data-theme="dark"] .text-teal-600,
[data-theme="dark"] .text-teal-700,
[data-theme="dark"] .text-teal-800,
[data-theme="dark"] .text-teal-900  { color: #5eead4 !important; }

/* ---- Azuis / Ciano / Sky ---- */
[data-theme="dark"] .text-blue-300,
[data-theme="dark"] .text-blue-400,
[data-theme="dark"] .text-blue-500,
[data-theme="dark"] .text-blue-600,
[data-theme="dark"] .text-blue-700,
[data-theme="dark"] .text-blue-800,
[data-theme="dark"] .text-blue-900  { color: #93c5fd !important; }

[data-theme="dark"] .text-sky-300,
[data-theme="dark"] .text-sky-400,
[data-theme="dark"] .text-sky-500,
[data-theme="dark"] .text-sky-600,
[data-theme="dark"] .text-sky-700,
[data-theme="dark"] .text-sky-800,
[data-theme="dark"] .text-sky-900   { color: #7dd3fc !important; }

[data-theme="dark"] .text-cyan-300,
[data-theme="dark"] .text-cyan-400,
[data-theme="dark"] .text-cyan-500,
[data-theme="dark"] .text-cyan-600,
[data-theme="dark"] .text-cyan-700,
[data-theme="dark"] .text-cyan-800,
[data-theme="dark"] .text-cyan-900  { color: #67e8f9 !important; }

/* ---- Índigo / Violeta / Roxo / Fúcsia ---- */
[data-theme="dark"] .text-indigo-300,
[data-theme="dark"] .text-indigo-400,
[data-theme="dark"] .text-indigo-500,
[data-theme="dark"] .text-indigo-600,
[data-theme="dark"] .text-indigo-700,
[data-theme="dark"] .text-indigo-800,
[data-theme="dark"] .text-indigo-900 { color: #a5b4fc !important; }

[data-theme="dark"] .text-violet-300,
[data-theme="dark"] .text-violet-400,
[data-theme="dark"] .text-violet-500,
[data-theme="dark"] .text-violet-600,
[data-theme="dark"] .text-violet-700,
[data-theme="dark"] .text-violet-800,
[data-theme="dark"] .text-violet-900 { color: #c4b5fd !important; }

[data-theme="dark"] .text-purple-300,
[data-theme="dark"] .text-purple-400,
[data-theme="dark"] .text-purple-500,
[data-theme="dark"] .text-purple-600,
[data-theme="dark"] .text-purple-700,
[data-theme="dark"] .text-purple-800,
[data-theme="dark"] .text-purple-900 { color: #d8b4fe !important; }

[data-theme="dark"] .text-fuchsia-300,
[data-theme="dark"] .text-fuchsia-400,
[data-theme="dark"] .text-fuchsia-500,
[data-theme="dark"] .text-fuchsia-600,
[data-theme="dark"] .text-fuchsia-700,
[data-theme="dark"] .text-fuchsia-800,
[data-theme="dark"] .text-fuchsia-900 { color: #f0abfc !important; }

/* ---- Cinza / Slate / Zinc / Stone — neutros legíveis ---- */
[data-theme="dark"] .text-gray-200,
[data-theme="dark"] .text-gray-300 { color: #e5e7eb !important; }
[data-theme="dark"] .text-slate-300,
[data-theme="dark"] .text-slate-400,
[data-theme="dark"] .text-slate-500 { color: #cbd5e1 !important; }
[data-theme="dark"] .text-slate-600,
[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-slate-800,
[data-theme="dark"] .text-slate-900 { color: #94a3b8 !important; }
[data-theme="dark"] .text-zinc-300,
[data-theme="dark"] .text-zinc-400  { color: #d4d4d8 !important; }
[data-theme="dark"] .text-zinc-500,
[data-theme="dark"] .text-zinc-600,
[data-theme="dark"] .text-zinc-700  { color: #a1a1aa !important; }

/* ---- Ícones FontAwesome dentro de cards / botões ---- */
/* Cards principais (KPI, glass, ops, stat) — força brilho mínimo nos ícones */
[data-theme="dark"] .kpi-card i.fas,
[data-theme="dark"] .kpi-card i.far,
[data-theme="dark"] .kpi-card i.fab,
[data-theme="dark"] .stat-card i.fas,
[data-theme="dark"] .stat-card i.far,
[data-theme="dark"] .ops-card-pro i.fas,
[data-theme="dark"] .ops-card-pro i.far,
[data-theme="dark"] .glass-card i.fas,
[data-theme="dark"] .glass-card i.far,
[data-theme="dark"] .glass-card i.fab {
  filter: brightness(1.25) saturate(1.1);
}

/* Botões do tipo btn-icon e ações de tabela — ícones legíveis */
[data-theme="dark"] .btn-icon i,
[data-theme="dark"] .data-table .btn-icon i,
[data-theme="dark"] .data-table td i.fas,
[data-theme="dark"] .data-table td i.far {
  filter: brightness(1.3);
}

/* Botões secundários no dark — ícones com cor mínima */
[data-theme="dark"] .btn-secondary i.fas,
[data-theme="dark"] .btn-secondary i.far,
[data-theme="dark"] .btn-secondary i.fab {
  opacity: 1 !important;
}

/* Sidebar / nav-item — ícones de menu coloridos legíveis */
[data-theme="dark"] .nav-item i.fas,
[data-theme="dark"] .nav-item i.far,
[data-theme="dark"] .nav-item i.fab {
  filter: brightness(1.2) saturate(1.15);
}

/* Tutorial cards — ícones brilhantes */
[data-theme="dark"] .tutorial-card-icon i,
[data-theme="dark"] .tutorial-card i.fas,
[data-theme="dark"] .tutorial-card i.far {
  filter: brightness(1.3);
}

/* Painéis de alerta / sino — ícones legíveis */
[data-theme="dark"] .alert-item-icon i,
[data-theme="dark"] .alert-tag i,
[data-theme="dark"] .tarefas-bell-btn i,
[data-theme="dark"] .chat-fab i {
  filter: brightness(1.25);
}

/* Backgrounds claros (bg-blue-50, bg-green-50…) usados em pílulas
   no modo escuro: texto fica ilegível. Força tons claros e fundo translúcido. */
[data-theme="dark"] .bg-indigo-50  { background-color: rgba(99, 102, 241, 0.18) !important; }
[data-theme="dark"] .bg-blue-50    { background-color: rgba(59, 130, 246, 0.18) !important; }
[data-theme="dark"] .bg-emerald-50 { background-color: rgba(16, 185, 129, 0.18) !important; }
[data-theme="dark"] .bg-green-50   { background-color: rgba(34, 197, 94, 0.18) !important; }
[data-theme="dark"] .bg-red-50     { background-color: rgba(239, 68, 68, 0.18) !important; }
[data-theme="dark"] .bg-rose-50    { background-color: rgba(244, 63, 94, 0.18) !important; }
[data-theme="dark"] .bg-amber-50   { background-color: rgba(245, 158, 11, 0.18) !important; }
[data-theme="dark"] .bg-yellow-50  { background-color: rgba(234, 179, 8, 0.18) !important; }
[data-theme="dark"] .bg-orange-50  { background-color: rgba(249, 115, 22, 0.18) !important; }
[data-theme="dark"] .bg-purple-50  { background-color: rgba(168, 85, 247, 0.18) !important; }
[data-theme="dark"] .bg-pink-50    { background-color: rgba(236, 72, 153, 0.18) !important; }
[data-theme="dark"] .bg-teal-50    { background-color: rgba(20, 184, 166, 0.18) !important; }
[data-theme="dark"] .bg-cyan-50    { background-color: rgba(6, 182, 212, 0.18) !important; }
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100   { background-color: rgba(148, 163, 184, 0.12) !important; }

/* Pílulas .bg-*-100.text-*-700/800 já tratadas mais acima — reforço para cores
   adicionais que não estavam cobertas */
[data-theme="dark"] .bg-indigo-100 { background-color: rgba(99, 102, 241, 0.22) !important; }
[data-theme="dark"] .bg-rose-100   { background-color: rgba(244, 63, 94, 0.22) !important; }
[data-theme="dark"] .bg-pink-100   { background-color: rgba(236, 72, 153, 0.22) !important; }
[data-theme="dark"] .bg-teal-100   { background-color: rgba(20, 184, 166, 0.22) !important; }
[data-theme="dark"] .bg-cyan-100   { background-color: rgba(6, 182, 212, 0.22) !important; }

[data-theme="dark"] .text-indigo-700,
[data-theme="dark"] .text-blue-700,
[data-theme="dark"] .text-emerald-700,
[data-theme="dark"] .text-green-700,
[data-theme="dark"] .text-red-700,
[data-theme="dark"] .text-rose-700,
[data-theme="dark"] .text-amber-700,
[data-theme="dark"] .text-orange-700,
[data-theme="dark"] .text-purple-700,
[data-theme="dark"] .text-pink-700,
[data-theme="dark"] .text-teal-700,
[data-theme="dark"] .text-cyan-700,
[data-theme="dark"] .text-yellow-700 { font-weight: 600; }

/* Garante que ícones inline (sem cor explícita) sejam visíveis */
[data-theme="dark"] i.fas,
[data-theme="dark"] i.far,
[data-theme="dark"] i.fab {
  /* fallback: se cor herdada for muito escura (gray-700/800), iluminar */
}
[data-theme="dark"] .text-gray-600 i.fas,
[data-theme="dark"] .text-gray-700 i.fas,
[data-theme="dark"] .text-gray-800 i.fas,
[data-theme="dark"] .text-gray-900 i.fas { color: #cbd5e1 !important; }

/* SVG icons (caso exista algum SVG inline com fill currentColor) */
[data-theme="dark"] svg.icon,
[data-theme="dark"] .icon svg {
  filter: brightness(1.2);
}
