:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --dark-bg: #1e293b;
  --darker-bg: #0f172a;
  --light-bg: #f8fafc;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 220px;
  height: 100vh;
  background: linear-gradient(180deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h2 {
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: var(--text-light);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.nav-item:hover::before,
.nav-item.active::before {
  transform: translateX(0);
}

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

.nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--white);
}

.nav-icon {
  font-size: 1.25rem;
  margin-right: 1rem;
  width: 24px;
  display: inline-block;
}

.nav-text {
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 1rem 1.5rem;
}

.nav-action {
  color: var(--primary-light);
}

.nav-action:hover {
  color: var(--white);
  background: rgba(99, 102, 241, 0.1);
}

.nav-logout {
  color: var(--danger-color);
}

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

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  font-size: 0.875rem;
  text-align: center;
}

/* ==================== MAIN WRAPPER ==================== */
.main-wrapper {
  margin-left: 220px;
  min-height: 100vh;
  background: var(--light-bg);
  padding: 2rem;
  transition: margin-left 0.3s ease;
}

.pagina {
  display: none;
  animation: fadeIn 0.4s ease;
}

.pagina.ativa {
  display: block;
}

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

/* ==================== DASHBOARD ==================== */
.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.dashboard-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ==================== FILTROS DE CONTAGEM ==================== */
.count-filters-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.count-filter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--light-bg);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  min-width: 120px;
}

