:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-header: rgba(17, 24, 39, 0.95);
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.90);
  --bg-input: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --table-th-bg: #161f30;
  --table-tr-border: rgba(255, 255, 255, 0.04);
  --table-tr-hover: rgba(255, 255, 255, 0.03);
  --badge-bg: rgba(255, 255, 255, 0.05);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  
  --glass-blur: blur(16px);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-header: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #6366f1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --table-th-bg: #f1f5f9;
  --table-tr-border: #e2e8f0;
  --table-tr-hover: #f8fafc;
  --badge-bg: #f1f5f9;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Scrollbar Custom */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: var(--radius-full);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}
::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

/* Layout Principal */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 16px;
  z-index: 20;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease, border-color 0.25s ease;
  overflow-x: hidden;
}

/* Modo Foco / Sidebar Colapsada */
.sidebar.collapsed {
  width: 72px;
  padding: 20px 8px;
}

.sidebar.collapsed .logo-container {
  padding: 0 0 16px 0;
  justify-content: center;
}

.sidebar.collapsed .logo-container img {
  max-height: 32px;
  max-width: 38px;
}

.sidebar.collapsed .logo-title,
.sidebar.collapsed .logo-subtitle {
  display: none !important;
}

.sidebar.collapsed .nav-group-item {
  width: 100%;
  align-items: center;
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .nav-parent {
  justify-content: center;
  padding: 12px 0;
  width: 100%;
  border-radius: var(--radius-sm);
  position: relative;
}

.sidebar.collapsed .nav-item span:not(.nav-icon),
.sidebar.collapsed .nav-parent span:not(.nav-icon),
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-arrow {
  display: none !important;
}

.sidebar.collapsed .nav-sub-menu {
  display: none !important;
  max-height: 0 !important;
  opacity: 0 !important;
  border-left: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.sidebar.collapsed .sidebar-footer button span:not(:first-child),
.sidebar.collapsed .ws-status-badge span:not(.pulse-dot) {
  display: none !important;
}

.sidebar.collapsed .sidebar-footer button {
  padding: 10px;
  justify-content: center;
}

.sidebar.collapsed .ws-status-badge {
  justify-content: center;
  padding: 8px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.logo-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  list-style: none;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-group-item {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

[data-theme="light"] .nav-item:hover {
  background: #f1f5f9;
  color: var(--accent-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18), rgba(6, 182, 212, 0.06));
  color: var(--accent-primary);
  font-weight: 700;
}

[data-theme="light"] .nav-item.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
}

.nav-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-text {
  flex: 1;
}

.nav-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  margin-left: auto;
}

.nav-group-item.expanded .nav-arrow {
  transform: rotate(90deg);
}

/* Sub-Menu em Cascata Aninhado */
.nav-sub-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 20px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.25s ease;
}

[data-theme="light"] .nav-sub-menu {
  border-left-color: #e2e8f0;
}

.nav-group-item.expanded .nav-sub-menu {
  max-height: 450px;
  opacity: 1;
  margin-top: 4px;
  margin-bottom: 6px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.nav-sub-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
}

[data-theme="light"] .nav-sub-item {
  color: #475569;
}

[data-theme="light"] .nav-sub-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-sub-item.active {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .nav-sub-item.active {
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: #ffffff !important;
}

.sub-icon {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sub-text {
  font-size: 0.82rem;
}

/* Sidebar Footer (Status da Conexão e Sync) */
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ws-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

.pulse-dot.offline {
  background-color: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-sync {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-sync:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.btn-sync:active {
  transform: translateY(0);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Header Limpo & Compacto */
.main-header, .top-header {
  background: var(--bg-header);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 10;
  min-height: 58px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select, .filter-input, input[type="text"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary) !important;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
}

.filter-select:focus, .filter-input:focus, input:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.filter-select option, select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-reset-filters {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 18px;
}

.btn-reset-filters:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

[data-theme="light"] .btn-reset-filters:hover {
  background: #e2e8f0;
}

/* Presets de Período e Filtros Internos de Página */
.page-filters-card {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.periodo-preset-pills {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.18);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .periodo-preset-pills {
  background: #f1f5f9;
}

.btn-preset-pill {
  padding: 5px 11px;
  font-size: 0.76rem;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-preset-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .btn-preset-pill:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-preset-pill.active {
  background: var(--accent-primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.filter-group-inline {
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-label-inline {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.filter-input-sm, .filter-select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary) !important;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
}

.filter-input-sm:focus, .filter-select-sm:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-reset-filters-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-reset-filters-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

[data-theme="light"] .btn-reset-filters-sm:hover {
  background: #e2e8f0;
}


/* Views & Pages Container */
.content-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view-section {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  min-height: 125px;
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-lg);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-primary);
}

.kpi-card.cyan::before { background: var(--accent-cyan); }
.kpi-card.emerald::before { background: var(--accent-emerald); }
.kpi-card.amber::before { background: var(--accent-amber); }
.kpi-card.purple::before { background: var(--accent-purple); }
.kpi-card.rose::before { background: var(--accent-rose); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-icon {
  font-size: 1.15rem;
  opacity: 0.85;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.15;
}

.kpi-footer-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.kpi-footer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  width: 100%;
  line-height: 1.25;
}

.kpi-footer-item .kpi-label {
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-footer-item .kpi-subval {
  font-weight: 700;
  color: var(--text-secondary);
}

.badge-trend-up {
  color: var(--accent-emerald);
  font-weight: 700;
}

.badge-trend-down {
  color: var(--accent-rose);
  font-weight: 700;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

@media (max-width: 1100px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.card-box {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-box-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

/* Tabelas Analíticas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  padding: 12px 14px;
  background: var(--table-th-bg);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--table-tr-border);
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--table-tr-hover);
}

.badge-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-tag.classe-a { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-tag.classe-b { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-tag.classe-c { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }

.badge-tag.status-ativo { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.badge-tag.status-risco { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-tag.status-churn { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }

/* Modais & Overlays Globais */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 480px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--text-primary);
  position: relative;
  z-index: 100001;
}

/* Modais Principais Full-Screen / Grandes */
#modalRaioXCliente,
#modalRaioXDia,
#modalRaioXGrupo,
#modalGerenciarUsuarios,
#modalApresentacaoConfig {
  z-index: 100000 !important;
}
#modalRaioXCliente .modal-content,
#modalRaioXDia .modal-content,
#modalRaioXGrupo .modal-content,
#modalGerenciarUsuarios .modal-content,
#modalApresentacaoConfig .modal-content {
  z-index: 100001 !important;
}

/* Modais Filhos / Detalhamento (Abrem SEMPRE POR CIMA do Raio-X do Cliente) */
#modalRaioXPedido,
#modalRegistrarContatoCrm,
#modalItensBonificacao,
#modalJustificarInfracao,
#modalNovaRegraFiltro {
  z-index: 105000 !important;
}
#modalRaioXPedido .modal-content,
#modalRegistrarContatoCrm .modal-content,
#modalItensBonificacao .modal-content,
#modalJustificarInfracao .modal-content,
#modalNovaRegraFiltro .modal-content {
  z-index: 105001 !important;
}

#modalCropFoto {
  z-index: 110000 !important;
}
#modalCropFoto .modal-content {
  z-index: 110001 !important;
}

/* Overlays Críticos / Celebrações / Login */
#modalVendaRealizada,
#modalMilestone,
#modalConsultorSino,
#syncModal,
#modalLogin {
  z-index: 120000 !important;
}

#modalRaioXCliente .modal-content,
#modalRaioXPedido .modal-content,
#modalRaioXDia .modal-content,
#modalRaioXGrupo .modal-content,
#modalItensBonificacao .modal-content,
#modalGerenciarUsuarios .modal-content {
  width: 1280px;
  max-width: 96vw;
  max-height: 94vh;
  padding: 22px 26px;
  background: var(--bg-secondary);
}

#modalRegistrarContatoCrm .modal-content {
  width: 720px;
  max-width: 95vw;
  max-height: 92vh;
  padding: 24px 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

/* Botões de Ação no Topo do Raio-X do Cliente */
.btn-action-rx-whats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.28));
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #10b981;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.btn-action-rx-whats:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(5, 150, 105, 0.5));
  border-color: #10b981;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-action-rx-pipeline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(139, 92, 246, 0.28));
  border: 1px solid rgba(129, 140, 248, 0.55);
  color: #e0e7ff;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.btn-action-rx-pipeline:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.5));
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .btn-action-rx-whats {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

[data-theme="light"] .btn-action-rx-whats:hover {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
}

[data-theme="light"] .btn-action-rx-pipeline {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

[data-theme="light"] .btn-action-rx-pipeline:hover {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

[data-theme="light"] #crmModalHistoricoContainer {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}

[data-theme="light"] #modalRegistrarContatoCrm .modal-content {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12) !important;
}

/* ==========================================================================
   NAVEGAÇÃO POR ABAS / TABS EM MODAIS E PAINÉIS
   ========================================================================== */
.modal-tab-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.btn-time-filter,
.modal-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
  text-decoration: none;
}

.btn-time-filter:hover,
.modal-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.btn-time-filter.active,
.modal-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), #6366f1) !important;
  color: #ffffff !important;
  font-weight: 800;
  border-color: rgba(129, 140, 248, 0.5) !important;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35) !important;
}

