/* ==========================================================================
   ODONTOLOGIA ESPECIALIZADA BRASIL - COMPONENTS STYLING
   Aesthetics: Clean, Minimalist, Modern, Fluid Micro-interactions
   ========================================================================== */

/* Top Navigation Bar / Sidebar Layout (Estilo Simples Dental / Clinicorp Pro) */
.app-layout-root {
  display: flex !important;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-body);
  overflow-x: hidden;
}

/* Sidebar Lateral Fixa (Cor Verde Água / Aquamarine Medical) */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(180deg, #e6f9f5 0%, #f0fdfa 40%, #e0f5f0 100%);
  border-right: 1.5px solid #99f6e4;
  display: flex;
  flex-direction: column;
  z-index: 70;
  box-shadow: 2px 0 20px rgba(13, 148, 136, 0.08);
  transition: background var(--transition-normal);
  overflow: hidden;
}

/* Marca / Logotipo na Barra Lateral */
.sidebar-brand {
  padding: 1.25rem 1.15rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(20, 184, 166, 0.22);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.35);
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand-text .brand-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f766e;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-text .brand-tagline {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0d9488;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 1px;
}

/* Navegação da Sidebar (Scrollable) */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scrollbar-width: thin;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #0d9488;
  letter-spacing: 0.08em;
  padding: 0 0.65rem 0.4rem;
  user-select: none;
  opacity: 0.95;
}

/* Itens de Menu (nav-tab e action-btn) */
.sidebar-nav .nav-tab,
.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #134e4a;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  text-align: left;
  user-select: none;
  position: relative;
}

.sidebar-nav .nav-tab .nav-icon,
.sidebar-action-btn .nav-icon {
  font-size: 1.1rem;
  width: 22px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-tab .nav-label,
.sidebar-action-btn .nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav .nav-tab .tab-badge {
  margin-left: auto;
  background: #0d9488;
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 12px;
}

.sidebar-nav .nav-tab:hover,
.sidebar-action-btn:hover {
  background: rgba(20, 184, 166, 0.14);
  color: #0f766e;
  transform: translateX(2px);
}

.sidebar-nav .nav-tab.active {
  background: #ffffff;
  color: #0f766e;
  font-weight: 800;
  border: 1px solid #5eead4;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.14);
}

.sidebar-nav .nav-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px rgba(20, 184, 166, 0.6);
}

/* Subtabs e Grupo Financeiro na Sidebar */
.sidebar-nav .nav-tab.nav-tab-finance-parent.active {
  background: #ffffff;
  color: #0f766e;
  border-color: #5eead4;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.14);
}

.sidebar-nav .nav-tab.nav-subtab {
  font-size: 0.81rem;
  padding: 0.42rem 0.65rem;
  gap: 0.55rem;
  border-radius: 6px;
  color: #134e4a;
}

.sidebar-nav .nav-tab.nav-subtab:hover {
  background: rgba(20, 184, 166, 0.15);
  color: #0f766e;
}

.sidebar-nav .nav-tab.nav-subtab.active {
  background: #ffffff;
  color: #0f766e;
  font-weight: 800;
  border: 1px solid #5eead4;
  box-shadow: 0 1px 6px rgba(13, 148, 136, 0.12);
}

.sidebar-nav .nav-tab.nav-subtab.active::before {
  background: #14b8a6;
  width: 3px;
  top: 4px;
  bottom: 4px;
  box-shadow: 0 0 6px rgba(20, 184, 166, 0.4);
}

/* Pills da Barra Superior do Financeiro */
.finance-subtab-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.finance-subtab-pill:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--primary-300);
}

.finance-subtab-pill.active {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border-color: #38bdf8;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.15);
}

/* Subtabs e Grupo Financeiro na Sidebar */
.sidebar-subtabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 0.85rem;
  padding-left: 0.65rem;
  border-left: 2px solid rgba(20, 184, 166, 0.35);
  margin-top: 3px;
  margin-bottom: 4px;
}

/* Rodapé da Sidebar */
.sidebar-footer {
  padding: 0.85rem 0.75rem;
  border-top: 1px solid rgba(20, 184, 166, 0.22);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-user-card {
  background: #ffffff;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-md);
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.08);
}

.sidebar-user-card .user-avatar-initials {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(20, 184, 166, 0.3);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f766e;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: #0d9488;
  font-weight: 600;
  display: block;
}

.sidebar-user-actions {
  display: flex;
  gap: 2px;
}

.btn-icon-subtle {
  background: none;
  border: none;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  color: #0d9488;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-size: 0.88rem;
}

.btn-icon-subtle:hover {
  background: rgba(20, 184, 166, 0.15);
  color: #0f766e;
}

.btn-icon-subtle.logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.sidebar-landing-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #0f766e;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #99f6e4;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin: 2px 0;
  transition: all 0.2s ease;
}

.sidebar-landing-link:hover {
  background: #ffffff;
  border-color: #14b8a6;
  color: #0d9488;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(20, 184, 166, 0.15);
}

.sidebar-utilities {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #0f766e;
  padding: 0 0.25rem;
}

.sidebar-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #0f766e;
}

.sidebar-sync-pill .sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #14b8a6;
  box-shadow: 0 0 6px rgba(20, 184, 166, 0.6);
  animation: pulseSync 2s infinite;
}

@keyframes pulseSync {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Área de Trabalho (Workspace) com Offset para Sidebar Fixa */
.app-workspace {
  flex: 1;
  min-width: 0;
  margin-left: 260px;
  width: calc(100% - 260px);
  max-width: calc(100% - 260px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-body);
}

/* Topbar Superior da Área de Trabalho */
.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-normal);
}

.workspace-title-box {
  display: flex;
  flex-direction: column;
}

.workspace-view-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.02em;
}

.workspace-view-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.workspace-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.workspace-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 280px;
}

.workspace-search-box .search-icon {
  position: absolute;
  left: 10px;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0.6;
}

.workspace-search-box input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  font-size: 0.83rem;
  font-family: var(--font-sans);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.workspace-search-box input:focus {
  border-color: var(--primary-500);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
  width: 320px;
}

/* Conteúdo Principal */
.main-container.workspace-content {
  flex: 1;
  padding: 1.75rem 2rem 3rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* View Header */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.view-heading h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.view-heading p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 0.25rem;
}

/* Buttons - Modern Minimalist & Tactile */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-light);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-success {
  background: #059669;
  color: white;
}
.btn-success:hover {
  background: #047857;
}

.btn-danger {
  background: #e11d48;
  color: white;
}
.btn-danger:hover {
  background: #be123c;
}

.btn-sm {
  padding: 0.42rem 0.85rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

/* Metrics Grid & Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary-500);
}

.metric-card.paid::before { background: #059669; }
.metric-card.pending::before { background: #d97706; }
.metric-card.glosa::before { background: #e11d48; }
.metric-card.repasse::before { background: #6366f1; }
.metric-card.profit::before { background: #0284c7; }

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.metric-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.metric-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  font-family: var(--font-heading);
}

.metric-footer {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Card Table Wrapper */
.card-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-surface);
}

