/* CRM & Control Panel Specific Styling */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  overflow-x: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: rgba(5, 5, 8, 0.98);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

/* Collapsed Sidebar State */
.app-container.sidebar-collapsed .sidebar {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important;
}

.app-container.sidebar-collapsed .main-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  flex: 1 1 100% !important;
}

/* Floating Re-Open Handle (Inspired by Canhamo) */
.retractable-sidebar-handle {
  position: fixed;
  left: 0;
  top: 75px;
  z-index: 999;
  display: none;
  cursor: pointer;
  background: linear-gradient(180deg, #1f083d 0%, #060608 100%);
  border: 1px solid var(--border-neon);
  border-left: none;
  border-radius: 0 10px 10px 0;
  padding: 12px 8px;
  box-shadow: 0 0 15px rgba(118, 255, 3, 0.2);
  transition: var(--transition);
}

.app-container.sidebar-collapsed .retractable-sidebar-handle,
body.sidebar-collapsed .retractable-sidebar-handle {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Sidebar Backdrop para Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 6, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.app-container.sidebar-mobile-open .sidebar-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.retractable-sidebar-handle:hover {
  padding-right: 12px;
  background: linear-gradient(180deg, #2a0b54 0%, #000 100%);
  box-shadow: 0 0 35px rgba(118, 255, 3, 0.6);
}

.retractable-sidebar-handle i {
  font-size: 13px;
  color: #fff;
  transition: transform 0.2s;
}

.retractable-sidebar-handle:hover i {
  transform: translateX(2px);
  color: var(--neon-green);
}

/* Sidebar Brand Header */
.sidebar-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
}

.brand-logo-img {
  max-width: 175px;
  height: auto;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  filter: drop-shadow(0 0 12px rgba(118, 255, 3, 0.35));
  transition: var(--transition);
}

.brand-logo-img:hover {
  transform: scale(1.02);
  filter: drop-shadow(0 0 18px rgba(118, 255, 3, 0.65));
}

.sidebar-menu {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item i {
  font-size: 17px;
  width: 22px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(118, 255, 3, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--neon-green);
  border-left: 3px solid var(--neon-green);
  box-shadow: inset 0 0 15px rgba(118, 255, 3, 0.05);
}

.sidebar-user {
  padding: 14px 16px;
  margin: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--neon-green);
  object-fit: cover;
}

.user-meta h4 {
  font-size: 13px;
  font-weight: 700;
}

.user-meta p {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--accent-red);
}

/* Main Content Area */
.main-wrapper,
.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100vh;
  transition: all 0.3s ease;
}

/* ==========================================================================
   REQUISITO R3: REDESIGN GLASSMORPHISM DA BARRA SUPERIOR (HEADER / TOPBAR)
   Fundo escuro translúcido com blur 12px, borda neon e botões estilo pill.
   ========================================================================== */
.topbar {
  height: 60px;
  padding: 0 24px;
  background: rgba(10, 10, 12, 0.6) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-brand h1, #pageTitle {
  font-size: 15px;
  font-weight: 600 !important;
  letter-spacing: 0.2px;
  color: #ededed;
  margin: 0;
}

.topbar-badge {
  background: rgba(57, 255, 20, 0.1);
  color: #39ff14;
  border: 1px solid rgba(57, 255, 20, 0.2);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.topbar-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  border: none;
  outline: none;
}

.topbar-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.topbar-btn.ghost {
  background: transparent;
  color: #a1a1aa !important;
  border: 1px solid transparent !important;
}
.topbar-btn.ghost:hover {
  color: #ededed !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.topbar-btn.secondary {
  background: #18181b !important;
  color: #ededed !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.topbar-btn.secondary:hover {
  background: #27272a !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.topbar-btn.primary {
  background: #39ff14 !important;
  color: #000000 !important;
  border: 1px solid #39ff14 !important;
  font-weight: 600 !important;
}
.topbar-btn.primary:hover {
  background: #4dff28 !important;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.3) !important;
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    height: 56px;
  }
  .topbar-badge {
    display: none;
  }
  .topbar-actions {
    gap: 8px;
  }
  .topbar-btn {
    padding: 0 8px;
    font-size: 12px !important;
  }
  .topbar-btn .btn-label {
    display: none;
  }
}

