/* ============================================================
   SalesMonitor — Design System & Global Styles
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Variables --- */
:root {
  /* Colors */
  --bg-base:        #f6f5ff;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f3f0ff;
  --bg-input:       #f8f7ff;
  --border:         rgba(124,58,237,0.18);
  --border-subtle:  rgba(124,58,237,0.08);

  /* Primary Palette */
  --primary:        #7c3aed;
  --primary-dark:   #6d28d9;
  --primary-light:  #a78bfa;
  --secondary:      #6366f1;
  --accent:         #c4b5fd;

  /* Semantic */
  --success:        #10b981;
  --success-bg:     rgba(16,185,129,0.08);
  --warning:        #d97706;
  --warning-bg:     rgba(217,119,6,0.08);
  --danger:         #dc2626;
  --danger-bg:      rgba(220,38,38,0.08);
  --info:           #2563eb;
  --info-bg:        rgba(37,99,235,0.08);

  /* Text */
  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #64748b;

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --grad-success:   linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --grad-gold:      linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-dark:      linear-gradient(135deg, #ffffff 0%, #f3f0ff 100%);

  /* Layout */
  --sidebar-width:  260px;
  --sidebar-collapsed: 72px;
  --topbar-h:       64px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* Shadow */
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.05);
  --shadow-md:      0 8px 24px rgba(124,58,237,0.08);
  --shadow-lg:      0 12px 32px rgba(124,58,237,0.12);
  --shadow-glow:    0 0 24px rgba(167,139,250,0.2);

  /* Transitions */
  --transition:     0.2s ease;
  --transition-slow: 0.4s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f6f5ff;
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.hidden { display: none !important; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-base);
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 8s ease-in-out infinite;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #c4b5fd, transparent 70%);
  top: -200px; left: -150px;
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #a78bfa, transparent 70%);
  bottom: -150px; right: -100px;
  animation-delay: -3s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  top: 40%; left: 50%;
  animation-delay: -6s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 48px 40px;
  margin: 24px;
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.glass-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(16, 185, 129, 0.1);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.logo-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 0 16px rgba(99,102,241,0.5));
}
.login-brand {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-tagline {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.form-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-input::placeholder { color: var(--text-muted); }

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

.login-demo {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}
.demo-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.demo-accounts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.demo-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  transition: all var(--transition);
}
.demo-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(99,102,241,0.1);
}
.demo-role {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.demo-role.manager { background: rgba(99,102,241,0.2); color: var(--primary-light); }
.demo-role.sales { background: rgba(16,185,129,0.2); color: var(--success); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(99,102,241,0.6); transform: translateY(-1px); }

.btn-secondary {
  background: rgba(99,102,241,0.1);
  color: var(--primary-light);
  border: 1px solid rgba(99,102,241,0.3);
}
.btn-secondary:hover { background: rgba(99,102,241,0.2); }

.btn-success {
  background: var(--grad-success);
  color: white;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}
.btn-success:hover { box-shadow: 0 6px 24px rgba(16,185,129,0.5); transform: translateY(-1px); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-icon {
  padding: 8px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(124,58,237,0.04);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 64px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.logo-icon-sm { flex-shrink: 0; }
.sidebar-brand {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-card); color: var(--primary); border-color: var(--primary); }

/* Legacy user-avatar kept for JS compatibility */
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}
.user-info { overflow: hidden; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid transparent;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--bg-card-hover); color: var(--primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(99,102,241,0.08));
  color: var(--primary);
  border-color: rgba(124,58,237,0.2);
  font-weight: 600;
}

/* --- Expert Insights Promo Card --- */
.sidebar-promo {
  margin: 0 12px 12px;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: opacity var(--transition);
}
.sidebar-promo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-promo-title {
  font-size: 13px;
  font-weight: 700;
  color: white;
}
.sidebar-promo-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}
.sidebar-promo-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.sidebar-promo-btn:hover { background: rgba(255,255,255,0.3); }

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--border-subtle);
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.btn-logout:hover {
  background: var(--danger-bg);
  border-color: rgba(239,68,68,0.3);
  color: var(--danger);
}

