/* ================================================================
   VENTASPRO — MAIN DESIGN SYSTEM
   Dark Navy Theme + Glassmorphism + Micro-animations
   ================================================================ */

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

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-darkest: #050810;
  --bg-dark: #0a0e1a;
  --bg-mid: #0f1525;
  --bg-card: #131928;
  --bg-card-hover: #1a2235;
  --bg-glass: rgba(19, 25, 40, 0.7);
  --border: rgba(99, 130, 255, 0.12);
  --border-light: rgba(99, 130, 255, 0.25);

  /* Brand */
  --primary: #4f7cff;
  --primary-glow: rgba(79, 124, 255, 0.35);
  --primary-dark: #3560e0;
  --secondary: #7c3aed;
  --accent: #06d6a0;
  --accent-glow: rgba(6, 214, 160, 0.3);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --info: #38bdf8;

  /* Day Colors (for map markers) */
  --day-lunes: #4f7cff;
  --day-martes: #06d6a0;
  --day-miercoles: #f59e0b;
  --day-jueves: #a78bfa;
  --day-viernes: #f87171;
  --day-sabado: #fb923c;

  /* Text */
  --text-primary: #e8ecf4;
  --text-secondary: #8892a4;
  --text-muted: #4d5a6e;
  --text-accent: #4f7cff;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--primary-glow);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-darkest);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ── Typography ─────────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.2rem;
}

h4 {
  font-size: 1rem;
}

p {
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--text-primary);
}

/* ── Layout ─────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-darkest);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--primary-glow);
}

.sidebar-logo .logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-md) var(--space-md) var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  margin: 2px var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.2), rgba(124, 58, 237, 0.15));
  color: var(--primary);
  border: 1px solid rgba(79, 124, 255, 0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-item .nav-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-item.active .nav-icon {
  background: rgba(79, 124, 255, 0.15);
  color: var(--primary);
}

.nav-item .nav-label {
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
}

.user-card:hover {
  background: var(--bg-card-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info .user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info .user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Main Content ────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition-slow);
}

.main-content.collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ── Top Bar ─────────────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  font-size: 1.1rem;
}

.topbar-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  font-size: 1rem;
  position: relative;
}

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

.topbar-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-dark);
}

/* ── Page Content ────────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--space-lg);
  display: none;
  animation: fadeInUp 0.3s ease;
}

.page-content.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Page Header ─────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.page-header-left .page-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header-left .page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-header-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ── Grid ────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* KPI Cards */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

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

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

