/* ==========================================================================
   MetaFlow — Dark Premium SaaS Stylesheet
   Modern, sophisticated, clean executive analytics & financial UI
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Numeric alignment */
.kpi-value, .goal-stat-val, .summary-box strong, td {
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* Refined Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-light);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Layout: Sidebar + Main Content
   ========================================================================== */

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  /* Remove justify-content: space-between — footer now sticks via flex-shrink: 0 */
  padding: 0;
  transition: all var(--transition-normal);
  z-index: 50;
  overflow: hidden; /* prevents sidebar itself from growing beyond viewport */
}

/* Inner scrollable area: brand + nav-menu */
.sidebar > div:first-child {
  flex: 1;
  min-height: 0; /* critical: lets flex child shrink below its content size so overflow-y works */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px 8px 16px;
  /* Custom thin scrollbar — visible only when needed */
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.sidebar > div:first-child::-webkit-scrollbar {
  width: 4px;
}

.sidebar > div:first-child::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar > div:first-child::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 4px;
}

.sidebar > div:first-child::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 4px 12px var(--blue-glow);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.brand-text span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.1px;
}

/* Sidebar Navigation */
.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 18px;
  flex-grow: 1;
}

.nav-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #94A3B8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  position: relative;
  user-select: none;
}

.nav-item[style*="display: none"] {
  display: none !important;
}

.nav-item span {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
  line-height: 1.2;
}

.nav-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #CBD5E1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  box-sizing: border-box;
}

.nav-svg {
  width: 15px;
  height: 15px;
  min-width: 15px;
  max-width: 15px;
  min-height: 15px;
  max-height: 15px;
  display: block;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* Specific WhatsApp Icon Theme */
.nav-icon.nav-icon-whatsapp {
  color: #25D366 !important;
  background: rgba(37, 211, 102, 0.08);
  border-color: rgba(37, 211, 102, 0.22);
}

/* Hover states (Monochrome Contrast) */
.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.09);
}

.nav-item:hover .nav-icon {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.nav-item:hover .nav-icon.nav-icon-whatsapp {
  color: #25D366 !important;
  background: rgba(37, 211, 102, 0.16);
  border-color: rgba(37, 211, 102, 0.38);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.3);
}

/* Active states (Crisp High-Contrast Monochrome) */
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.22);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nav-item.active .nav-icon {
  background: #FFFFFF;
  color: #0F172A;
  border-color: #FFFFFF;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

.nav-item.active .nav-icon.nav-icon-whatsapp {
  background: #25D366 !important;
  color: #FFFFFF !important;
  border-color: #25D366 !important;
  box-shadow: 0 0 14px rgba(37, 211, 102, 0.45);
}

/* Light Theme support */
[data-theme="light"] .nav-item {
  color: #64748B;
}

[data-theme="light"] .nav-icon {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .nav-icon.nav-icon-whatsapp {
  background: rgba(37, 211, 102, 0.1);
  border-color: rgba(37, 211, 102, 0.25);
  color: #16A34A !important;
}

[data-theme="light"] .nav-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #0F172A;
  border-color: rgba(0, 0, 0, 0.09);
}

[data-theme="light"] .nav-item:hover .nav-icon {
  color: #0F172A;
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .nav-item:hover .nav-icon.nav-icon-whatsapp {
  color: #16A34A !important;
  background: rgba(37, 211, 102, 0.18);
  border-color: rgba(37, 211, 102, 0.35);
}

[data-theme="light"] .nav-item.active {
  color: #FFFFFF;
  background: #0F172A;
  border-color: #0F172A;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .nav-item.active .nav-icon {
  background: #FFFFFF;
  color: #0F172A;
  border-color: #FFFFFF;
}

[data-theme="light"] .nav-item.active .nav-icon.nav-icon-whatsapp {
  background: #25D366 !important;
  color: #FFFFFF !important;
  border-color: #25D366 !important;
}

/* ─── Sidebar Collapse Mode ────────────────────────────────── */
.sidebar {
  position: relative;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.22s cubic-bezier(0.16, 1, 0.3, 1), padding 0.22s ease;
}

.sidebar-collapse-btn {
  position: absolute;
  right: -13px;
  top: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 11px;
  flex-shrink: 0;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 8px rgba(56, 189, 248, 0.15);
}

.sidebar-collapse-btn:hover {
  background: var(--bg-surface-light);
  color: #38bdf8;
  border-color: #38bdf8;
  transform: scale(1.15);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

.sidebar.collapsed {
  width: 68px !important;
  min-width: 68px !important;
  padding: 0 !important;
}

.sidebar.collapsed > div:first-child {
  padding: 24px 8px 8px 8px !important;
}

.sidebar.collapsed .brand-text {
  display: none !important;
}

.sidebar.collapsed .brand {
  padding: 0 0 22px 0 !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0 !important;
  width: 100% !important;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar.collapsed .brand img {
  width: 32px !important;
  height: 32px !important;
  margin: 0 auto !important;
  display: block !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center !important;
  padding: 8px 0 !important;
  gap: 0 !important;
  width: 100% !important;
}

.sidebar.collapsed .nav-icon {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  margin: 0 auto !important;
}

.sidebar.collapsed .nav-item span:not(.nav-icon) {
  display: none !important;
}

.sidebar.collapsed .nav-item .badge {
  display: none !important;
}

.sidebar.collapsed .sidebar-user-card {
  padding: 6px 0 !important;
  justify-content: center !important;
}

.sidebar.collapsed .sidebar-user-card > div > div:last-child {
  display: none !important;
}

.sidebar.collapsed #sidebarLogoutBtn {
  display: none !important;
}

.sidebar.collapsed .sidebar-today-pill,
.sidebar.collapsed .system-status {
  display: none !important;
}

.sidebar.collapsed .sidebar-footer {
  padding: 10px 8px 12px 8px !important;
  align-items: center;
}

.sidebar-footer {
  flex-shrink: 0; /* never shrinks — always visible at the bottom */
  padding: 12px 16px 16px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-today-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.sidebar-today-pill .pill-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.sidebar-today-pill .pill-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.system-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald-500);
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--emerald-500);
  border-radius: var(--radius-full);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Main Content Area & Topbar
   ========================================================================== */

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100%;
  min-width: 0;
  background-color: var(--bg-app);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background-color: var(--bg-card-glass);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.page-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.page-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Discreet Live Clock & Server Status in Topbar */
.topbar-status-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  height: 34px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.topbar-clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.topbar-clock-pill i {
  font-size: 12px;
  color: var(--blue-400);
}

.topbar-divider {
  width: 1px;
  height: 14px;
  background-color: var(--border-subtle);
}

.topbar-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--emerald-400);
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--emerald-500);
  border-radius: var(--radius-full);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2.5s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-surface-light);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Premium SaaS Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 2px 8px var(--blue-glow);
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--blue-600), var(--blue-700));
  box-shadow: 0 2px 12px var(--blue-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-light);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--red-bg);
  color: var(--rose-500);
  border: 1px solid var(--red-border);
}