[data-theme="light"] .modal-tab-nav {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

[data-theme="light"] .btn-time-filter,
[data-theme="light"] .modal-tab-btn {
  color: #475569;
}

[data-theme="light"] .btn-time-filter:hover,
[data-theme="light"] .modal-tab-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .btn-time-filter.active,
[data-theme="light"] .modal-tab-btn.active {
  background: #ffffff !important;
  color: #4338ca !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.modal-content .card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .modal-content .card-box {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .modal-content .kpi-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* Sticky Headers para Tabelas Analíticas e Modais */
.data-table thead th,
.table-powerbi-ritmo thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--table-th-bg);
  box-shadow: 0 1px 0 var(--border-color);
}

[data-theme="light"] .data-table thead th,
[data-theme="light"] .table-powerbi-ritmo thead th {
  background: #f8fafc;
  box-shadow: 0 1px 0 #e2e8f0;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  width: 0%;
  transition: width 0.3s ease;
}

/* --- Avatares & Fotos de Consultores --- */
.consultor-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-color);
  background: var(--bg-input);
}

.avatar-fallback-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  border: 1.5px solid var(--border-color);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* --- Modais de Celebração Corporativa & Reconhecimento na TV --- */
.modal-brand-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-brand-logo {
  max-height: 44px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.45));
}

.modal-brand-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.modal-avatar-wrapper {
  margin: 6px auto 14px auto;
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-avatar-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent-emerald);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.6), 0 0 70px rgba(16, 185, 129, 0.3);
  background: var(--bg-secondary);
}

.modal-avatar-fallback {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 2.8rem;
  border: 4px solid var(--accent-emerald);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.6);
}

.modal-avatar-img.milestone {
  border-color: var(--accent-amber);
  box-shadow: 0 0 45px rgba(245, 158, 11, 0.7), 0 0 90px rgba(245, 158, 11, 0.35);
}

.modal-avatar-fallback.milestone {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  border-color: var(--accent-amber);
  box-shadow: 0 0 45px rgba(245, 158, 11, 0.7);
}

.modal-avatar-img.sino {
  border-color: #fbbf24;
  box-shadow: 0 0 50px rgba(251, 191, 36, 0.85), 0 0 100px rgba(245, 158, 11, 0.45);
}

.modal-avatar-fallback.sino {
  background: linear-gradient(135deg, #d97706, #b45309, #78350f);
  border-color: #fbbf24;
  box-shadow: 0 0 50px rgba(251, 191, 36, 0.85);
}

/* Sino Badalando Flutuando Projetado Para Fora do Card 🔔 */
.bell-floating-outer {
  position: absolute;
  top: -34px;
  right: -24px;
  transform-origin: top center;
  animation: bellSwing 1.5s ease-in-out infinite, bellGlowPulse 2s ease-in-out infinite;
  font-size: 4.4rem;
  line-height: 1;
  z-index: 10;
  cursor: pointer;
  filter: drop-shadow(0 0 25px rgba(251, 191, 36, 0.95)) drop-shadow(0 0 45px rgba(245, 158, 11, 0.8));
}

/* Ícone de Troféu Flutuando Para Fora no Card de Venda e Milestone */
.trophy-floating-outer {
  position: absolute;
  top: -30px;
  right: -20px;
  font-size: 3.8rem;
  line-height: 1;
  z-index: 10;
  animation: bounce 2s infinite;
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.8));
}

.trophy-floating-outer.milestone {
  filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.9));
}

/* Régua Visual dos Marcos da Lousa (50% e 100%) 🎨 */
.lousa-regua-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 191, 36, 0.25);
  margin: 10px 0;
}

.lousa-regua-step {
  padding: 10px 8px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.lousa-regua-step.painted {
  background: linear-gradient(180deg, #fbbf24, #d97706);
  color: #000;
  border-color: #fef08a;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
  transform: scale(1.05);
}

.lousa-regua-step.current {
  background: linear-gradient(180deg, #34d399, #059669);
  color: #fff;
  border-color: #6ee7b7;
  box-shadow: 0 0 15px rgba(52, 211, 153, 0.8);
  animation: pulseNeon 1.2s infinite;
}

.celebration-timer-bar.sino {
  background: linear-gradient(90deg, #fbbf24, #f59e0b, #ec4899);
}

/* --- Barra de Timer e Fila de Comemorações --- */
.celebration-timer-container {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 14px;
}

.celebration-timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent-emerald);
  transition: width linear;
}

.celebration-timer-bar.milestone {
  background: var(--accent-amber);
}

.celebration-timer-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.queue-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Botão de Comemoração Manual 🎉 */
.btn-celebrate-sale {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
  white-space: nowrap;
}

[data-theme="light"] .btn-celebrate-sale {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.4);
}

.btn-celebrate-sale:hover {
  background: var(--accent-emerald);
  color: #000;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

.btn-celebrate-sale:active {
  transform: scale(0.95);
}

.modal-content.celebration {
  cursor: default;
}

/* Alternador de Tema Moderno (Pill Toggle) */
.theme-pill-toggle,
.theme-toggle-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  user-select: none;
}

.theme-pill-toggle:hover,
.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  border-color: var(--accent-primary);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.2);
}