.count-filter-item:hover {
  background: var(--primary-light);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.count-filter-item.active {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.count-number {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: inherit;
}

.count-value {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: inherit;
  opacity: 0.9;
}

.count-label {
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  color: inherit;
}

@media (max-width: 768px) {
  .count-filters-container {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .count-filter-item {
    min-width: 100px;
    padding: 0.75rem 1rem;
  }
  
  .count-number {
    font-size: 1.5rem;
  }
  
  .count-value {
    font-size: 0.75rem;
  }
  
  .count-label {
    font-size: 0.75rem;
  }
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.stat-card.stat-primary::before {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.stat-card.stat-success::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.stat-card.stat-warning::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.stat-card.stat-info::before {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.stat-icon {
  font-size: 3rem;
  opacity: 0.2;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.stat-details {
  position: relative;
  z-index: 1;
}

.stat-details h3 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.stat-details p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.dashboard-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.dashboard-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.dashboard-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.pedidos-andamento-lista {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pedido-andamento-item {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--light-bg);
  border-left: 4px solid var(--primary-color);
  transition: all 0.3s ease;
  cursor: pointer;
}

.pedido-andamento-item:hover {
  background: #e0e7ff;
  transform: translateX(5px);
}

.pedido-andamento-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pedido-andamento-numero {
  font-weight: 600;
  color: var(--primary-color);
}

.pedido-andamento-valor {
  font-weight: 700;
  color: var(--text-primary);
}

.pedido-andamento-cliente {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.pedido-andamento-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-light);
}

.status-chart {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--light-bg);
  transition: all 0.3s ease;
}

.status-item:hover {
  background: #e0e7ff;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-badge {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-name {
  font-weight: 500;
  color: var(--text-primary);
}

.status-count {
  font-weight: 600;
  color: var(--primary-color);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.search-input {
  flex: 1;
  min-width: 250px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ==================== TABLE ==================== */
.table-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.data-table thead {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white);
}

.data-table th {
  padding: 0.4rem 0.3rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

/* Larguras específicas para cada coluna */
.data-table th:nth-child(1) { width: 40px; }   /* # */
.data-table th:nth-child(2) { width: 65px; }  /* DATA */
.data-table th:nth-child(3) { width: 80px; }  /* CLIENTE */
.data-table th:nth-child(4) { width: 180px; }  /* PRODUTOS */
.data-table th:nth-child(5) { width: 65px; }  /* STATUS */
.data-table th:nth-child(6) { width: 65px; }  /* VALOR */
.data-table th:nth-child(7) { width: 80px; }  /* TIPO */
.data-table th:nth-child(8) { width: 80px; }  /* AÇÕES */

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

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

.data-table td {
  padding: 0.6rem 0.4rem;
  color: var(--text-primary);
  font-size: 0.7rem;
}

/* Ajustar coluna de produtos para permitir quebra de linha */
.data-table td:nth-child(4) {
  white-space: normal;
  word-wrap: break-word;
  max-width: 180px;
}

/* Outras colunas mantêm texto em linha única */
.data-table td:nth-child(1),
.data-table td:nth-child(2),
.data-table td:nth-child(3),
.data-table td:nth-child(5),
.data-table td:nth-child(6) {
  white-space: nowrap;
}

.data-table td.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

/* ==================== BADGES & STATUS ==================== */
.status {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-success {
  background: #d1fae5;
  color: #065f46;
}

.status-warning {
  background: #fed7aa;
  color: #92400e;
}

.status-danger {
  background: #fee2e2;
  color: #991b1b;
}

.status-info {
  background: #dbeafe;
  color: #1e40af;
}

.status-primary {
  background: #e0e7ff;
  color: #4338ca;
}

.status-admin {
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
}

.status-andamento {
  background: #fef3c7;
  color: #92400e;
}

/* Status de recebimento */
.status-recebido {
  background-color: #d4edda !important;
  border-left: 4px solid #28a745 !important;
}

.status-nao-recebido {
  background-color: #f8d7da !important;
  border-left: 4px solid #dc3545 !important;
}

.recebimento-select.status-recebido {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.recebimento-select.status-nao-recebido {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

/* Modal de confirmação de recebimento */
.confirmacao-info {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.confirmacao-info p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.confirmacao-info strong {
  color: #495057;
  font-weight: 600;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

/* Cores das situações das contas a receber */
.situacao-aberto {
  background-color: #e8f5e8; /* Verde claro */
}

.situacao-atrasado {
  background-color: #fff3cd; /* Amarelo claro */
}

.situacao-pago {
  background-color: #f8f9fa; /* Cinza claro */
}

.situacao-liquidado {
  background-color: #f8f9fa; /* Cinza claro - mantido para compatibilidade */
}

.situacao-criada {
  background-color: #e3f2fd; /* Azul claro - mantido para compatibilidade */
}

.situacao {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.situacao.situacao-aberto {
  background-color: #28a745;
  color: white;
}

.situacao.situacao-atrasado {
  background-color: #ffc107;
  color: #212529;
}

.situacao.situacao-pago {
  background-color: #6c757d;
  color: white;
}

.situacao.situacao-liquidado {
  background-color: #6c757d;
  color: white;
}

.situacao.situacao-criada {
  background-color: #2196f3;
  color: white;
}

/* ==================== STATUS DOS PEDIDOS ==================== */
.status-pedido {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
  min-width: 80px;
  text-align: center;
}

/* Status específicos dos pedidos */
.status-pedido.status-em-aberto {
  background-color: #28a745;
  color: white;
}

.status-pedido.status-em-andamento {
  background-color: #17a2b8;
  color: white;
}

.status-pedido.status-atendido {
  background-color: #6c757d;
  color: white;
}

.status-pedido.status-cancelado {
  background-color: #dc3545;
  color: white;
}

.status-pedido.status-pendente {
  background-color: #ffc107;
  color: #212529;
}

.status-pedido.status-nao-encontrado {
  background-color: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.status-pedido.status-sem-pedido {
  background-color: #f8f9fa;
  color: #6c757d;
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--white);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.pagination button:hover:not(:disabled) {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination span {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ==================== MODAL ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal.ativo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: slideUp 0.3s ease;
}

.modal-content table {
  min-width: 100%;
  table-layout: auto;
}

.modal-content th,
.modal-content td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-content th:first-child,
.modal-content td:first-child {
  white-space: normal;
  min-width: 200px;
}

/* Evitar quebra de linha em nomes de clientes */
.cliente-nome {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Melhorar exibição de informações do pedido */
.pedido-detalhes strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

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

.close {
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.close:hover {
  color: var(--danger-color);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-content {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }

  .data-table {
    font-size: 0.75rem;
    min-width: 650px;
  }

  .data-table th,
  .data-table td {
    padding: 0.4rem 0.3rem;
  }

  /* Ajustar larguras para mobile */
  .data-table th:nth-child(1) { width: 35px; }   /* # */
  .data-table th:nth-child(2) { width: 60px; }  /* DATA */
  .data-table th:nth-child(3) { width: 70px; }  /* CLIENTE */
  .data-table th:nth-child(4) { width: 150px; }  /* PRODUTOS */
  .data-table th:nth-child(5) { width: 60px; }  /* STATUS */
  .data-table th:nth-child(6) { width: 60px; }  /* VALOR */
  .data-table th:nth-child(7) { width: 60px; }  /* TIPO */
  .data-table th:nth-child(8) { width: 70px; }  /* AÇÕES */
}

/* Para telas grandes */
@media (min-width: 1200px) {
  .data-table {
    min-width: 800px;
  }

  /* Aumentar larguras para telas grandes */
  .data-table th:nth-child(1) { width: 50px; }   /* # */
  .data-table th:nth-child(2) { width: 80px; }  /* DATA */
  .data-table th:nth-child(3) { width: 100px; }  /* CLIENTE */
  .data-table th:nth-child(4) { width: 200px; }  /* PRODUTOS */
  .data-table th:nth-child(5) { width: 80px; }  /* STATUS */
  .data-table th:nth-child(6) { width: 80px; }  /* VALOR */
  .data-table th:nth-child(7) { width: 90px; }  /* TIPO */
  .data-table th:nth-child(8) { width: 90px; }  /* AÇÕES */
}

/* ==================== UTILITIES ==================== */
.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
  font-style: italic;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--secondary-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ==================== LOGIN PROFESSIONAL ==================== */
.login-body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  position: relative;
  overflow: hidden;
}

.login-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.login-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
}

.login-container {
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.login-box {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
}

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

.company-logo {
  margin-bottom: 1.5rem;
}

.logo-icon {
  font-size: 3rem;
  margin: 0 auto;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
  margin: 0 auto 1.5rem auto;
}

.company-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.025em;
}

.company-name {
  font-size: 2.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.system-subtitle {
  color: #64748b;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-form {
  margin-top: 2rem;
}

.login-form .form-group {
  margin-bottom: 1.5rem;
}

.login-form .form-group label {
  display: block;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.login-form .form-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
}

.login-form .form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: rgba(255, 255, 255, 0.95);
}

.login-form .btn-primary {
  width: 100%;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.login-form .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.login-form .btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Filtros */
.filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type="date"] {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s ease;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.search-input {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s ease;
  min-width: 200px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Paginação */
.pagination-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.btn-pagination {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  color: var(--text-color);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pagination:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
}

.btn-pagination.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination-info {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Responsivo para filtros */
@media (max-width: 768px) {
  .filters-container {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-group {
    min-width: auto;
  }
  
  .search-input {
    min-width: auto;
  }
  
  .pagination-controls {
    flex-wrap: wrap;
  }
}

/* Botão secundário */
.btn-secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.4);
}

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

/* ===== ESTILOS PARA GRÁFICOS DO DASHBOARD ===== */

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.chart-container {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.chart-container:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.chart-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.btn-chart {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--white);
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-chart:hover {
  background: var(--light-bg);
  color: var(--text-primary);
}

.btn-chart.active {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-wrapper canvas {
  max-height: 100%;
  max-width: 100%;
}

/* Responsividade para gráficos */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .chart-wrapper {
    height: 250px;
  }
}

@media (max-width: 768px) {
  .chart-container {
    padding: 1rem;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .chart-wrapper {
    height: 200px;
  }
}

/* Animações para gráficos */
@keyframes chartFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chart-container {
  animation: chartFadeIn 0.6s ease-out;
}

/* Estilos para pedidos em andamento no dashboard */
.pedidos-andamento-lista {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.pedidos-andamento-lista::-webkit-scrollbar {
  width: 6px;
}

.pedidos-andamento-lista::-webkit-scrollbar-track {
  background: var(--light-bg);
  border-radius: 3px;
}

.pedidos-andamento-lista::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.pedidos-andamento-lista::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ==================== PÁGINA DE COMPARAÇÃO VHSYS ==================== */
#pagina-comparacao-vhsys .data-table th {
  text-align: center;
  background: var(--light-bg) !important;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

#pagina-comparacao-vhsys .data-table th[rowspan="2"] {
  vertical-align: middle;
}

#pagina-comparacao-vhsys .data-table td {
  text-align: center;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border-color);
}

#pagina-comparacao-vhsys .data-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

/* Estilos para valores VHSys e Controle */
.valor-vhsys {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info-color);
  font-weight: 700;
}

.valor-controle {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  font-weight: 700;
}

/* Estilos para diferenças */
.diferenca-zero {
  color: var(--secondary-color);
  font-weight: 700;
}

.diferenca-positiva {
  color: var(--info-color);
  font-weight: 700;
}

.diferenca-negativa {
  color: var(--danger-color);
  font-weight: 700;
}

/* Status badges */
.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.sem-diferenca {
  background: var(--secondary-color);
  color: white;
}

.status-badge.vhsys-maior {
  background: var(--info-color);
  color: white;
}

.status-badge.controle-maior {
  background: var(--warning-color);
  color: white;
}

.status-badge.apenas-vhsys {
  background: var(--primary-color);
  color: white;
}

.status-badge.apenas-controle {
  background: var(--danger-color);
  color: white;
}

/* Comparação de valores */
.valor-comparacao {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.valor-vhsys {
  font-size: 0.875rem;
  color: var(--info-color);
  font-weight: 600;
}

.valor-controle {
  font-size: 0.875rem;
  color: var(--warning-color);
  font-weight: 600;
}

.valor-diferenca {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
}

.valor-diferenca.positiva {
  background: rgba(16, 185, 129, 0.1);
  color: var(--secondary-color);
}

.valor-diferenca.negativa {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.valor-diferenca.zero {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-secondary);
}

/* Botões de ação específicos */
.btn-detalhes-cliente {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Estatísticas específicas da comparação */
#stats-comparacao .stat-card {
  border-left: 4px solid var(--primary-color);
}

#stats-comparacao .stat-card:nth-child(2) {
  border-left-color: var(--info-color);
}

#stats-comparacao .stat-card:nth-child(3) {
  border-left-color: var(--warning-color);
}

#stats-comparacao .stat-card:nth-child(4) {
  border-left-color: var(--secondary-color);
}

/* Responsividade específica para comparação */
@media (max-width: 768px) {
  #pagina-comparacao-vhsys .data-table {
    font-size: 0.75rem;
  }
  
  #pagina-comparacao-vhsys .valor-comparacao {
    font-size: 0.75rem;
  }
  
  .status-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
  }
}