.btn-danger:hover {
  background-color: var(--rose-500);
  color: #FFFFFF;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-xs);
}

/* Content Views */
.view-section {
  padding: 24px 32px;
  display: none;
  animation: saasFadeIn 0.2s ease-out;
}

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

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

/* ==========================================================================
   Period Filter Pills
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.period-pills {
  display: inline-flex;
  background-color: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 3px;
}

.period-pill {
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.period-pill:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
}

.period-pill.active {
  background-color: var(--blue-600);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.35);
}

.custom-date-range {
  display: none;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.custom-date-range.visible {
  display: inline-flex;
}

/* Input Controls */
.input-control, select.input-control, textarea.input-control {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

select.input-control {
  cursor: pointer;
}

select.input-control option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 12px;
}

.input-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-sm {
  padding: 5px 9px;
  font-size: 12px;
}

/* Pulsing Red Action Button */
.btn-danger-pulsing {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff !important;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 2s infinite cubic-bezier(0.66, 0, 0, 1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  width: 100%;
  text-decoration: none;
}

.btn-danger-pulsing:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.55);
}

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

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* ==========================================================================
   KPI Cards Grid — Dark Premium SaaS
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
}

.kpi-card.highlight::before {
  background: linear-gradient(90deg, var(--blue-500), var(--blue-400));
}

