@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* ==========================================================================
     Design System & Tokens - Zyron Analytics v2
     ========================================================================== */
  
  /* --- Typography --- */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* --- Color Palette (Light Theme Default) --- */
  --bg-app: hsl(220, 20%, 97%); /* Fundo geral da aplicação (cinza super claro) */
  --bg-surface: hsl(0, 0%, 100%); /* Fundo de cartões (branco puro) */
  --bg-sidebar: hsl(225, 10%, 8%); /* Sidebar escura premium */
  
  /* Text Colors */
  --text-primary: hsl(222, 47%, 11%); /* Títulos e textos principais */
  --text-secondary: hsl(215, 16%, 47%); /* Textos auxiliares */
  --text-sidebar: hsl(210, 20%, 80%); /* Textos na sidebar */
  --text-sidebar-active: hsl(0, 0%, 100%); /* Texto ativo na sidebar */
  
  /* Accent Colors (Menta/Esmeralda como nas referências) */
  --primary-color: hsl(152, 60%, 65%); /* Verde Menta (DataLab tracker) */
  --primary-hover: hsl(152, 60%, 55%);
  --primary-light: hsl(152, 60%, 90%);
  --primary-text: hsl(152, 80%, 20%); /* Texto escuro sobre fundo menta */
  
  /* Secondary Accent (Azul/Roxo das linhas de gráfico) */
  --secondary-color: hsl(230, 80%, 75%);
  --secondary-light: hsl(230, 80%, 92%);
  
  /* Interface Colors */
  --border-color: hsl(214, 32%, 91%);
  --border-sidebar: hsl(225, 10%, 15%);
  
  /* Semantic Colors (Riscos/Alertas) */
  --risk-low: var(--primary-color);
  --risk-medium: hsl(38, 92%, 50%);
  --risk-high: hsl(0, 84%, 60%);
  
  /* --- Shapes & Effects --- */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-glow: 0 8px 24px -4px hsla(152, 60%, 65%, 0.4);
  
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
}

/* ==========================================================================
   CSS Reset Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition-base);
}

ul {
  list-style: none;
}

/* ==========================================================================
   App Layout
   ========================================================================== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-right: 1px solid var(--border-sidebar);
  transition: var(--transition-base);
  z-index: 50;
}

.sidebar-header {
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--surface-color);
  letter-spacing: -0.5px;
}

.nav-group {
  margin-bottom: 32px;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: hsl(225, 10%, 40%);
  margin-bottom: 12px;
  font-weight: 600;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-weight: 500;
  font-size: 14px;
}

.nav-item:hover {
  background-color: hsla(0, 0%, 100%, 0.05);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background-color: hsla(0, 0%, 100%, 0.1);
  color: var(--text-sidebar-active);
  font-weight: 600;
}

.nav-item i {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  margin-top: auto;
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 32px 48px;
}

/* Header / Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.page-title {
  font-size: 28px;
  color: var(--text-primary);
}

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

/* ==========================================================================
   UI Components
   ========================================================================== */

/* Cards */
.card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card.accent-card {
  background-color: var(--primary-color);
  color: var(--primary-text);
  border: none;
}

.card.dark-card {
  background-color: var(--bg-sidebar);
  color: var(--surface-color);
  border: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 14px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--primary-text);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: var(--bg-app);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.col-span-12 { grid-column: span 12; }
.col-span-8 { grid-column: span 8; }
.col-span-6 { grid-column: span 6; }
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }

/* ==========================================================================
   Responsive (Mobile First adaptations can be improved later)
   ========================================================================== */
/* Botões de controle da Sidebar no mobile */
.btn-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sidebar-close {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: hsla(0, 0%, 100%, 0.05);
  border: 1px solid hsla(0, 0%, 100%, 0.1);
  color: var(--text-sidebar);
  cursor: pointer;
  z-index: 100;
}

.btn-sidebar-close:hover {
  background-color: hsla(0, 0%, 100%, 0.1);
  color: #fff;
}

/* Container de tabelas responsivas */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
}