/* --- Collapsed Sidebar --- */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .btn-logout span,
.sidebar.collapsed .sidebar-promo-content,
.sidebar.collapsed .sidebar-promo-btn { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .btn-logout { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-promo { align-items: center; padding: 12px 8px; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Overlay gelap di belakang sidebar (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;                /* di bawah sidebar (z-index: 100) agar nav bisa diklik */
  opacity: 0;
  transition: opacity 0.28s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ── Tombol × di dalam sidebar (hanya mobile) ── */
.sidebar-close-mobile {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.sidebar-close-mobile:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}
.page-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

/* Search in topbar */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: 38px;
  width: 220px;
  transition: border-color var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.topbar-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.topbar-search svg { color: var(--text-muted); flex-shrink: 0; }
.topbar-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}
.topbar-search-input::placeholder { color: var(--text-muted); }

/* Icon buttons in topbar */
.topbar-icon-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}
.topbar-icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: var(--border);
}
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid white;
}

/* Dev tools compact */
.topbar-dev-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* User profile in topbar */
.topbar-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.topbar-user-profile:hover { border-color: var(--border); background: var(--bg-card-hover); }
.user-avatar-img {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.topbar-user-info { line-height: 1.3; }
.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.topbar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Summary CTA button */
.btn-summary-ai {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124,58,237,0.4);
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-summary-ai:hover {
  box-shadow: 0 6px 20px rgba(124,58,237,0.5);
  transform: translateY(-1px);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.page-content { padding: 28px; flex: 1; }

/* ============================================================
   CARDS & STAT WIDGETS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}
.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before { background: var(--info); }

.stat-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon.primary { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.stat-icon.success { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-icon.warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-icon.info { background: rgba(59,130,246,0.15); color: var(--info); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-change {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(124, 58, 237, 0.03); }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-primary { background: rgba(99,102,241,0.1); color: var(--primary-light); }
.badge-gold {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(217,119,6,0.1));
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; }
.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 20px;
  transition: width 0.8s ease;
}
.progress-fill.success { background: var(--grad-success); }
.progress-fill.warning { background: var(--grad-gold); }

/* ============================================================
   FORMS
   ============================================================ */
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.form-control {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-card); }

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 24px; }

.modal-container.modal-lg { max-width: 900px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 24px; right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  min-width: 280px;
  max-width: 380px;
  animation: toastIn 0.3s ease;
  font-size: 13px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}
.toast-icon { flex-shrink: 0; }
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast.warning { border-color: rgba(245,158,11,0.3); }
.toast.info    { border-color: rgba(99,102,241,0.3); }

/* ============================================================
   TRANSACTION MODULE
   ============================================================ */
.tx-items-list { display: flex; flex-direction: column; gap: 12px; }
.tx-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}
.tx-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.tx-item-num {
  width: 22px; height: 22px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.tx-item-title { font-size: 13px; font-weight: 600; flex: 1; }
.tx-item-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}
.tx-item-remove:hover { color: var(--danger); }

.tx-summary {
  background: rgba(99,102,241,0.05);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}
.tx-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.tx-summary-row.total {
  font-size: 16px;
  font-weight: 700;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
  padding-top: 12px;
}
.tx-summary-row.total .amount { color: var(--primary-light); }

/* ============================================================
   STAMP CARD (legacy - kept for any existing uses)
   ============================================================ */
.stamp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}
.stamp-card:hover { border-color: var(--border); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.stamp-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
}
.stamp-dot.filled {
  border-color: var(--warning);
  background: rgba(245,158,11,0.1);
  animation: stampPop 0.3s ease;
}
@keyframes stampPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   ELEGANT STAMP CARD (modal)
   ============================================================ */