.kpi-card.positive::before {
  background: linear-gradient(90deg, var(--emerald-500), #34D399);
}

.kpi-card.negative::before {
  background: linear-gradient(90deg, var(--rose-500), #FB7185);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-positive {
  background-color: var(--green-bg);
  color: var(--emerald-500);
  border: 1px solid var(--green-border);
}

.badge-negative {
  background-color: var(--red-bg);
  color: var(--rose-500);
  border: 1px solid var(--red-border);
}

.badge-neutral {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-purple {
  background-color: var(--blue-subtle);
  color: var(--blue-400);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   Goal Banner & Progress
   ========================================================================== */

.goal-banner {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.goal-banner-info h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.goal-banner-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.goal-stats-row {
  display: flex;
  gap: 24px;
  align-items: center;
}

.goal-stat-item {
  display: flex;
  flex-direction: column;
}

.goal-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.goal-stat-val {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.progress-container {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-bg {
  height: 6px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-600), var(--emerald-500));
  border-radius: var(--radius-full);
  transition: width 0.6s ease-in-out;
}

/* ==========================================================================
   Charts Section
   ========================================================================== */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.chart-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.chart-card.full-width {
  grid-column: 1 / -1;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-card-header span {
  font-size: 12px;
  color: var(--text-muted);
}

.chart-body {
  position: relative;
  height: 270px;
  width: 100%;
}

/* ==========================================================================
   Calendar View
   ========================================================================== */

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-nav h3 {
  font-size: 17px;
  font-weight: 700;
  min-width: 170px;
  text-align: center;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-day-cell {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  min-height: 105px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-day-cell:hover {
  border-color: var(--blue-500);
  background-color: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.calendar-day-cell.empty {
  background-color: transparent;
  border-color: transparent;
  cursor: default;
}

.calendar-day-cell.today {
  border-color: var(--blue-500);
  background: var(--blue-subtle);
}

.cal-day-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cal-day-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  font-size: 11px;
}

.cal-stat-line {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}

.cal-stat-line.profit-pos {
  color: var(--emerald-500);
  font-weight: 600;
}

.cal-stat-line.profit-neg {
  color: var(--rose-500);
  font-weight: 600;
}

/* ==========================================================================
   Forms & Daily Record Builder
   ========================================================================== */

.form-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.sales-builder-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 20px;
}

.sales-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sales-builder-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sales-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sale-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr 40px;
  gap: 8px;
  align-items: center;
  background-color: var(--bg-card);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.daily-live-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.summary-box {
  display: flex;
  flex-direction: column;
}

.summary-box span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.summary-box strong {
  font-size: 15px;
  color: var(--text-primary);
  margin-top: 2px;
  font-weight: 700;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.custom-table thead {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.custom-table th {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.4px;
}

.custom-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.custom-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Planner Scenario Cards
   ========================================================================== */

.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.scenario-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.scenario-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.scenario-card-header {
  margin-bottom: 14px;
}

.scenario-card-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.scenario-card-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.scenario-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
  padding: 12px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.scenario-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.scenario-item span.plan {
  font-weight: 600;
  color: var(--blue-400);
}

.scenario-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
}

.scenario-card-footer strong {
  font-size: 15px;
  color: var(--emerald-500);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.97);
  transition: transform var(--transition-fast);
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

/* ═══════════════════════════════════════════════════════════
   SLIDE-OVER DRAWER (PAINEL LATERAL DIREITO)
═══════════════════════════════════════════════════════════ */
.modal-backdrop.drawer-right {
  justify-content: flex-end;
  align-items: stretch;
}

.modal-backdrop.drawer-right .modal-content {
  width: 100%;
  max-width: 540px;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border-left: 1px solid var(--border-subtle);
  border-top: none;
  border-right: none;
  border-bottom: none;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  box-shadow: -12px 0 35px rgba(0, 0, 0, 0.55);
}

.modal-backdrop.drawer-right-wide .modal-content {
  max-width: 660px;
}

@media (max-width: 768px) {
  .modal-backdrop.drawer-right .modal-content,
  .modal-backdrop.drawer-right-wide .modal-content {
    max-width: 100%;
  }
}

.modal-backdrop.drawer-right.active .modal-content {
  transform: translateX(0);
}

.modal-backdrop.drawer-right .modal-header {
  padding: 18px 24px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-backdrop.drawer-right .modal-body {
  padding: 22px 24px;
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-backdrop.drawer-right .modal-footer {
  padding: 16px 24px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Modular Drawer Cards & Layout Helpers */
.drawer-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.drawer-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.drawer-live-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 580px) {
  .drawer-live-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.drawer-summary-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-summary-pill span {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.drawer-summary-pill strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-sale-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: border-color var(--transition-fast);
}

.drawer-sale-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.drawer-sale-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-sale-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .drawer-sale-row-2col {
    grid-template-columns: 1fr;
  }
}




.admin-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

@media (max-width: 480px) {
  .admin-users-grid {
    grid-template-columns: 1fr;
  }
}

.admin-user-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.admin-user-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-md);
}

.admin-user-card.is-master {
  border-color: rgba(139, 92, 246, 0.35);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.04) 0%, var(--bg-card) 100%);
}

.admin-user-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600), var(--purple-600));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border-subtle);
  overflow: hidden;
}

.admin-user-info {
  flex-grow: 1;
  overflow: hidden;
}

.admin-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-user-email {
  font-size: 12px;
  color: var(--blue-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.admin-user-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.admin-user-stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.admin-user-stat-col:not(:last-child) {
  border-right: 1px solid var(--border-subtle);
}

.admin-user-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.admin-user-stat-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.admin-user-payt-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-user-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: saasSlideIn 0.2s ease-out;
  min-width: 280px;
}

.toast.success {
  border-left: 3px solid var(--emerald-500);
}

.toast.error {
  border-left: 3px solid var(--rose-500);
}

.toast.info {
  border-left: 3px solid var(--blue-500);
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    max-height: 50vh; /* limit height so it doesn't cover all screen */
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0;
  }
  .sidebar > div:first-child {
    padding: 12px 16px 8px 16px !important;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .sidebar-footer {
    padding: 8px 16px 10px 16px !important;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .topbar {
    padding: 12px 16px;
  }
  .view-section {
    padding: 16px;
  }
}

/* ==========================================================================
   Interactive Onboarding Tour (Spotlight & Tooltips)
   ========================================================================== */

.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.tour-spotlight {
  position: fixed;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(9, 10, 15, 0.82), 0 0 20px var(--blue-glow);
  border: 2px solid var(--blue-500);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 10000;
}

.tour-card {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 40px);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 22px;
  z-index: 10001;
  pointer-events: auto;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  animation: tourCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tourCardPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tour-step-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--blue-400);
  background-color: var(--blue-glow);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tour-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color var(--transition-fast);
}

.tour-close-btn:hover {
  color: var(--rose-500);
}

.tour-body h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tour-body p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 18px;
}

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

/* ==========================================================================
   Meta Ads Manager & Toggle Switches
   ========================================================================== */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  vertical-align: middle;
  cursor: pointer;
  margin: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-strong, #374151);
  transition: .25s ease;
  border-radius: 20px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .slider {
  background-color: var(--blue-600, #2563eb);
}

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

.col-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
}

.col-picker-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.col-picker-item input[type="checkbox"] {
  accent-color: var(--blue-600);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.col-picker-item span {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Meta Ads Manager Horizontal Category Tabs */
.meta-entity-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  margin-bottom: -2px;
}

.meta-entity-tab:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.meta-entity-tab.active {
  color: var(--blue-400);
  border-bottom-color: var(--blue-500);
  background-color: rgba(59, 130, 246, 0.08);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.meta-entity-tab.active .badge {
  background-color: var(--blue-600);
  color: #ffffff;
}

/* User Profile Sidebar Card */
.sidebar-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.sidebar-user-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--blue-500);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sidebar-user-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--blue-500);
}