/* Content Area */
.content-body {
  padding: 30px;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
  display: block;
}

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

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  padding: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-green), transparent);
}

.kpi-card.purple::before {
  background: linear-gradient(90deg, var(--purple-primary), transparent);
}

.kpi-card.cyan::before {
  background: linear-gradient(90deg, var(--accent-cyan), transparent);
}

.kpi-card.amber::before {
  background: linear-gradient(90deg, var(--accent-amber), transparent);
}

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

.kpi-header span {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  margin-right: 8px;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-green);
  font-size: 17px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

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

/* Proportional Tables */
.table-card {
  padding: 28px;
  margin-bottom: 30px;
  border-radius: var(--radius-lg);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 16px;
}

.table-title h3 {
  font-size: 18px;
  font-weight: 800;
}

.table-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
}

.search-box input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 9px 16px 9px 38px;
  font-size: 13px;
  color: #fff;
  width: 240px;
  transition: var(--transition);
}

.search-box input:focus {
  width: 300px;
  border-color: var(--neon-green);
  outline: none;
  box-shadow: 0 0 15px rgba(118, 255, 3, 0.2);
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Blindagem da Central de Liberações: 100% responsiva dentro do quadrante sem barra lateral nem cortes */
#tab-releases .table-responsive {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#tab-releases .custom-table {
  width: 100% !important;
  table-layout: fixed !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
}

#tab-releases .custom-table th,
#tab-releases .custom-table td {
  box-sizing: border-box !important;
}

#tab-releases .custom-table td input.form-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

.custom-table {
  width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.custom-table th {
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.02);
  white-space: normal;
  word-break: break-word;
}

.custom-table th:first-child { border-radius: 8px 0 0 0; }
.custom-table th:last-child { border-radius: 0 8px 0 0; }

.custom-table td {
  padding: 12px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}

.custom-table tr:hover td {
  background: rgba(118, 255, 3, 0.02);
}

/* Colunas Específicas do CRM (1 ou 2 linhas perfeitamente organizadas) */
.col-client-name {
  
  font-weight: 700;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.3;
}

.col-client-user {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 3px;
  
}

.col-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--neon-green);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  
  transition: var(--transition);
}

.col-whatsapp:hover {
  text-shadow: 0 0 10px rgba(118, 255, 3, 0.6);
  color: #a3ff54;
}

.col-whatsapp i {
  font-size: 15px;
  flex-shrink: 0;
}

.col-plan-name {
  font-weight: 600;
  color: #fff;
  
  line-height: 1.3;
}

.col-plan-price {
  font-size: 11.5px;
  color: var(--accent-cyan);
  
  margin-top: 3px;
  font-weight: 600;
}

.col-device-name {
  
  color: #f4f4f5;
  font-weight: 500;
  line-height: 1.3;
}

.col-device-app {
  font-size: 11px;
  color: var(--text-muted);
  
  margin-top: 3px;
}