.theme-pill-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: transform 0.3s ease;
}

.theme-pill-toggle:hover .theme-pill-indicator {
  transform: rotate(20deg) scale(1.15);
}

.theme-pill-label {
  font-size: 0.8rem;
  letter-spacing: -0.2px;
}

[data-theme="light"] .theme-pill-toggle,
[data-theme="light"] .theme-toggle-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .theme-pill-toggle:hover,
[data-theme="light"] .theme-toggle-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Botões de Logoff / Sair */
.btn-top-logout {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-top-logout:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}

.btn-sidebar-logout {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 4px;
}

.btn-sidebar-logout:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
}

[data-theme="light"] .btn-top-logout {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #e11d48;
}

[data-theme="light"] .btn-top-logout:hover {
  background: #e11d48;
  color: #ffffff;
}

[data-theme="light"] .btn-sidebar-logout {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #e11d48;
}

[data-theme="light"] .btn-sidebar-logout:hover {
  background: #e11d48;
  color: #ffffff;
}

/* Botão Nativo de Upload de Foto */
.btn-upload-foto {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-upload-foto:hover {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* User Profile Widget & Login Modal */
.user-profile-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.user-profile-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.role-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
  text-transform: uppercase;
}

.role-badge.admin {
  background: rgba(239, 68, 68, 0.18);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.role-badge.gestor {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.role-badge.consultor {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Tabela de Ritmo do Consultor */
.semana-row-header {
  background: rgba(99, 102, 241, 0.12) !important;
  font-weight: 700;
  color: var(--accent-cyan);
}

[data-theme="light"] .semana-row-header {
  background: #eef2ff !important;
  color: #4f46e5 !important;
}

.table-ritmo tr.hoje-highlight {
  background: rgba(6, 182, 212, 0.15) !important;
  border-left: 3px solid var(--accent-cyan);
}

[data-theme="light"] .table-ritmo tr.hoje-highlight {
  background: #ecfeff !important;
  border-left: 3px solid #06b6d4;
}

.status-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-align: center;
  display: inline-block;
  white-space: nowrap;
}

.status-tag.atingida {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

[data-theme="light"] .status-tag.atingida {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-tag.abaixo {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

[data-theme="light"] .status-tag.abaixo {
  background: #ffe4e6;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.status-tag.futuro {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

[data-theme="light"] .status-tag.futuro {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Modal de Ajuste / Corte de Foto Estilo WhatsApp */
.crop-viewport-container {
  position: relative;
  width: 340px;
  height: 340px;
  max-width: 100%;
  margin: 8px auto 14px auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0f172a;
  cursor: grab;
  user-select: none;
  touch-action: none;
  border: 1px solid var(--border-color);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.crop-viewport-container:active {
  cursor: grabbing;
}

#cropCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.crop-circular-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.75) 50%);
  border-radius: var(--radius-md);
}

/* ==========================================
   MODO APRESENTAÇÃO (SLIDESHOW / TV)
   ========================================== */
body.presentation-active .sidebar {
  transform: translateX(-100%);
  width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  overflow: hidden !important;
}

body.presentation-active .top-header {
  display: none !important;
}

body.presentation-active .content-scrollable {
  padding: 24px 36px;
  overflow-y: auto;
}

/* Barra Flutuante de Controle da Apresentação */
.presentation-floating-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
  color: #fff;
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.3s ease;
  animation: slideUp 0.3s ease;
}

.presentation-floating-bar.auto-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(30px);
  pointer-events: none;
}

[data-theme="light"] .presentation-floating-bar {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .presentation-floating-bar span#presCurrentScreenTitle {
  color: #0f172a !important;
}

.pres-bar-divider {
  height: 24px;
  width: 1px;
  background: rgba(255, 255, 255, 0.18);
}

[data-theme="light"] .pres-bar-divider {
  background: rgba(0, 0, 0, 0.12);
}

/* Botões da Barra Flutuante */
.btn-pres-control {
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  font-family: inherit;
}

.btn-pres-control:active {
  transform: scale(0.95);
}

.btn-pres-nav {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: 6px 14px;
}

.btn-pres-nav:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
  color: #fff;
}

[data-theme="light"] .btn-pres-nav {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .btn-pres-nav:hover {
  background: #e2e8f0;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-pres-play {
  background: var(--accent-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-pres-play:hover {
  transform: scale(1.08);
  background: #4f46e5;
}

.btn-pres-cfg {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.btn-pres-cfg:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

[data-theme="light"] .btn-pres-cfg {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
}

[data-theme="light"] .btn-pres-cfg:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-pres-exit {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.btn-pres-exit:hover {
  background: rgba(244, 63, 94, 0.3);
  color: #fff;
}

.presentation-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 10000;
}

.presentation-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  width: 0%;
  transition: width 0.1s linear;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================
   RESPONSIVIDADE MULTI-RESOLUÇÃO
   ========================================== */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 72px;
    padding: 18px 8px;
  }
  .sidebar .logo-container {
    padding: 0 0 12px 0;
    justify-content: center;
  }
  .sidebar .logo-container img {
    max-height: 28px;
    max-width: 36px;
  }
  .sidebar .nav-item {
    justify-content: center;
    padding: 10px 6px;
  }
  .sidebar .nav-item span:not(.nav-icon) {
    display: none;
  }
  .sidebar .sidebar-footer button span:not(:first-child),
  .sidebar .ws-status-badge span:not(.pulse-dot) {
    display: none;
  }
  .hide-on-compact {
    display: none;
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .top-header {
    padding: 12px 14px;
  }
  .content-scrollable {
    padding: 14px 12px;
  }
  .filters-bar {
    gap: 8px;
  }
  .filter-select, .filter-input {
    width: 100%;
  }
}

/* ==========================================
   RESUMO ANUAL / HEATMAP MATRIX & ANALYTICS
   ========================================== */
.heatmap-matrix {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 100%;
  font-size: 0.74rem;
  table-layout: auto;
}

.heatmap-matrix th, .heatmap-matrix td {
  padding: 5px 2px;
  text-align: center;
  white-space: nowrap;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.heatmap-matrix thead th {
  background: var(--table-th-bg);
  position: sticky;
  top: 0;
  z-index: 6;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 6px 2px;
}

.heatmap-matrix th.sticky-col,
.heatmap-matrix td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg-secondary);
  text-align: left;
  padding-left: 8px;
  padding-right: 6px;
  font-weight: 700;
  min-width: 125px;
  border-right: 2px solid var(--border-color);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
}

.heatmap-matrix thead th.sticky-col {
  z-index: 8;
}

.heatmap-matrix tfoot tr td.sticky-col {
  background: var(--bg-secondary);
  z-index: 7;
}

.heatmap-matrix th.sticky-total,
.heatmap-matrix td.sticky-total {
  position: sticky;
  right: 0;
  z-index: 5;
  font-weight: 800;
  background: var(--bg-secondary);
  border-left: 2px solid var(--border-color);
  box-shadow: -2px 0 6px rgba(0, 0, 0, 0.15);
  min-width: 95px;
  text-align: right;
  padding-right: 8px;
}

.heatmap-matrix thead th.sticky-total {
  z-index: 8;
}

.heatmap-matrix tfoot tr td.sticky-total {
  background: var(--bg-secondary);
  color: var(--accent-emerald);
  z-index: 7;
}

.heatmap-matrix tfoot tr td {
  background: var(--bg-secondary);
  font-weight: 800;
  border-top: 2px solid var(--border-color);
}

.heatmap-year-row {
  cursor: pointer;
  background: rgba(99, 102, 241, 0.08);
  font-weight: 800;
  user-select: none;
  transition: var(--transition);
}

[data-theme="light"] .heatmap-year-row {
  background: #f1f5f9;
}

.heatmap-year-row:hover {
  background: rgba(99, 102, 241, 0.18);
}

.heatmap-month-row {
  transition: var(--transition);
}

.heatmap-month-row.hidden {
  display: none;
}

.heatmap-cell {
  position: relative;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
  border-radius: 2px;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  z-index: 10;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  filter: brightness(1.2);
}

/* Tabelas Hierárquicas e Analíticas */
.tree-parent-row {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  transition: var(--transition);
}

.tree-parent-row:hover {
  background: var(--table-tr-hover);
}

.tree-child-row {
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.76rem;
  color: var(--text-secondary);
}

[data-theme="light"] .tree-child-row {
  background: rgba(0, 0, 0, 0.02);
}

.tree-child-row.hidden {
  display: none;
}

/* ==========================================
   ESTILOS DA GESTÃO DE FILTROS & REGRAS (SWITCHES & BADGES)
   ========================================== */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  cursor: pointer;
  user-select: none;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.18);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: 0.25s ease;
}

[data-theme="light"] .switch-slider {
  background-color: #cbd5e1;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #fff;
  border-radius: 50%;
  transition: 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.switch-toggle input:checked + .switch-slider {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(18px);
}

.badge-op-fiscal {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.78rem;
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
  transition: var(--transition);
}

.badge-op-fiscal.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.1);
  text-decoration: line-through;
}

[data-theme="light"] .badge-op-fiscal.inactive {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.badge-status-filtro {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.78rem;
  transition: var(--transition);
}

.badge-status-filtro.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status-filtro.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: line-through;
}

[data-theme="light"] .badge-status-filtro.inactive {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.btn-icon-del {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.65;
  transition: var(--transition);
}

.btn-icon-del:hover {
  opacity: 1;
  background: rgba(244, 63, 94, 0.2);
  transform: scale(1.15);
}

/* ==========================================================================
   PÓDIO DOS CAMPEÕES COMERCIAIS & DESTAQUES (TOP 3 / TOP 5)
   ========================================================================== */

.podio-toggle-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  gap: 4px;
}

[data-theme="light"] .podio-toggle-group {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.btn-podio-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-podio-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.btn-podio-toggle.active {
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
  font-weight: 700;
}

[data-theme="light"] .btn-podio-toggle.active {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: #ffffff;
}

/* Container do Pódio */
.podio-container {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  align-items: end;
  width: 100%;
}

.podio-container.mode-top3 {
  grid-template-columns: 1fr 1.15fr 1fr;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.podio-container.mode-top5 {
  grid-template-columns: repeat(5, 1fr);
  max-width: 100%;
}

@media (max-width: 1024px) {
  .podio-container.mode-top5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .podio-container.mode-top3,
  .podio-container.mode-top5 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SUB-NAVEGAÇÃO CONTEXTUAL POR PILARES (HUB NAVIGATION)
   ========================================================================== */

.subnav-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: thin;
  flex-shrink: 0;
  min-height: 52px;
}

[data-theme="light"] .subnav-bar {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.subnav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.subnav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

.subnav-icon {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.subnav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .subnav-btn {
  color: #475569;
}

[data-theme="light"] .subnav-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.subnav-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: #ffffff !important;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .subnav-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ==========================================================================
   GAUGE / VELOCÍMETRO DE ATINGIMENTO DA META DO DIA
   ========================================================================== */

.gauge-card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 6px 0;
}

.gauge-svg {
  width: 170px;
  height: 90px;
  overflow: visible;
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 14;
  stroke-linecap: round;
}

[data-theme="light"] .gauge-bg {
  stroke: #e2e8f0;
}

.gauge-fill {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 126;
  stroke-dashoffset: 126;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.gauge-value-text {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-top: -26px;
  letter-spacing: -0.5px;
}

/* Interatividade e Filtro Cruzado no Pódio do Dia */
.podio-dia-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.podio-dia-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.podio-dia-item:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.podio-dia-item.active {
  background: rgba(16, 185, 129, 0.15) !important;
  border: 1.5px solid var(--accent-emerald) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25) !important;
}

.podio-dia-rank {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.podio-dia-val {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent-emerald);
}

/* Estado Dourado / Campeão para Atingimento >= 100% da Meta do Dia */
.kpi-card.kpi-card-gold {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.08), rgba(251, 191, 36, 0.14)) !important;
  border: 1px solid rgba(251, 191, 36, 0.55) !important;
  border-left: 4px solid #fbbf24 !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.25), inset 0 0 15px rgba(251, 191, 36, 0.08) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .kpi-card.kpi-card-gold {
  background: linear-gradient(135deg, #fffbeb, #fef3c7) !important;
  border-color: #f59e0b !important;
  border-left: 4px solid #d97706 !important;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2) !important;
}

.kpi-card.kpi-card-gold .kpi-title {
  color: #fbbf24 !important;
  font-weight: 700;
}

[data-theme="light"] .kpi-card.kpi-card-gold .kpi-title {
  color: #b45309 !important;
}

.kpi-card.kpi-card-gold .gauge-value-text {
  color: #fbbf24 !important;
  text-shadow: 0 0 14px rgba(245, 158, 11, 0.6);
}

[data-theme="light"] .kpi-card.kpi-card-gold .gauge-value-text {
  color: #b45309 !important;
  text-shadow: none;
}

/* Pódio do Dia */
.podio-dia-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.podio-dia-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.podio-dia-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
}

[data-theme="light"] .podio-dia-item {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .podio-dia-item:hover {
  background: #f1f5f9;
}

.podio-dia-item.pos-1 {
  border-left: 4px solid #fbbf24;
  background: rgba(251, 191, 36, 0.06);
}

.podio-dia-item.pos-2 {
  border-left: 4px solid #94a3b8;
  background: rgba(148, 163, 184, 0.06);
}

.podio-dia-item.pos-3 {
  border-left: 4px solid #f97316;
  background: rgba(249, 115, 22, 0.06);
}


/* Cards do Pódio */
.podio-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 22px 16px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  overflow: hidden;
}

.podio-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

/* Ordem visual no modo Top 3 para criar o pódio olímpico (2º esq, 1º centro, 3º dir) */
.podio-container.mode-top3 .podio-card.pos-1 {
  order: 2;
  min-height: 380px;
  padding-top: 28px;
}
.podio-container.mode-top3 .podio-card.pos-2 {
  order: 1;
  min-height: 340px;
}
.podio-container.mode-top3 .podio-card.pos-3 {
  order: 3;
  min-height: 320px;
}

/* Ordem visual no modo Top 5 para criar o pódio olímpico piramidal (4º, 2º, 1º, 3º, 5º) */
.podio-container.mode-top5 .podio-card.pos-1 {
  order: 3;
  min-height: 400px;
  padding-top: 28px;
}
.podio-container.mode-top5 .podio-card.pos-2 {
  order: 2;
  min-height: 350px;
}
.podio-container.mode-top5 .podio-card.pos-3 {
  order: 4;
  min-height: 330px;
}
.podio-container.mode-top5 .podio-card.pos-4 {
  order: 1;
  min-height: 300px;
}
.podio-container.mode-top5 .podio-card.pos-5 {
  order: 5;
  min-height: 280px;
}

@media (max-width: 1024px) {
  .podio-container.mode-top5 {
    grid-template-columns: repeat(3, 1fr);
  }
  .podio-container.mode-top5 .podio-card {
    order: initial !important;
    min-height: auto !important;
  }
}

@media (max-width: 768px) {
  .podio-container.mode-top3 .podio-card,
  .podio-container.mode-top5 .podio-card {
    order: initial !important;
    min-height: auto !important;
  }
}

/* Cores e Temas Específicos por Posição */

/* 1º Lugar - OURO */
.podio-card.pos-1 {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.14) 0%, rgba(17, 24, 39, 0.85) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 8px 30px rgba(245, 158, 11, 0.18);
}
[data-theme="light"] .podio-card.pos-1 {
  background: linear-gradient(180deg, #fef3c7 0%, #ffffff 100%);
  border-color: #f59e0b;
}

/* 2º Lugar - PRATA */
.podio-card.pos-2 {
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.12) 0%, rgba(17, 24, 39, 0.85) 100%);
  border: 1.5px solid rgba(226, 232, 240, 0.35);
  box-shadow: 0 6px 24px rgba(226, 232, 240, 0.12);
}
[data-theme="light"] .podio-card.pos-2 {
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
  border-color: #94a3b8;
}

/* 3º Lugar - BRONZE */
.podio-card.pos-3 {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.12) 0%, rgba(17, 24, 39, 0.85) 100%);
  border: 1.5px solid rgba(249, 115, 22, 0.35);
  box-shadow: 0 6px 24px rgba(249, 115, 22, 0.12);
}
[data-theme="light"] .podio-card.pos-3 {
  background: linear-gradient(180deg, #ffedd5 0%, #ffffff 100%);
  border-color: #f97316;
}

/* 4º Lugar - SAFIRA / AZUL */
.podio-card.pos-4 {
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.10) 0%, rgba(17, 24, 39, 0.85) 100%);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
[data-theme="light"] .podio-card.pos-4 {
  background: linear-gradient(180deg, #e0f2fe 0%, #ffffff 100%);
  border-color: #38bdf8;
}

/* 5º Lugar - AMETISTA / ROXO */
.podio-card.pos-5 {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.10) 0%, rgba(17, 24, 39, 0.85) 100%);
  border: 1px solid rgba(168, 85, 247, 0.3);
}
[data-theme="light"] .podio-card.pos-5 {
  background: linear-gradient(180deg, #f3e8ff 0%, #ffffff 100%);
  border-color: #c084fc;
}

/* Badge de Medalha / Posição */
.podio-badge-rank {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.podio-card.pos-1 .podio-badge-rank {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #000000;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}
.podio-card.pos-2 .podio-badge-rank {
  background: linear-gradient(135deg, #f8fafc, #94a3b8);
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(148, 163, 184, 0.3);
}
.podio-card.pos-3 .podio-badge-rank {
  background: linear-gradient(135deg, #fb923c, #c2410c);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.3);
}
.podio-card.pos-4 .podio-badge-rank {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #ffffff;
}
.podio-card.pos-5 .podio-badge-rank {
  background: linear-gradient(135deg, #c084fc, #7e22ce);
  color: #ffffff;
}

/* Avatar Container & Efeitos */
.podio-avatar-wrapper {
  position: relative;
  margin-bottom: 12px;
  display: inline-block;
}

.podio-crown-icon {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.8));
  animation: podioFloat 2.5s ease-in-out infinite alternate;
  z-index: 2;
}

@keyframes podioFloat {
  0% { transform: translateX(-50%) translateY(0px) rotate(-3deg); }
  100% { transform: translateX(-50%) translateY(-5px) rotate(3deg); }
}

.podio-avatar-img {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  transition: var(--transition);
}

.podio-card.pos-1 .podio-avatar-img,
.podio-card.pos-1 .podio-avatar-fallback {
  width: 86px;
  height: 86px;
  border: 3.5px solid #fbbf24;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.5);
}

.podio-card.pos-2 .podio-avatar-img,
.podio-card.pos-2 .podio-avatar-fallback {
  width: 76px;
  height: 76px;
  border: 3px solid #cbd5e1;
  box-shadow: 0 0 16px rgba(203, 213, 225, 0.4);
}

.podio-card.pos-3 .podio-avatar-img,
.podio-card.pos-3 .podio-avatar-fallback {
  width: 72px;
  height: 72px;
  border: 3px solid #fb923c;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.4);
}

.podio-card.pos-4 .podio-avatar-img,
.podio-card.pos-4 .podio-avatar-fallback,
.podio-card.pos-5 .podio-avatar-img,
.podio-card.pos-5 .podio-avatar-fallback {
  width: 66px;
  height: 66px;
  border: 2.5px solid var(--border-color);
}

.podio-avatar-fallback {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

[data-theme="light"] .podio-avatar-fallback {
  background: #e2e8f0;
  color: #1e293b;
}

/* Informações do Consultor */
.podio-consultor-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podio-card.pos-1 .podio-consultor-name {
  font-size: 1.12rem;
  font-weight: 800;
}

.podio-status-tag {
  margin-bottom: 12px;
}

/* Faturamento Líquido */
.podio-fat-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
}

[data-theme="light"] .podio-fat-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.podio-fat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.podio-fat-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-emerald);
  margin-top: 2px;
}

.podio-card.pos-1 .podio-fat-val {
  font-size: 1.28rem;
}

/* Progresso da Meta */
.podio-meta-box {
  width: 100%;
  margin-bottom: 10px;
}

.podio-meta-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.podio-meta-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

[data-theme="light"] .podio-meta-bar-bg {
  background: #e2e8f0;
}

.podio-meta-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

/* Vendas Hoje Destaque */
.podio-hoje-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.podio-hoje-badge.empty {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-weight: 500;
}

[data-theme="light"] .podio-hoje-badge.empty {
  background: #f1f5f9;
}

/* Rodapé / Mini métricas */
.podio-mini-metrics {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Isolamento de Alto Contraste dos Modais de Comemoração (Imune ao Tema Claro) --- */
#modalVendaRealizada .modal-content,
#modalMilestone .modal-content,
#modalConsultorSino .modal-content {
  color: #f8fafc !important;
  overflow: visible !important;
}

[data-theme="light"] #modalVendaRealizada .modal-content,
[data-theme="light"] #modalMilestone .modal-content,
[data-theme="light"] #modalConsultorSino .modal-content {
  color: #f8fafc !important;
}

[data-theme="light"] #saleModalCliente {
  color: #ffffff !important;
}