/* Split-Screen Login Layout */
.login-split-wrapper {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: row;
}

.login-hero-side {
  flex: 1 1 58%;
  position: relative;
  background-color: #080F1E;
  background-image: radial-gradient(circle at 70% 35%, rgba(37, 99, 235, 0.16) 0%, rgba(8, 15, 30, 0.85) 60%, #080F1E 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 48px;
  min-height: 100vh;
  overflow: hidden;
}

.login-globe-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.login-hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 80%, rgba(8, 15, 30, 0.85) 0%, rgba(8, 15, 30, 0.2) 50%, rgba(8, 15, 30, 0.55) 100%);
  pointer-events: none;
  z-index: 2;
}

.typewriter-cursor {
  display: inline-block;
  margin-left: 3px;
  color: #38BDF8;
  font-weight: 300;
  animation: typewriter-blink 0.9s infinite;
}

@keyframes typewriter-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.login-form-side {
  width: 100%;
  max-width: 480px;
  min-width: 360px;
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  border-left: 1px solid var(--border-subtle);
  box-shadow: -12px 0 35px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 10;
  min-height: 100vh;
  overflow-y: auto;
}

/* Auth Success & Loading Transition States */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin {
  display: inline-block;
  animation: spin 0.85s linear infinite;
}

#loginOverlay {
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

#loginOverlay.auth-dissolve {
  opacity: 0 !important;
  transform: scale(1.015) !important;
  pointer-events: none !important;
}