@media (max-width: 1024px) {
  /* Exibir botão de toggle do menu */
  .btn-menu-toggle {
    display: flex;
  }
  
  /* Exibir botão de fechar dentro da sidebar */
  .btn-sidebar-close {
    display: flex;
  }

  /* Gaveta do menu lateral */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    z-index: 10000; /* Acima de tudo */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  /* Overlay com desfoque premium */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
  
  /* Conteúdo Principal */
  .main-content {
    padding: 24px 20px;
  }
  
  .topbar {
    margin-bottom: 24px;
  }
  
  .page-title {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 16px;
    /* Clip corta o overflow visual da página sem bloquear o scroll interno dos filhos */
    overflow-x: clip;
  }

  /* ===== ABA VENDAS: Scroll horizontal nas tabelas ===== */

  /* Card contido dentro da tela — sem estouro lateral */
  #view-vendas .card {
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* O wrapper da tabela rola lateralmente de forma isolada */
  #view-vendas .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    display: block;
  }

  /* Largura mínima das tabelas de vendas (cabe em telas ~375px) */
  #view-vendas .data-table {
    min-width: 460px;
  }

  /* Card de Oportunidades de Revenda: texto longo deve quebrar linha */
  #vendas-alertas-list li {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    font-size: 13px;
  }

  #vendas-alertas-list li span {
    display: block;
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* Botões de ação da aba vendas (Nova Venda / Cadastrar Produto) */
  .vendas-header-actions {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .vendas-header-actions .btn {
    flex: 1 1 auto;
    min-width: 120px;
    text-align: center;
    justify-content: center;
    font-size: 13px !important;
    padding: 9px 12px !important;
  }
  
  /* Empilhamento robusto do Grid do Dashboard em 1 única coluna */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  
  .col-span-12, .col-span-8, .col-span-6, .col-span-4, .col-span-3 {
    grid-column: span 1 !important;
  }
  
  /* Ajuste de margem negativa do cartão de retornos no mobile */
  #returns-container {
    margin-top: 0 !important;
  }
  
  /* Grid de retornos em 1 coluna se for tela muito pequena */
  .returns-grid {
    grid-template-columns: 1fr !important;
  }

  /* Evitar zoom automático do navegador móvel ao focar em campos de texto */
  .form-control, input, textarea, select {
    font-size: 16px !important;
  }

  /* Prevenir quebras horizontais e zoom no cartão de retornos no mobile */
  .return-card {
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .return-info > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
  }
  
  .return-info > div:first-child > div {
    width: 100% !important;
  }

  .return-info > div:first-child .action-group {
    justify-content: flex-start !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  
  .return-info h4 {
    white-space: normal !important;
    word-break: break-word !important;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }
  
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
}


/* ==========================================================================
   View Routing Logic (SPA)
   ========================================================================== */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

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

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

/* Utils para tabelas (abrange todas as views) */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}
.tag-new {
  background: hsla(230, 80%, 75%, 0.1);
  color: var(--secondary-color);
}
.tag-buyer {
  background: hsla(152, 60%, 55%, 0.1);
  color: var(--primary-color);
}
.tag-warning {
  background: hsla(38, 92%, 50%, 0.1);
  color: var(--risk-medium);
}

/* ==========================================================================
   Action Buttons (Tabelas)
   ========================================================================== */
.action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.btn-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  opacity: 0.8;
}
.btn-action:hover {
  transform: scale(1.1);
  background: hsla(0, 0%, 0%, 0.02);
  opacity: 1;
}