[data-theme="light"] #saleModalItens {
  color: #e2e8f0 !important;
}

[data-theme="light"] #modalVendaRealizada span[style*="color: var(--text-muted)"],
[data-theme="light"] #modalMilestone span[style*="color: var(--text-muted)"],
[data-theme="light"] #modalConsultorSino span[style*="color: var(--text-muted)"] {
  color: #94a3b8 !important;
}

/* --- Tabela Estilo Power BI Acompanhamento Diário & Semanal --- */
.table-powerbi-ritmo {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-powerbi-ritmo th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.82rem;
}

[data-theme="light"] .table-powerbi-ritmo th {
  background: #f8fafc;
  color: #475569;
}

.table-powerbi-ritmo .tr-week-header {
  background: rgba(99, 102, 241, 0.08);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.table-powerbi-ritmo .tr-week-header:hover {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .table-powerbi-ritmo .tr-week-header {
  background: #f1f5f9;
  color: #1e293b;
}

.table-powerbi-ritmo .tr-week-header td {
  padding: 8px 14px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.btn-week-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: bold;
  margin-right: 8px;
  cursor: pointer;
  line-height: 1;
}

[data-theme="light"] .btn-week-toggle {
  background: #e2e8f0;
  color: #334155;
}

.table-powerbi-ritmo .tr-day-row {
  transition: var(--transition);
}

.table-powerbi-ritmo .tr-day-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .table-powerbi-ritmo .tr-day-row:hover {
  background: #f8fafc;
}

.table-powerbi-ritmo .tr-day-row td {
  padding: 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .table-powerbi-ritmo .tr-day-row td {
  border-bottom: 1px solid #f1f5f9;
}

.table-powerbi-ritmo .day-number-badge {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-left: 26px;
  min-width: 24px;
}

[data-theme="light"] .table-powerbi-ritmo .day-number-badge {
  background: #e2e8f0;
  color: #475569;
}

.table-powerbi-ritmo .tr-total-footer {
  background: rgba(255, 255, 255, 0.07);
  font-weight: 800;
  font-size: 0.92rem;
  border-top: 2px solid var(--border-color);
}

[data-theme="light"] .table-powerbi-ritmo .tr-total-footer {
  background: #e2e8f0;
  color: #0f172a;
}

.table-powerbi-ritmo .tr-total-footer td {
  padding: 10px 14px;
}

.desvio-negativo {
  color: var(--accent-rose);
  font-weight: 600;
}

.desvio-positivo {
  color: var(--accent-emerald);
  font-weight: 600;
}

/* ==========================================================================
   PRELOADER INICIAL DO SISTEMA (DNA VITAL)
   ========================================================================== */
.app-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000000;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.app-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

[data-theme="light"] .app-preloader {
  background: #f1f5f9;
}

.preloader-ambient-glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.22) 0%, rgba(99, 102, 241, 0.12) 50%, transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  animation: preloaderPulse 2.4s ease-in-out infinite alternate;
}

[data-theme="light"] .preloader-ambient-glow {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.18) 0%, rgba(99, 102, 241, 0.10) 50%, transparent 70%);
}