.col-single-line {
  
  line-height: 1.3;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-icon:hover {
  background: rgba(118, 255, 3, 0.15);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.btn-icon.wa:hover {
  background: rgba(37, 211, 102, 0.2);
  border-color: #25d366;
  color: #25d366;
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Minimalist & High-Tech Dropzone for Extratos */
.dropzone {
  border: 2px dashed rgba(118, 255, 3, 0.45);
  border-radius: var(--radius-lg);
  padding: 44px 30px;
  text-align: center;
  background: radial-gradient(circle at center, rgba(118, 255, 3, 0.04) 0%, rgba(0, 0, 0, 0.4) 100%);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
  background: radial-gradient(circle at center, rgba(118, 255, 3, 0.08) 0%, rgba(25, 8, 45, 0.45) 100%);
  border-color: var(--neon-green);
  box-shadow: 0 0 35px rgba(118, 255, 3, 0.25);
}

.dropzone-icon-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(118, 255, 3, 0.1);
  border: 1px solid var(--border-neon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(118, 255, 3, 0.15);
  transition: var(--transition);
}

.dropzone:hover .dropzone-icon-ring {
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(118, 255, 3, 0.4);
}

.dropzone-icon-ring i {
  font-size: 28px;
  color: var(--neon-green);
}

.dropzone h4 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========================================================
   WHATSAPP ATTENDANCE PLUGIN & AI WORKSPACE (ITEM 5)
======================================================== */
.whatsapp-plugin-bar {
  background: rgba(12, 12, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.whatsapp-plugin-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.whatsapp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.4);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.whatsapp-status-pill i {
  font-size: 14px;
}

.whatsapp-status-pill .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 10px #25d366;
  animation: pulseNeon 2s infinite;
}

.ai-attendance-workspace {
  display: grid;
  grid-template-columns: 310px 1fr 340px;
  gap: 20px;
  min-height: 650px;
  height: calc(100vh - 220px);
}

/* Coluna 1: Leads & Contatos Recentes */
.leads-attendance-col {
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.leads-attendance-col h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.leads-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.lead-contact-card {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.lead-contact-card:hover, .lead-contact-card.active {
  background: rgba(118, 255, 3, 0.08);
  border-color: var(--neon-green);
  box-shadow: 0 0 15px rgba(118, 255, 3, 0.1);
}

.lead-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f083d, #000);
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.lead-info-meta {
  flex: 1;
  overflow: hidden;
}

.lead-info-meta .lead-name {
  font-size: 13px;
  font-weight: 700;
  
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-info-meta .lead-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Coluna 2: Chat Style WhatsApp Web */
.whatsapp-chat-container {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b0e11;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9);
}

.chat-header-wa {
  padding: 14px 20px;
  background: #111b21;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-active-contact {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-body-wa {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(118, 255, 3, 0.02) 0%, transparent 60%),
    linear-gradient(180deg, #0b0e11 0%, #06080a 100%);
}

.wa-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}

.wa-bubble.incoming {
  align-self: flex-start;
  background: #202c33;
  color: #e9edef;
  border-bottom-left-radius: 2px;
}

.wa-bubble.outgoing {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 15px rgba(0, 92, 75, 0.3);
}

.wa-bubble-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.chat-footer-wa {
  padding: 14px 18px;
  background: #111b21;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-footer-wa input {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: var(--radius-full);
  padding: 12px 18px;
  color: #fff;
  font-size: 13.5px;
}

.chat-footer-wa input:focus {
  outline: none;
  box-shadow: 0 0 10px rgba(118, 255, 3, 0.3);
}

/* Coluna 3: IA Copilot & Gerenciador de Conhecimento */
.ai-copilot-col {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.agent-mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.agent-mode-btn {
  background: none;
  border: none;
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.agent-mode-btn.active {
  background: var(--neon-green);
  color: #000;
}

/* Knowledge Base Manager Card */
.knowledge-manager-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* Responsive */
@media (max-width: 1200px) {
  .ai-attendance-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    overflow-x: hidden;
  }
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.8) !important;
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin: 0 !important;
  }
  .app-container.sidebar-mobile-open .sidebar {
    transform: translateX(0) !important;
  }
  .retractable-sidebar-handle {
    display: none !important;
  }
  .main-wrapper {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .topbar {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar-left {
    gap: 12px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 8px;
  }
  .content-body {
    padding: 16px 12px;
  }
}

/* Select & Dropdown dark theme enforcement */
select, .form-select {
  color-scheme: dark !important;
  background-color: #0d101a !important;
  color: #ffffff !important;
}

select option, .form-select option, optgroup {
  background-color: #0d101a !important;
  color: #ffffff !important;
  padding: 10px 14px;
  font-size: 14px;
}

select option:checked, .form-select option:checked {
  background-color: #27144a !important;
  color: #76ff03 !important;
  font-weight: 700;
}

/* ==========================================================================
   MÁQUINA DE CONVERSÃO & RÉGUA WHATSAPP (MODAL #whatsappModal)
   ========================================================================== */

/* Container Principal do Modal */
.wa-modal-container {
  max-width: 880px;
  width: 95%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #090314;
  border: 1px solid rgba(118, 255, 3, 0.4);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(118, 255, 3, 0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-modal-header {
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wa-modal-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wa-modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #25d366;
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.25);
}

.wa-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.wa-modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.wa-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(92vh - 140px);
}

/* Card de Destaque do Contato */
.wa-contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}

.wa-contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #18082e 0%, #2f1057 100%);
  border: 2px solid var(--neon-green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-green);
  font-size: 16px;
  flex-shrink: 0;
}

.wa-contact-info {
  flex: 1;
  min-width: 0;
}

.wa-contact-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.wa-contact-name-row h4 {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-contact-meta-row {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wa-meta-dot {
  color: rgba(255, 255, 255, 0.2);
}

/* Seletor em 5 Abas/Cards da Régua */
.wa-phases-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.wa-phase-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.wa-phase-tab:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(118, 255, 3, 0.3);
}

.wa-phase-tab.active {
  background: linear-gradient(180deg, rgba(118, 255, 3, 0.12) 0%, rgba(9, 1, 20, 0.8) 100%);
  border-color: var(--neon-green);
  box-shadow: 0 0 15px rgba(118, 255, 3, 0.2);
}

.wa-phase-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.wa-phase-tab.active .wa-phase-badge {
  background: var(--neon-green);
  color: #000;
}

.wa-phase-text strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-phase-tab.active .wa-phase-text strong {
  color: var(--neon-green);
}

.wa-phase-text small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Área de Trabalho em 2 Colunas */
.wa-workspace-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  min-height: 380px;
}

/* Coluna 1: Editor */
.wa-editor-col {
  display: flex;
  flex-direction: column;
}

.wa-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wa-editor-phase-indicator {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-wa-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.btn-wa-reset:hover {
  color: var(--neon-green);
}

/* Chips de Variáveis Rápidas */
.wa-vars-container {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

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

.wa-var-chip {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c084fc;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.wa-var-chip:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #c084fc;
  color: #fff;
  transform: translateY(-1px);
}

.wa-textarea {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: #f4f4f5;
  resize: none;
  font-family: inherit;
  transition: var(--transition);
}

.wa-textarea:focus {
  border-color: var(--neon-green);
  outline: none;
  box-shadow: 0 0 10px rgba(118, 255, 3, 0.2);
}

.wa-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Coluna 2: Mockup do WhatsApp */
.wa-preview-col {
  display: flex;
  flex-direction: column;
}

.wa-mockup-frame {
  flex: 1;
  background: #0b141a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.wa-mockup-topbar {
  background: #1f2c34;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.wa-mockup-contact {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-mockup-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

.wa-mockup-info {
  display: flex;
  flex-direction: column;
}

.wa-mockup-name {
  font-size: 13px;
  font-weight: 700;
  color: #e9edef;
  line-height: 1.2;
}

.wa-mockup-status {
  font-size: 10px;
  color: #25d366;
}

.wa-mockup-icons {
  display: flex;
  gap: 14px;
  color: #aebac1;
  font-size: 13px;
}

/* Corpo do Chat com Fundo Estilo WhatsApp */
.wa-mockup-chat {
  flex: 1;
  max-height: 380px;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 16px 16px;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-mockup-date-pill {
  align-self: center;
  background: rgba(17, 27, 33, 0.85);
  color: #8696a0;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.wa-bubble-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

/* Balão de Mensagem de Saída (WhatsApp Dark Oficial) */
.wa-chat-bubble {
  background: #005c4b;
  color: #e9edef;
  border-radius: 8px 0 8px 8px;
  padding: 10px 12px 6px 12px;
  max-width: 92%;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.wa-bubble-body {
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  color: #e9edef;
}

.wa-bubble-body strong {
  font-weight: 800;
  color: #fff;
}

.wa-bubble-body em {
  font-style: italic;
}

.wa-bubble-body del {
  text-decoration: line-through;
  opacity: 0.8;
}

.wa-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 10px;
  color: #8696a0;
  margin-top: 4px;
}

.wa-ticks {
  color: #53bdeb;
  font-size: 11px;
}

/* Rodapé de Ações */
.wa-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

.wa-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Botão Secundário: Copiar */
.btn-wa-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-wa-copy:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
  transform: translateY(-1px);
}

.btn-wa-copy.copied {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Botão Primário: Disparar WhatsApp (wa.me) */
.btn-wa-send {
  background: #25d366;
  border: 1px solid #25d366;
  color: #000;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.35);
  transition: var(--transition);
}

.btn-wa-send:hover {
  background: #20ba59;
  border-color: #20ba59;
  box-shadow: 0 0 28px rgba(37, 211, 102, 0.6);
  transform: translateY(-1px);
}

/* Responsividade Mobile e Telas Menores */
@media (max-width: 820px) {
  .wa-phases-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .wa-workspace-grid {
    grid-template-columns: 1fr;
  }
  .wa-preview-col {
    min-height: 260px;
  }
  .wa-mockup-frame {
    max-height: 360px;
  }
}

/* ==========================================================================
   REQUISITO R3: TABELA DE CLIENTES CLICÁVEL & MODAL DE PERFIL 360°
   ========================================================================== */
.client-row-clickable {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.client-row-clickable:hover td {
  background: rgba(118, 255, 3, 0.04) !important;
}

.client-profile-modal-container {
  background: #090314;
  border: 1px solid rgba(118, 255, 3, 0.35);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(118, 255, 3, 0.15);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   REQUISITO R5: GRÁFICOS E TABELA DA ABA RELATÓRIOS
   ========================================================================== */
#tab-reports .metric-card {
  min-height: 96px;
}

#tab-dashboard canvas,
#tab-reports canvas {
  width: 100% !important;
}

@media (max-width: 768px) {
  .client-profile-modal-container {
    width: 98%;
    max-height: 95vh;
  }
}

/* ==========================================================================
   REQUISITO R1: QUADRANTES DE MÉTRICAS (FATURAS E RELATÓRIOS)
   Glassmorphism, CSS Grid, Hover Verde Neon & Números Brilhantes
   ========================================================================== */

.metrics-grid,
.quadrants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
  width: 100%;
}

/* Quadrante Glassmorphism */
.quadrant-card {
  position: relative;
  background: linear-gradient(135deg, rgba(16, 8, 34, 0.75) 0%, rgba(7, 3, 16, 0.85) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(118, 255, 3, 0.18);
  border-left: 4px solid var(--neon-green);
  border-radius: var(--radius-md, 14px);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(118, 255, 3, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Efeito Hover Verde Neon */
.quadrant-card:hover {
  transform: translateY(-4px);
  border-color: rgba(118, 255, 3, 0.75);
  border-left: 4px solid var(--neon-green);
  background: linear-gradient(135deg, rgba(24, 10, 52, 0.85) 0%, rgba(10, 4, 24, 0.95) 100%);
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.8),
    0 0 25px rgba(118, 255, 3, 0.35),
    inset 0 0 18px rgba(118, 255, 3, 0.08);
}

/* Ícone do Quadrante */
.quadrant-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(118, 255, 3, 0.12);
  border: 1px solid rgba(118, 255, 3, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-green);
  font-size: 22px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.quadrant-card:hover .quadrant-icon {
  background: rgba(118, 255, 3, 0.25);
  border-color: var(--neon-green);
  box-shadow: 0 0 16px rgba(118, 255, 3, 0.4);
  transform: scale(1.08);
}

/* Dados e Textos */
.quadrant-data {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.quadrant-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Números em Destaque Brilhante */
.quadrant-value,
.glow-number {
  font-size: 28px;
  font-weight: 900;
  color: var(--neon-green);
  letter-spacing: -0.5px;
  line-height: 1.15;
  text-shadow: 0 0 12px rgba(118, 255, 3, 0.5);
  transition: text-shadow 0.3s ease;
}

.quadrant-card:hover .quadrant-value,
.quadrant-card:hover .glow-number {
  text-shadow: 0 0 18px rgba(118, 255, 3, 0.85), 0 0 32px rgba(118, 255, 3, 0.4);
}

.quadrant-subtext {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   REQUISITO R1: LAYOUT FULL-WIDTH DO CONTEÚDO PRINCIPAL (100% LARGURA FLUIDA)
   Remoção mandatória da regra zoom: 0.9 que causava corte de 10% no layout.
   Garantido flex: 1, width: 100%, max-width: 100%, min-width: 0, box-sizing: border-box.
   ========================================================================== */
.main-wrapper,
.main-content {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  /* Substituição da regra antiga zoom: 0.9 por preenchimento fluido 100% full-width */
  .main-wrapper,
  .main-content {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Quando o menu lateral for FECHADO/MINIMIZADO (.sidebar-collapsed) */
  .app-container.sidebar-collapsed .main-wrapper,
  .app-container.sidebar-collapsed .main-content,
  body.sidebar-collapsed .main-wrapper,
  body.sidebar-collapsed .main-content {
    zoom: 1;
    width: 100%;
    max-width: 100%;
  }
}

/* Mobile: Sempre zoom 100% nativo para usabilidade e legibilidade */
@media (max-width: 768px) {
  .main-wrapper,
  .main-content {
    zoom: 1 !important;
    width: 100%;
    max-width: 100%;
  }
}

/* ==========================================================================
   REQUISITO R4: CARDS DO DASHBOARD CLICÁVEIS (MICRO-INTERAÇÕES & ACESSIBILIDADE)
   ========================================================================== */
.clickable-kpi-card,
.clickable-alert-card {
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.clickable-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.7), 0 0 20px rgba(118, 255, 3, 0.22);
  border-color: rgba(118, 255, 3, 0.5);
}

.clickable-kpi-card.cyan:hover {
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.7), 0 0 20px rgba(118, 255, 3, 0.28);
  border-color: rgba(118, 255, 3, 0.55);
}

.clickable-kpi-card.purple:hover {
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.7), 0 0 20px rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.5);
}

.clickable-kpi-card.amber:hover {
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.7), 0 0 20px rgba(168, 85, 247, 0.3);
  border-color: rgba(168, 85, 247, 0.55);
}

.clickable-kpi-card:active {
  transform: translateY(-1px) scale(0.99);
}

.clickable-kpi-card:hover .kpi-shortcut-hint {
  opacity: 1 !important;
  color: var(--neon-green);
  transform: translateX(3px);
  transition: all 0.2s ease;
}

.clickable-kpi-card.cyan:hover .kpi-shortcut-hint {
  color: var(--accent-cyan);
}

.clickable-kpi-card.purple:hover .kpi-shortcut-hint {
  color: var(--purple-primary);
}

.clickable-kpi-card.amber:hover .kpi-shortcut-hint {
  color: var(--accent-amber);
}

.clickable-alert-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.clickable-alert-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.clickable-alert-card:active {
  transform: translateY(0);
}

/* Acessibilidade por Teclado (WCAG 2.1 Focus) */
.clickable-kpi-card:focus-visible,
.clickable-alert-card:focus-visible {
  outline: 2px solid var(--neon-green);
  outline-offset: 2px;
}

/* ==========================================================================
   REQUISITO R2: TOAST SUPERIOR DIREITO E ANIMAÇÃO PULSE DO BADGE DE LIBERAÇÕES
   ========================================================================== */
.toast-container,
#toastContainer {
  position: fixed !important;
  top: 25px !important;
  bottom: auto !important;
  right: 25px !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  pointer-events: none !important;
}

.toast {
  pointer-events: auto !important;
}

.toast-release-alert {
  background: rgba(10, 15, 20, 0.96) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(57, 255, 20, 0.6) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(57, 255, 20, 0.35) !important;
  color: #ffffff !important;
  animation: slideInToast 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

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

@keyframes badgePulseNeon {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.7);
  }
  50% {
    transform: scale(1.35);
    box-shadow: 0 0 16px 4px rgba(57, 255, 20, 0.9);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(57, 255, 20, 0);
  }
}

.badge-pulse-neon {
  animation: badgePulseNeon 0.8s ease-in-out 3 !important;
  display: inline-block !important;
}

/* ==========================================================================
   SISTEMA TIPOGRÁFICO SÊNIOR NO CRM & COPIAR EM 1 CLIQUE (FILA EXPRESSA)
   ========================================================================== */
.app-container {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.topbar-title h2,
.table-title h3,
.modal-header h3,
.quadrant-value {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
}

.custom-table td,
.data-table td,
.quadrant-value,
.glow-number,
.badge-counter,
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.font-mono,
.credential-mono,
input.font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
  font-variant-ligatures: none;
  letter-spacing: 0.03em;
}

.btn-copy-quick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(118, 255, 3, 0.08);
  border: 1px solid rgba(118, 255, 3, 0.3);
  color: var(--neon-green);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-copy-quick:hover {
  background: rgba(118, 255, 3, 0.18);
  border-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(118, 255, 3, 0.25);
}

.btn-copy-quick:active {
  transform: scale(0.96);
}

.btn-copy-quick.copied {
  background: var(--neon-green) !important;
  color: #030306 !important;
  border-color: var(--neon-green) !important;
  box-shadow: 0 0 14px rgba(118, 255, 3, 0.6) !important;
}

/* ==========================================================================
   ADAPTAÇÃO MOBILE COMPLETA CRM (OFF-CANVAS, CARDS RESPONSIVOS & ANTI-ZOOM)
   ========================================================================== */

.btn-sidebar-mobile-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(118, 255, 3, 0.4);
  color: var(--neon-green);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-sidebar-mobile-toggle:hover {
  background: rgba(118, 255, 3, 0.2);
  box-shadow: 0 0 10px rgba(118, 255, 3, 0.35);
}

@media (max-width: 768px) {
  .btn-sidebar-mobile-toggle {
    display: inline-flex !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    max-height: 100vh !important;
    width: 280px !important;
    max-width: 85vw !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8) !important;
  }

  .app-container.sidebar-mobile-open .sidebar {
    transform: translateX(0) !important;
  }

  .retractable-sidebar-handle {
    display: none !important;
  }

  /* Prevenção de Auto-Zoom acidental em dispositivos móveis (iOS Safari / Android Chrome) */
  input, select, textarea, .form-input, .form-select {
    font-size: 16px !important; /* Tamanho mínimo de 16px para desativar zoom automático */
  }

  /* Topbar Mobile */
  .topbar {
    height: 60px !important;
    padding: 0 12px !important;
  }

  #pageTitle {
    font-size: 14px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: calc(100vw - 180px) !important;
  }

  .topbar-actions {
    gap: 6px !important;
  }

  .topbar-btn {
    padding: 6px 10px !important;
    min-height: 36px !important;
  }

  /* Content Body */
  .content-body {
    padding: 12px 10px !important;
  }

  /* KPI Grid & Dashboard Mobile */
  .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
  }

  /* Charts Container Mobile (empilha colunas no mobile) */
  div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Tabela de Testes Pendentes (Central de Liberações Mobile) - Sem barra horizontal indesejada */
  #tab-releases .table-responsive {
    overflow-x: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #tab-releases .custom-table {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  #tab-releases .custom-table td input.form-input {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 36px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  #tab-releases .custom-table td button.btn-neon {
    min-height: 36px !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  /* Faturas e Clientes: Scroll horizontal fluido com proteção contra cortes */
  .table-card {
    border-radius: 12px !important;
    padding: 12px !important;
  }

  .table-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 12px !important;
  }

  .table-controls {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .search-box {
    width: 100% !important;
  }

  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 -10px !important;
    padding: 0 10px !important;
  }

  .custom-table {
    min-width: 620px !important;
  }

  /* Modais no Mobile ocupando quase toda a tela com scrolling suave */
  .modal-container,
  .client-profile-modal-container,
  .wa-modal-container {
    width: 96% !important;
    max-width: 96% !important;
    margin: 8px auto !important;
    max-height: 94vh !important;
    padding: 16px !important;
  }

  /* Ações em 1 toque confortáveis */
  .btn-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 14px !important;
  }
}



/* ==========================================================================
   📱 CRM MOBILE ULTRA-REFRESH (CARDS VERTICAIS & ZERO SCROLL HORIZONTAL)
   ========================================================================== */

@media (max-width: 768px) {
  /* Tira a rolagem excessiva do CRM no celular */
  .crm-content {
    padding: 12px 10px !important;
  }

  /* Header compacto com botões touch */
  .crm-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 12px 14px !important;
  }

  .crm-header-actions {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
  }

  .crm-header-actions .btn {
    flex: 1 !important;
    justify-content: center !important;
    font-size: 13px !important;
    padding: 10px 8px !important;
  }

  /* Cards KPI em grid de 2 colunas */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .kpi-card {
    padding: 12px !important;
  }

  .kpi-card .kpi-value {
    font-size: 20px !important;
  }

  /* Tabela de Clientes em modo Mobile-Card fluído */
  .table-responsive {
    border-radius: 12px !important;
    border: none !important;
  }

  .custom-table {
    min-width: 100% !important;
  }
}

