/* ========================================================
   SysMayorista — Premium Dashboard Design System
   DSSD © 2026
   ======================================================== */

/* --- CSS Variables (Design Tokens) --- */
:root {
  --bg-primary: #0a0f1e;
  --bg-secondary: #0f172a;
  --bg-surface: rgba(15, 23, 42, 0.75);
  --bg-surface-hover: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(30, 41, 59, 0.55);
  --bg-glass-strong: rgba(30, 41, 59, 0.8);

  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(59, 130, 246, 0.4);

  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --blue-glow: rgba(59, 130, 246, 0.25);
  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --green: #10b981;
  --green-light: #34d399;
  --green-glow: rgba(16, 185, 129, 0.2);
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --red: #ef4444;
  --red-light: #f87171;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
  --shadow-glow-blue: 0 0 20px rgba(59,130,246,0.15);
  --shadow-glow-green: 0 0 20px rgba(16,185,129,0.15);

  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 270px;
  --header-height: 72px;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --- Background Effects --- */
.background {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute; border-radius: 50%;
  filter: blur(120px); opacity: 0.3;
  animation: orbFloat 12s infinite alternate ease-in-out;
}
.orb-1 { width: 500px; height: 500px; background: var(--blue); top: -150px; left: -100px; }
.orb-2 { width: 600px; height: 600px; background: var(--purple); bottom: -200px; right: -150px; animation-delay: -4s; }
.orb-3 { width: 350px; height: 350px; background: var(--green); top: 50%; left: 40%; opacity: 0.15; animation-delay: -8s; }

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.05); }
  100% { transform: translate(60px, 40px) scale(1); }
}

/* --- Glass Utility --- */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

.glass-strong {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

/* --- Dashboard Layout --- */
.dashboard {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  margin: 16px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.sidebar-logo {
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 8px;
}

.sidebar-logo h2 {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue-light), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}

.sidebar nav { flex: 1; }
.sidebar nav ul { list-style: none; }

.sidebar nav li {
  padding: 13px 16px;
  margin-bottom: 4px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  position: relative;
  user-select: none;
}

.sidebar nav li .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar nav li .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar nav li:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text-primary);
  transform: translateX(4px);
}

.sidebar nav li.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.15));
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow: var(--shadow-glow-blue);
}

.sidebar nav li.active .nav-icon svg {
  stroke: var(--blue-light);
}

.sidebar-footer {
  padding: 16px 8px 0;
  border-top: 1px solid var(--border-glass);
  margin-top: auto;
}

.sidebar-footer p {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

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

/* --- Header Bar --- */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  box-shadow: var(--shadow-md);
}

.header-bar h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-date {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.avatar {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  width: 38px; height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 0 12px rgba(59,130,246,0.3);
}

/* --- Page Content Transition --- */
.page-content {
  animation: pageIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

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

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  opacity: 0;
  transition: var(--transition-base);
}

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

.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 50px; height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.15); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); }

.stat-info h3 {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.stat-info .stat-trend {
  font-size: 0.75rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up { color: var(--green-light); }
.stat-trend.down { color: var(--red-light); }

/* --- Simulation Panel (Dashboard) --- */
.sim-panel {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.sim-panel::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08), transparent 70%);
  pointer-events: none;
}

.sim-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.sim-panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.sim-panel-header .ai-badge {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sim-panel > p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.sim-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.sim-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
}

.sim-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-blue);
}

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

.sim-btn .sim-btn-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sim-btn .sim-btn-icon.wa { background: rgba(37, 211, 102, 0.15); }
.sim-btn .sim-btn-icon.restock { background: rgba(245, 158, 11, 0.15); }
.sim-btn .sim-btn-icon.dispatch { background: rgba(139, 92, 246, 0.15); }

.sim-btn-text strong { display: block; margin-bottom: 2px; }
.sim-btn-text span { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }

/* --- Recent Orders Table (Dashboard) --- */
.orders-section {
  padding: 24px;
  flex: 1;
}

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

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.section-header .view-all {
  font-size: 0.82rem;
  color: var(--blue-light);
  cursor: pointer;
  transition: var(--transition-fast);
  background: none;
  border: none;
  font-family: var(--font);
}
.section-header .view-all:hover { color: #fff; }

/* --- Data Tables (Shared) --- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition-fast);
  font-size: 0.88rem;
}

.data-table tbody tr { cursor: default; }

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

.data-table tbody tr td:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.data-table tbody tr td:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.data-table .order-id {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.data-table .client-name { font-weight: 500; }

.data-table .amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green-light);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-light);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge.processing {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-light);
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-light);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge.neutral {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border-color: var(--border-glass-hover);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.78rem;
}

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font);
  font-size: 1rem;
}
.btn-icon:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* --- Products Page --- */
.products-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  min-width: 280px;
  transition: var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-box svg {
  width: 16px; height: 16px;
  stroke: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.stock-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-controls .btn-icon {
  width: 28px; height: 28px;
  font-size: 0.9rem;
}

.stock-value {
  min-width: 50px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stock-low { color: var(--red-light); }
.stock-warning { color: var(--amber-light); }
.stock-ok { color: var(--green-light); }

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

/* --- Orders Page --- */
.filters-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.filter-btn.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-light);
  border-color: rgba(59, 130, 246, 0.3);
}

.order-status-select {
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}
.order-status-select:focus {
  border-color: var(--blue);
}
.order-status-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* --- Clients Page --- */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.client-card {
  padding: 24px;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.client-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-lg);
}

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

.client-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.client-avatar.tier-gold { background: linear-gradient(135deg, #f59e0b, #d97706); }
.client-avatar.tier-silver { background: linear-gradient(135deg, #94a3b8, #64748b); }
.client-avatar.tier-platinum { background: linear-gradient(135deg, var(--blue), var(--purple)); }

.client-info { margin-left: 12px; flex: 1; }
.client-info h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 2px; }
.client-info p { font-size: 0.8rem; color: var(--text-muted); }

.ai-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}
.ai-score.high { color: var(--green-light); }
.ai-score.mid { color: var(--amber-light); }
.ai-score.low { color: var(--red-light); }

.client-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.client-stat {
  background: rgba(255,255,255,0.03);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
.client-stat label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}
.client-stat span {
  font-size: 0.9rem;
  font-weight: 700;
}

.ai-insight {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.ai-insight-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-insight p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Reports Page --- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  padding: 24px;
}

.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

.ai-report-section { padding: 24px; }

.ai-report-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-report-content {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 20px;
  min-height: 120px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.ai-report-content .typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--green-light);
  margin-left: 2px;
  animation: blink 0.7s infinite;
  vertical-align: text-bottom;
}

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

/* --- WhatsApp Chat Modal --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wa-chat {
  width: 420px;
  max-width: 95vw;
  max-height: 85vh;
  background: #0b141a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.9) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.wa-header {
  background: #1f2c34;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wa-header-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.wa-header-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e9edef;
}
.wa-header-info span {
  font-size: 0.72rem;
  color: var(--green-light);
}

.wa-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #8696a0;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: var(--transition-fast);
}
.wa-close:hover { color: #fff; }

.wa-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  min-height: 350px;
}

.wa-message {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  position: relative;
  animation: msgIn 0.3s ease-out;
}

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

.wa-message.client {
  background: #005c4b;
  color: #e9edef;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.wa-message.bot {
  background: #1f2c34;
  color: #e9edef;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.wa-message .msg-time {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
  text-align: right;
  margin-top: 4px;
}

.wa-typing {
  align-self: flex-start;
  background: #1f2c34;
  padding: 12px 18px;
  border-radius: 8px;
  border-bottom-left-radius: 2px;
  display: flex;
  gap: 4px;
  animation: msgIn 0.2s ease-out;
}

.wa-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #8696a0;
  animation: typingBounce 1.2s infinite;
}
.wa-typing span:nth-child(2) { animation-delay: 0.15s; }
.wa-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.wa-footer {
  background: #1f2c34;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.wa-footer span {
  flex: 1;
  font-size: 0.82rem;
  color: #8696a0;
  font-style: italic;
}

/* --- Simulation Step Panel (Restock / Dispatch) --- */
.sim-modal {
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.sim-modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sim-modal .sim-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.sim-modal .sim-close:hover { color: #fff; }

.sim-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-glass);
  animation: msgIn 0.3s ease-out;
}

.sim-step:last-child { border-bottom: none; }

.sim-step-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.sim-step-icon.loading { background: rgba(59,130,246,0.15); }
.sim-step-icon.success { background: rgba(16,185,129,0.15); }
.sim-step-icon.warning { background: rgba(245,158,11,0.15); }

.sim-step-content h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.sim-step-content p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sim-step-content .email-preview {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.6s ease;
}

/* Route visualization */
.route-visual {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 10px;
}

.route-stop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.82rem;
}