.stamp-card-elegant {
  background: linear-gradient(135deg, #faf5ff 0%, #f3f0ff 100%);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stamp-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stamp-elegant {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}

.stamp-filled {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
  color: white;
  animation: stampElePop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.stamp-filled:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(124,58,237,0.45); }

.stamp-empty {
  background: white;
  border: 2px dashed rgba(124,58,237,0.2);
  color: var(--text-muted);
}

.stamp-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.7;
}
.stamp-filled .stamp-num { color: rgba(255,255,255,0.8); }

@keyframes stampElePop {
  0%   { transform: scale(0.6) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

.stamp-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
}
.stamp-card-footer.reward-ready {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(217,119,6,0.05));
  border-color: rgba(245,158,11,0.4);
  color: #b45309;
}

.doctor-list { display: flex; flex-direction: column; gap: 12px; }
.doctor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
}
.doctor-card:hover { border-color: var(--border); background: var(--bg-card-hover); }

/* ============================================================
   BEST PRODUCTS CHART
   ============================================================ */
.products-grid { display: flex; flex-direction: column; gap: 8px; }
.product-rank-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.product-rank-item:hover { border-color: var(--border); background: var(--bg-card-hover); }
.rank-num {
  font-size: 18px;
  font-weight: 800;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.rank-num.gold { color: #ffd700; }
.rank-num.silver { color: #c0c0c0; }
.rank-num.bronze { color: #cd7f32; }

.product-rank-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.product-rank-name { font-size: 13px; font-weight: 600; }
.product-rank-cat { font-size: 11px; color: var(--text-muted); }
.product-rank-prog { height: 4px; background: rgba(255,255,255,0.06); border-radius: 20px; overflow: hidden; }
.product-rank-prog-fill { height: 100%; background: var(--grad-primary); border-radius: 20px; transition: width 1s ease; }

.product-rank-val { text-align: right; flex-shrink: 0; }
.product-rank-val-main { font-size: 13px; font-weight: 700; color: var(--primary-light); }
.product-rank-val-sub { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-list { display: flex; flex-direction: column; gap: 10px; }
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.leaderboard-item:hover { border-color: var(--border); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.leaderboard-item.rank-1 {
  background: linear-gradient(135deg, rgba(255,215,0,0.1), var(--bg-card) 60%);
  border-color: rgba(255,215,0,0.4);
}
.leaderboard-item.rank-2 {
  background: linear-gradient(135deg, rgba(192,192,192,0.08), var(--bg-card) 60%);
}
.leaderboard-item.rank-3 {
  background: linear-gradient(135deg, rgba(205,127,50,0.08), var(--bg-card) 60%);
}

.lb-rank {
  font-size: 22px;
  font-weight: 900;
  width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.lb-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: white;
  background: var(--grad-primary);
  flex-shrink: 0;
}

.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.lb-meta { font-size: 12px; color: var(--text-muted); }

.lb-progress { flex: 1; min-width: 120px; }
.lb-sales { text-align: right; flex-shrink: 0; }
.lb-sales-val { font-size: 16px; font-weight: 800; color: var(--primary-light); }
.lb-sales-label { font-size: 11px; color: var(--text-muted); }

.lb-badge {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 20px;
}

/* ============================================================
   FILTER TABS
   ============================================================ */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
}
.filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  transition: all var(--transition);
}
.filter-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.filter-tab:hover:not(.active) { color: var(--text-secondary); }

/* ============================================================
   DASHBOARD PAGES
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-header-left h1 {
  font-size: 22px;
  font-weight: 800;
}
.page-header-left p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.search-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* ============================================================
   MOBILE PREVIEW
   ============================================================ */
body.mobile-preview {
  background: linear-gradient(135deg, #f7fbfc 0%, #eaf7ef 100%);
  min-width: 0;
  overflow-x: hidden;
}
body.mobile-preview .sidebar {
  display: none;
}
body.mobile-preview .main-content {
  margin-left: 0;
  width: min(375px, 100%);
  max-width: 100%;
  margin: 16px auto;
  box-shadow: var(--shadow-lg);
  border-radius: 24px;
  overflow: hidden;
}
body.mobile-preview .topbar {
  border-radius: 24px 24px 0 0;
  padding: 0 12px;
}
body.mobile-preview .page-content {
  padding: 12px 12px 18px;
}
body.mobile-preview .mobile-menu-btn {
  display: inline-flex;
}
body.mobile-preview .sidebar-close-mobile {
  display: flex;
}
body.mobile-preview .sidebar-toggle {
  display: none;
}
body.mobile-preview .topbar-right {
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
body.mobile-preview .page-title {
  font-size: 16px;
  flex: 1 1 100%;
}
body.mobile-preview .toast-container {
  right: 12px;
  left: auto;
}
body.mobile-preview .btn {
  min-width: 0;
}
body.mobile-preview .btn-sm {
  padding: 6px 10px;
}
body.mobile-preview .transactions-grid {
  grid-template-columns: 1fr !important;
}
body.mobile-preview .transactions-grid > .card {
  width: 100%;
}
/* Form Pencatatan: hilangkan sticky di mobile preview */
body.mobile-preview .transactions-grid > .card:first-child {
  position: static !important;
}
/* Filter bar: stack vertikal */
body.mobile-preview .filter-row {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}
body.mobile-preview .filter-month {
  width: 100%;
  min-width: 0;
}
/* Sembunyikan tabel, tampilkan kartu */
body.mobile-preview .tx-table .table-wrapper {
  display: none !important;
}
body.mobile-preview .tx-mobile-cards {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
}
/* Top doctors: lebih kompak */
body.mobile-preview #top-doctors-list {
  gap: 10px;
}
body.mobile-preview .grand-total-badge {
  font-size: 11px;
  padding: 4px 10px;
}
body.mobile-preview .topbar-right {
  flex-wrap: wrap;
}
body.mobile-preview .topbar-right > div {
  width: 100%;
}
/* ============================================================
   MANAGER PANEL
   ============================================================ */
.manager-target-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.target-sales-list { display: flex; flex-direction: column; gap: 16px; }
.target-sales-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
}

/* ============================================================
   LOYALTY — STREAK BADGES
   ============================================================ */
.loyalty-streak-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.loyalty-streak-badge.reward {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(217,119,6,0.08));
  color: #b45309;
  border: 1px solid rgba(245,158,11,0.4);
}
.loyalty-streak-badge.streak {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(99,102,241,0.08));
  color: var(--primary);
  border: 1px solid rgba(124,58,237,0.2);
}
.loyalty-streak-badge.streak1 {
  background: rgba(16,185,129,0.08);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.2);
}

/* ============================================================
   REPORTS — PIPELINE EQUIPMENT
   ============================================================ */
.reports-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  width: fit-content;
}
.reports-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.reports-tab:hover { color: var(--text-primary); }
.reports-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.pipeline-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pipeline-table th,
.pipeline-table td { vertical-align: middle; }
.pipeline-table th { background: var(--bg-input); }