.login-btn-success {
  background: linear-gradient(135deg, #10B981, #059669) !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5) !important;
  border-color: #10B981 !important;
  transition: all 0.25s ease !important;
}

@media (max-width: 960px) {
  .login-split-wrapper {
    flex-direction: column;
  }
  .login-hero-side {
    min-height: 220px;
    padding: 28px 24px;
    flex: none;
  }
  .login-hero-side .hero-text-block {
    display: none;
  }
  .login-form-side {
    max-width: 100%;
    min-height: auto;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding: 32px 24px;
    box-shadow: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   iOS DATE & MONTH WHEEL PICKER (DRUM ROLL / INERTIAL WHEEL)
   ═══════════════════════════════════════════════════════════════ */

.ios-picker-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  height: 36px;
  min-width: 155px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  position: relative;
}

.ios-picker-input-wrap:hover {
  border-color: var(--blue-500);
  background-color: var(--bg-card-hover);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.ios-picker-input-wrap .ios-input-icon {
  color: var(--blue-400);
  font-size: 14px;
  flex-shrink: 0;
}

.ios-picker-input-wrap .ios-picker-value-text {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.ios-picker-input-wrap .ios-picker-clear-inline {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.ios-picker-input-wrap .ios-picker-clear-inline:hover {
  color: var(--rose-500);
}

/* iOS Picker Modal Backdrop */
.ios-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: iosFadeIn 0.22s ease-out forwards;
}

@keyframes iosFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* iOS Sheet Card */
.ios-picker-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ══════════════════════════════════════════════════════════════════
   HISTORY CLEAN DROPDOWN & SOPHISTICATED CALENDAR POPOVERS
   ══════════════════════════════════════════════════════════════════ */

.history-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.history-dropdown-trigger:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background-color: var(--bg-card-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.history-dropdown-trigger.is-open {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background-color: var(--bg-card);
}

.history-dropdown-trigger .dropdown-input-icon {
  color: var(--blue-400);
  font-size: 15px;
  flex-shrink: 0;
}

.history-dropdown-trigger .dropdown-value-text {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.history-dropdown-trigger .dropdown-clear-inline {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.history-dropdown-trigger .dropdown-clear-inline:hover {
  color: var(--rose-400);
}

.history-dropdown-trigger .dropdown-chevron-icon {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.history-dropdown-trigger.is-open .dropdown-chevron-icon {
  transform: rotate(180deg);
  color: var(--blue-400);
}

/* History Dropdown Popovers */
.history-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 320px;
  max-width: 340px;
  background: #0b1120;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 48px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 2000;
  padding: 16px;
  animation: historyPopoverSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(16px);
}

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

.history-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}

.history-cal-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.history-cal-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-weight: 700;
  font-size: 12.5px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.history-cal-select:hover, .history-cal-select:focus {
  border-color: var(--blue-400);
  background: #273549;
}

.history-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #1e293b;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.history-nav-btn:hover {
  background: var(--blue-600);
  color: #ffffff;
  border-color: var(--blue-500);
  transform: scale(1.05);
}

.history-months-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.history-month-btn {
  padding: 12px 6px;
  text-align: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #131d31;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.history-month-btn .month-sub {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
}

.history-month-btn:hover {
  border-color: var(--blue-500);
  color: #ffffff;
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.history-month-btn.active {
  border-color: #60a5fa;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.history-month-btn.active .month-sub {
  color: #dbeafe;
}

.history-popover-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.btn-cal-action {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-cal-action.clear-btn {
  background: #1e293b;
  color: #94a3b8;
}

.btn-cal-action.clear-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.btn-cal-action.shortcut-btn {
  background: #1e293b;
  color: #cbd5e1;
}

.btn-cal-action.shortcut-btn:hover {
  color: #ffffff;
  background: #334155;
}

.btn-cal-action.today-btn {
  background: #2563eb;
  color: #ffffff;
}

.btn-cal-action.today-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* Mini Calendar Popover Styling */
.history-cal-popover {
  min-width: 320px;
}

.history-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  margin-bottom: 6px;
}

.history-cal-weekday {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  padding: 4px 0;
  letter-spacing: 0.3px;
}

.history-cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 12px;
}

.history-cal-day-btn {
  height: 34px;
  width: 34px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #e2e8f0;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-cal-day-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.4);
  transform: scale(1.06);
}

.history-cal-day-btn.other-month {
  color: #475569;
  opacity: 0.45;
}

.history-cal-day-btn.today {
  border-color: #a855f7;
  font-weight: 700;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.1);
}

.history-cal-day-btn.active {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
  color: #ffffff !important;
  font-weight: 700;
  border-color: #60a5fa !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

/* ==========================================================================
   Unattributed Sales Banner (Estilo UTMify)
   ========================================================================== */
.unattributed-sales-alert {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.12), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-left: 4px solid #eab308;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.08);
  animation: fadeIn 0.3s ease;
}

.unattributed-alert-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 260px;
}

.unattributed-alert-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: var(--radius-md);
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.unattributed-alert-title {
  font-size: 14px;
  font-weight: 700;
  color: #fef08a;
  margin: 0 0 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unattributed-alert-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.btn-attribution-trigger {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #000000;
  font-weight: 700;
  font-size: 12.5px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(234, 179, 8, 0.3);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-attribution-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.45);
  filter: brightness(1.05);
}

.attribution-sale-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.attribution-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.attribution-info-item {
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.attribution-info-item span {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.attribution-info-item strong {
  font-size: 12px;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════════════
   CRM WHATSAPP & PIPELINE KANBAN STYLES
   ══════════════════════════════════════════════════════════════════ */

.crm-header-banner {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.crm-view-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.crm-view-toggle button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.crm-view-toggle button.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ═══════════════════════════════════════════════════════════
   CRM WHATSAPP & KANBAN STYLES
═══════════════════════════════════════════════════════════ */
#view-crm {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  box-sizing: border-box;
  min-width: 0;
}

.crm-header-banner,
#view-crm .kpi-grid,
#view-crm #crmTodayAlertBanner,
#view-crm .table-filter-bar,
#view-crm .crm-top-scrollbar-wrapper {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.crm-view-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.crm-view-toggle button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}

.crm-view-toggle button.active {
  background: var(--blue-600);
  color: #FFF;
}

/* Kanban Top Horizontal Scrollbar Track */
.crm-top-scrollbar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-top-scrollbar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.crm-top-scrollbar-slider {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--blue-500), var(--purple-500));
  border-radius: 4px;
  position: absolute;
  top: 0;
  left: 0;
  transition: left 0.1s ease, width 0.1s ease;
  cursor: grab;
}

.crm-top-scrollbar-slider:active {
  cursor: grabbing;
}

.crm-kanban-board {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 4px 4px 24px 4px;
  min-height: calc(100vh - 340px);
  align-items: flex-start;
  touch-action: pan-x;
  scrollbar-width: thin;
  scrollbar-color: var(--blue-500) var(--bg-card);
  box-sizing: border-box;
}

.crm-kanban-board::-webkit-scrollbar {
  height: 8px;
}

.crm-kanban-board::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 4px;
}

.crm-kanban-board::-webkit-scrollbar-thumb {
  background: var(--blue-600);
  border-radius: 4px;
}

.crm-kanban-board::-webkit-scrollbar-thumb:hover {
  background: var(--blue-500);
}

.crm-column {
  flex: 0 0 320px;
  width: 320px;
  min-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.crm-column.drag-over {
  border-color: var(--blue-500);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.2);
}

.crm-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.crm-col-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}

.crm-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.crm-col-count {
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.crm-col-value {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--emerald-400);
}

.crm-column-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
}

.crm-empty-col-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 28px 10px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}

.crm-add-card-btn {
  margin: 8px 12px 12px;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.crm-add-card-btn:hover {
  background: var(--bg-hover);
  border-color: var(--blue-500);
  color: var(--blue-400);
}

/* CRM Card */
.crm-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.crm-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.crm-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #FFF;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crm-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #FFF;
  font-weight: 700;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crm-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #FFF;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crm-card-user-info {
  overflow: hidden;
  flex: 1;
}

.crm-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-card-phone {
  font-size: 11.5px;
  color: var(--text-muted);
}

.crm-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.crm-tag-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.crm-drawer-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
}

.crm-contact-tag-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.crm-contact-tag-item .crm-tag-color-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.crm-contact-tag-item .crm-tag-label-text {
  letter-spacing: -0.2px;
}