.toolbar-search {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  gap: 0.5rem;
  min-width: 300px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.toolbar-search:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.toolbar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.875rem;
  width: 100%;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.select-filter {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.select-filter:focus {
  border-color: var(--border-focus);
}

.data-table-container {
  overflow-x: auto;
  max-height: 600px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table thead th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.data-table tbody td {
  padding: 1rem 1.25rem;
  color: var(--text-main);
  vertical-align: middle;
}

.guide-pill {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.08);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(14, 165, 233, 0.2);
  display: inline-block;
  font-size: 0.85rem;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.paid {
  background: var(--status-paid-bg);
  color: var(--status-paid-text);
  border: 1px solid var(--status-paid-border);
}

.status-badge.pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
  border: 1px solid var(--status-pending-border);
}

.status-badge.glosa {
  background: var(--status-glosa-bg);
  color: var(--status-glosa-text);
  border: 1px solid var(--status-glosa-border);
}

.status-badge.analysis {
  background: var(--status-analysis-bg);
  color: var(--status-analysis-text);
  border: 1px solid var(--status-analysis-border);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Reconciliation Dropzone */
.dropzone-container {
  background: var(--bg-surface);
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-xl);
  padding: 3.5rem 2rem;
  text-align: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  margin-bottom: 2rem;
}

.dropzone-container:hover, .dropzone-container.drag-over {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.dropzone-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.dropzone-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}

.dropzone-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Reconciliation Summary Box */
.reconcile-summary-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.reconcile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.reconcile-stat-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  text-align: center;
  transition: transform var(--transition-fast);
}

.reconcile-stat-card:hover {
  transform: translateY(-2px);
}

.reconcile-stat-card.success {
  background: var(--status-paid-bg);
  border-color: var(--status-paid-border);
  color: var(--status-paid-text);
}

.reconcile-stat-card.warning {
  background: var(--status-pending-bg);
  border-color: var(--status-pending-border);
  color: var(--status-pending-text);
}

.reconcile-stat-card.danger {
  background: var(--status-glosa-bg);
  border-color: var(--status-glosa-border);
  color: var(--status-glosa-text);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  display: flex;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 660px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-light);
  animation: modalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-main);
}

.modal-footer {
  padding: 1.1rem 1.75rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface);
  flex-shrink: 0;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary-500);
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 320px;
}

.toast.success { border-left-color: #059669; }
.toast.error { border-left-color: #e11d48; }
.toast.warning { border-left-color: #d97706; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Repasse Period Mode Segmented Tabs */
.period-mode-segmented .btn-period-tab {
  background: transparent;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-mode-segmented .btn-period-tab:hover {
  color: var(--text-main);
}

.period-mode-segmented .btn-period-tab.active {
  background: var(--bg-surface);
  color: var(--primary-600);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

/* Repasse Printable Receipt */
.receipt-paper {
  background: white !important;
  color: #0f172a !important;
  padding: 2.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  box-shadow: none;
}

.receipt-header {
  border-bottom: 2.5px solid #0f172a;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.receipt-totals {
  background: #f8fafc;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  margin: 1.5rem 0;
  display: flex;
  justify-content: space-between;
}

.receipt-signature-line {
  margin-top: 3.5rem;
  border-top: 1.5px solid #64748b;
  width: 280px;
  text-align: center;
  padding-top: 0.5rem;
  font-size: 0.8rem;
  color: #475569;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }
  body {
    background: white !important;
    color: #000000 !important;
  }
  body * {
    visibility: hidden !important;
  }
  #modal-receipt,
  #modal-receipt .modal-card,
  #modal-receipt-content,
  #receipt-printable-area,
  #receipt-printable-area *,
  #modal-dental-receipt,
  #modal-dental-receipt .modal-card,
  #dental-receipt-body,
  #dental-receipt-body * {
    visibility: visible !important;
  }
  #modal-receipt,
  #modal-dental-receipt {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  #modal-receipt .modal-header,
  #modal-receipt button,
  #modal-dental-receipt .modal-header,
  #modal-dental-receipt .modal-footer,
  #modal-dental-receipt button {
    display: none !important;
  }
  #modal-receipt .modal-card,
  #modal-dental-receipt .modal-card {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }
  #receipt-printable-area {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
  }
  tr {
    page-break-inside: avoid !important;
  }
}

/* ==========================================================================
   HEADER USER BADGE & SYNC INDICATOR
   ========================================================================== */
.header-sync-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulseSync 2s infinite ease-in-out;
}

@keyframes pulseSync {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.75; }
}

