:root {
  --primary: #764ba2;
  --primary-dark: #5a3d7a;
  --primary-light: #b39ddb;
  --accent: #3498db;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #2c3e50;
  --text-muted: #7f8c8d;
  --border: #e0e0e0;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#toastContainer {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }

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

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

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

.skeleton {
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-kpi {
  height: 80px;
  margin-bottom: 0.5rem;
}

.skeleton-chart {
  height: 200px;
}

.btn-primary, .btn-secondary, .btn-danger, .btn-success {
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar nav a svg {
  flex-shrink: 0;
}

.sidebar nav a.active {
  border-left: 3px solid var(--primary);
  background: #34495e;
}

.sidebar .sub-nav a {
  padding-left: 2.25rem;
  font-size: 0.925rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.field-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15) !important;
}

.field-error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.2rem;
  display: block;
}

.modal-overlay { cursor: pointer; }
.modal-overlay > .modal { cursor: default; }

#toastContainer:empty { display: none; }

.venta-row { cursor: pointer; }
.venta-row:hover { background: #eef2f7; }
.detail-row td { background: #fafafa; }
.detail-row table thead th { background: #e0e0e0; color: #333; padding: 0.4rem 0.75rem; font-size: 0.85rem; }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 0.75rem 1rem; flex-direction: row; flex-wrap: wrap; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .sidebar nav a { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
  .sidebar .sub-nav { display: flex; }
  .sidebar .sub-nav a { padding-left: 0.5rem; }
  .sidebar .spacer { display: none; }
  .sidebar nav hr { display: none; }
  .sidebar-logo { max-width: 60px; margin-bottom: 0; }
  .main-content { padding: 1rem; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .modal { width: 95%; padding: 1.5rem; }
  form .form-row { grid-template-columns: 1fr; }
}