.btn-action.act-orange { color: #f59e0b; border-color: rgba(245, 158, 11, 0.4); }
.btn-action.act-green { color: #10b981; border-color: rgba(16, 185, 129, 0.4); }
.btn-action.act-lime { color: #84cc16; border-color: rgba(132, 204, 22, 0.4); }
.btn-action.act-red { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.btn-action.act-blue { color: #3b82f6; border-color: rgba(59, 130, 246, 0.4); }

/* ==========================================================================
   Modais (Glassmorphism)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: hsla(0, 0%, 5%, 0.6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100005;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid hsla(0,0%,100%,0.1);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 24px 48px hsla(0,0%,0%,0.4);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  color: #fff;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* Ajuste específico para formulários dentro de modais (que são escuros) */
.modal-content .form-control {
  background: hsla(0,0%,0%,0.3);
  border-color: hsla(0,0%,100%,0.1);
  color: #fff;
}

.modal-content .form-control:focus {
  background: hsla(0,0%,0%,0.5);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px hsla(152, 60%, 65%, 0.1);
}


select.form-control option {
  background-color: hsl(225, 10%, 15%);
  color: #fff;
}

/* ==========================================================================
   Quick Actions (Dashboard)
   ========================================================================== */
.btn-quick {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  color: #000;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-quick:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-quick i {
  width: 18px;
  height: 18px;
}

.btn-quick-1 {
  background: var(--primary-color);
  color: var(--primary-text);
  border: 1px solid var(--primary-color);
}
.btn-quick-1:hover {
  background: var(--primary-hover);
}

.btn-quick-2 {
  background: hsla(152, 60%, 65%, 0.1);
  color: var(--primary-color);
  border: 1px solid hsla(152, 60%, 65%, 0.2);
}
.btn-quick-2:hover {
  background: hsla(152, 60%, 65%, 0.2);
}

.btn-quick-3 {
  background: hsla(230, 80%, 75%, 0.1);
  color: var(--secondary-color);
  border: 1px solid hsla(230, 80%, 75%, 0.2);
}
.btn-quick-3:hover {
  background: hsla(230, 80%, 75%, 0.2);
}

.btn-quick-4 {
  background: var(--bg-sidebar);
  color: #fff;
  border: 1px solid var(--bg-sidebar);
}
.btn-quick-4:hover {
  background: #000;
}

/* ==========================================================================
   Dashboard Returns Grid (Cards)
   ========================================================================== */
.returns-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding-top: 8px;
}

.return-card {
  background-color: var(--bg-surface);
  border-radius: 12px;
  padding: 12px;
  position: relative;
  border-left: 3px solid var(--risk-high);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.return-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.return-initial {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: hsla(220, 20%, 97%, 1); /* var(--bg-app) */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-color);
  border: 1px solid var(--border-color);
}

.return-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.return-info h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.return-risk {
  font-size: 12px;
  color: var(--risk-high);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.return-progress {
  display: flex;
  gap: 6px;
  padding: 4px 0;
}

.return-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
}

.return-progress-dot.active {
  background: var(--primary-color);
}

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

.return-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.return-actions {
  display: flex;
  gap: 8px;
}

/* Tamanho reduzido dos botões padrão quando estão no card de retorno */
.return-card .btn-action {
  width: 26px;
  height: 26px;
}

.return-card .btn-action i {
  width: 14px !important;
  height: 14px !important;
}
/* ==========================================================================
   Ajustes de Configurações (Interruptores e Botões)
   ========================================================================== */

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.setting-item:hover {
  border-color: var(--primary-color);
  background: #fff;
}

.setting-info h4 {
  color: var(--text-primary);
  margin-bottom: 2px;
}

.setting-info {
  flex: 1;
  min-width: 0;
  margin-right: 16px;
}

/* Switch Component */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Botão de Relatório Premium */
.btn-report {
  background-color: var(--bg-sidebar);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid hsla(0,0%,100%,0.1);
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.btn-report:hover {
  background-color: #000;
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px rgba(0,0,0,0.4);
}

.btn-report i {
  width: 20px;
  height: 20px;
  color: var(--primary-color);
}

.spin {
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  background: hsla(0,0%,100%,0.05);
  border: 1px solid hsla(0,0%,100%,0.05);
  padding: 12px;
  border-radius: 10px;
}

.note-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.note-item-text {
  font-size: 13.5px;
  color: #fff;
  line-height: 1.5;
}

.clickable-name {
  cursor: pointer;
  transition: color 0.2s ease;
}

.clickable-name:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.toast {
  background: var(--bg-sidebar);
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  animation: slideIn 0.3s ease-out;
  border: 1px solid hsla(0,0%,100%,0.1);
}

.toast i {
  color: var(--primary-color);
  width: 18px;
  height: 18px;
}

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

.toast.fade-out {
  animation: fadeOut 0.3s ease-in forwards;
}

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

/* ==========================================
   PDF REPORT STYLING
   ========================================== */
.pdf-report {
  font-family: 'Inter', sans-serif;
  color: #111;
  background-color: #fff;
  padding: 40px;
  box-sizing: border-box;
}

.pdf-report h1, .pdf-report h2, .pdf-report h3, .pdf-report h4 {
  color: #000;
  margin: 0;
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #333;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.pdf-header-logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
}

.pdf-header-info {
  text-align: right;
  font-size: 12px;
  color: #555;
  line-height: 1.6;
}

.pdf-section {
  margin-bottom: 30px;
}

.pdf-section-title {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #333;
  margin-bottom: 16px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

/* Cards Grid */
.pdf-grid-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.pdf-card {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  padding: 16px;
  border-radius: 8px;
}

.pdf-card-title {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 600;
}

.pdf-card-value {
  font-size: 20px;
  font-weight: 700;
  color: #000;
}

/* Comparativos */
.pdf-comparison {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.pdf-comp-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.pdf-comp-label {
  font-size: 13px;
  font-weight: 600;
}

.pdf-comp-val {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pdf-trend-up { color: #10b981; }
.pdf-trend-down { color: #ef4444; }
.pdf-trend-neutral { color: #6b7280; }

/* Lists / Tables */
.pdf-table {
  width: 100%;
  border-collapse: collapse;
}

.pdf-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: #555;
  padding: 8px;
  border-bottom: 1px solid #ccc;
}

.pdf-table td {
  padding: 10px 8px;
  font-size: 13px;
  border-bottom: 1px solid #eee;
}

/* Insights & Improvements */
.pdf-insights-box, .pdf-improvements-box {
  background: #fdfdfd;
  border-left: 4px solid #333;
  padding: 16px;
  margin-bottom: 16px;
}

.pdf-insights-box ul, .pdf-improvements-box ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #333;
  line-height: 1.8;
}

.pdf-improvements-box {
  border-left-color: #ef4444;
}

/* Weekly Chart placeholder */
.pdf-chart-container {
  height: 150px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-top: 20px;
  border-bottom: 1px solid #ddd;
}

.pdf-chart-bar {
  flex: 1;
  background-color: #333;
  min-height: 5px;
  position: relative;
  border-radius: 4px 4px 0 0;
}

.pdf-chart-label {
  position: absolute;
  bottom: -20px;
  width: 100%;
  text-align: center;
  font-size: 10px;
  color: #555;
}
.pdf-chart-value {
  position: absolute;
  top: -20px;
  width: 100%;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
}

/* ==========================================================================
   Auth View (Login/Register)
   ========================================================================== */
.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}

.auth-card {
  background: hsla(0, 0%, 100%, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid hsla(0, 0%, 100%, 0.1);
  padding: 40px;
  border-radius: 24px;
  width: 100%;
  max-width: 400px;
  color: #fff;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
  text-align: center;
}

.auth-card h2 {
  font-size: 28px;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.auth-card p {
  color: var(--text-sidebar);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-card .form-control {
  background: hsla(0,0%,0%,0.3);
  border-color: hsla(0,0%,100%,0.1);
  color: #fff;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.auth-card .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px hsla(152, 60%, 65%, 0.1);
}

.auth-card .btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  margin-bottom: 12px;
}

.auth-card .btn-secondary {
  background: transparent;
  border: 1px solid hsla(0,0%,100%,0.2);
  color: #fff;
}

.auth-card .btn-secondary:hover {
  background: hsla(0,0%,100%,0.05);
}

.auth-error {
  color: var(--risk-high);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ==========================================
   INTERFACES RESPONSIVAS PREMIUM (CARD HEADERS & ALIGNMENT)
   ========================================== */
.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-card-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.logout-footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 12px;
}

.btn-logout {
  background: #ef4444;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Media Queries Responsivas de Detalhe */
@media (max-width: 768px) {
  .card-header-flex {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }
  
  .card-header-flex h3 {
    text-align: center;
    font-size: 16px !important;
  }
  
  .card-header-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  
  .card-header-actions > div,
  .card-header-actions input,
  .card-header-actions button {
    width: 100% !important;
  }
  
  .card-header-actions .btn {
    justify-content: center;
  }

  .report-card-flex {
    flex-direction: column;
    align-items: stretch !important;
    gap: 16px;
    text-align: center;
  }
  
  .report-card-flex p {
    margin: 0 auto;
  }

  .btn-report {
    width: 100%;
    justify-content: center;
  }

  .logout-footer {
    justify-content: center;
    padding: 0;
  }

  .btn-logout {
    width: 100%;
    justify-content: center;
  }

  /* Regras de responsividade exclusivas para a aba de Clientes */
  .mobile-only-actions {
    display: flex !important;
    gap: 8px;
    margin-top: 6px;
    justify-content: flex-start;
  }
  .mobile-only-actions .action-group {
    justify-content: flex-start !important;
  }
  .desktop-only-cell {
    display: none !important;
  }
  .metrics-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* Lado a lado */
    gap: 12px !important;
    margin-bottom: 8px !important;
  }
  .metrics-container .card {
    grid-column: span 1 !important;
    min-height: 80px !important;
    padding: 12px !important;
  }
  .metrics-container .metric-label {
    font-size: 11px !important;
  }
  .metrics-container .metric-value {
    font-size: 26px !important;
    margin-top: 2px !important;
  }

  /* Regras de responsividade exclusivas para a aba de Vendas */
  .vendas-header-actions {
    flex-direction: row !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }
  .vendas-header-actions button {
    flex: 1 !important;
    padding: 10px 8px !important;
    font-size: 13px !important;
    justify-content: center !important;
  }
  .vendas-metrics-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* Grade 2x2 real */
    gap: 12px !important;
    margin-bottom: 16px !important;
  }
  .vendas-metrics-grid .col-span-3,
  .vendas-metrics-grid .col-span-6,
  .vendas-metrics-grid .col-span-4 {
    grid-column: span 1 !important; /* Cada card ocupa exatamente 1 de 2 colunas */
  }
  .vendas-metrics-grid .card {
    grid-column: span 1 !important;
    min-height: 80px !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
  }
  .vendas-metrics-grid .card p {
    font-size: 11px !important;
    text-align: center !important;
  }
  .vendas-metrics-grid .card h3 {
    font-size: 18px !important;
    margin-top: 4px !important;
    text-align: center !important;
  }
  .vendas-table-card {
    min-height: 280px !important;
    padding: 16px !important;
    overflow: hidden !important; /* Garante que o card não extrapole horizontalmente */
    width: 100% !important;
    box-sizing: border-box !important;
  }
  #vendas-alertas-list {
    gap: 10px !important;
  }
  #vendas-alertas-list li {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
    font-size: 13px !important;
  }

  /* Scroll horizontal isolado dentro do table-container (Clientes, Agenda, Serviços) */
  .table-container {
    overflow-x: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }
  /* Largura mínima padrão de todas as tabelas — força scroll horizontal */
  .data-table {
    min-width: 520px !important;
  }
  /* Tabelas de vendas com colunas mais densas podem ter min-width menor */
  #view-vendas .data-table {
    min-width: 460px !important;
  }
}

/* Regras padrão de visibilidade no Desktop */
.mobile-only-actions {
  display: none;
}
.desktop-only-cell {
  display: table-cell;
}

/* Uniformidade e Proporcionalidade de Inputs dentro dos Modais */
.modal-content .form-control {
  box-sizing: border-box !important;
  height: 46px !important;
  width: 100% !important;
  padding: 10px 16px !important;
}
.modal-content textarea.form-control {
  height: auto !important;
}

/* Efeito de hover no upload de foto de perfil */
#profile-avatar-container:hover #profile-avatar-upload-overlay {
  opacity: 1 !important;
}

/* ==========================================================================
   Melhorias de Usabilidade Mobile (Modais e Datas)
   ========================================================================== */

/* Habilita rolagem no modal inteiro se ele for mais alto que a tela do celular */
.modal-overlay {
  display: flex !important;
  align-items: flex-start !important; /* Inicia do topo para permitir rolagem natural */
  justify-content: center !important;
  overflow-y: auto !important; /* Rolagem vertical nativa */
  padding: 24px 12px !important; /* Margem de respiro nas bordas */
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  margin: auto 0 !important; /* Centraliza verticalmente se couber, rola naturalmente se maior */
  max-height: none !important; /* Garante que o card cresça e use o scroll do overlay */
  width: 100% !important;
  max-width: 400px !important;
  box-sizing: border-box !important;
}

/* Corrige o tamanho exagerado e estouro de largura dos inputs de data no iOS/Mobile */
.form-control[type="date"],
input[type="date"].form-control {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/* Garante alinhamento de texto e altura correta dos inputs de data no iOS Safari */
.form-control[type="date"]::-webkit-date-and-time-value {
  text-align: left !important;
  min-height: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ==========================================================================
   Custom Dropdown (Custom Select) Premium
   ========================================================================== */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 46px;
  padding: 10px 16px;
  background: hsla(0, 0%, 0%, 0.3) !important;
  border: 1px solid hsla(0, 0%, 100%, 0.1) !important;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.custom-select-trigger:focus,
.custom-select-container.open .custom-select-trigger {
  outline: none;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 4px hsla(152, 60%, 65%, 0.1) !important;
  background: hsla(0, 0%, 0%, 0.45) !important;
}

.custom-select-trigger-text {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.custom-select-chevron {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.custom-select-container.open .custom-select-chevron {
  transform: rotate(180deg);
  color: var(--primary-color);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.96) translateY(-8px);
  pointer-events: none;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
}

.custom-select-container.open .custom-select-dropdown {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.custom-select-search-container {
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.custom-select-search {
  width: 100% !important;
  height: 34px !important;
  padding: 6px 12px !important;
  background: rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-size: 13px !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.custom-select-search:focus {
  border-color: var(--primary-color) !important;
  background: rgba(0, 0, 0, 0.35) !important;
}

.custom-select-options {
  max-height: 200px;
  overflow-y: auto;
  padding: 6px;
}

/* Scrollbar fina para o menu */
.custom-select-options::-webkit-scrollbar {
  width: 5px;
}

.custom-select-options::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-options::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.custom-select-group-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
  padding: 8px 10px 4px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.custom-select-group-header:first-child {
  margin-top: 0;
  border-top: none;
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  margin-bottom: 2px;
}

.custom-select-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.custom-select-option.selected {
  background: rgba(45, 212, 191, 0.1);
}

.custom-select-option.selected .custom-select-opt-name {
  color: var(--primary-color);
  font-weight: 600;
}

.custom-select-opt-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.custom-select-opt-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  flex-shrink: 0;
}

.custom-select-opt-icon.service {
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.12);
  color: var(--primary-color);
}

.custom-select-opt-icon.product {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.custom-select-opt-name {
  font-size: 13px;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-opt-price {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  margin-left: 8px;
}

.custom-select-opt-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-select-opt-badge.service {
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.2);
  color: var(--primary-color);
}

.custom-select-opt-badge.product {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.custom-select-no-results {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  padding: 16px;
}

/* Estilos adicionais para itens de checkout com bordas de foco estilizadas */
.cart-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cart-item-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 2px 0 0 2px;
}

.cart-item-card.service::before {
  background: var(--primary-color);
  box-shadow: 0 0 8px var(--primary-color);
}

.cart-item-card.product::before {
  background: #3b82f6;
  box-shadow: 0 0 8px #3b82f6;
}

.cart-item-price-input {
  width: 85px !important;
  height: 34px !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: right !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.cart-item-price-input:not(:disabled) {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(0, 0, 0, 0.25) !important;
  color: #fff !important;
}

.cart-item-price-input:not(:disabled):focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15) !important;
  background: rgba(0, 0, 0, 0.35) !important;
}

.cart-item-price-input:disabled {
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  background: rgba(0, 0, 0, 0.1) !important;
  color: rgba(255, 255, 255, 0.35) !important;
  cursor: not-allowed;
}

/* Ocultar setas de incremento do input de número */
.cart-item-price-input::-webkit-outer-spin-button,
.cart-item-price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cart-item-price-input[type=number] {
  -moz-appearance: textfield;
}

.cart-item-delete-btn {
  background: rgba(239, 68, 68, 0.08) !important;
  color: #ef4444 !important;
  border-radius: 50% !important;
  border: 1px solid rgba(239, 68, 68, 0.15) !important;
  cursor: pointer !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.cart-item-delete-btn:hover {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  transform: scale(1.08) rotate(4deg);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}