.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-subtle);
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.user-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.user-details-col {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.user-name-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-role-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.user-actions-btns {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-left: 1px solid var(--border-light);
  padding-left: 0.45rem;
  margin-left: 0.2rem;
}

.btn-user-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.btn-user-action:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.btn-user-action.logout {
  color: #ef4444;
}

.btn-user-action.logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Nav Tabs Segmented Styling */
.nav-tabs-wrapper {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0.5rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.nav-tab.active {
  color: var(--primary-600);
  background: var(--primary-50);
  border-color: rgba(5, 150, 105, 0.2);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .nav-tab.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

/* Modal Large & Multi-Procedure Guide Styles */
.modal-card-lg {
  max-width: 880px !important;
}

.procedure-item-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: 2.2fr 0.9fr 1.1fr 0.9fr 1.1fr auto;
  gap: 0.75rem;
  align-items: center;
  transition: all var(--transition-fast);
}

.procedure-item-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

@media (max-width: 768px) {
  .procedure-item-card {
    grid-template-columns: 1fr;
  }
}

.treatment-guide-summary-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.summary-kpi-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.summary-value.highlight-primary {
  color: var(--primary-600);
}

.summary-value.highlight-repasse {
  color: var(--accent-indigo);
}

.summary-value.highlight-lucro {
  color: #0d9488;
}

/* ==========================================================================
   LOGIN SCREEN & AUTHENTICATION STYLES - PERFECT CENTERING & MODERN FINTECH
   ========================================================================== */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 999999;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(circle at 50% 15%, rgba(5, 150, 105, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 85% 85%, rgba(2, 132, 199, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 45%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.login-card {
  margin: auto; /* Guarantees dead-center in flex container on any viewport height */
  width: 100%;
  max-width: 410px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  box-shadow: 
    0 25px 50px -12px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  animation: loginAppear 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  position: relative;
}

[data-theme="dark"] .login-card {
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

@keyframes loginAppear {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-brand-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.login-title span.highlight {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.login-error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: none;
}

/* Operator Custom Pricing Table */
.inline-price-input {
  transition: all 0.2s ease;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
}

.inline-price-input:focus {
  border-color: var(--primary-500) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
  background: white;
}

.pricing-table-inline-input {
  transition: all 0.2s ease;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
}

.pricing-table-inline-input:focus {
  border-color: var(--primary-500) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
  background: white;
}

.op-pill-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.op-pill-btn:hover {
  transform: translateY(-1px);
}

/* Dental Guide PDF Upload & Auto-Extraction Box */
.guide-dropzone {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.guide-dropzone:hover {
  border-color: var(--primary-500) !important;
  background: rgba(16, 185, 129, 0.08) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}

#guide-extraction-banner {
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   KPI Cards & Grids
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.15;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
}

.kpi-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   PONTO 1: IMPORTAÇÃO EM LOTE DE GUIAS (BATCH UPLOAD)
   ========================================================================== */
.batch-dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: var(--bg-surface-subtle);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.batch-dropzone:hover, .batch-dropzone.dragover {
  border-color: var(--primary-500);
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12);
}

.batch-progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0 0.5rem 0;
}

.batch-progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  transition: width 0.3s ease;
}

.batch-table-input {
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  width: 100%;
  transition: all 0.2s ease;
}

.batch-table-input:focus {
  border-color: var(--primary-500);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Fullscreen Batch Modal (Ocupa a tela toda para máxima visibilidade e edição confortável) */
.modal-overlay.batch-fullscreen-overlay {
  padding: 0.75rem !important;
}

.modal-card.batch-modal-fullscreen {
  width: 98vw !important;
  max-width: 98vw !important;
  height: 96vh !important;
  max-height: 96vh !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45) !important;
}

.modal-card.batch-modal-fullscreen .modal-body {
  flex: 1;
  max-height: none !important;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem !important;
  overflow: hidden !important;
}

.batch-review-full-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
}

.batch-table-container-fullscreen {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.batch-table-fullscreen {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

.batch-table-fullscreen thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border-medium);
  padding: 0.75rem 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: left;
  white-space: nowrap;
}

.batch-table-fullscreen tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.batch-table-fullscreen tbody tr:hover {
  background: var(--bg-surface-hover);
}

.batch-compact-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.batch-table-input-lg {
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  width: 100%;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.batch-table-input-lg:focus {
  border-color: var(--primary-500);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  outline: none;
}

.batch-proc-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.74rem;
  margin: 2px 2px;
  color: var(--text-main);
  line-height: 1.3;
}

.batch-proc-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #4338ca;
}

.batch-tooth-tag {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.7rem;
}

/* ==========================================================================
   PONTO 2: CENTRAL DE GLOSAS & RECURSO ANS
   ========================================================================== */
.badge-glosa-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-glosa-pendente {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-glosa-protocolado {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-glosa-recuperado {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-glosa-mantido {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  border: 1px solid rgba(107, 114, 128, 0.25);
}

.badge-deadline-ans {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-deadline-safe {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.badge-deadline-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.badge-deadline-expired {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}

/* Official ANS Appeal Letter Styling */
.appeal-letter-sheet {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 2.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.appeal-header-box {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.appeal-clinic-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.appeal-clinic-meta {
  font-size: 0.8rem;
  color: #475569;
  margin-top: 0.25rem;
}

.appeal-ans-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  text-align: right;
}

.appeal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.85rem;
}

.appeal-table th, .appeal-table td {
  border: 1px solid #cbd5e1;
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.appeal-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #1e293b;
}

.appeal-justification-area {
  width: 100%;
  min-height: 160px;
  padding: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #0f172a;
  background: #fdfdfd;
  resize: vertical;
}

.appeal-signature-box {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #94a3b8;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

/* ==========================================================================
   PONTO 3: CALENDÁRIO DE FLUXO DE CAIXA & PREVISÃO DE RECEBIMENTOS
   ========================================================================== */
.cashflow-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.cashflow-month-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cashflow-calendar-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
}

.calendar-weekdays-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.calendar-weekday-cell {
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-light);
}

.calendar-day-cell {
  background: var(--bg-surface);
  min-height: 105px;
  padding: 0.6rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.calendar-day-cell:hover {
  background: var(--bg-subtle);
  transform: scale(1.008);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.calendar-day-cell.selected {
  outline: 2px solid var(--primary-500);
  background: rgba(16, 185, 129, 0.04);
}

.calendar-day-cell.today {
  border-top: 3px solid var(--primary-500);
}

.calendar-day-cell.other-month {
  background: var(--bg-subtle);
  opacity: 0.45;
  cursor: default;
}

.calendar-day-cell.other-month:hover {
  transform: none;
  box-shadow: none;
}

.calendar-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.calendar-day-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.calendar-day-cell.today .calendar-day-num {
  background: var(--primary-500);
  color: white;
}

.calendar-day-pill {
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
  line-height: 1.2;
}

.calendar-day-pill.paid {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.calendar-day-pill.pending {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.calendar-day-pill.overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.calendar-pill-val {
  font-size: 0.74rem;
  font-weight: 800;
}

.calendar-pill-count {
  font-size: 0.65rem;
  opacity: 0.85;
}

/* Operator Forecast Bar Card */
.operator-forecast-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
}

.operator-forecast-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-400);
}

/* ========================================================
   APPOINTMENTS & AGENDA ODONTOLÓGICA
   ======================================================== */
.schedule-slot-row:hover {
  background: rgba(16, 185, 129, 0.02);
}

.schedule-slot-row:hover .empty-slot-area .btn-quick-book {
  opacity: 1 !important;
}

.empty-slot-area:hover {
  background: rgba(16, 185, 129, 0.06) !important;
  border-color: var(--primary-300) !important;
  color: var(--primary-700) !important;
}

.appointment-card:hover {
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1.5px);
}

/* ========================================================
   PATIENTS & PRONTUÁRIO ODONTOLÓGICO (LISTA ELEGANTE & ODONTOGRAMA)
   ======================================================== */
.patient-list-row {
  cursor: default;
}

.patient-list-row:hover {
  background: rgba(16, 185, 129, 0.04) !important;
}

.btn-quick-filter-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-quick-filter-chip:hover {
  border-color: var(--primary-400);
  color: var(--primary-700);
  background: rgba(16, 185, 129, 0.05);
}

.btn-quick-filter-chip.active {
  background: var(--primary-600) !important;
  color: #ffffff !important;
  border-color: var(--primary-600) !important;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.25);
}

.btn-clinical-template:hover {
  background: rgba(5, 150, 105, 0.1) !important;
  border-color: #059669 !important;
  color: #065f46 !important;
  transform: translateY(-1px);
}

.patient-card:hover {
  box-shadow: var(--shadow-md) !important;
  border-color: var(--primary-300) !important;
  transform: translateY(-2px);
}

.chart-tab-btn {
  padding: 0.7rem 1.15rem;
  font-size: 0.84rem;
  font-weight: 700;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chart-tab-btn:hover {
  color: var(--primary-600) !important;
  background: rgba(16, 185, 129, 0.04) !important;
}

.chart-tab-btn.active {
  color: var(--primary-700) !important;
  border-bottom-color: var(--primary-600) !important;
  background: rgba(16, 185, 129, 0.08) !important;
}

/* ========================================================
   ODONTOGRAMA VISUAL INTERATIVO (32 DENTES)
   ======================================================== */
.tooth-box {
  width: 58px;
  min-height: 136px;
  border-radius: 10px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 3px 6px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tooth-box:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  z-index: 10;
  border-color: #94a3b8;
}

.tooth-box.selected {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.45), 0 8px 20px rgba(5, 150, 105, 0.2) !important;
  transform: translateY(-3px) scale(1.08);
  z-index: 15;
}

.tooth-number {
  font-size: 0.76rem;
  font-weight: 800;
  color: #334155;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Modelo Anatômico de Dente Completo Integrado (Coroa, Colo e Raiz) */
.complete-tooth-svg {
  width: 52px;
  height: 92px;
  margin: 2px 0;
  overflow: visible;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
}

.tooth-box:hover .complete-tooth-svg {
  transform: scale(1.05);
}

.complete-tooth-part {
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease, filter 0.15s ease;
}

.complete-tooth-part:hover {
  filter: brightness(1.15) drop-shadow(0 0 5px rgba(5, 150, 105, 0.9));
  stroke: #059669 !important;
  stroke-width: 1.8px !important;
}

.complete-tooth-part.active {
  stroke-width: 2px !important;
  stroke: #2563eb !important;
  filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.75));
}

.tooth-state-tag {
  font-size: 0.56rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 4px;
  text-transform: uppercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Condições do dente com cores clínicas universais */
.tooth-status-higido {
  background: #ffffff;
  border-color: #cbd5e1;
}
.tooth-status-higido .tooth-state-tag {
  background: #f1f5f9;
  color: #64748b;
}

.tooth-status-carie {
  background: #fff1f2;
  border-color: #f43f5e;
}
.tooth-status-carie .tooth-number { color: #e11d48; }
.tooth-status-carie .tooth-state-tag {
  background: #ffe4e6;
  color: #be123c;
}

.tooth-status-restaurado {
  background: #eff6ff;
  border-color: #3b82f6;
}
.tooth-status-restaurado .tooth-number { color: #1d4ed8; }
.tooth-status-restaurado .tooth-state-tag {
  background: #dbeafe;
  color: #1e40af;
}

.tooth-status-canal {
  background: #faf5ff;
  border-color: #8b5cf6;
}
.tooth-status-canal .tooth-number { color: #6d28d9; }
.tooth-status-canal .tooth-state-tag {
  background: #ede9fe;
  color: #5b21b6;
}

.tooth-status-implante {
  background: #ecfdf5;
  border-color: #10b981;
}
.tooth-status-implante .tooth-number { color: #047857; }
.tooth-status-implante .tooth-state-tag {
  background: #d1fae5;
  color: #065f46;
}

.tooth-status-protese {
  background: #fffbeb;
  border-color: #f59e0b;
}
.tooth-status-protese .tooth-number { color: #b45309; }
.tooth-status-protese .tooth-state-tag {
  background: #fef3c7;
  color: #92400e;
}

.tooth-status-extracao {
  background: #f8fafc;
  border-color: #94a3b8;
  opacity: 0.72;
}
.tooth-status-extracao .tooth-number { color: #475569; }
.tooth-status-extracao .tooth-state-tag {
  background: #e2e8f0;
  color: #334155;
}

/* ========================================================
   ESTATÍSTICAS & RESUMO CLÍNICO DA ARCADA (ODONTOGRAMA)
   ======================================================== */
.odontogram-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.odontogram-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.odontogram-stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.odontogram-stat-info {
  display: flex;
  flex-direction: column;
}

.odontogram-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.odontogram-stat-count {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text-main);
}

/* ========================================================
   SWITCH DE DENTIÇÃO (ADULTO PERMANENTE VS INFANTIL DECÍDUA)
   ======================================================== */
.dentition-switch-pills {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

.btn-dentition-toggle {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-dentition-toggle.active {
  background: #ffffff;
  color: var(--primary-700);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

/* ========================================================
   NOVO ODONTOGRAMA ANATÔMICO EM PARÁBOLA REAL & WORKSPACE
   ======================================================== */
.odontogram-treatment-workspace {
  display: grid;
  grid-template-columns: minmax(480px, 1.35fr) minmax(360px, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

@media (max-width: 1100px) {
  .odontogram-treatment-workspace {
    grid-template-columns: 1fr;
  }
}

.odontogram-arch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.odontogram-arch-svg {
  width: 100%;
  max-width: 740px;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.06));
}

.arch-tooth-group {
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), filter 0.16s ease;
}

.arch-tooth-group:hover rect {
  filter: brightness(1.15) drop-shadow(0 0 6px rgba(5, 150, 105, 0.9));
  stroke: #059669 !important;
  stroke-width: 2.2px !important;
}

.arch-tooth-group.selected rect {
  stroke: #2563eb !important;
  stroke-width: 2.6px !important;
  filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.85));
}

.arch-tooth-number {
  cursor: pointer;
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  font-weight: 800;
  font-size: 13.5px;
  user-select: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.arch-tooth-number:hover {
  filter: brightness(1.25) drop-shadow(0 0 4px currentColor);
  transform: scale(1.22);
}

.arch-tooth-number.selected {
  font-weight: 900;
  filter: drop-shadow(0 0 5px currentColor);
}

.tooth-selection-halo {
  animation: pulseHalo 1.8s infinite ease-in-out;
}

@keyframes pulseHalo {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.1); opacity: 0.5; }
  100% { transform: scale(1); opacity: 0.9; }
}

.odontogram-side-panel {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.odontogram-focused-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.odontogram-focused-card.active-focus {
  border-color: #2563eb;
}

.btn-open-3d-glowing {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

.btn-open-3d-glowing:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  filter: brightness(1.08);
}

.cond-pill-btn {
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cond-pill-btn:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.cond-pill-btn.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #1e293b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.cond-pill-btn.active[data-cond="carie"] { background: #dc2626; border-color: #dc2626; }
.cond-pill-btn.active[data-cond="restaurado"] { background: #2563eb; border-color: #2563eb; }
.cond-pill-btn.active[data-cond="canal"] { background: #9333ea; border-color: #9333ea; }
.cond-pill-btn.active[data-cond="implante"] { background: #059669; border-color: #059669; }
.cond-pill-btn.active[data-cond="protese"] { background: #d97706; border-color: #d97706; }
.cond-pill-btn.active[data-cond="extracao"] { background: #475569; border-color: #475569; }
.cond-pill-btn.active[data-cond="higido"] { background: #64748b; border-color: #64748b; }


/* ========================================================
   SEÇÃO DE FOTOGRAFIAS CLÍNICAS & CONTROLE DO ADMINISTRADOR
   ======================================================== */
.admin-photo-auth-card {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.9)) !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 14px !important;
  padding: 1.25rem 1.5rem !important;
  margin-bottom: 1.25rem !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.admin-photo-auth-card.mandatory-active {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.98), rgba(255, 241, 242, 0.9)) !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.12) !important;
}

/* Banner de Protocolo Clínico Obrigatório do Administrador (Exibido para Dentistas/Outros Usuários) */
.clinic-policy-mandatory-banner {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(255, 241, 242, 0.85));
  border: 1.5px solid #fca5a5;
  border-radius: 14px;
  padding: 1.1rem 1.45rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.08);
  animation: fadeIn 0.25s ease;
}

.clinic-policy-optional-banner {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.95), rgba(236, 253, 245, 0.85));
  border: 1.5px solid #a7f3d0;
  border-radius: 14px;
  padding: 0.95rem 1.35rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.06);
}

.admin-auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0369a1;
}

.admin-photo-auth-card.mandatory-active .admin-shield-badge {
  color: #b91c1c;
}

.admin-auth-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.admin-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Switch Toggle iOS Style */
.switch-control {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-control input:checked + .switch-slider {
  background-color: #dc2626;
}

.switch-control input:checked + .switch-slider:before {
  transform: translateX(24px);
}

/* Drag & Drop Zone de Fotografias */
.photo-dropzone {
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.photo-dropzone:hover, .photo-dropzone.dragover {
  border-color: #059669;
  background: rgba(5, 150, 105, 0.04);
}

.photo-dropzone-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* Galeria de Fotos Anexadas */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.photo-thumbnail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
}

.photo-thumbnail-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.photo-img-container {
  width: 100%;
  height: 130px;
  background: #0f172a;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.photo-img-container:hover img {
  transform: scale(1.06);
}

.photo-img-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
}

.photo-img-container:hover .photo-img-overlay {
  opacity: 1;
}

.photo-card-body {
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Animação Vibrante quando Foto Obrigatória não foi anexada */
@keyframes photoShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.photo-required-shake {
  animation: photoShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3.5px rgba(239, 68, 68, 0.35), 0 8px 24px rgba(239, 68, 68, 0.2) !important;
}

/* Lightbox Modal para Visualização em Alta Resolução */
#modal-photo-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s ease;
}

#modal-photo-lightbox.active {
  display: flex;
}

.photo-lightbox-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.photo-lightbox-img-wrapper {
  background: #090d16;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: 75vh;
}

.photo-lightbox-img-wrapper img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
}

/* Responsividade do Menu Dividido */
@media (max-width: 900px) {
  .nav-control-bar {
    padding: 0.5rem 1rem;
  }
  .nav-tabs-wrapper {
    padding: 0.35rem 1rem 0;
  }
}

/* ========================================================
   PRONTUÁRIO ODONTOLÓGICO COMPLETO EM TELA INTEIRA
   Abre ocupando toda a área de trabalho mantendo menu lateral visível
   ======================================================== */
#modal-patient-chart {
  position: fixed !important;
  top: 0 !important;
  left: 260px !important;
  right: 0 !important;
  bottom: 0 !important;
  width: calc(100vw - 260px) !important;
  height: 100vh !important;
  z-index: 60 !important;
  background: var(--bg-surface, #ffffff) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: none;
  align-items: stretch !important;
  justify-content: stretch !important;
  animation: chartSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#modal-patient-chart.active {
  display: flex !important;
}

@keyframes chartSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#modal-patient-chart .modal-card {
  width: 100% !important;
  max-width: 100% !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  border-left: 1px solid #cbd5e1 !important;
  box-shadow: -10px 0 35px rgba(15, 23, 42, 0.12) !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  background: #f8fafc !important;
}

#modal-patient-chart .modal-header {
  padding: 1.25rem 2.25rem !important;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdfd 100%) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.03) !important;
  flex-shrink: 0 !important;
  position: relative;
  z-index: 20;
}

#modal-patient-chart .chart-tabs-bar {
  padding: 0.5rem 2.25rem 0 !important;
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  flex-shrink: 0 !important;
  display: flex !important;
  gap: 0.4rem !important;
  overflow-x: auto !important;
}