.crm-contact-tag-item .crm-tag-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.crm-contact-tag-item:hover {
  transform: translateY(-1px);
  border-color: var(--tag-color, var(--blue-500));
  color: var(--text-primary);
  background: var(--bg-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.crm-contact-tag-item:hover .crm-tag-status-icon {
  opacity: 1;
  transform: scale(1.2);
}

/* Quando a etiqueta está ativa / selecionada no contato */
.crm-contact-tag-item.is-active {
  background: var(--tag-color, var(--blue-600)) !important;
  border-color: var(--tag-color, var(--blue-600)) !important;
  color: #FFFFFF !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.crm-contact-tag-item.is-active .crm-tag-color-indicator {
  background-color: #FFFFFF !important;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.9);
}

.crm-contact-tag-item.is-active .crm-tag-status-icon {
  opacity: 1;
  font-size: 13px;
  color: #FFFFFF;
}

/* Custom Native Calendar Picker Indicator Color matching Theme */
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(1) brightness(2) !important;
  opacity: 1 !important;
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  transform: scale(1.15);
}

[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"] {
  color-scheme: light;
}

[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0) brightness(0) !important;
  opacity: 0.85 !important;
}

.crm-card-msg-preview {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--border-subtle);
}

/* Follow-up Note Box directly on Kanban Card */
.crm-card-note-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--blue-500);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  font-size: 11.5px;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.35;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.crm-card-note-icon {
  color: var(--blue-400);
  flex-shrink: 0;
  font-size: 12px;
  margin-top: 1px;
}

.crm-card-note-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.crm-drawer-name-input {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  outline: none;
  width: 100%;
  max-width: 280px;
  transition: all var(--transition-fast);
}

.crm-drawer-name-input:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.crm-drawer-name-input:focus {
  background: var(--bg-surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--blue-glow);
}

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

.crm-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crm-meta-item {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.crm-badge-reminder {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-400);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: pulseReminder 2s infinite ease-in-out;
}

.crm-badge-reminder.today {
  background: rgba(239, 68, 68, 0.2);
  color: var(--rose-400);
  border-color: rgba(239, 68, 68, 0.4);
}

@keyframes pulseReminder {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.crm-action-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.crm-action-icon-btn.whatsapp:hover {
  background: #25D366;
  color: #FFF;
}

/* ═══════════════════════════════════════════════════════════
   CRM REDESIGNED TABLE (LIST VIEW)
═══════════════════════════════════════════════════════════ */
.crm-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.crm-table thead th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

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

.crm-table tbody tr:last-child {
  border-bottom: none;
}

.crm-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.crm-table td {
  padding: 14px 18px;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════
   CRM DRAWER & CALENDAR DATEPICKER WIDGET
═══════════════════════════════════════════════════════════ */
.crm-drawer-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.crm-drawer-hero-info {
  flex: 1;
  overflow: hidden;
}

.crm-drawer-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.crm-drawer-phone {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.crm-drawer-email {
  font-size: 12px;
  color: var(--text-muted);
}

.crm-notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.crm-note-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  position: relative;
}

.crm-note-item.has-reminder {
  border-left: 3px solid var(--amber-400);
}

.crm-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.crm-note-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 13px;
}

.crm-note-delete-btn:hover {
  color: var(--rose-400);
}

.crm-note-text {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: pre-wrap;
}

.crm-note-reminder-bar {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

/* Calendar Date Quick Chips Widget */
.crm-calendar-quick-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.crm-calendar-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.crm-calendar-chip:hover {
  background: var(--blue-600);
  border-color: var(--blue-500);
  color: #FFF;
}

/* ═══════════════════════════════════════════════════════════
   MATRIX DIGITAL RAIN & NEON BORDER MODAL FOR WHATSAPP
═══════════════════════════════════════════════════════════ */
.crm-matrix-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 15, 0.90);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  overflow: hidden;
}

.crm-matrix-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.28;
  pointer-events: none;
  z-index: 1;
}

/* Modal Card with Animated Neon Border Beam */
.crm-matrix-modal-card {
  position: relative;
  width: 92%;
  max-width: 520px;
  background: #0d131f;
  border-radius: 24px;
  padding: 32px 28px;
  z-index: 10;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px rgba(37, 211, 102, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

/* Continuous Animated Green Neon Border Beam around rounded edges */
.crm-matrix-modal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 2.5px;
  background: conic-gradient(
    from var(--beam-angle, 0deg),
    transparent 0%,
    transparent 65%,
    #10B981 80%,
    #25D366 90%,
    #00FF88 98%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: crmRotateBorderBeam 3.5s linear infinite;
}

@property --beam-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes crmRotateBorderBeam {
  0% {
    --beam-angle: 0deg;
  }
  100% {
    --beam-angle: 360deg;
  }
}

.crm-whatsapp-hero-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #25D366, #128C7E);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #FFFFFF;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.45), 0 0 20px rgba(37, 211, 102, 0.25);
  position: relative;
  animation: floatWhatsAppIcon 3s ease-in-out infinite alternate;
}

@keyframes floatWhatsAppIcon {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-5px) scale(1.03); }
}

.crm-matrix-modal-title {
  font-family: 'Share Tech Mono', 'VT323', monospace;
  font-size: 23px;
  font-weight: 700;
  color: #00FF88;
  margin: 0 0 18px 0;
  letter-spacing: 2.5px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.7), 0 0 20px rgba(37, 211, 102, 0.4);
  user-select: none;
}

.matrix-text-locked {
  font-family: 'Share Tech Mono', 'VT323', monospace;
  color: #00FF88;
  letter-spacing: 2.5px;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.8), 0 0 16px rgba(37, 211, 102, 0.5);
}

.matrix-text-glitch {
  font-family: 'Share Tech Mono', 'VT323', monospace;
  color: #FFFFFF;
  background: rgba(0, 255, 136, 0.2);
  padding: 0 2px;
  border-radius: 2px;
  text-shadow: 0 0 12px #00FF88, 0 0 24px #25D366;
  font-weight: 900;
  display: inline-block;
  margin: 0 1px;
}

