/* ==========================================================================
   THEME-DUAL-AMB.CSS — AMBIANCE HEALTH INSTITUTE
   SISTEMA DE TEMAS DINÂMICOS & REWORK VISUAL COMPLETO (DARK & LIGHT)
   Padrão: Modo Claro (Pearl Silk & Terracotta / Rose Gold)
   Alternativo: Modo Escuro (Deep Slate & Electric Royal Sapphire)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. MODO CLARO (TEMA 2: PEARL SILK & TERRACOTTA / ROSE GOLD)
   -------------------------------------------------------------------------- */
:root, [data-theme="light"] {
  --bg-main: #fbf9f7;
  --bg-main-elevated: #f5efeb;
  --bg-card: #ffffff;
  --bg-card-hover: #fcf6f3;
  --border-color: #ebdcd3;
  --border-focus: #b86e5c;
  
  --primary: #a85d4c;
  --primary-light: #7c3a2d;
  --primary-surface: #fdf5f2;
  --primary-dark: #5c2217;
  --primary-glow: rgba(168, 93, 76, 0.2);
  --gold-gradient: linear-gradient(135deg, #c98877 0%, #a85d4c 50%, #8c4333 100%);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --card-shadow: 0 4px 20px rgba(160, 130, 120, 0.08);
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --topbar-border: #ebdcd3;
  --sidebar-bg: #ffffff;
}

/* --------------------------------------------------------------------------
   2. MODO ESCURO (TEMA 3: DEEP SLATE & ELECTRIC ROYAL SAPPHIRE)
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-main: #0b0f17;
  --bg-main-elevated: #0f172a;
  --bg-card: #131c2e;
  --bg-card-hover: #19253c;
  --border-color: rgba(37, 99, 235, 0.28);
  --border-focus: #38bdf8;
  
  --primary: #2563eb;
  --primary-light: #38bdf8;
  --primary-surface: rgba(37, 99, 235, 0.15);
  --primary-dark: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.45);
  --gold-gradient: linear-gradient(135deg, #38bdf8 0%, #2563eb 50%, #1d4ed8 100%);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 16px rgba(37, 99, 235, 0.12);
  --topbar-bg: rgba(15, 23, 42, 0.95);
  --topbar-border: rgba(37, 99, 235, 0.35);
  --sidebar-bg: #0d1524;
}

/* --------------------------------------------------------------------------
   3. TRANSIÇÕES GLOBAIS SUAVES
   -------------------------------------------------------------------------- */
body, 
.sidebar, 
.system-topbar-compact, 
.agenda-wide-card, 
.card, 
.content-card, 
.modal-content,
.modal-box,
.schedule-slot,
.sidebar-user-pill,
.sidebar-footer-btn,
.clean-toolbar-single-row,
#medical-fullcalendar,
.patients-table-container,
.patients-table {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease !important;
}

/* --------------------------------------------------------------------------
   4. SOBREPOSIÇÃO INTEGRAL NO MODO ESCURO (SEM NENHUM FUNDO BRANCO RESIDUAL)
   -------------------------------------------------------------------------- */
[data-theme="dark"] body {
  background-color: #0b0f17 !important;
  background-image: 
    radial-gradient(circle at 12% 12%, rgba(37, 99, 235, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 88% 88%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(11, 15, 23, 0.98) 0%, rgba(6, 9, 15, 1) 100%) !important;
  color: #f8fafc !important;
}

/* 4.1 SIDEBAR COMPLETA NO MODO ESCURO */
[data-theme="dark"] .sidebar {
  background: #0d1524 !important;
  border-right: 1px solid rgba(37, 99, 235, 0.25) !important;
  box-shadow: 6px 0 28px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .btn-sidebar-collapse {
  background: rgba(37, 99, 235, 0.15) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .btn-sidebar-collapse:hover {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5) !important;
}

[data-theme="dark"] .sidebar-user-pill {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .sidebar-user-avatar {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.4) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .sidebar-user-name {
  color: #f8fafc !important;
}

[data-theme="dark"] .sidebar-user-role {
  color: #94a3b8 !important;
}

[data-theme="dark"] .sidebar-user-edit-btn {
  background: rgba(37, 99, 235, 0.18) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

[data-theme="dark"] .sidebar-user-edit-btn:hover {
  background: #2563eb !important;
  color: #ffffff !important;
}

[data-theme="dark"] .sidebar-new-appointment-btn {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35) !important;
  color: #ffffff !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
}

[data-theme="dark"] .sidebar-new-appointment-btn:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.55) !important;
}

[data-theme="dark"] .sidebar-cluster-label.cluster-oper   { color: #60a5fa !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-oper::after { background: #60a5fa !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-atend  { color: #34d399 !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-atend::after { background: #34d399 !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-finan  { color: #fbbf24 !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-finan::after { background: #fbbf24 !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-intel  { color: #c084fc !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-intel::after { background: #c084fc !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-gestao { color: #94a3b8 !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-gestao::after { background: #94a3b8 !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-integ  { color: #22d3ee !important; }
[data-theme="dark"] .sidebar-cluster-label.cluster-integ::after { background: #22d3ee !important; }

[data-theme="dark"] .nav-item {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(37, 99, 235, 0.12) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(15, 23, 42, 0.8) 100%) !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] .nav-item.active .nav-icon-badge {
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.5) !important;
}

[data-theme="dark"] .nav-icon-badge.icon-blue    { background: rgba(37, 99, 235, 0.18) !important; color: #60a5fa !important; border: 1px solid rgba(37, 99, 235, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-teal    { background: rgba(20, 184, 166, 0.18) !important; color: #2dd4bf !important; border: 1px solid rgba(20, 184, 166, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-indigo  { background: rgba(99, 102, 241, 0.18) !important; color: #a5b4fc !important; border: 1px solid rgba(99, 102, 241, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-amber   { background: rgba(245, 158, 11, 0.18) !important; color: #fbbf24 !important; border: 1px solid rgba(245, 158, 11, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-rose    { background: rgba(244, 63, 94, 0.18) !important; color: #fb7185 !important; border: 1px solid rgba(244, 63, 94, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-emerald { background: rgba(16, 185, 129, 0.18) !important; color: #34d399 !important; border: 1px solid rgba(16, 185, 129, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-purple  { background: rgba(168, 85, 247, 0.18) !important; color: #c084fc !important; border: 1px solid rgba(168, 85, 247, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-cyan    { background: rgba(6, 182, 212, 0.18) !important; color: #22d3ee !important; border: 1px solid rgba(6, 182, 212, 0.35) !important; }
[data-theme="dark"] .nav-icon-badge.icon-slate   { background: rgba(148, 163, 184, 0.18) !important; color: #cbd5e1 !important; border: 1px solid rgba(148, 163, 184, 0.35) !important; }

[data-theme="dark"] .sidebar-action-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .sidebar-footer-btn {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .sidebar-footer-btn:hover {
  background: rgba(37, 99, 235, 0.2) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .sidebar-footer-btn.btn-danger-soft {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
}

[data-theme="dark"] .sidebar-footer-btn.btn-danger-soft:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
}

/* 4.2 TOPBAR NO MODO ESCURO */
[data-theme="dark"] .system-topbar-compact {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .topbar-breadcrumb-wrap {
  color: #94a3b8 !important;
}

[data-theme="dark"] .topbar-breadcrumb-wrap .crumb-highlight {
  color: #f8fafc !important;
}

[data-theme="dark"] .channel-pill-status {
  background: rgba(16, 185, 129, 0.15) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
}

[data-theme="dark"] .btn-quick-new-appt {
  background: linear-gradient(135deg, #2563eb, #1e40af) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}

/* 4.3 AGENDA MÉDICA & FULLCALENDAR NO MODO ESCURO */
[data-theme="dark"] .clean-toolbar-single-row,
[data-theme="dark"] .agenda-toolbar-unified {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .clean-toolbar-single-row label,
[data-theme="dark"] .toolbar-group label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .clean-toolbar-single-row select,
[data-theme="dark"] .toolbar-group select {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .btn-group-segmented {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .btn-tool {
  color: #94a3b8 !important;
}

[data-theme="dark"] .btn-tool:hover,
[data-theme="dark"] .btn-tool.active {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4) !important;
}

[data-theme="dark"] .calendar-card,
[data-theme="dark"] .full-width-calendar,
[data-theme="dark"] #medical-fullcalendar {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .fc {
  --fc-page-bg-color: #131c2e !important;
  --fc-neutral-bg-color: #0b0f17 !important;
  --fc-list-event-hover-bg-color: rgba(37, 99, 235, 0.15) !important;
  --fc-theme-standard-border-color: rgba(37, 99, 235, 0.2) !important;
  --fc-border-color: rgba(37, 99, 235, 0.2) !important;
}

[data-theme="dark"] .fc-theme-standard th,
[data-theme="dark"] .fc-col-header-cell {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .fc-col-header-cell-cushion {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .fc-timegrid-slot-label-cushion,
[data-theme="dark"] .fc-timegrid-axis-cushion {
  color: #94a3b8 !important;
}

[data-theme="dark"] .fc-daygrid-day-number {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-scrollgrid-sync-table td {
  border-color: rgba(37, 99, 235, 0.18) !important;
}

[data-theme="dark"] .fc-timegrid-col.fc-day-today {
  background: rgba(37, 99, 235, 0.08) !important;
}

/* 4.4 HORÁRIOS DE ATENDIMENTO (tab-doctor-schedules) */
[data-theme="dark"] #schedule-readonly-container,
[data-theme="dark"] #tab-doctor-schedules div[style*="background: #ffffff"],
[data-theme="dark"] #tab-doctor-schedules div[style*="background:#ffffff"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] #tab-doctor-schedules div[style*="background: #f8fafc"],
[data-theme="dark"] #tab-doctor-schedules div[style*="background:#f8fafc"] {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] #schedule-readonly-container table {
  background: transparent !important;
}

[data-theme="dark"] #schedule-readonly-container thead tr,
[data-theme="dark"] #schedule-readonly-container tr[style*="background: #faf5f1"] {
  background: #0f172a !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] #schedule-readonly-container thead th {
  color: #38bdf8 !important;
}

[data-theme="dark"] #schedule-readonly-container tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] #schedule-readonly-container tbody tr:hover {
  background: rgba(37, 99, 235, 0.1) !important;
}

/* 4.5 TABELA DE PREÇOS & PROCEDIMENTOS (tab-pricing) */
[data-theme="dark"] .patients-table-container,
[data-theme="dark"] .patients-table {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] .patients-table th,
[data-theme="dark"] #tab-pricing .patients-table th,
[data-theme="dark"] #tab-patients .patients-table th {
  background: #0f172a !important;
  border-bottom: 1.5px solid rgba(37, 99, 235, 0.35) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .patients-table td,
[data-theme="dark"] #tab-pricing .patients-table td,
[data-theme="dark"] #tab-patients .patients-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: #cbd5e1 !important;
  background: transparent !important;
}

[data-theme="dark"] .patients-table tr:hover td {
  background: rgba(37, 99, 235, 0.1) !important;
}

[data-theme="dark"] .spec-input,
[data-theme="dark"] .price-input,
[data-theme="dark"] .dur-input,
[data-theme="dark"] #tab-pricing select,
[data-theme="dark"] #tab-pricing input {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .spec-input:focus,
[data-theme="dark"] .price-input:focus,
[data-theme="dark"] .dur-input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35) !important;
  background: #0f172a !important;
}

[data-theme="dark"] .price-input {
  color: #34d399 !important;
}

/* 4.6 ATENDIMENTO WHATSAPP & TRANSLADO / SUPORTE HUMANO */
[data-theme="dark"] #human-support-list > div,
[data-theme="dark"] .human-support-empty,
[data-theme="dark"] div[style*="padding: 50px 20px; color: var(--text-muted); background: #ffffff"],
[data-theme="dark"] div[style*="padding: 50px 20px; color: var(--text-muted); background:#ffffff"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] #human-support-list h4,
[data-theme="dark"] div[style*="padding: 50px 20px"] h4 {
  color: #f8fafc !important;
}

[data-theme="dark"] #human-support-list p,
[data-theme="dark"] div[style*="padding: 50px 20px"] p {
  color: #94a3b8 !important;
}

/* 4.7 TODOS OS MODAIS DO SISTEMA (.modal-box, .modal-header, .modal-footer) */
[data-theme="dark"] .modal-box,
[data-theme="dark"] .dialog-box,
[data-theme="dark"] div[class*="modal-box"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 20px rgba(37, 99, 235, 0.2) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .modal-header {
  background: #0f172a !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.25) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .modal-header h4,
[data-theme="dark"] .modal-title {
  color: #f8fafc !important;
}

[data-theme="dark"] .modal-body-scrollable,
[data-theme="dark"] .modal-body {
  background: #131c2e !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .modal-footer {
  background: #0f172a !important;
  border-top: 1px solid rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .close-btn {
  color: #94a3b8 !important;
}

[data-theme="dark"] .close-btn:hover {
  color: #ffffff !important;
}

/* Modais Específicos: Agendar Consulta, Confirmação e Editores */
[data-theme="dark"] .modal-box input,
[data-theme="dark"] .modal-box select,
[data-theme="dark"] .modal-box textarea,
[data-theme="dark"] .luxury-input {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .modal-box input:focus,
[data-theme="dark"] .modal-box select:focus,
[data-theme="dark"] .modal-box textarea:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] #booking-search-dropdown {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.4) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] #booking-patient-selected-card {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-theme="dark"] #booking-patient-edit-inline-panel {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] #booking-patient-edit-inline-panel label,
[data-theme="dark"] #booking-new-patient-box label {
  color: #e2e8f0 !important;
}

[data-theme="dark"] #booking-new-patient-box {
  background: #131d2e !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

[data-theme="dark"] #booking-new-patient-box div[style*="background: #fefce8"] {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

[data-theme="dark"] #booking-new-patient-box div[style*="background: #fefce8"] label {
  color: #fde68a !important;
}

/* 4.8 GESTÃO DE EQUIPE & ACESSOS (tab-team) */
[data-theme="dark"] #tab-team .content-card,
[data-theme="dark"] div[style*="padding: 18px 22px; background: #ffffff; border-radius: 14px"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] div[style*="padding: 18px 22px"] h4 {
  color: #38bdf8 !important;
}

[data-theme="dark"] div[style*="padding: 18px 22px"] p {
  color: #cbd5e1 !important;
}

/* 4.9 DADOS DA CLÍNICA & CONFIGURAÇÕES (tab-clinic-general) */
[data-theme="dark"] .address-subdivided-card {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .address-subdivided-card div[style*="background: #ffffff"],
[data-theme="dark"] .address-subdivided-card div[style*="background:#ffffff"] {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] #setting-address-preview-text {
  color: #38bdf8 !important;
}

[data-theme="dark"] #settings-specialties-container > div,
[data-theme="dark"] div[style*="background: #fdfaf8"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  border-left: 4px solid #2563eb !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] #settings-specialties-container strong {
  color: #f8fafc !important;
}

[data-theme="dark"] #settings-specialties-container p {
  color: #cbd5e1 !important;
}

/* 4.10 FILA DE APROVAÇÕES PIX & FALTA REAGENDAR (tab-approvals & tab-pending-reschedules) */
[data-theme="dark"] .pending-item {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .pending-item-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

[data-theme="dark"] .requested-time {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] #full-approvals-list div,
[data-theme="dark"] #pending-reschedules-list div {
  color: #94a3b8 !important;
}

[data-theme="dark"] #full-approvals-list h4,
[data-theme="dark"] #pending-reschedules-list h4 {
  color: #f8fafc !important;
}

/* 4.11 AGENDA MÉDICA & PRÓXIMOS HORÁRIOS (DASHBOARD) */
[data-theme="dark"] .agenda-wide-card {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(37, 99, 235, 0.1) !important;
}

[data-theme="dark"] .clean-card-header-row,
[data-theme="dark"] .agenda-wide-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .header-main-title,
[data-theme="dark"] .agenda-title-wrap h3 {
  color: #f8fafc !important;
}

[data-theme="dark"] .badge-date-today,
[data-theme="dark"] .date-badge-pill {
  background: rgba(37, 99, 235, 0.18) !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .pill-btn,
[data-theme="dark"] .doc-filter-pill {
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .pill-btn:hover,
[data-theme="dark"] .doc-filter-pill:hover {
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: #2563eb !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .pill-btn.active,
[data-theme="dark"] .doc-filter-pill.active {
  background: #2563eb !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.45) !important;
}

[data-theme="dark"] .btn-link-action,
[data-theme="dark"] .btn-text-action {
  color: #38bdf8 !important;
}

[data-theme="dark"] .schedule-slot {
  background: #0f172a !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
  border-left: 4px solid #2563eb !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] .schedule-slot:hover {
  background: #152238 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .slot-time {
  color: #f8fafc !important;
}

[data-theme="dark"] .slot-date-sub {
  color: #94a3b8 !important;
}

[data-theme="dark"] .slot-patient h5 {
  color: #f8fafc !important;
}

[data-theme="dark"] .slot-patient p {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .slot-note-text {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .status-confirmed {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

[data-theme="dark"] .status-pending {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .status-cancelled {
  background: rgba(244, 63, 94, 0.2) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(244, 63, 94, 0.4) !important;
}

/* 4.12 CARDS OPERACIONAIS, TELEMETRIA & GAVETA DE DETALHES */
[data-theme="dark"] .card, 
[data-theme="dark"] .content-card, 
[data-theme="dark"] .kpi-modern-card,
[data-theme="dark"] .panel,
[data-theme="dark"] .table-container,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .app-side-drawer-panel,
[data-theme="dark"] .appointment-drawer-panel {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.28) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .kpi-label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .kpi-card-value {
  color: #f8fafc !important;
}

[data-theme="dark"] .kpi-modern-card:hover {
  border-color: #38bdf8 !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.2) !important;
}

/* 4.13 REGRA GLOBAL CONTRA ELEMENTOS COM BACKGROUND BRANCO INLINE NO MODO ESCURO */
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:white"] {
  background: #131c2e !important;
  color: #f8fafc !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

/* 4.14 SOFIA IA ORB NO MODO ESCURO */
[data-theme="dark"] .sofia-fab,
[data-theme="dark"] #sofia-floating-btn {
  background: linear-gradient(135deg, #1e3a8a 0%, #0b0f17 100%) !important;
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.5), 0 8px 30px rgba(0, 0, 0, 0.7) !important;
  color: #38bdf8 !important;
}

/* --------------------------------------------------------------------------
   5. BOTÕES DE ALTERNÂNCIA DE TEMA (DARK / LIGHT TOGGLE)
   -------------------------------------------------------------------------- */
.btn-theme-toggle {
  background: rgba(168, 93, 76, 0.08);
  border: 1px solid rgba(168, 93, 76, 0.25);
  color: var(--primary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.btn-theme-toggle:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

[data-theme="dark"] .btn-theme-toggle {
  background: rgba(37, 99, 235, 0.2) !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .btn-theme-toggle:hover {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5) !important;
}

/* ==========================================================================
   PACOTE MASTER DE REFINAMENTO VISUAL & CORREÇÕES DO MODO ESCURO (DARK MODE)
   Solicitações de Alto Padrão - Bruno / Ambiance Health Institute
   ========================================================================== */

/* 1. BOTÃO NOVO AGENDAMENTO (LETRA & ÍCONE BRANCO CRISTALINO EM TODOS OS TEMAS) */
.sidebar-new-appointment-btn,
.sidebar-new-appointment-btn span,
.sidebar-new-appointment-btn i,
.sidebar-new-appointment-btn svg,
.btn-quick-new-appt,
.btn-quick-new-appt span,
.btn-quick-new-appt i,
.btn-quick-new-appt svg {
  color: #ffffff !important;
}

/* 2. CABEÇALHOS GERAIS NO MODO ESCURO (COR BRANCA EM VEZ DE CINZA) */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .header-main-title,
[data-theme="dark"] .card-header h3,
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .modal-header h4,
[data-theme="dark"] .table th,
[data-theme="dark"] table th,
[data-theme="dark"] .section-title,
[data-theme="dark"] .content-card-title,
[data-theme="dark"] .topbar-breadcrumb-wrap .crumb-highlight {
  color: #f8fafc !important;
}

/* 3. AGENDA MÉDICA NO MODO ESCURO */
/* 3.1 Remarcar Dia e Lembretes D-1 */
[data-theme="dark"] #tab-pending-reschedules,
[data-theme="dark"] #tab-reminders,
[data-theme="dark"] .pending-item,
[data-theme="dark"] .reminder-card,
[data-theme="dark"] .reminder-item,
[data-theme="dark"] .pending-reschedule-card {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] .pending-item-header,
[data-theme="dark"] .reminder-card-header {
  background: #0f172a !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.25) !important;
  color: #f8fafc !important;
}

/* 3.2 Campo de Busca por Paciente em Falta Agendar */
[data-theme="dark"] #filter-pending-reschedules-search,
[data-theme="dark"] #reschedule-search,
[data-theme="dark"] input[placeholder*="Buscar por paciente"],
[data-theme="dark"] input[placeholder*="Buscar paciente"],
[data-theme="dark"] input[placeholder*="Filtrar paciente"] {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

/* 3.3 Horários de Atendimento & Escala Semanal */
[data-theme="dark"] #tab-doctor-schedules .content-card,
[data-theme="dark"] .weekly-schedule-card,
[data-theme="dark"] .schedule-day-row,
[data-theme="dark"] .schedule-day-box {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

/* Badge de "Atende" em tom escuro integrado e harmônico */
[data-theme="dark"] .badge-attending,
[data-theme="dark"] .badge-available,
[data-theme="dark"] .schedule-status-badge,
[data-theme="dark"] span[style*="background: #ecfdf5"],
[data-theme="dark"] span[style*="background:#ecfdf5"] {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

/* Nomes dos Dias da Semana e Horários em Cor Branca */
[data-theme="dark"] .schedule-day-name,
[data-theme="dark"] .schedule-hours-text,
[data-theme="dark"] .weekly-schedule-card span,
[data-theme="dark"] .weekly-schedule-card strong,
[data-theme="dark"] #schedule-readonly-container td,
[data-theme="dark"] #schedule-readonly-container strong {
  color: #f8fafc !important;
}

/* 4. PROCEDIMENTOS E PREÇOS NO MODO ESCURO */
/* Quadradinhos e Checkboxes com X escurecidos */
[data-theme="dark"] .consult-badge-btn,
[data-theme="dark"] .consult-x-mark,
[data-theme="dark"] .pricing-field-group label {
  background: #0f172a !important;
  border: 1px solid rgba(37, 99, 235, 0.4) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .consult-badge-btn:hover {
  background: #1e293b !important;
  border-color: #38bdf8 !important;
}

[data-theme="dark"] input[type="checkbox"] {
  accent-color: #2563eb !important;
}

/* Inputs da Tabela de Preços */
[data-theme="dark"] #tab-pricing .price-input,
[data-theme="dark"] #tab-pricing .spec-input,
[data-theme="dark"] #tab-pricing .dur-input,
[data-theme="dark"] #tab-pricing input,
[data-theme="dark"] #tab-pricing select {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

/* 5. ATENDIMENTO WHATSAPP & CHAT NO MODO ESCURO */
/* Balões de Chat Escurecidos com Alto Contraste */
[data-theme="dark"] .chat-messages-container,
[data-theme="dark"] .chat-conversation-area,
[data-theme="dark"] #chat-messages-body,
[data-theme="dark"] .simulator-messages {
  background: #0b0f17 !important;
}

/* Balão do Paciente: Tom Slate Escuro Confortável */
[data-theme="dark"] .chat-message.patient,
[data-theme="dark"] .chat-message.user,
[data-theme="dark"] .message.incoming,
[data-theme="dark"] .msg-bubble-patient,
[data-theme="dark"] div[class*="message-patient"],
[data-theme="dark"] div[style*="background: #f1f5f9"],
[data-theme="dark"] div[style*="background:#f1f5f9"] {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px 12px 12px 2px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Balão da Sofia / Atendente: Sapphire Elegante */
[data-theme="dark"] .chat-message.ai,
[data-theme="dark"] .chat-message.bot,
[data-theme="dark"] .message.outgoing,
[data-theme="dark"] .msg-bubble-ai,
[data-theme="dark"] div[class*="message-ai"],
[data-theme="dark"] div[style*="background: #fdf2f0"],
[data-theme="dark"] div[style*="background:#fdf2f0"] {
  background: #172554 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(37, 99, 235, 0.45) !important;
  border-radius: 12px 12px 2px 12px !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .chat-message p,
[data-theme="dark"] .chat-message span,
[data-theme="dark"] .chat-bubble p,
[data-theme="dark"] .chat-bubble span,
[data-theme="dark"] .msg-text {
  color: #f8fafc !important;
}

[data-theme="dark"] .chat-input-area,
[data-theme="dark"] .chat-input-wrapper {
  background: #0f172a !important;
  border-top: 1px solid rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] #chat-input-text,
[data-theme="dark"] .chat-input textarea,
[data-theme="dark"] .chat-input input {
  background: #0b0f17 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

/* 6. PACIENTES E PRONTUÁRIOS NO MODO ESCURO */
/* Busca por CPF e Nome */
[data-theme="dark"] #patient-search-input,
[data-theme="dark"] #patients-cpf-search,
[data-theme="dark"] #search-patient-cpf,
[data-theme="dark"] input[placeholder*="CPF"],
[data-theme="dark"] input[placeholder*="cpf"],
[data-theme="dark"] input[placeholder*="Buscar por nome"] {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

/* Prontuários e Anamnese */
[data-theme="dark"] #record-chief-complaint,
[data-theme="dark"] #record-physical-exam,
[data-theme="dark"] #record-diagnosis,
[data-theme="dark"] #record-conduct,
[data-theme="dark"] #tab-medical-records textarea,
[data-theme="dark"] #tab-medical-records input {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

/* 7. TELEMETRIA E BALÕES DE ESTATÍSTICAS */
[data-theme="dark"] #tab-statistics .content-card,
[data-theme="dark"] .kpi-two-tier-container,
[data-theme="dark"] .kpi-modern-card,
[data-theme="dark"] .telemetry-card,
[data-theme="dark"] .stats-two-col-grid > div {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] .kpi-label,
[data-theme="dark"] .telemetry-label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .kpi-card-value {
  color: #f8fafc !important;
}

/* 8. SATISFAÇÃO NPS NO MODO ESCURO */
[data-theme="dark"] #tab-nps .content-card,
[data-theme="dark"] .nps-card,
[data-theme="dark"] .nps-score-box,
[data-theme="dark"] .nps-badge {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

/* 9. EQUIPE NO MODO ESCURO */
[data-theme="dark"] #tab-team .content-card,
[data-theme="dark"] .team-user-row,
[data-theme="dark"] .user-item-box {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .team-avatar,
[data-theme="dark"] .user-icon-wrap,
[data-theme="dark"] #tab-team .nav-icon-badge {
  background: rgba(37, 99, 235, 0.2) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
}

/* 10. TELAS DE CONFIGURAÇÃO (DADOS DA CLÍNICA, PIX, ASAAS, ICLINIC, SOFIA IA, BACKUPS) */
[data-theme="dark"] #tab-clinic-general input,
[data-theme="dark"] #tab-clinic-general select,
[data-theme="dark"] #tab-clinic-general textarea,
[data-theme="dark"] #tab-integrations input,
[data-theme="dark"] #tab-integrations select,
[data-theme="dark"] #tab-integrations textarea,
[data-theme="dark"] #tab-settings-ai input,
[data-theme="dark"] #tab-settings-ai select,
[data-theme="dark"] #tab-settings-ai textarea,
[data-theme="dark"] #tab-backups input,
[data-theme="dark"] #tab-backups select,
[data-theme="dark"] #tab-backups textarea,
[data-theme="dark"] #setting-ai-personality,
[data-theme="dark"] #setting-ai-autonomy,
[data-theme="dark"] .content-card input,
[data-theme="dark"] .content-card select,
[data-theme="dark"] .content-card textarea,
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .content-card input:focus,
[data-theme="dark"] .content-card textarea:focus,
[data-theme="dark"] .content-card select:focus,
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
  background: #0f172a !important;
}

/* 11. TABELA DE AUDITORIA & LOGS NO MODO ESCURO */
[data-theme="dark"] #tab-audit-logs .content-card,
[data-theme="dark"] #tab-audit-logs .table-container,
[data-theme="dark"] #tab-audit-logs table {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #tab-audit-logs div[style*="background: #ffffff"],
[data-theme="dark"] #tab-audit-logs div[style*="background:#ffffff"] {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] #tab-audit-logs input,
[data-theme="dark"] #tab-audit-logs select,
[data-theme="dark"] .audit-search-input,
[data-theme="dark"] .audit-category-select {
  background: #0b0f17 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #tab-audit-logs td {
  color: #cbd5e1 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* ==========================================================================
   12. MASTER SUITE — REFINAMENTO CIRÚRGICO MODO ESCURO (TODAS AS TELAS)
   ========================================================================== */

/* 12.1 CABEÇALHOS GERAIS BRANCOS (SEM LETRA CINZA) */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .header-main-title,
[data-theme="dark"] .clean-toolbar-title,
[data-theme="dark"] .content-card h2,
[data-theme="dark"] .content-card h3,
[data-theme="dark"] .card-header h2,
[data-theme="dark"] .card-header h3,
[data-theme="dark"] .stat-card-title,
[data-theme="dark"] thead th,
[data-theme="dark"] .patients-table th,
[data-theme="dark"] table th {
  color: #ffffff !important;
}

/* 12.2 AGENDA MÉDICA: BOTÕES REMARCAR DIA E LEMBRETES D-1 */
[data-theme="dark"] .btn-tool-warning {
  background: rgba(217, 119, 6, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="dark"] .btn-tool-primary {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] #reschedule-modal .modal-box,
[data-theme="dark"] #cancel-appointment-modal .modal-box {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.4) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #reschedule-modal input,
[data-theme="dark"] #reschedule-modal select,
[data-theme="dark"] #cancel-appointment-modal input,
[data-theme="dark"] #cancel-appointment-modal select {
  background: #0b0f17 !important;
  color: #f8fafc !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
}

/* 12.3 HORÁRIOS DE ATENDIMENTO: ESCALA COM TEXTO BRANCO E "ATENDE" INTEGRADO */
[data-theme="dark"] #schedule-readonly-container {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] #schedule-readonly-container table thead tr {
  background: #0f172a !important;
  border-bottom: 2px solid rgba(37, 99, 235, 0.4) !important;
}

[data-theme="dark"] #schedule-readonly-container table thead th {
  color: #ffffff !important;
}

[data-theme="dark"] .sched-readonly-row,
[data-theme="dark"] #schedule-readonly-tbody tr {
  background: #131c2e !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

[data-theme="dark"] .sched-readonly-row:hover,
[data-theme="dark"] #schedule-readonly-tbody tr:hover {
  background: #19253c !important;
}

[data-theme="dark"] .sched-col-day,
[data-theme="dark"] #schedule-readonly-tbody tr td:first-child {
  color: #ffffff !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .sched-col-hours,
[data-theme="dark"] #schedule-readonly-tbody tr td:last-child {
  color: #ffffff !important;
  font-weight: 600 !important;
}

[data-theme="dark"] .sched-badge-attend,
[data-theme="dark"] #schedule-readonly-tbody span[style*="background: #ecfdf5"] {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

[data-theme="dark"] .sched-badge-off,
[data-theme="dark"] #schedule-readonly-tbody span[style*="background: #f1f5f9"] {
  background: rgba(100, 116, 139, 0.25) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

[data-theme="dark"] #schedule-readonly-duration-badge {
  background: rgba(37, 99, 235, 0.2) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] #tab-doctor-schedules div[style*="background: #f8fafc"] {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

/* 12.4 FALTA REAGENDAR: CAMPO DE BUSCA PRETO/ESCURO */
[data-theme="dark"] #filter-pending-reschedules-search,
[data-theme="dark"] #filter-pending-reschedules-doctor,
[data-theme="dark"] .reschedule-search-input,
[data-theme="dark"] .reschedule-doctor-filter {
  background: #0b0f17 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

[data-theme="dark"] #tab-pending-reschedules .content-card,
[data-theme="dark"] .pending-reschedule-card {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

/* 12.5 PROCEDIMENTOS E PREÇOS: SOB CONSULTA E INPUTS ESCUROS */
[data-theme="dark"] .consult-badge-btn {
  background: #0f172a !important;
  border: 1.5px solid rgba(37, 99, 235, 0.4) !important;
}

[data-theme="dark"] .consult-badge-btn .consult-x-mark {
  color: #f87171 !important;
  background: transparent !important;
  border: none !important;
}

[data-theme="dark"] .price-input.is-sob-consulta,
[data-theme="dark"] .dur-input.is-sob-consulta,
[data-theme="dark"] #tab-pricing input[disabled],
[data-theme="dark"] #tab-pricing input[style*="color: #b45309"] {
  background: rgba(217, 119, 6, 0.18) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

/* 12.6 ATENDIMENTO WHATSAPP: BALÕES ESCURECIDOS DE ALTO CONTRASTE */
[data-theme="dark"] #tab-human-support .content-card,
[data-theme="dark"] [id^="human-card-"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] [id^="human-card-"] div[style*="background: #ffffff"],
[data-theme="dark"] [id^="human-card-"] div[style*="background:#ffffff"] {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] [id^="human-card-"] div[style*="background: #f1f5f9"],
[data-theme="dark"] [id^="human-card-"] div[style*="background:#f1f5f9"] {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] [id^="human-card-"] div[style*="background: #dcfce7"],
[data-theme="dark"] [id^="human-card-"] div[style*="background:#dcfce7"] {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #ecfdf5 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

[data-theme="dark"] #chat-messages-body div[style*="background: #ffffff"],
[data-theme="dark"] #chat-messages-body div[style*="background:#ffffff"],
[data-theme="dark"] .chat-bubble.ai {
  background: rgba(37, 99, 235, 0.22) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(37, 99, 235, 0.4) !important;
}

[data-theme="dark"] #chat-messages-body div[style*="background: #dcfce7"],
[data-theme="dark"] #chat-messages-body div[style*="background:#dcfce7"],
[data-theme="dark"] .chat-bubble.patient {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
}

/* 12.7 PACIENTES E PRONTUÁRIOS: PESQUISA POR CPF E ANAMNESE */
[data-theme="dark"] #patient-search-input,
[data-theme="dark"] #manual-patient-search-input,
[data-theme="dark"] .booking-search-input,
[data-theme="dark"] .luxury-input,
[data-theme="dark"] #patient-cpf,
[data-theme="dark"] #inline-pat-cpf,
[data-theme="dark"] #quick-pat-cpf,
[data-theme="dark"] #edit-pat-cpf {
  background: #0b0f17 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

/* 12.8 TELEMETRIA & NPS: BALÕES E CARDS ESCURECIDOS */
[data-theme="dark"] #tab-statistics .content-card div[style*="background: linear-gradient"],
[data-theme="dark"] #tab-statistics div[style*="background: linear-gradient"] {
  background: linear-gradient(135deg, #131c2e 0%, #0d1524 100%) !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

[data-theme="dark"] .kpi-modern-card {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] .doc-compact-row {
  background: #0f172a !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .doc-compact-name {
  color: #ffffff !important;
}

[data-theme="dark"] #tab-satisfaction-survey div[style*="background: #ffffff"],
[data-theme="dark"] #tab-satisfaction-survey .content-card {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] #tab-satisfaction-survey label {
  color: #ffffff !important;
}

[data-theme="dark"] #setting-google-review-url {
  background: #0b0f17 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

[data-theme="dark"] #tab-satisfaction-survey span[style*="background: #fffbeb"] {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

/* 12.9 EQUIPE: ÍCONES E RESUMO DE PERMISSÕES ESCUROS */
[data-theme="dark"] #team-table-body td div[style*="width: 32px"] {
  background: #0f172a !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

[data-theme="dark"] #team-table-body strong {
  color: #ffffff !important;
}

[data-theme="dark"] #tab-team div[style*="padding: 18px 22px"] {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #tab-team div[style*="padding: 18px 22px"] p {
  color: #cbd5e1 !important;
}

/* 12.10 TELAS DE CONFIGURAÇÃO (TODOS OS INPUTS ESCUROS) */
[data-theme="dark"] #tab-clinic-general .content-card,
[data-theme="dark"] #tab-integrations .content-card,
[data-theme="dark"] #tab-ai-settings .content-card,
[data-theme="dark"] #tab-backup-routine .content-card,
[data-theme="dark"] #tab-clinic-general input,
[data-theme="dark"] #tab-clinic-general select,
[data-theme="dark"] #tab-clinic-general textarea,
[data-theme="dark"] #tab-integrations input,
[data-theme="dark"] #tab-integrations select,
[data-theme="dark"] #tab-integrations textarea,
[data-theme="dark"] #tab-ai-settings input,
[data-theme="dark"] #tab-ai-settings select,
[data-theme="dark"] #tab-ai-settings textarea,
[data-theme="dark"] #tab-backup-routine input,
[data-theme="dark"] #tab-backup-routine select,
[data-theme="dark"] #tab-backup-routine textarea,
[data-theme="dark"] #setting-ai-personality,
[data-theme="dark"] #setting-ai-autonomy {
  background: #0b0f17 !important;
  color: #f8fafc !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
}

/* ==========================================================================
   12.10 BLINDAGEM GERAL DE TABELAS (.data-table) NO MODO ESCURO
   ========================================================================== */
[data-theme="dark"] .data-table {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}
[data-theme="dark"] .data-table th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-bottom: 2px solid rgba(37, 99, 235, 0.35) !important;
}
[data-theme="dark"] .data-table td {
  background: #131c2e !important;
  color: #cbd5e1 !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.18) !important;
}
[data-theme="dark"] .data-table tr:hover td {
  background: #19253c !important;
}
[data-theme="dark"] .data-table td strong {
  color: #f8fafc !important;
}

/* ==========================================================================
   12.11 CANAL DE SUPORTE & ORDENS DE SERVIÇO (DESIGN SYSTEM LIGHT & DARK)
   ========================================================================== */

/* Estilos Padrão (Modo Claro) */
.support-metric-card {
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.support-metric-card:hover {
  transform: translateY(-2px);
}
.support-metric-total {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
}
.support-metric-total .support-metric-icon {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}
.support-metric-total .support-metric-title {
  color: #64748b;
}
.support-metric-total .support-metric-value {
  color: #1e293b;
}

.support-metric-open {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
}
.support-metric-open .support-metric-icon {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
}
.support-metric-open .support-metric-title,
.support-metric-open .support-metric-value {
  color: #b45309;
}

.support-metric-progress {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 1px solid #bae6fd;
}
.support-metric-progress .support-metric-icon {
  background: rgba(2, 132, 199, 0.16);
  color: #0284c7;
}
.support-metric-progress .support-metric-title,
.support-metric-progress .support-metric-value {
  color: #0369a1;
}

.support-metric-closed {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
}
.support-metric-closed .support-metric-icon {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}
.support-metric-closed .support-metric-title,
.support-metric-closed .support-metric-value {
  color: #047857;
}

.support-filters-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.support-filters-bar input,
.support-filters-bar select {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
}

.support-table-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.support-table thead tr {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}
.support-table thead th {
  color: #475569;
}
.support-table tbody tr {
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}
.support-table tbody tr:hover {
  background: #f8fafc;
}

/* ==========================================================================
   REGRAS ESPECÍFICAS PARA MODO ESCURO [data-theme="dark"]
   ========================================================================== */
[data-theme="dark"] .support-metric-total {
  background: rgba(30, 41, 59, 0.75) !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
}
[data-theme="dark"] .support-metric-total .support-metric-icon {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .support-metric-total .support-metric-title {
  color: #94a3b8 !important;
}
[data-theme="dark"] .support-metric-total .support-metric-value {
  color: #f8fafc !important;
}

[data-theme="dark"] .support-metric-open {
  background: rgba(245, 158, 11, 0.14) !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}
[data-theme="dark"] .support-metric-open .support-metric-icon {
  background: rgba(245, 158, 11, 0.25) !important;
  color: #fbbf24 !important;
}
[data-theme="dark"] .support-metric-open .support-metric-title,
[data-theme="dark"] .support-metric-open .support-metric-value {
  color: #fbbf24 !important;
}

[data-theme="dark"] .support-metric-progress {
  background: rgba(2, 132, 199, 0.15) !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
}
[data-theme="dark"] .support-metric-progress .support-metric-icon {
  background: rgba(56, 189, 248, 0.22) !important;
  color: #38bdf8 !important;
}
[data-theme="dark"] .support-metric-progress .support-metric-title,
[data-theme="dark"] .support-metric-progress .support-metric-value {
  color: #38bdf8 !important;
}

[data-theme="dark"] .support-metric-closed {
  background: rgba(16, 185, 129, 0.14) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}
[data-theme="dark"] .support-metric-closed .support-metric-icon {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #34d399 !important;
}
[data-theme="dark"] .support-metric-closed .support-metric-title,
[data-theme="dark"] .support-metric-closed .support-metric-value {
  color: #34d399 !important;
}

/* Barra de Filtros e Busca no Modo Escuro */
[data-theme="dark"] .support-filters-bar {
  background: #131c2e !important;
  border-color: rgba(37, 99, 235, 0.32) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45) !important;
  color: #f8fafc !important;
}
[data-theme="dark"] #support-search-input,
[data-theme="dark"] #support-status-filter,
[data-theme="dark"] #support-type-filter {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

/* Tabela e Linhas no Modo Escuro */
[data-theme="dark"] .support-table-container,
[data-theme="dark"] #tab-support .table-responsive {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
}
[data-theme="dark"] .support-table,
[data-theme="dark"] #tab-support table {
  background: #131c2e !important;
}
[data-theme="dark"] .support-table thead tr,
[data-theme="dark"] #tab-support table thead tr {
  background: #0f172a !important;
  border-bottom: 2px solid rgba(37, 99, 235, 0.35) !important;
}
[data-theme="dark"] .support-table thead th,
[data-theme="dark"] #tab-support table thead th {
  color: #94a3b8 !important;
  background: #0f172a !important;
}
[data-theme="dark"] .support-table tbody tr,
[data-theme="dark"] #tab-support table tbody tr {
  background: #131c2e !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.18) !important;
}
[data-theme="dark"] .support-table tbody tr:hover,
[data-theme="dark"] #tab-support table tbody tr:hover {
  background: #19253c !important;
}
[data-theme="dark"] .support-table tbody td,
[data-theme="dark"] #tab-support table tbody td {
  color: #cbd5e1 !important;
  border-color: rgba(37, 99, 235, 0.15) !important;
}

/* Janelas Modais no Modo Escuro */
[data-theme="dark"] #modal-new-support-ticket .modal-box,
[data-theme="dark"] #modal-view-support-ticket .modal-box {
  background: #131c2e !important;
  border: 1px solid rgba(37, 99, 235, 0.45) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-new-support-ticket form,
[data-theme="dark"] #modal-view-support-ticket #view-ticket-body {
  background: #131c2e !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #ticket-description,
[data-theme="dark"] #ticket-resolution-text,
[data-theme="dark"] #modal-ticket-resolution,
[data-theme="dark"] .support-textarea {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .support-select,
[data-theme="dark"] #modal-ticket-status-select {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #ticket-dropzone {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
}

[data-theme="dark"] #ticket-dropzone-empty div {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .support-type-choice {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.28) !important;
}

/* Containers Internos dos Modais no Modo Escuro */
[data-theme="dark"] #modal-view-support-ticket div[style*="background: var(--bg-card)"],
[data-theme="dark"] #modal-view-support-ticket div[style*="background:var(--bg-card)"] {
  background: #0f172a !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

/* Cabeçalho do Modal de O.S. (Alto Contraste Branco) */
.support-modal-header-title,
#view-ticket-title {
  color: #ffffff !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85) !important;
  letter-spacing: 0.3px !important;
}

/* Cards de Metadados Unificados e Simétricos */
.support-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .support-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.support-meta-card {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 72px;
  height: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .support-meta-card {
  background: #0b0f17 !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

.support-meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  margin-bottom: 4px;
  display: block;
}

[data-theme="dark"] .support-meta-label {
  color: #94a3b8 !important;
}

.support-meta-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

[data-theme="dark"] .support-meta-val {
  color: #f8fafc !important;
}

/* 12.12 MODAL DE DETALHES DA CONSULTA (CABEÇALHO EM LINHA ÚNICA & DARK MODE) */
[data-theme="dark"] #appointment-details-modal .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] #appointment-details-modal h3 {
  color: #ffffff !important;
}

[data-theme="dark"] #app-modal-date-time-subtitle {
  color: #93c5fd !important;
  background: rgba(30, 58, 138, 0.35) !important;
  border-color: rgba(96, 165, 250, 0.4) !important;
}

/* 12.13 FULLCALENDAR ALL-DAY & DIAS BLOQUEADOS (DARK MODE) */
[data-theme="dark"] .fc .fc-timegrid-all-day {
  background: #111a2e !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .fc .fc-timegrid-all-day .fc-timegrid-axis-cushion {
  color: #fca5a5 !important;
}

[data-theme="dark"] .fc-event-day-blocked {
  background: repeating-linear-gradient(
    45deg,
    rgba(239, 68, 68, 0.22),
    rgba(239, 68, 68, 0.22) 10px,
    rgba(239, 68, 68, 0.32) 10px,
    rgba(239, 68, 68, 0.32) 20px
  ) !important;
  border-color: #ef4444 !important;
  color: #fecaca !important;
}

[data-theme="dark"] .fc-bg-blocked-day {
  background: repeating-linear-gradient(
    -45deg,
    rgba(239, 68, 68, 0.08),
    rgba(239, 68, 68, 0.08) 10px,
    rgba(239, 68, 68, 0.16) 10px,
    rgba(239, 68, 68, 0.16) 20px
  ) !important;
}