#modal-patient-chart .modal-body {
  flex: 1 !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 1.75rem 2.25rem !important;
  background: var(--bg-app) !important;
}

#modal-patient-chart .modal-footer {
  padding: 0.95rem 2.25rem !important;
  background: var(--bg-surface) !important;
  border-top: 1px solid var(--border-light) !important;
  box-shadow: 0 -4px 16px -2px rgba(15, 23, 42, 0.03) !important;
  flex-shrink: 0 !important;
}

/* Cartões de Alto Padrão (Chiques) para o Prontuário */
.chart-luxury-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.chart-luxury-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.03);
  border-color: #cbd5e1;
}

.chart-luxury-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

@media (max-width: 991px) {
  #modal-patient-chart {
    left: 0 !important;
    width: 100vw !important;
    z-index: 80 !important;
  }
}

/* ==========================================================================
   PAINEL DO ADMINISTRADOR: MATRIZ DE PERMISSÕES & CONTROLE DE ACESSO (RBAC)
   ========================================================================== */
.perm-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.perm-checkbox-item:hover {
  background: var(--bg-subtle);
  border-color: var(--primary-300);
}

.perm-checkbox-item input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary-600);
  cursor: pointer;
  flex-shrink: 0;
}

.perm-checkbox-item span {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.perm-checkbox-item span strong {
  font-size: 0.8rem;
  color: var(--text-main);
}

.perm-checkbox-item span small {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.user-row-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-row-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.btn-quick-simulate-user:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   AGENDAMENTO DIRETO DE CONSULTAS NO PRONTUÁRIO
   ========================================================================== */
.chart-schedule-box {
  animation: fadeIn 0.25s ease-out;
}

.btn-chart-quick-date,
.btn-chart-quick-time {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-chart-quick-date:hover,
.btn-chart-quick-time:hover {
  background: var(--primary-50);
  border-color: var(--primary-400);
  color: var(--primary-700);
}

/* Modais de alta prioridade e z-index */
#modal-appointment {
  z-index: 1100 !important;
}

#modal-patient-budget,
#modal-patient-prescription {
  z-index: 1150 !important;
}

#modal-signature-pad {
  z-index: 1300 !important;
}