/* ============================================================
   TRANSAKSI — MOBILE CARD VIEW
   ============================================================ */

/* Desktop: sembunyikan kartu mobile */
.tx-mobile-cards { display: none; }

/* Kartu per transaksi */
.tx-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}
.tx-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.tx-card-date  { font-size: 11px; color: var(--text-muted); padding-top: 2px; }
.tx-card-amount { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.tx-card-doctor { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-top: 4px; }
.tx-card-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tx-card-sales { font-size: 11px; color: var(--primary-light); margin-top: 2px; }
.tx-card-items {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  line-height: 1.6;
}
.tx-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.tx-card-actions .btn { flex: 1; justify-content: center; }

.invoice-pdf-import {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px dashed rgba(99,102,241,0.35);
  border-radius: var(--radius-md);
  background: rgba(99,102,241,0.05);
}
.invoice-pdf-status {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}
.invoice-pdf-status.loading { color: var(--primary); }
.invoice-pdf-status.success { color: var(--success); }
.invoice-pdf-status.warning { color: var(--warning); }
.invoice-pdf-status.error { color: var(--danger); }
.invoice-pdf-import .btn:disabled { opacity: 0.6; cursor: wait; }

/* Stock import button group (KBT / SBI / KDS) */
.stock-import-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  user-select: none;
}
.stock-import-btn:hover { background: var(--bg-card-hover); color: var(--primary); }