.matrix-type-cursor {
  font-family: 'Share Tech Mono', 'VT323', monospace;
  color: #00FF88;
  font-weight: 900;
  text-shadow: 0 0 10px #00FF88;
  animation: matrixCursorBlink 0.55s infinite steps(2, start);
  margin-left: 3px;
}

.matrix-type-cursor.finished {
  animation: matrixCursorBlink 1.1s infinite steps(2, start);
}

@keyframes matrixCursorBlink {
  to { visibility: hidden; }
}

/* ═══════════════════════════════════════════════════════════
   CUSTOM HIGH-END DATE & TIME PICKER
═══════════════════════════════════════════════════════════ */
.crm-custom-dtpicker-container {
  position: relative;
  width: 100%;
}

.crm-dtpicker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  text-align: left;
}

.crm-dtpicker-btn:hover,
.crm-dtpicker-btn.is-active {
  background: var(--bg-surface-light);
  border-color: var(--border-focus);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 10px var(--blue-glow);
}

.crm-dtpicker-btn .crm-dtpicker-icon {
  color: var(--blue-400);
  font-size: 15px;
  flex-shrink: 0;
}

.crm-dtpicker-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 290px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 15px var(--blue-glow);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: saasFadeIn 0.2s ease-out;
}

.crm-dtpicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crm-dtpicker-month-year {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: capitalize;
}

.crm-dtpicker-nav-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.crm-dtpicker-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: #38BDF8;
}

.crm-dtpicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.crm-dtpicker-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
}

.crm-dtpicker-day {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.crm-dtpicker-day:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.crm-dtpicker-day.today {
  border: 1px solid var(--blue-500);
  font-weight: 700;
  color: #38BDF8;
}

.crm-dtpicker-day.selected {
  background: var(--blue-600) !important;
  color: #FFFFFF !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
}

.crm-dtpicker-day.other-month {
  opacity: 0.3;
}

.crm-dtpicker-time-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.crm-dtpicker-time-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.crm-dtpicker-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
}

.crm-dtpicker-select:focus {
  border-color: #38BDF8;
}

.crm-dtpicker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════════════════════
   CRM REORDERING, COLOR PICKER & BUYER BADGES
═══════════════════════════════════════════════════════════ */
.crm-sortable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crm-sortable-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  user-select: none;
}

.crm-sortable-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.crm-sortable-item.dragging {
  opacity: 0.45;
  background: var(--bg-surface);
  border: 1.5px dashed var(--blue-500);
}

.crm-sortable-item.drag-over {
  border-top: 2px solid var(--blue-500);
}

.crm-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 15px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease;
}

.crm-drag-handle:hover {
  color: var(--blue-400);
}

.crm-drag-handle:active {
  cursor: grabbing;
}

.crm-col-dot-clickable {
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.crm-col-dot-clickable:hover {
  transform: scale(1.35);
  box-shadow: 0 0 8px currentColor;
}

.crm-color-dot-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.crm-col-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.crm-col-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.crm-col-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.crm-card-buyer-badge {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.25));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-400);
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
}

.crm-protected-badge {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════════
   CENTRAL DE SUPORTE, MELHORIAS & RELATO DE PROBLEMAS
   ══════════════════════════════════════════════════════════════════ */

.support-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.support-guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.support-guide-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.support-guide-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.support-action-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.12));
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.support-hyperlink-text {
  color: #60A5FA;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.support-hyperlink-text:hover {
  color: #93C5FD;
}

/* ─── Widget de Chat Flutuante no Canto Inferior Direito ─── */
.support-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 100px);
  background: var(--bg-card);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.support-chat-widget.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.support-chat-header {
  background: linear-gradient(135deg, #1E1B4B, #312E81);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.support-chat-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.support-type-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.support-type-btn.active.btn-melhoria {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10B981;
  color: #10B981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.support-type-btn.active.btn-problema {
  background: rgba(244, 63, 94, 0.15);
  border-color: #F43F5E;
  color: #F43F5E;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.2);
}

.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-surface);
}

.support-msg-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-bubble-user {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.support-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.support-msg-body {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.support-msg-time {
  font-size: 10px;
  color: var(--text-muted);
}

.support-bubble-admin {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-left: 14px;
  position: relative;
}

.support-admin-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.support-admin-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--purple-400);
  display: flex;
  align-items: center;
  gap: 4px;
}

.support-admin-reply-body {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: pre-wrap;
}