#modal-admin-user {
  z-index: 1200 !important;
}

/* Classe utilitária para elementos ocultos por permissão */
.permission-hidden {
  display: none !important;
}

.permission-disabled {
  opacity: 0.45 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

/* ========================================================
   ORÇAMENTOS ODONTOLÓGICOS & DOCUMENTOS
   ======================================================== */
.budget-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.budget-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-sm);
}

.budget-status-pill {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.budget-status-pill.pendente {
  background: #fef3c7;
  color: #b45309;
}

.budget-status-pill.aprovado {
  background: #dcfce7;
  color: #15803d;
}

.budget-status-pill.recusado {
  background: #fee2e2;
  color: #b91c1c;
}

.budget-status-pill.concluido {
  background: #e0e7ff;
  color: #4338ca;
}

/* Card de Assinatura Eletrônica */
.signature-badge-card {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.05), rgba(2, 132, 199, 0.05));
  border: 1.5px solid #10b981;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-sig-color.active {
  box-shadow: 0 0 0 2px var(--primary-500) !important;
}

.btn-quick-rx:hover {
  background: var(--primary-50) !important;
  border-color: var(--primary-300) !important;
  color: var(--primary-700) !important;
}

/* ==========================================================================
   CRM & CAPTAÇÃO DE PACIENTES - LUXURY SALES FUNNEL & CAMPAIGNS
   Aesthetics: Executive Clinic Kanban, Real-time WhatsApp, Vibrant Badges
   ========================================================================== */

.crm-view-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 3rem;
}

/* KPIs Executivos do CRM */
.crm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.crm-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.crm-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border-color: var(--border-subtle);
}

.crm-kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-gradient, var(--primary-gradient));
}