@keyframes preloaderPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

.preloader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.preloader-logo-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader-logo {
  max-width: 210px;
  height: auto;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.35));
  animation: preloaderFloat 3s ease-in-out infinite;
}

@keyframes preloaderFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.preloader-loading-bar {
  width: 150px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

[data-theme="light"] .preloader-loading-bar {
  background: rgba(0, 0, 0, 0.06);
}

.preloader-bar-fill {
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #6366f1, #10b981);
  border-radius: 999px;
  position: absolute;
  animation: preloaderIndeterminate 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes preloaderIndeterminate {
  0% { left: -50%; width: 30%; }
  50% { left: 25%; width: 60%; }
  100% { left: 100%; width: 30%; }
}

.preloader-status-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.5px;
  animation: preloaderTextFade 1.6s ease-in-out infinite alternate;
}

[data-theme="light"] .preloader-status-text {
  color: #64748b;
}

@keyframes preloaderTextFade {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ==========================================================================
   TELA DE LOGIN MINIMALISTA (DNA VITAL)
   ========================================================================== */
.login-screen-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease, background 0.3s ease;
}

.login-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-theme-pill {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f1f5f9;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  user-select: none;
}

.login-theme-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
  color: #ffffff;
}

.login-theme-icon {
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.login-theme-pill:hover .login-theme-icon {
  transform: rotate(20deg) scale(1.15);
}

.login-theme-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.login-ambient-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 550px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(99, 102, 241, 0.08) 45%, transparent 70%);
  filter: blur(70px);
  pointer-events: none;
}