.route-stop .route-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  flex-shrink: 0;
  position: relative;
}

.route-stop .route-dot.start { background: var(--green); border-color: var(--green); }
.route-stop .route-dot.end { background: var(--blue); border-color: var(--blue); }

.route-line {
  width: 2px;
  height: 20px;
  background: rgba(59,130,246,0.3);
  margin-left: 5px;
}

.route-savings {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-glass);
}

.route-saving-item {
  flex: 1;
  text-align: center;
}
.route-saving-item label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.route-saving-item span {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--green-light);
}

/* --- Notification Toast --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 300px;
  max-width: 420px;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

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

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

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

.toast.success { border-left: 3px solid var(--green); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--amber); }
.toast.error { border-left: 3px solid var(--red); }

/* --- Activity Log (Dashboard) --- */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.84rem;
}

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

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.green { background: var(--green); }
.activity-dot.blue { background: var(--blue); }
.activity-dot.amber { background: var(--amber); }
.activity-dot.purple { background: var(--purple); }

.activity-text { flex: 1; color: var(--text-secondary); line-height: 1.4; }
.activity-text strong { color: var(--text-primary); }
.activity-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; margin-top: 2px; }

/* --- Demo Context Box --- */
.demo-context {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-left: 4px solid var(--green);
  color: var(--text-primary);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  max-width: 340px;
  z-index: 4000;
  backdrop-filter: blur(12px);
  font-family: var(--font);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.5s ease-out;
}

.demo-context h3 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--green);
}

.demo-context p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.demo-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  transition: var(--transition-fast);
}
.demo-close:hover { color: #fff; }

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

/* --- Back Button (Preserved) --- */
.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 9999;
  background: rgba(16, 185, 129, 0.6);
  color: #fff;
  padding: 10px;
  width: 44px;
  height: 44px;
  text-decoration: none;
  border-radius: 50px;
  font-family: var(--font);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.back-btn:hover {
  width: 165px;
  background: rgba(16, 185, 129, 0.9);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-btn .icon {
  font-size: 18px;
  min-width: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.back-btn .text {
  opacity: 0;
  margin-left: 8px;
  transition: opacity 0.3s ease;
  font-size: 14px;
}

.back-btn:hover .text {
  opacity: 1;
  transition-delay: 0.1s;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: 1fr; }
  .sim-buttons { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 100%; }
  .dashboard { flex-direction: column; height: auto; min-height: 100vh; }
  body { overflow: auto; }
  .sidebar {
    width: auto;
    margin: 0;
    padding: 12px;
    border-radius: 0;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .sidebar-logo { padding: 0; border-bottom: none; margin-bottom: 0; }
  .sidebar-logo .logo-sub { display: none; }
  .sidebar nav ul { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
  .sidebar nav li { padding: 8px 12px; margin-bottom: 0; font-size: 0.8rem; white-space: nowrap; }
  .sidebar-footer { display: none; }
  .main-content { padding: 12px; }
  .header-bar { flex-direction: column; gap: 10px; text-align: center; padding: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .demo-context { max-width: 280px; bottom: 10px; right: 10px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .products-toolbar { flex-direction: column; }
  .search-box { min-width: 100%; }
}