.crm-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.crm-kpi-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.crm-kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-kpi-value {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-top: 2px;
}

.crm-kpi-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Seção de Campanhas Inteligentes & Relacionamento (Branco e Esmeralda) */
.crm-campaigns-strip {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1.5px solid #d1fae5;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.05);
  margin-bottom: 1.25rem;
}

.crm-campaigns-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.crm-campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.15rem;
}

.crm-campaign-card {
  background: #ffffff;
  border: 1.5px solid #e0eee4;
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(6, 78, 59, 0.03);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.crm-campaign-card:hover {
  border-color: #10b981;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
  transform: translateY(-2px);
}

.crm-campaign-thumb {
  width: 100%;
  height: 135px;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin-bottom: 0.85rem;
  border: 1px solid #e0eee4;
}

/* WhatsApp Live Preview Mockup */
.crm-whatsapp-phone-mockup {
  background: #111b21;
  border-radius: 26px;
  padding: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  max-width: 340px;
  width: 100%;
  margin: 0 auto;
  border: 3px solid #2a3942;
}

.crm-whatsapp-screen {
  background: #0b141a;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 440px;
}

.crm-whatsapp-header-bar {
  background: #202c33;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-whatsapp-chat-area {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 16px 16px;
}

.crm-whatsapp-bubble {
  background: #005c4b;
  color: #e9edef;
  border-radius: 10px 10px 2px 10px;
  padding: 8px 10px;
  max-width: 95%;
  margin-left: auto;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  position: relative;
  word-break: break-word;
  white-space: pre-wrap;
}

.crm-whatsapp-bubble img {
  width: 100%;
  border-radius: 7px;
  margin-bottom: 6px;
  max-height: 160px;
  object-fit: cover;
  display: block;
}

.crm-whatsapp-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.65);
  text-align: right;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

/* Modal de Criação e Edição de Campanha WhatsApp */
#modal-crm-campaign .modal-card {
  max-width: 1040px;
  width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  border: 2px solid #a7f3d0;
  box-shadow: 0 25px 60px rgba(6, 78, 59, 0.22);
  background: #ffffff;
  overflow: hidden;
}

#modal-crm-campaign #form-crm-campaign {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  margin: 0;
}

#modal-crm-campaign .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: #fbfdfc;
}

.crm-campaign-grid-layout {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 880px) {
  .crm-campaign-grid-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.crm-modal-sticky-preview {
  position: sticky;
  top: 0;
  background: #f8fbf9;
  border: 1.5px solid #d1fae5;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.05);
}

.crm-banner-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.crm-banner-picker-item {
  border: 2px solid #d1fae5;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  background: #ffffff;
}

.crm-banner-picker-item:hover {
  transform: translateY(-2px);
  border-color: #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.18);
}

.crm-banner-picker-item.selected {
  border-color: #059669;
  box-shadow: 0 0 0 2px #34d399, 0 4px 12px rgba(16, 185, 129, 0.25);
  background: #ecfdf5;
}

.crm-banner-picker-item.selected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  background: #059669;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.crm-banner-picker-item img {
  width: 100%;
  height: 65px;
  object-fit: cover;
  display: block;
}

/* Barra de Filtros e Alternador de Visões */
.crm-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.crm-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.crm-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Funil Kanban do CRM */
.crm-funnel-board {
  display: flex;
  gap: 1.15rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  min-height: 520px;
}

.crm-column {
  flex: 0 0 310px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  max-height: 720px;
}

.crm-column-header {
  padding: 0.9rem 1rem;
  border-bottom: 1.5px solid var(--col-border, var(--border-subtle));
  background: var(--col-bg, var(--bg-subtle));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crm-col-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
}

.crm-col-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.crm-col-count-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}

.crm-col-total-badge {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: #047857;
  border: 1px solid #a7f3d0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.crm-column-body {
  padding: 0.75rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 120px;
}

/* Card Individual de Lead / Oportunidade */
.crm-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: all 0.22s ease;
  cursor: grab;
  position: relative;
  border-left: 3.5px solid var(--temp-color, #10b981);
}

.crm-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
  border-color: var(--border-subtle);
}

.crm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.crm-card-name {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.25;
}