.login-card-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  padding: 24px 16px;
  animation: loginFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-minimal-card {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 40px 32px 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
}

.login-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 34px;
}

.login-minimal-logo {
  max-height: 52px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}

.login-form-minimal {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group-minimal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label-minimal {
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.01em;
}

.input-container-minimal {
  position: relative;
  display: flex;
  align-items: center;
}

.input-minimal {
  width: 100%;
  background: #141e33 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: 12px;
  padding: 13px 16px;
  color: #ffffff !important;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.input-minimal::placeholder {
  color: #64748b !important;
  font-weight: 500;
}

.input-minimal:focus {
  background: #17233c !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.2);
  color: #ffffff !important;
}

/* Suporte de Contraste para Autopreenchimento do Navegador (Autofill Dark Mode) */
.input-minimal:-webkit-autofill,
.input-minimal:-webkit-autofill:hover, 
.input-minimal:-webkit-autofill:focus,
.input-minimal:-webkit-autofill:active {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0px 1000px #141e33 inset !important;
  box-shadow: 0 0 0px 1000px #141e33 inset !important;
  transition: background-color 5000s ease-in-out 0s;
  color: #ffffff !important;
  font-weight: 600 !important;
}

.btn-eye-toggle {
  position: absolute;
  right: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 4px;
  color: #94a3b8;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-eye-toggle:hover {
  opacity: 1;
  transform: scale(1.1);
}

.error-msg-minimal {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.btn-submit-minimal {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px -4px rgba(37, 99, 235, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-submit-minimal:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.65);
}

.btn-submit-minimal:active:not(:disabled) {
  transform: translateY(0);
}

.btn-submit-minimal:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   TEMA CLARO (LIGHT THEME) OVERRIDES PARA TELA DE LOGIN
   ========================================================================== */
[data-theme="light"] .login-screen-overlay {
  background: #f1f5f9;
}

[data-theme="light"] .login-theme-pill {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .login-theme-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .login-ambient-glow {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.1) 50%, transparent 75%);
}

[data-theme="light"] .login-minimal-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: #e2e8f0;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .label-minimal {
  color: #334155;
}