.kpi-card.orange::before {
  background: linear-gradient(90deg, var(--warning), #f97316);
}

.kpi-card.red::before {
  background: linear-gradient(90deg, var(--danger), #dc2626);
}

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

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
}

.kpi-card.blue .kpi-icon {
  background: rgba(79, 124, 255, 0.15);
  color: var(--primary);
}

.kpi-card.green .kpi-icon {
  background: rgba(6, 214, 160, 0.15);
  color: var(--accent);
}

.kpi-card.orange .kpi-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.kpi-card.red .kpi-icon {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-change {
  font-size: 0.75rem;
  margin-top: var(--space-sm);
  font-weight: 600;
}

.kpi-change.up {
  color: var(--success);
}

.kpi-change.down {
  color: var(--danger);
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.tab-btn {
  padding: 8px var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
}

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

.tab-btn.active {
  background: rgba(79, 124, 255, 0.15);
  border-color: rgba(79, 124, 255, 0.3);
  color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeInUp 0.2s ease;
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 10px var(--space-md);
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control option {
  background: var(--bg-card);
}

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

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

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

.btn-success {
  background: linear-gradient(135deg, var(--accent), var(--success));
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 6px var(--space-md);
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px var(--space-xl);
  font-size: 0.95rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background: var(--bg-mid);
  padding: 12px var(--space-md);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px var(--space-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(99, 130, 255, 0.06);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: var(--transition-fast);
}

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

.table tbody tr:hover td {
  color: var(--text-primary);
}

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: rgba(79, 124, 255, 0.15);
  color: var(--primary);
  border: 1px solid rgba(79, 124, 255, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background: rgba(56, 189, 248, 0.15);
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-muted {
  background: rgba(77, 90, 110, 0.3);
  color: var(--text-muted);
  border: 1px solid rgba(77, 90, 110, 0.3);
}

.badge.dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Search / Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px var(--space-md) 9px 38px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
  position: relative;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(79, 124, 255, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.modal-lg {
  max-width: 800px;
}

.modal.modal-xl {
  max-width: 1000px;
}

.modal.modal-sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  font-size: 1.1rem;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 280px;
  max-width: 360px;
  animation: toastIn 0.3s ease;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

.toast.warning {
  border-color: var(--warning);
}

.toast.info {
  border-color: var(--primary);
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info .toast-icon {
  color: var(--primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state .empty-text {
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ── Status Dot ──────────────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
}

.status-dot.inactive {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger-glow);
}

.status-dot.pending {
  background: var(--warning);
}

/* ── Product Card ────────────────────────────────────────────────── */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

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

.product-card-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-muted);
}

.product-card-body {
  padding: var(--space-md);
}

.product-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.product-cat {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: var(--space-sm);
}

.product-stock {
  font-size: 0.75rem;
  margin-top: 4px;
}

.product-stock.low {
  color: var(--danger);
}

.product-stock.ok {
  color: var(--success);
}

.product-stock.mid {
  color: var(--warning);
}

.product-offer-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

/* ── Map Container ───────────────────────────────────────────────── */
#map-container {
  height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Chart Container ─────────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

/* ── Order Item Row ──────────────────────────────────────────────── */
.order-item-row {
  display: grid;
  grid-template-columns: 1fr 80px 120px 40px;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

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

/* ── Divider ─────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .sidebar.mobile-open {
    transform: translateX(0);
  }

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

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: var(--space-md);
  }
}

/* ── Utility ─────────────────────────────────────────────────────── */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

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

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

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

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

.w-full {
  width: 100%;
}

.hidden {
  display: none !important;
}

.admin-only {
  display: none;
}

.body-admin .admin-only {
  display: inline-flex;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Login Page ──────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: var(--bg-darkest);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: rgba(79, 124, 255, 0.15);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: rgba(124, 58, 237, 0.12);
  bottom: -80px;
  right: -80px;
  animation-delay: -3s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: rgba(6, 214, 160, 0.08);
  top: 50%;
  left: 50%;
  animation-delay: -5s;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -20px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 30px) scale(0.95);
  }
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(79, 124, 255, 0.1);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto var(--space-md);
  box-shadow: 0 0 40px var(--primary-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 20px var(--primary-glow);
  }

  50% {
    box-shadow: 0 0 40px var(--primary-glow);
  }
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Separator ───────────────────────────────────────────────────── */
.sep {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.sep::before,
.sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Role Selector ───────────────────────────────────────────────── */
.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.role-btn {
  padding: 12px var(--space-md);
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.role-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.role-btn.selected {
  border-color: var(--primary);
  background: rgba(79, 124, 255, 0.1);
  color: var(--primary);
}

.role-btn .role-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.role-btn .role-name {
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Quick Select Chips ──────────────────────────────────────────── */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.chip {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--text-muted);
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Inline quantity input ───────────────────────────────────────── */
.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-mid);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

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

.qty-input {
  width: 44px;
  text-align: center;
  background: var(--bg-card);
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  outline: none;
  padding: 0 4px;
  height: 28px;
}

/* ── Day color markers ───────────────────────────────────────────── */
.day-lunes {
  color: var(--day-lunes);
}

.day-martes {
  color: var(--day-martes);
}

.day-miercoles {
  color: var(--day-miercoles);
}

.day-jueves {
  color: var(--day-jueves);
}

.day-viernes {
  color: var(--day-viernes);
}

.day-sabado {
  color: var(--day-sabado);
}

/* ── Progress Bar ────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-mid);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
}

.progress-fill.blue {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.progress-fill.green {
  background: linear-gradient(90deg, var(--accent), var(--success));
}

.progress-fill.orange {
  background: linear-gradient(90deg, var(--warning), #f97316);
}

/* ── Loading spinner ─────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Tooltip ─────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: var(--transition-fast);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── Preview Document & Receipt Styles ──────────────────────────── */
.preview-document {
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  color: var(--text-primary);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.preview-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.preview-logo-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.preview-meta-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}

.preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.preview-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-meta-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.preview-meta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-vendor-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 124, 255, 0.12);
  color: var(--primary);
  border: 1px solid rgba(79, 124, 255, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.88rem;
}

.preview-table th {
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 10px var(--space-md);
  border-bottom: 2px solid var(--border);
  text-align: left;
}

.preview-table td {
  padding: 10px var(--space-md);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.preview-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.preview-totals-box {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

.preview-totals-card {
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.preview-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.preview-total-row.grand-total {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
}

/* ── Product Card Controls ───────────────────────────────────────── */
.product-card .card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Printing Styles ─────────────────────────────────────────────── */
.print-only {
  display: none;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .app-layout,
  .modal-overlay,
  .sidebar,
  .topbar,
  .toast-container,
  .btn,
  .filter-bar,
  .tabs {
    display: none !important;
  }

  .print-only,
  #print-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 20mm !important;
    background: #ffffff !important;
    color: #111111 !important;
  }

  #print-container * {
    color: #111111 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .printable-receipt {
    max-width: 800px;
    margin: 0 auto;
    font-family: Arial, Helvetica, sans-serif;
  }

  .printable-receipt table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 15px 0 !important;
  }

  .printable-receipt th,
  .printable-receipt td {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    text-align: left !important;
  }

  .printable-receipt th {
    background: #f2f2f2 !important;
    font-weight: bold !important;
  }
}