/* Inline status dropdown in pipeline table */
.pipeline-status-select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 20px;
  padding: 3px 24px 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-width: 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: box-shadow 0.15s ease;
}
.pipeline-status-select:focus {
  box-shadow: 0 0 0 2px rgba(124,58,237,0.2);
}
.pipeline-status-select:hover {
  filter: brightness(0.97);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
.fade-in { animation: fadeIn 0.4s ease; }
.slide-up { animation: slideUp 0.4s ease; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .sidebar-toggle { display: none; }
  .sidebar-close-mobile { display: flex; }

  /* Paksa sidebar selalu expanded di mobile — abaikan class 'collapsed' */
  .sidebar.collapsed { width: var(--sidebar-width) !important; }
  .sidebar.collapsed .sidebar-brand,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .nav-section-label { display: block !important; opacity: 1 !important; width: auto !important; }
  .sidebar.collapsed .nav-item { justify-content: flex-start !important; padding: 10px 16px !important; }
  .sidebar.collapsed .sidebar-toggle svg { transform: none !important; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .topbar-dev-tools { display: none; }
  .topbar-user-info { display: none; }
  .btn-summary-ai span { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .stamp-grid { grid-template-columns: repeat(4, 1fr); }
  .leaderboard-item { flex-wrap: wrap; }
  .lb-progress { min-width: 100%; order: 5; }
  .transactions-grid { grid-template-columns: 1fr !important; }

  /* Form Pencatatan: hilangkan sticky di mobile */
  .transactions-grid > .card:first-child { position: static !important; }

  /* Filter bar: stack vertikal */
  .filter-row { display: flex !important; flex-direction: column !important; gap: 10px !important; }
  .filter-month { width: 100%; min-width: 0; }

  /* Sembunyikan tabel, tampilkan kartu */
  .tx-table .table-wrapper { display: none !important; }
  .tx-mobile-cards { display: flex !important; flex-direction: column; gap: 10px; }

  /* Top doctors: scroll horizontal tetap */
  #top-doctors-list { gap: 10px; }

  /* Search wrap full width */
  .tx-table + .tx-mobile-cards,
  .search-input-wrap { min-width: 0; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .demo-accounts { flex-direction: column; }
  .filter-row { grid-template-columns: 1fr; }
}

/* --- Logo Color (Purple theme) --- */
#logoGrad stop:first-child, #logoGrad2 stop:first-child {
  stop-color: #7c3aed !important;
}
#logoGrad stop:last-child, #logoGrad2 stop:last-child {
  stop-color: #6366f1 !important;
}

/* ============================================================
   APPSHEET v.7 — LAYOUT & MOBILE
   ============================================================ */

/* Header baris atas */
.appsheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.appsheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.appsheet-import-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

/* Legenda sumber data */
.appsheet-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.appsheet-legend-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

/* Toolbar filter (search + selects) */
.appsheet-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 14px !important;
  margin-bottom: 0 !important;
}
.appsheet-selects {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.appsheet-select {
  width: auto;
  min-width: 120px;
  padding: 7px 10px;
  font-size: 12px;
}

/* Footer tabel */
.stock-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 8px;
}

/* Toggle view: sembunyikan tabel saat mode kartu aktif */
.stock-hidden-on-card  { display: none !important; }
.stock-hidden-on-table { display: none !important; }

/* Kartu mobile stock */
.stock-view-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stock-mobile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}
.stock-mobile-card--low {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.03);
}
.smc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.smc-kode {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.03em;
}
.smc-nama {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.4;
}
.smc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.smc-row:last-child { border-bottom: none; }
.smc-lbl { color: var(--text-muted); font-size: 11px; }
.smc-val { font-weight: 600; text-align: right; }
.smc-harga { color: var(--primary); }
.smc-kritis { color: #dc2626; }

/* Label tombol sembunyikan di layar sangat kecil */
@media (max-width: 380px) {
  .stock-view-label { display: none; }
  .appsheet-btn-label { display: none; }
}

/* ── Responsive @media 768px ── */
@media (max-width: 768px) {
  .appsheet-header { flex-direction: column; gap: 10px; }
  .appsheet-actions { width: 100%; justify-content: flex-start; }
  .appsheet-import-group { flex: 1; }
  .stock-import-btn { flex: 1; justify-content: center; padding: 8px 6px; font-size: 11px; }

  .appsheet-legend { display: none; } /* legend disembunyikan di mobile, hemat ruang */
  .appsheet-legend-hint { display: none; }

  .appsheet-toolbar { flex-direction: column; gap: 8px; }
  .appsheet-toolbar .search-input-wrap { min-width: 0; width: 100%; }
  .appsheet-selects { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .appsheet-select { min-width: 0; width: 100%; }

  /* Pada mobile nyata, tampilan kartu lebih nyaman */
  .stock-view-table { display: none !important; }
  .stock-hidden-on-table { display: flex !important; }
}

@media (max-width: 480px) {
  .appsheet-selects { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile Preview (tombol "Mobile" di topbar) ── */
body.mobile-preview .appsheet-header { flex-direction: column; gap: 10px; }
body.mobile-preview .appsheet-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
body.mobile-preview .appsheet-import-group { flex: 1; }
body.mobile-preview .stock-import-btn { flex: 1; justify-content: center; padding: 8px 4px; font-size: 11px; }
body.mobile-preview .appsheet-legend { display: none; }
body.mobile-preview .appsheet-toolbar { flex-direction: column; gap: 8px; }
body.mobile-preview .appsheet-toolbar .search-input-wrap { width: 100%; min-width: 0; }
body.mobile-preview .appsheet-selects { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
body.mobile-preview .appsheet-select { min-width: 0; width: 100%; font-size: 12px; }
body.mobile-preview .stock-view-table { display: none !important; }
body.mobile-preview .stock-hidden-on-table { display: flex !important; }
body.mobile-preview .stock-view-cards { gap: 8px; }
body.mobile-preview .stock-mobile-card { padding: 12px; }
body.mobile-preview .smc-nama { font-size: 12px; }
body.mobile-preview .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
body.mobile-preview .stat-card { padding: 12px; }
body.mobile-preview .stat-value { font-size: 20px; }
body.mobile-preview .appsheet-btn-label { display: none; }

/* ============================================================
   MOBILE POLISH — merapikan tabel, kartu & 20 Best Products di HP
   ============================================================ */

/* Chart popularitas: bisa digeser horizontal agar label tetap terbaca di HP */
.billboard-chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.billboard-chart-scroll svg { display: block; }

@media (max-width: 768px) {
  /* Tabel: scroll horizontal yang rapi + jarak sel lebih pas */
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
  }
  .table { min-width: 560px; }
  .pipeline-table { min-width: 720px; }
  .table th { padding: 10px 12px; }
  .table td { padding: 11px 12px; }

  /* 20 Best Products: item ranking lebih ringkas, tidak berdesakan */
  .product-rank-item { gap: 10px; padding: 12px; }
  .rank-num { width: 26px; font-size: 16px; }
  .product-rank-name { font-size: 12px; }
  .product-rank-val-main { font-size: 12px; white-space: nowrap; }

  /* Chart: paksa lebar minimum agar kurva & label terbaca (geser untuk lihat semua) */
  .billboard-chart-scroll svg { min-width: 640px; }

  /* Modal lebih pas di layar kecil */
  .modal-overlay { padding: 12px; }
  .modal-header { padding: 16px; }
  .modal-body { padding: 16px; }
}

@media (max-width: 480px) {
  .page-content { padding: 14px; }
  .product-rank-val-main { font-size: 11px; }
  .billboard-chart-scroll svg { min-width: 560px; }
}