[data-theme="light"] .input-minimal {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .input-minimal::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .input-minimal:focus {
  background: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.04);
  color: #0f172a !important;
}

[data-theme="light"] .input-minimal:-webkit-autofill,
[data-theme="light"] .input-minimal:-webkit-autofill:hover, 
[data-theme="light"] .input-minimal:-webkit-autofill:focus,
[data-theme="light"] .input-minimal:-webkit-autofill:active {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  box-shadow: 0 0 0px 1000px #ffffff inset !important;
  color: #0f172a !important;
}

[data-theme="light"] .btn-eye-toggle {
  color: #64748b;
}

[data-theme="light"] .error-msg-minimal {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* =======================================================
   ESTILOS DRAG & DROP - PIPELINE CRM (ESTILO TRELLO)
   ======================================================= */
.kanban-card[draggable="true"] {
  cursor: grab;
  user-select: none;
  -webkit-user-drag: element;
  transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.kanban-card[draggable="true"]:active {
  cursor: grabbing;
}

.kanban-card[draggable="true"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  border-color: var(--accent-primary);
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.97) rotate(1.5deg);
  border: 2px dashed var(--accent-primary) !important;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25) !important;
}

.kanban-column {
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.kanban-cards-container {
  min-height: 250px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.kanban-column.drag-over,
.kanban-cards-container.drag-over {
  background: rgba(59, 130, 246, 0.08) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: inset 0 0 0 2px var(--accent-primary), 0 0 16px rgba(59, 130, 246, 0.2) !important;
}


/* =======================================================
   ESTILOS MAPA DE CALOR GEOGRÁFICO DO BRASIL
   ======================================================= */
.br-map-svg {
  width: 100%;
  max-width: 580px;
  height: auto;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.35));
  transition: all 0.3s ease;
  user-select: none;
}

.br-state {
  cursor: pointer;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill 0.25s ease, stroke 0.25s ease, stroke-width 0.25s ease, filter 0.25s ease, transform 0.25s ease;
  transform-origin: center;
}

.br-state:hover {
  stroke: #ffffff !important;
  stroke-width: 3 !important;
  filter: brightness(1.25) drop-shadow(0 0 12px rgba(255, 255, 255, 0.7)) !important;
}

.br-state.selected {
  stroke: #fbbf24 !important;
  stroke-width: 4 !important;
  filter: drop-shadow(0 0 18px rgba(251, 191, 36, 0.95)) brightness(1.2) !important;
}

.br-state.dimmed {
  opacity: 0.25 !important;
  filter: grayscale(85%) !important;
}

.br-label {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.9);
  user-select: none;
}

.br-label.br-label-lg {
  font-size: 16px;
  letter-spacing: 0.8px;
}

.br-label.br-label-sm {
  font-size: 10.5px;
}

.br-label.br-label-xs {
  font-size: 8.5px;
  font-weight: 900;
}

/* Tooltip 3D Flutuante do Mapa */
.map-tooltip-brasil {
  position: fixed;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  font-size: 0.82rem;
  min-width: 220px;
  max-width: 300px;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.map-tooltip-brasil.visible {
  opacity: 1;
  transform: scale(1);
}

[data-theme="light"] .map-tooltip-brasil {
  background: rgba(255, 255, 255, 0.96);
  border-color: #cbd5e1;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
  color: #0f172a;
}

.map-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.map-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

[data-theme="light"] .map-bar-container {
  background: #e2e8f0;
}

.map-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.top5-estado-card:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  transform: translateY(-1px);
}

[data-theme="light"] .top5-estado-card:hover {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
}

/* ========================================================================== */
/* MÓDULO FINANCEIRO (ABAS, PRESETS E ELEMENTOS VISUAIS)                      */
/* ========================================================================== */
.financeiro-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.financeiro-tabs-nav .tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.financeiro-tabs-nav .tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.financeiro-tabs-nav .tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .financeiro-tabs-nav .tab-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-time-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-time-preset:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.btn-time-preset.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  font-weight: 700;
}

[data-theme="light"] .btn-time-preset {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .btn-time-preset.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   CAMADA DE IA ANALÍTICA (GEMINI 2.5 FLASH) - BRIEFING & COPILOTO DE DADOS
   ========================================================================== */

/* Botão do Header Copiloto IA */
.btn-ai-chat-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #e0e7ff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.15);
}

.btn-ai-chat-header:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(168, 85, 247, 0.4));
  border-color: rgba(168, 85, 247, 0.8);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.35);
  transform: translateY(-1px);
}

.ai-sparkle-icon {
  font-size: 0.95rem;
  animation: aiSparkleGlow 2.5s infinite ease-in-out;
}