.support-badge-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.support-badge-pill.badge-melhoria {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.support-badge-pill.badge-problema {
  background: rgba(244, 63, 94, 0.15);
  color: #F43F5E;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.support-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.support-status-pill.status-pendente {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.support-status-pill.status-analise {
  background: rgba(59, 130, 246, 0.15);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.support-status-pill.status-resolvido {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.support-chat-input-area {
  padding: 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── Painel Master & Histórico Cards ─── */
.master-ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.master-ticket-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.master-ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.ticket-user-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ticket-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600), var(--purple-600));
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ticket-box-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-content-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.ticket-reply-box {
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.user-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-history-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Privacy Mode (Ocultar Valores / Números em Pontos)
   ========================================================================== */
body.privacy-mode .kpi-value,
body.privacy-mode #kpiAdSpendTax,
body.privacy-mode .goal-stat-val,
body.privacy-mode .product-table td:nth-child(n+2),
body.privacy-mode .privacy-sensitive {
  -webkit-text-security: disc !important;
  letter-spacing: 2px !important;
  user-select: none !important;
  transition: all 0.25s ease;
}

@supports not (-webkit-text-security: disc) {
  body.privacy-mode .kpi-value,
  body.privacy-mode #kpiAdSpendTax,
  body.privacy-mode .goal-stat-val,
  body.privacy-mode .product-table td:nth-child(n+2),
  body.privacy-mode .privacy-sensitive {
    filter: blur(6px) !important;
    user-select: none !important;
  }
}

body.privacy-mode .chart-body canvas,
body.privacy-mode .charts-grid canvas {
  filter: blur(8px) !important;
  transition: filter 0.3s ease;
  pointer-events: none;
}

/* ==========================================================================
   Smart Floating Notifications (Bottom Right 30min Follow-ups & Goal Strategy)
   ========================================================================== */
.mf-smart-notification-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 400px;
  width: calc(100vw - 48px);
  pointer-events: none;
}

.mf-notification-card {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: mfNotifSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mf-notification-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.mf-notification-followup::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.mf-notification-goal::before {
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #3b82f6);
}

.mf-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mf-notif-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.mf-notif-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.mf-notif-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.mf-notif-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.mf-notif-fade-out {
  animation: mfNotifSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mfNotifSlideIn {
  from {
    transform: translateX(120%) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes mfNotifSlideOut {
  from {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateX(120%) scale(0.95);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   META ADS & CAMPANHAS — DESIGN SYSTEM ULTRA-MODERNO & ANIMAÇÕES
═══════════════════════════════════════════════════════════════════════════ */

#view-meta-ads {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 120px);
}

.meta-ads-bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

#metaDisconnectedState,
#metaConnectedState,
#metaSecSettings {
  position: relative;
  z-index: 1;
}

/* Viewport desconectado (Centralizado e imersivo) */
.meta-ads-disconnected-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 75vh;
  padding: 30px 20px;
}

/* Card Hero de Conexão */
.meta-hero-connect-card {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 40px rgba(56, 189, 248, 0.15);
  border-radius: 24px;
  padding: 40px 36px;
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}

.meta-hero-connect-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.85), 0 0 50px rgba(56, 189, 248, 0.25);
}

.meta-hero-logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.2), rgba(56, 189, 248, 0.3));
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(24, 119, 242, 0.3);
}

.meta-hero-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.meta-hero-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  margin-bottom: 8px;
}

.meta-hero-sub {
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.55;
  margin-bottom: 24px;
}

.btn-meta-connect-primary {
  width: 100%;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #1877f2 0%, #0284c7 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 20px rgba(24, 119, 242, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-meta-connect-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(24, 119, 242, 0.55);
  background: linear-gradient(135deg, #1b85f8 0%, #0ea5e9 100%);
}

.btn-danger-pulsing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-danger-pulsing:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD CUSTOMIZÁVEL — DRAG & DROP E EXCLUSÃO DE MÉTRICAS
═══════════════════════════════════════════════════════════════════════════ */

.kpi-card {
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, opacity 0.25s ease;
}

.kpi-card[draggable="true"] {
  cursor: grab;
}

.kpi-card[draggable="true"]:active {
  cursor: grabbing;
}

.kpi-card.kpi-dragging {
  opacity: 0.35;
  transform: scale(0.96) !important;
  border: 2px dashed #38bdf8 !important;
  box-shadow: 0 15px 35px rgba(56, 189, 248, 0.25) !important;
}

.kpi-card.kpi-drag-over {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.4) !important;
  transform: translateY(-4px);
}

/* Ícone de arrastar no topo do card */
.kpi-card-drag-handle {
  position: absolute;
  top: 8px;
  right: 30px;
  color: var(--text-muted);
  opacity: 0;
  cursor: grab;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  user-select: none;
}

.kpi-card:hover .kpi-card-drag-handle {
  opacity: 0.6;
}

.kpi-card-drag-handle:hover {
  opacity: 1;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

/* Botão de excluir/ocultar métrica */
.kpi-card-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  opacity: 0;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s ease;
  user-select: none;
}

.kpi-card:hover .kpi-card-delete-btn {
  opacity: 0.6;
}

.kpi-card-delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  transform: scale(1.15);
}

/* Estilo do Modal de Personalização do Dashboard */
.dash-customize-modal-body {
  max-height: 65vh;
  overflow-y: auto;
  padding: 8px 4px;
}

.dash-customize-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.dash-customize-item:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: var(--bg-card-hover);
}

.dash-customize-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-customize-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POP-UP DETALHES DE CAMPANHA / ANÚNCIO (MODAL GLASSMORPHISM)
═══════════════════════════════════════════════════════════════════════════ */

.meta-popup-card {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 50px rgba(56, 189, 248, 0.2);
  border-radius: 20px;
  max-width: 860px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: metaPopupZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes metaPopupZoomIn {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.meta-popup-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.4);
}

.meta-popup-body {
  padding: 24px;
  overflow-y: auto;
}

.meta-popup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.meta-popup-kpi {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
}

.meta-popup-kpi:hover {
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-2px);
}

.meta-popup-kpi .val {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.meta-popup-kpi .lbl {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}









