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

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --secondary: #00c853;
  --danger: #e53935;
  --warning: #ff6f00;
  --info: #0288d1;
  --bg: #f5f7fa;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --text: #1c1c2e;
  --text-light: #64748b;
  --border: #e2e8f0;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--secondary), var(--primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.logo h1 {
  font-size: 18px;
  font-weight: 700;
}

.menu {
  padding: 16px 0;
  flex: 1;
}

.menu-item {
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border-left: 3px solid transparent;
}

.menu-item .icon {
  font-size: 20px;
  width: 24px;
}

.menu-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.menu-item.active {
  background: rgba(0, 200, 83, 0.15);
  color: white;
  border-left-color: var(--secondary);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.user-icon {
  font-size: 18px;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255, 77, 77, 0.15);
  border: 1px solid rgba(255, 77, 77, 0.3);
  color: #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 77, 77, 0.25);
  border-color: rgba(255, 77, 77, 0.5);
  transform: translateY(-1px);
}

/* ==================== MAIN CONTENT ==================== */

.main-content {
  margin-left: 260px;
  padding: 32px;
  width: calc(100% - 260px);
  min-height: 100vh;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-light);
  font-size: 14px;
}

/* ==================== CARDS ==================== */

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--primary);
}

/* ==================== FORMS ==================== */

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

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-light);
}

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

/* ==================== BUTTONS ==================== */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--secondary);
  color: white;
}

.btn-primary:hover {
  background: #00a844;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 200, 83, 0.3);
}

.btn-secondary {
  background: var(--text-light);
  color: white;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #c62828;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ==================== GRIDS ==================== */

.produtos-grid,
.funcionarios-grid,
.bancos-grid,
.trafego-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.item-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.item-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.item-card-icon {
  font-size: 28px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.item-card-subtitle {
  font-size: 12px;
  color: var(--text-light);
}

.item-card-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--secondary);
  margin: 12px 0;
}

.item-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ==================== STATS ==================== */

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

.stat-card {
  padding: 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid;
}

.stat-card.green {
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-color: var(--secondary);
}

.stat-card.red {
  background: linear-gradient(135deg, #ffebee, #fce4ec);
  border-color: var(--danger);
}

.stat-card.blue {
  background: linear-gradient(135deg, #e3f2fd, #e1f5fe);
  border-color: var(--info);
}

.stat-card.orange {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border-color: var(--warning);
}

.stat-icon {
  font-size: 36px;
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.stat-info p {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}

.stat-info h3 {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
}

/* ==================== LUCRO BOX ==================== */

.lucro-box {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 24px;
}

.lucro-box h3 {
  color: white;
  margin-bottom: 8px;
}

.lucro-box .formula {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.lucro-value {
  font-size: 36px;
  font-weight: 900;
}

.total-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--primary);
  text-align: center;
}

/* ==================== FECHAMENTO ==================== */

.fechamento-result {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}

.fechamento-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.fechamento-item:last-child {
  border-bottom: none;
}

.fechamento-item.diferenca {
  background: white;
  padding: 16px;
  border-radius: 8px;
  margin-top: 12px;
  border: 2px solid var(--border);
}

.fechamento-item.diferenca.zero {
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-color: var(--secondary);
}

.fechamento-item.diferenca.erro {
  background: linear-gradient(135deg, #ffebee, #fce4ec);
  border-color: var(--danger);
}

.fechamento-status {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
}

.fechamento-status.sucesso {
  background: var(--secondary);
  color: white;
}

.fechamento-status.erro {
  background: var(--danger);
  color: white;
}

/* ==================== FILTER BAR ==================== */

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

/* ==================== LISTS ==================== */

.list-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.list-item-info p {
  font-size: 12px;
  color: var(--text-light);
}

.list-item-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

/* ==================== MODALS ==================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 28px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--primary);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ==================== INFO TEXT ==================== */

.info-text {
  background: #e3f2fd;
  border-left: 4px solid var(--info);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .sidebar {
    width: 80px;
  }

  .logo h1,
  .menu-item span:not(.icon) {
    display: none;
  }

  .main-content {
    margin-left: 80px;
    width: calc(100% - 80px);
    padding: 16px;
  }

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

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

/* ==================== UTILITIES ==================== */

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

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-info {
  color: var(--info);
}

.mt-2 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 16px;
}

/* ==================== OCR INTERFACE ==================== */

.loading-box {
  background: linear-gradient(135deg, #e3f2fd, #e1f5fe);
  border: 2px solid var(--info);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 16px 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.transaction-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.transaction-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: all 0.2s;
}

.transaction-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.transaction-card.selected {
  border-color: var(--secondary);
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
}

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

.transaction-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
}

.confidence-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.confidence-high {
  background: #e8f5e9;
  color: #2e7d32;
}

.confidence-medium {
  background: #fff3e0;
  color: #e65100;
}

.confidence-low {
  background: #ffebee;
  color: #c62828;
}

.transaction-details {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.category-select {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-top: 8px;
}

.ocr-summary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.ocr-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.ocr-summary-item {
  text-align: center;
}

.ocr-summary-item h4 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 4px;
}

.ocr-summary-item p {
  font-size: 12px;
  opacity: 0.9;
}

.bulk-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.keyword-tag {
  display: inline-block;
  background: var(--primary-light);
  color: white;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
}