@keyframes aiSparkleGlow {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.9; }
  50% { transform: scale(1.18) rotate(12deg); opacity: 1; filter: drop-shadow(0 0 6px #a855f7); }
}

[data-theme="light"] .btn-ai-chat-header {
  background: linear-gradient(135deg, #eef2ff, #f3e8ff);
  border-color: #c084fc;
  color: #6b21a8;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.12);
}

[data-theme="light"] .btn-ai-chat-header:hover {
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  border-color: #9333ea;
  color: #581c87;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

/* Card de Briefing Executivo Diário */
.card-briefing-ai {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card-briefing-ai::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #818cf8, #a855f7, #ec4899);
}

[data-theme="light"] .card-briefing-ai {
  background: linear-gradient(135deg, #ffffff, #faf5ff);
  border-color: rgba(168, 85, 247, 0.3);
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.briefing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 12px;
}

[data-theme="light"] .briefing-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.briefing-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.briefing-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.4);
  font-size: 1.1rem;
}

.briefing-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.briefing-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.briefing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-briefing-refresh, .btn-briefing-chat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-briefing-refresh:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.btn-briefing-chat {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
}

.btn-briefing-chat:hover {
  background: rgba(168, 85, 247, 0.3);
  border-color: #a855f7;
  color: #ffffff;
}

[data-theme="light"] .btn-briefing-refresh {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .btn-briefing-chat {
  background: #f3e8ff;
  border-color: #d8b4fe;
  color: #7e22ce;
}

/* Conteúdo Markdown do Briefing */
.briefing-content {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.briefing-content h1, .briefing-content h2, .briefing-content h3, .briefing-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin: 12px 0 6px 0;
}

.briefing-content p {
  margin: 6px 0;
}

.briefing-content ul, .briefing-content ol {
  margin: 6px 0 10px 20px;
  padding: 0;
}

.briefing-content li {
  margin-bottom: 4px;
}

.briefing-content strong {
  color: #f1f5f9;
  font-weight: 700;
}

[data-theme="light"] .briefing-content strong {
  color: #0f172a;
}

.briefing-content blockquote {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-cyan);
  margin: 8px 0;
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

[data-theme="light"] .briefing-content blockquote {
  background: #f8fafc;
  border-left-color: #0284c7;
}

/* Skeleton Loading para Briefing */
.briefing-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .skeleton-line {
  background: #e2e8f0;
}

.skeleton-line.shimmer {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmerAnim 1.8s infinite;
}

[data-theme="light"] .skeleton-line.shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
}

@keyframes shimmerAnim {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   DRAWER DO CHAT INTERATIVO (COPILOTO DE DADOS)
   ========================================================================== */

.ai-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 92vw;
  height: 100vh;
  background: #0f172a;
  border-left: 1px solid rgba(168, 85, 247, 0.3);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-drawer.open {
  transform: translateX(0);
}

[data-theme="light"] .ai-drawer {
  background: #ffffff;
  border-left-color: rgba(168, 85, 247, 0.25);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
}

.ai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .ai-drawer-header {
  background: #f8fafc;
}

.ai-drawer-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar-glow {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.ai-drawer-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.ai-drawer-badge {
  font-size: 0.72rem;
  color: var(--accent-emerald);
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

.ai-drawer-close-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-drawer-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Quick Chips de Atalho Rápido */
.ai-quick-chips-container {
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .ai-quick-chips-container {
  background: #f1f5f9;
}

.ai-chips-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}

.ai-chips-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: normal;
  line-height: 1.35;
}

.ai-chip-btn:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.45);
  color: #e9d5ff;
  transform: translateX(3px);
}

[data-theme="light"] .ai-chip-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .ai-chip-btn:hover {
  background: #f5f3ff;
  border-color: #c084fc;
  color: #6b21a8;
}

/* Área de Mensagens */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.ai-chat-msg {
  display: flex;
  gap: 12px;
  max-width: 94%;
}

.ai-msg-bot {
  align-self: flex-start;
}

.ai-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.ai-msg-bot .ai-msg-avatar {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.4));
  border: 1px solid rgba(168, 85, 247, 0.5);
}

.ai-msg-user .ai-msg-avatar {
  background: var(--accent-primary);
  color: #ffffff;
}

.ai-msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  word-break: break-word;
}

.ai-msg-bot .ai-msg-bubble {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-top-left-radius: 2px;
}

[data-theme="light"] .ai-msg-bot .ai-msg-bubble {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  border-top-right-radius: 2px;
}

.ai-msg-bubble p {
  margin: 0 0 8px 0;
}

.ai-msg-bubble p:last-child {
  margin-bottom: 0;
}

.ai-msg-bubble ul, .ai-msg-bubble ol {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.ai-msg-bubble li {
  margin-bottom: 4px;
}

.ai-msg-bubble strong {
  font-weight: 700;
  color: inherit;
}

.ai-msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.8rem;
}

.ai-msg-bubble th, .ai-msg-bubble td {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.ai-msg-bubble th {
  background: rgba(0, 0, 0, 0.2);
  font-weight: 700;
}

/* Indicador de Digitação (Typing Indicator) */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid var(--border-color);
}

[data-theme="light"] .ai-typing-indicator {
  background: #f8fafc;
}

.ai-typing-avatar {
  font-size: 1rem;
}

.ai-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-typing-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: dotPulse 1.4s infinite ease-in-out both;
}

.ai-typing-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-typing-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Formulário de Envio */
.ai-chat-form {
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border-color);
}

[data-theme="light"] .ai-chat-form {
  background: #f8fafc;
}

.ai-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  transition: border-color 0.2s ease;
}

[data-theme="light"] .ai-input-wrapper {
  background: #ffffff;
  border-color: #cbd5e1;
}

.ai-input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ai-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  resize: none;
  outline: none;
  max-height: 120px;
  padding: 4px 0;
  line-height: 1.4;
}

.ai-chat-input::placeholder {
  color: var(--text-muted);
}

.ai-send-btn {
  background: var(--accent-primary);
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  background: #4338ca;
  transform: scale(1.05);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-clear-chat {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.btn-clear-chat:hover {
  color: var(--accent-rose);
}

/* ==========================================================================
   TELA DEDICADA: DATA DRIVEN (🤖 INTELIGÊNCIA ANALÍTICA)
   ========================================================================== */

.data-driven-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
  gap: 12px;
}

[data-theme="light"] .data-driven-page-header {
  background: linear-gradient(135deg, #ffffff, #faf5ff);
  border-color: rgba(168, 85, 247, 0.25);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.08);
}

.data-driven-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.data-driven-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.35));
  border: 1px solid rgba(168, 85, 247, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
}

.data-driven-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.3px;
}

.data-driven-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.data-driven-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
}

/* Botão Ver Resumo Diário (Discreto e Alto Contraste) */
.btn-open-briefing-modal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.btn-open-briefing-modal:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .btn-open-briefing-modal {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .btn-open-briefing-modal:hover {
  background: #f8fafc;
  border-color: #6366f1;
  color: #4f46e5;
}

/* Card do Chat Integrado em Tela Cheia */
.data-driven-chat-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

[data-theme="light"] .data-driven-chat-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.data-driven-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
}

[data-theme="light"] .data-driven-chat-header {
  background: #f8fafc;
}

/* Botão Nova Janela */
.btn-new-chat-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-chat-tab:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

[data-theme="light"] .btn-new-chat-tab {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .btn-new-chat-tab:hover {
  background: #e2e8f0;
  border-color: #6366f1;
  color: #4f46e5;
}

/* Barra de Abas / Janelas de Conversa */
.ai-chat-tabs-bar {
  display: flex;
  align-items: center;
  background: rgba(10, 15, 30, 0.75);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 12px 0 12px;
  overflow-x: auto;
  gap: 6px;
}

[data-theme="light"] .ai-chat-tabs-bar {
  background: #f1f5f9;
}

.ai-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}

.ai-chat-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  max-width: 170px;
}

.ai-chat-tab:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

[data-theme="light"] .ai-chat-tab {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .ai-chat-tab:hover {
  background: rgba(0, 0, 0, 0.06);
}

.ai-chat-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
  border-bottom: 2px solid var(--accent-primary);
  font-weight: 700;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.ai-chat-tab.editing {
  max-width: 240px;
  background: var(--bg-card);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
  padding: 3px 8px;
}

.ai-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.ai-tab-title-input {
  background: var(--bg-card);
  border: 1.5px solid var(--accent-primary);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 6px;
  width: 140px;
  outline: none;
  font-family: inherit;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .ai-tab-title-input {
  background: #ffffff;
  border-color: var(--accent-primary);
  color: #0f172a;
}

.ai-tab-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.ai-chat-tab:hover .ai-tab-actions,
.ai-chat-tab.active .ai-tab-actions {
  opacity: 1;
}

.ai-tab-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-tab-btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

[data-theme="light"] .ai-tab-btn-icon:hover {
  background: rgba(0, 0, 0, 0.08);
}

.ai-tab-btn-icon.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}