.crm-temp-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.crm-temp-quente {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.crm-temp-morno {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.crm-temp-frio {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.crm-card-treatment {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-700);
  background: rgba(5, 150, 105, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.crm-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.crm-card-value {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  color: #047857;
}

.crm-card-source {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.crm-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.btn-crm-whatsapp {
  background: #25d366;
  color: #ffffff !important;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-crm-whatsapp:hover {
  background: #1eb956;
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.crm-stage-select {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  max-width: 140px;
  cursor: pointer;
}

/* Modal de Oportunidade / Lead */
.crm-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* ==========================================================================
   ALERTA DE FALTAS & RESGATE DE PACIENTES (NO-SHOW ALERT & RE-ENGAGEMENT)
   ========================================================================== */

.missed-appointments-alert-card {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(255, 241, 242, 0.9));
  border: 1.5px solid #f87171;
  border-left: 6px solid #dc2626;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.08);
  animation: fadeInAlert 0.3s ease-out;
}

@keyframes fadeInAlert {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.missed-alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(248, 113, 113, 0.3);
  padding-bottom: 0.75rem;
}

.missed-alert-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #991b1b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.missed-pulse-dot {
  width: 10px;
  height: 10px;
  background-color: #dc2626;
  border-radius: 50%;
  display: inline-block;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.missed-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.missed-patient-item {
  background: #ffffff;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.missed-patient-item:hover {
  border-color: #f87171;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.09);
  transform: translateY(-2px);
}

.btn-whatsapp-rescue {
  background: #25d366;
  color: #ffffff !important;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
}

.btn-whatsapp-rescue:hover {
  background: #1eb956;
  transform: scale(1.02);
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.35);
}

.btn-reschedule-now {
  background: #059669;
  color: #ffffff !important;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #047857;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reschedule-now:hover {
  background: #047857;
  transform: scale(1.02);
}

[data-theme="dark"] .missed-appointments-alert-card {
  background: rgba(153, 27, 27, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  border-left-color: #ef4444;
}

[data-theme="dark"] .missed-patient-item {
  background: var(--bg-surface);
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .missed-alert-title {
  color: #fca5a5;
}

/* ==========================================================================
   AGENDA ODONTOLÓGICA: 15 MINUTOS & ARRASTAR E SOLTAR (DRAG & DROP)
   ========================================================================== */

.draggable-apt-card {
  user-select: none;
  cursor: grab !important;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease, opacity 0.15s ease;
}

.draggable-apt-card:hover {
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-1px);
}

.draggable-apt-card:active {
  cursor: grabbing !important;
}

.draggable-apt-card.is-dragging {
  opacity: 0.38 !important;
  transform: scale(0.97) rotate(-0.5deg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15) !important;
  border-style: dashed !important;
  pointer-events: none;
}

.apt-drag-grip {
  cursor: grab;
  user-select: none;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background 0.15s ease;
}

.apt-drag-grip:hover {
  background: rgba(0, 0, 0, 0.08);
}

.droppable-slot {
  transition: background 0.15s ease, outline 0.15s ease, box-shadow 0.15s ease;
}

.draggable-apt-card {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: element;
  cursor: grab !important;
}

.draggable-apt-card {
  cursor: grab !important;
  user-select: none;
  -webkit-user-select: none;
}

.draggable-apt-card:hover {
  cursor: grab !important;
}

.draggable-apt-card:active {
  cursor: grabbing !important;
}

.apt-drag-grip {
  cursor: grab !important;
}

.apt-drag-grip:active {
  cursor: grabbing !important;
}

.draggable-apt-card.is-dragging {
  opacity: 0.4 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25) !important;
}

.droppable-slot.drag-over-slot {
  background: rgba(16, 185, 129, 0.25) !important;
  outline: 3px dashed #059669 !important;
  outline-offset: -2px;
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.35) !important;
  position: relative;
  border-radius: 8px;
  z-index: 25;
}

[data-theme="dark"] .droppable-slot.drag-over-slot {
  background: rgba(16, 185, 129, 0.35) !important;
  outline-color: #34d399 !important;
}

.week-full-hour-row {
  border-top: 1.5px solid var(--border-light) !important;
}

.week-quarter-hour-row {
  border-top: 1px dashed rgba(0, 0, 0, 0.06) !important;
}

[data-theme="dark"] .week-quarter-hour-row {
  border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   MODERN DESIGN OVERHAUL: COHESIVE PALETTE, GLASS EFFECT & UNIVERSAL DARK MODE
   ========================================================================== */

/* Modern Global Card & Container Enhancements */
.card, .metric-card, .card-table-wrapper, .crm-column, .week-calendar-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.workspace-topbar {
  background: var(--bg-surface-glass) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid var(--border-light) !important;
}

.sidebar-nav .nav-tab {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  border-radius: var(--radius-sm) !important;
}

.sidebar-nav .nav-tab:hover {
  background: var(--bg-subtle) !important;
  transform: translateX(3px) !important;
}

.sidebar-nav .nav-tab.active {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.12) 0%, rgba(13, 148, 136, 0.08) 50%, rgba(2, 132, 199, 0.1) 100%) !important;
  color: var(--primary-600) !important;
  font-weight: 800 !important;
  border-left: 3.5px solid var(--primary-500) !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.08) !important;
}

/* Modern Pill Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   UNIVERSAL DARK MODE OVERRIDES (PERFECT CONTRAST & ZERO HARDCODED COLOR CLASH)
   ========================================================================== */

[data-theme="dark"] body {
  background-color: var(--bg-app) !important;
  color: var(--text-main) !important;
}

/* Fix Hardcoded Dark Text in Dark Mode */
[data-theme="dark"] strong,
[data-theme="dark"] b {
  color: var(--text-main);
}

[data-theme="dark"] a:not(.btn):not(.btn-primary) {
  color: var(--primary-400);
}

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

[data-theme="dark"] .sidebar-nav .nav-tab {
  color: #94a3b8;
}

[data-theme="dark"] .sidebar-nav .nav-tab:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .sidebar-nav .nav-tab.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(13, 148, 136, 0.12) 50%, rgba(2, 132, 199, 0.15) 100%) !important;
  color: #34d399 !important;
  border-left-color: #10b981 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.15) !important;
}

[data-theme="dark"] .workspace-view-title {
  color: #f8fafc !important;
}

[data-theme="dark"] .workspace-view-subtitle {
  color: #94a3b8 !important;
}

/* Dark Mode Inputs, Selects & Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: var(--bg-surface-elevated) !important;
  color: var(--text-main) !important;
  border-color: var(--border-light) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
}

[data-theme="dark"] select option {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
}

/* Dark Mode Modals */
[data-theme="dark"] .modal-overlay {
  background: rgba(4, 7, 13, 0.75) !important;
}

[data-theme="dark"] .modal-card {
  background: var(--bg-surface) !important;
  border-color: var(--border-light) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7) !important;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer {
  background: var(--bg-surface) !important;
  border-color: var(--border-light) !important;
  color: var(--text-main) !important;
}

/* Dark Mode Cards & Surfaces */
[data-theme="dark"] .metric-card,
[data-theme="dark"] .card-table-wrapper,
[data-theme="dark"] .patient-card,
[data-theme="dark"] .chart-luxury-card,
[data-theme="dark"] .crm-column,
[data-theme="dark"] .crm-card,
[data-theme="dark"] .sidebar-user-card {
  background: var(--bg-surface) !important;
  border-color: var(--border-light) !important;
  color: var(--text-main) !important;
}

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

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

/* Dark Mode Data Tables */
[data-theme="dark"] .data-table thead th,
[data-theme="dark"] .table-toolbar {
  background: var(--bg-subtle) !important;
  color: #cbd5e1 !important;
  border-color: var(--border-light) !important;
}

[data-theme="dark"] .data-table tbody td {
  color: var(--text-main) !important;
  border-color: var(--border-light) !important;
}

[data-theme="dark"] .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

/* Dark Mode Agenda Appointments */
[data-theme="dark"] .week-calendar-card {
  background: var(--bg-surface) !important;
  border-color: var(--border-light) !important;
}

[data-theme="dark"] .week-day-cell {
  border-color: var(--border-light) !important;
}

[data-theme="dark"] .appointment-card,
[data-theme="dark"] .week-apt-card {
  background: var(--bg-surface-elevated) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .appointment-card a,
[data-theme="dark"] .week-apt-card a {
  color: #f8fafc !important;
}

[data-theme="dark"] .appointment-card div,
[data-theme="dark"] .week-apt-card div {
  color: #cbd5e1;
}

/* Dark Mode Secondary Buttons */
[data-theme="dark"] .btn-secondary {
  background: var(--bg-surface-elevated) !important;
  border-color: var(--border-light) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--primary-500) !important;
  color: #f8fafc !important;
}

/* Estilos da Ficha de Anamnese Interativa */
.btn-anamnese-toggle {
  padding: 5px 14px;
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-anamnese-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-anamnese-toggle.active-no {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
  font-weight: 900 !important;
  box-shadow: 0 1px 3px rgba(22, 101, 52, 0.15);
}

.btn-anamnese-toggle.active-yes {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
  font-weight: 900 !important;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.15);
}

.anamnese-q-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: all 0.15s ease;
}

.anamnese-q-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-sm);
}

.anamnese-q-card.is-answered-yes {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.02);
}

.anamnese-q-card.is-answered-no {
  border-left: 4px solid #10b981;
}

/* ==========================================================================
   CENTRAL DE DOCUMENTOS ODONTOLÓGICOS (PRONTUÁRIO)
   Sub-abas (Novo / Histórico), Cards das 6 Categorias e Modelos Pré-escritos
   ========================================================================== */
.doc-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--border-light);
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.doc-subtabs-nav {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 3px;
}

.doc-subtab-btn {
  border: none;
  background: transparent;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.doc-subtab-btn:hover {
  color: var(--text-main);
}

.doc-subtab-btn.active {
  background: var(--bg-surface);
  color: var(--primary-600);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.doc-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.doc-category-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.doc-category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--card-accent, var(--primary-400));
}