/* ==========================================================================
   MÓDULO DE GESTÃO FINANCEIRA & DRE / FLUXO DE CAIXA
   ========================================================================== */
.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
  width: 100%;
}

.finance-kpi-grid .quadrant-card {
  padding: 12px 18px;
  min-height: 82px;
  border-radius: 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.finance-kpi-grid .quadrant-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.finance-kpi-grid .quadrant-icon {
  width: 42px;
  height: 42px;
  font-size: 16px;
  border-radius: 10px;
  margin-bottom: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finance-kpi-grid .quadrant-data {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.finance-kpi-grid .quadrant-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  display: block;
  margin-bottom: 2px;
}

.finance-kpi-grid .quadrant-value {
  font-size: 20px !important;
  font-weight: 800;
  margin: 1px 0 2px 0;
  white-space: nowrap;
  overflow: visible;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.finance-kpi-grid .quadrant-subtext {
  font-size: 11px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  display: block;
  opacity: 0.8;
}

@media (max-width: 1024px) {
  .finance-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .finance-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.badge-fin-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-fin-receita {
  background: rgba(118, 255, 3, 0.12);
  color: #76ff03;
  border: 1px solid rgba(118, 255, 3, 0.3);
}

.badge-fin-despesa {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-fin-investimento {
  background: rgba(139, 92, 246, 0.12);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-fin-pago {
  background: rgba(118, 255, 3, 0.15);
  color: #76ff03;
  border: 1px solid rgba(118, 255, 3, 0.35);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.badge-fin-pago:hover {
  background: rgba(118, 255, 3, 0.25);
  box-shadow: 0 0 10px rgba(118, 255, 3, 0.2);
}

.badge-fin-pendente {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.badge-fin-pendente:hover {
  background: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.category-meter {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.category-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.category-meter-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.category-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