.doc-category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, var(--primary-500));
}

.doc-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.65rem;
}

.doc-card-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--card-accent-bg, rgba(16, 185, 129, 0.1));
  color: var(--card-accent, var(--primary-600));
  flex-shrink: 0;
}

.doc-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.doc-card-desc {
  font-size: 0.77rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.85rem;
  min-height: 32px;
}

.doc-templates-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 1rem;
  flex: 1;
}

.doc-template-quick-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.doc-template-quick-btn:hover {
  background: var(--card-accent-bg, rgba(16, 185, 129, 0.08));
  border-color: var(--card-accent, var(--primary-400));
  color: var(--card-accent, var(--primary-600));
  padding-left: 11px;
}

.doc-template-quick-btn span.arrow {
  opacity: 0.5;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.doc-template-quick-btn:hover span.arrow {
  opacity: 1;
  transform: translateX(2px);
}

.doc-card-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
  margin-top: auto;
}

.btn-doc-blank {
  width: 100%;
  padding: 6px 12px;
  font-size: 0.77rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-doc-blank:hover {
  border-color: var(--card-accent, var(--primary-500));
  color: var(--card-accent, var(--primary-600));
  background: var(--card-accent-bg, rgba(16, 185, 129, 0.05));
}

/* Cores temáticas específicas para as 6 categorias */
.doc-card-contrato {
  --card-accent: #8b5cf6;
  --card-accent-bg: rgba(139, 92, 246, 0.1);
}

.doc-card-termo {
  --card-accent: #f59e0b;
  --card-accent-bg: rgba(245, 158, 11, 0.1);
}

.doc-card-receita {
  --card-accent: #0284c7;
  --card-accent-bg: rgba(2, 132, 199, 0.1);
}

.doc-card-rx {
  --card-accent: #0d9488;
  --card-accent-bg: rgba(13, 148, 136, 0.1);
}

.doc-card-atestado {
  --card-accent: #059669;
  --card-accent-bg: rgba(5, 150, 105, 0.1);
}

.doc-card-custom {
  --card-accent: #4f46e5;
  --card-accent-bg: rgba(79, 70, 229, 0.1);
}

/* HISTÓRICO DE DOCUMENTOS */
.doc-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.doc-history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  margin-bottom: 0.9rem;
  transition: all 0.15s ease;
}

.doc-history-card:hover {
  border-color: var(--primary-300);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

/* ========================================================
   MODAL DE INSPEÇÃO & TRATAMENTO ANATÔMICO 3D DO DENTE
   ======================================================== */
.modal-tooth-3d-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-tooth-3d-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-tooth-3d-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 1020px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.modal-tooth-3d-overlay.active .modal-tooth-3d-card {
  transform: scale(1) translateY(0);
}

.tooth-3d-header {
  padding: 1.15rem 1.6rem;
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #0284c7 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.tooth-3d-body {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  flex: 1;
  overflow-y: auto;
  min-height: 490px;
}

@media (max-width: 880px) {
  .tooth-3d-body {
    grid-template-columns: 1fr;
  }
}

.tooth-3d-viewport-stage {
  background: radial-gradient(circle at 50% 38%, #0d2a4d 0%, #07172c 55%, #020712 100%);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  border-right: 1px solid rgba(56, 189, 248, 0.2);
  perspective: 1200px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.75);
}

.tooth-3d-perspective-card {
  transform-style: preserve-3d;
  transition: none;
  cursor: grab;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  will-change: transform;
}

.tooth-3d-perspective-card:active {
  cursor: grabbing;
}

.tooth-3d-svg-large {
  width: 250px;
  height: 300px;
  filter: drop-shadow(0 0 30px rgba(2, 132, 199, 0.35));
  transition: all 0.25s ease;
}

/* SISTEMA MULTI-CAMADAS 3D COM PROFUNDIDADE REAL (PARALAXE ÓPTICA EM Z) */
.tooth-3d-layers-viewport {
  position: relative;
  width: 260px;
  height: 315px;
  transform-style: preserve-3d;
  user-select: none;
}

.tooth-depth-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform-style: preserve-3d;
  will-change: transform;
}

.tooth-depth-layer.layer-front {
  pointer-events: auto;
  cursor: crosshair;
}

.tooth-depth-layer.layer-back {
  pointer-events: none;
}

.tooth-depth-layer.layer-pulp {
  pointer-events: none;
}

.tooth-depth-layer.layer-markers {
  pointer-events: none;
}

.tooth-3d-svg-layer {
  width: 100%;
  height: 100%;
  display: block;
}

/* BARRA DE FERRAMENTAS CLÍNICAS (MARCAÇÃO POR TOQUE DIRETO NO DENTE) */
.tooth-3d-tool-bar {
  display: flex;
  gap: 5px;
  background: rgba(15, 23, 42, 0.88);
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.btn-clinical-tool {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 0.73rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-clinical-tool:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  border-color: #38bdf8;
}

.btn-clinical-tool.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  transform: scale(1.04);
}

/* CHIPS DAS POSIÇÕES MARCADAS NO PAINEL */
.tooth-point-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.tooth-point-chip:hover {
  border-color: #38bdf8;
  background: #f0f9ff;
}

.btn-remove-tooth-point {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-remove-tooth-point:hover {
  color: #ef4444;
  background: #fee2e2;
}

@keyframes pulse-pin {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 0.35; }
  100% { transform: scale(1); opacity: 0.9; }
}

.pulse-target-ring {
  animation: pulse-pin 2s infinite ease-in-out;
  transform-origin: center;
}

.tooth-3d-face-hotspot {
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.tooth-3d-face-hotspot:hover {
  filter: brightness(1.25) drop-shadow(0 0 14px rgba(56, 189, 248, 0.95)) !important;
  stroke: #38bdf8 !important;
  stroke-width: 3px !important;
}

.tooth-3d-face-hotspot.active {
  stroke-width: 3.2px !important;
  stroke: #67e8f9 !important;
  filter: drop-shadow(0 0 16px rgba(56, 189, 248, 1)) !important;
}

.tooth-3d-views-bar {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  margin-top: 12px;
  z-index: 10;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-3d-view-toggle {
  background: transparent;
  border: none;
  font-size: 0.74rem;
  font-weight: 800;
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-3d-view-toggle:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.btn-3d-view-toggle.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}

.tooth-3d-controls-panel {
  padding: 1.5rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  overflow-y: auto;
}

.face-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 8px;
}

.btn-face-selector {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-face-selector:hover {
  border-color: #059669;
  background: #f0fdf4;
}

.btn-face-selector.active {
  border-color: #059669;
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.25);
}

.btn-face-selector.active.carie {
  border-color: #ef4444;
  background: #fef2f2;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.btn-face-selector.active.resina {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.btn-face-selector.active.canal {
  border-color: #8b5cf6;
  background: #f5f3ff;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.condition-pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.btn-condition-pill {
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  text-align: left;
}

.btn-condition-pill:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.btn-condition-pill.active {
  border-color: #059669;
  background: #ecfdf5;
  color: #065f46;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.15);
}


