/* ============================================
   Invenza — Inventory Management
   Core Stylesheet
   ============================================ */

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

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  color-scheme: light;
  --primary: #22B573;
  --primary-dark: #15945A;
  --primary-light: #EAF8F1;
  --background: #F6F8FA;
  --surface: #FFFFFF;
  --border: #E8EDF1;
  --text: #17212B;
  --muted: #6B7280;
  --success: #22B573;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --heading-color: #0f172a;
  --body-text: #334155;
  --text-secondary: #475569;
  --muted-color: #64748b;
  --border-color: #e2e8f0;
  --subtle-bg: #f8fafc;
}

.dark, html.dark, :root.dark {
  color-scheme: dark;
  --background: #0F172A;
  --surface: #1E293B;
  --border: #334155;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --primary-light: #0D2B1D;
  --heading-color: #F1F5F9;
  --body-text: #CBD5E1;
  --text-secondary: #94A3B8;
  --muted-color: #94A3B8;
  --border-color: #334155;
  --subtle-bg: #1E293B;
}

/* ============================================
   Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background-color: var(--background);
  color: var(--text);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* ============================================
   Custom Scrollbar
   ============================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(107,114,128,0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(107,114,128,0.5); }
.dark ::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.3); }

/* ============================================
   Layout System — Enhanced sidebar
   ============================================ */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 2px 0 8px rgba(0,0,0,0.02);
}

#sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--primary) 0%, transparent 100%);
  opacity: 0.3;
}

#sidebar.collapsed { width: var(--sidebar-collapsed-width); }
#sidebar.collapsed .sidebar-label { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
#sidebar.collapsed .submenu { display: none !important; }
#sidebar.collapsed .nav-toggle-icon { display: none !important; }
#sidebar.collapsed .sidebar-section-label { opacity: 0; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
#sidebar.collapsed .submenu-item { display: none; }

.sidebar-label {
  transition: opacity 0.2s ease, width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
}

#main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}

#main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }

#app-header {
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

/* ============================================
   Navigation — Clean menu with +/- toggle icons
   ============================================ */
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary, var(--muted)); text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer; width: 100%;
  border: none; background: none;
  font-family: inherit;
  position: relative;
}
.nav-item:hover {
  background: var(--background);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Toggle icon (+/-) on the right side */
.nav-toggle-icon {
  margin-left: auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.nav-toggle-icon svg {
  transition: transform 0.25s ease;
}

/* Submenu items with vertical tree connector */
.submenu {
  overflow: hidden; max-height: 0;
  transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1);
  padding-left: 20px;
}
.submenu.open { max-height: 600px; }

.submenu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px 9px 20px;
  border-radius: 8px; font-size: 13px; font-weight: 450;
  color: var(--text-secondary, var(--muted)); text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}
/* Vertical tree line */
.submenu-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
  transition: background 0.2s ease;
}
/* Horizontal connector line */
.submenu-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  transition: background 0.2s ease;
}
.submenu-item:hover {
  color: var(--text);
  background: var(--background);
}
.submenu-item:hover::before,
.submenu-item:hover::after {
  background: var(--primary);
}
.submenu-item.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 500;
}
.submenu-item.active::before,
.submenu-item.active::after {
  background: var(--primary);
}

/* Badge for menu items (e.g., "Hot") */
.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}
.nav-badge-hot {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
}
.nav-badge-info {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white;
}

.sidebar-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--muted);
  padding: 16px 12px 6px; opacity: 1;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

/* ============================================
   Cards — Clean, professional styling
   ============================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 20px 14px;
  position: relative;
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.stat-sub-card { }

/* ============================================
   Badges
   ============================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  letter-spacing: 0.2px;
}
.badge-success { background: #DCFCE7; color: #15803D; }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-danger  { background: #FEE2E2; color: #B91C1C; }
.badge-info    { background: #DBEAFE; color: #1D4ED8; }
.badge-gray    { background: #F3F4F6; color: #374151; }
.badge-purple  { background: #F3E8FF; color: #7E22CE; }
.badge-orange  { background: #FFF7ED; color: #C2410C; }

.dark .badge-success { background: #14532D; color: #4ADE80; }
.dark .badge-warning { background: #451A03; color: #FCD34D; }
.dark .badge-danger  { background: #450A0A; color: #F87171; }
.dark .badge-info    { background: #1E3A5F; color: #60A5FA; }
.dark .badge-gray    { background: #374151; color: #D1D5DB; }
.dark .badge-purple  { background: #2E1065; color: #C084FC; }
.dark .badge-orange  { background: #431407; color: #FB923C; }

/* ============================================
   Tables — Clean, professional styling
   ============================================ */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  background: var(--background);
  color: var(--muted);
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.6px; padding: 12px 16px;
  text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease, background 0.2s ease;
}
.data-table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
}
.data-table thead th[data-sort]:hover {
  color: var(--primary);
  background: rgba(34,181,115,0.04);
}
.data-table thead th.sort-active {
  color: var(--primary);
  background: rgba(34,181,115,0.06);
}
.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  margin-left: 4px;
  border-radius: 4px;
  vertical-align: middle;
  transition: all 0.2s ease;
}
.sort-icon svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sort-icon.active {
  color: var(--primary);
  background: rgba(34,181,115,0.1);
}
.sort-icon.active svg {
  transform: scale(1.1);
}
.sort-icon.desc svg {
  transform: rotate(180deg);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr:hover {
  background: rgba(34,181,115,0.03);
}
.data-table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
}
.data-table tbody tr:last-child { border-bottom: none; }
.dark .data-table thead th { background: rgba(255,255,255,0.04); }
.dark .data-table thead th[data-sort]:hover {
  background: rgba(34,181,115,0.08);
}
.dark .data-table thead th.sort-active {
  background: rgba(34,181,115,0.1);
}
.dark .data-table tbody tr:hover { background: rgba(255,255,255,0.04); }

/* ============================================
   Forms
   ============================================ */
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text); margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text);
  outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34,181,115,0.1); }
.form-input.error { border-color: var(--danger); }
.form-input::placeholder { color: var(--muted); }
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }
.dark .form-input { background: rgba(255,255,255,0.05); border-color: var(--border); color: var(--text); }

.form-select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px; cursor: pointer;
}
.dark .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
option {
  background: var(--surface);
  color: var(--text);
}
.form-textarea { resize: vertical; min-height: 100px; }

/* ============================================
   Buttons — Clean, professional styling
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent; text-decoration: none;
  white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active { transform: scale(0.98); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 12px; }
.btn-icon { padding: 8px; }
.btn-icon-sm { padding: 6px; }

.btn-primary {
  background: var(--primary);
  color: #fff; border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--background);
  color: var(--text); border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.dark .btn-secondary { background: rgba(255,255,255,0.07); border-color: var(--border); color: var(--text); }

.btn-outline {
  background: transparent; color: var(--primary); border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }

.btn-danger {
  background: #EF4444; color: #fff; border-color: #EF4444;
}
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--background); color: var(--text); }

.btn-success { background: #22B573; color: #fff; border-color: #22B573; }
.btn-warning { background: #F59E0B; color: #fff; border-color: #F59E0B; }

/* ============================================
   Modals
   ============================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.15s ease;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.2s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
}
.modal-box.modal-sm { max-width: 400px; }
.modal-box.modal-lg { max-width: 720px; }
.modal-box.modal-xl { max-width: 960px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 20px 24px; border-top: 1px solid var(--border); }

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--surface); box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  border: 1px solid var(--border);
  min-width: 300px; max-width: 380px;
  animation: slideInRight 0.3s cubic-bezier(0.4,0,0.2,1);
  transition: opacity 0.3s, transform 0.3s;
  position: relative;
}
.toast.removing { opacity: 0; transform: translateX(100%); }
.toast-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-success .toast-icon { background: #DCFCE7; color: #16A34A; }
.toast-error   .toast-icon { background: #FEE2E2; color: #DC2626; }
.toast-warning .toast-icon { background: #FEF3C7; color: #D97706; }
.toast-info    .toast-icon { background: #DBEAFE; color: #2563EB; }
.toast-close { position: absolute; top: 10px; right: 10px; background: none; border: none; cursor: pointer; color: var(--muted); padding: 2px; border-radius: 4px; }
.toast-close:hover { color: var(--text); background: var(--background); }

/* ============================================
   Skeleton
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--background) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ============================================
   Dropdowns
   ============================================ */
.dropdown-menu {
  position: absolute; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1); z-index: 50;
  min-width: 180px; animation: fadeInDown 0.15s ease; overflow: hidden;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; color: var(--text);
  cursor: pointer; transition: background 0.1s;
  text-decoration: none; border: none; background: none;
  width: 100%; font-family: inherit;
}
.dropdown-item:hover { background: var(--background); color: var(--primary); }
.dropdown-item.danger:hover { background: #FEE2E2; color: #DC2626; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ============================================
   Footer — Enhanced styling
   ============================================ */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  transition: all 0.2s ease;
}
footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}
footer a:hover {
  color: var(--primary-dark);
}

/* ============================================
   Animations — Enhanced with cubic-bezier easing
   ============================================ */
@keyframes fadeIn      { from{opacity:0} to{opacity:1} }
@keyframes slideUp     { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideInRight{ from{opacity:0;transform:translateX(100%)} to{opacity:1;transform:translateX(0)} }
@keyframes shimmer     { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
@keyframes fadeInDown  { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }
@keyframes pulse       { 0%,100%{opacity:1} 50%{opacity:.5} }
@keyframes spin        { to{transform:rotate(360deg)} }
@keyframes slideInUp   { from{opacity:0;transform:translateY(40px)} to{opacity:1;transform:translateY(0)} }
@keyframes scaleIn     { from{opacity:0;transform:scale(0.9)} to{opacity:1;transform:scale(1)} }
@keyframes float       { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes glow        { 0%,100%{box-shadow:0 0 5px rgba(34,181,115,0.3)} 50%{box-shadow:0 0 20px rgba(34,181,115,0.5)} }

.animate-fadeIn     { animation: fadeIn 0.2s ease; }
.animate-slideUp    { animation: slideUp 0.2s ease; }
.animate-fadeInDown { animation: fadeInDown 0.2s ease; }
.animate-spin       { animation: spin 0.8s linear infinite; }
.animate-slideInUp  { animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.animate-scaleIn    { animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

/* Staggered card animations for page load */
.stagger-1 { animation-delay: 0.05s; animation-fill-mode: backwards; }
.stagger-2 { animation-delay: 0.1s; animation-fill-mode: backwards; }
.stagger-3 { animation-delay: 0.15s; animation-fill-mode: backwards; }
.stagger-4 { animation-delay: 0.2s; animation-fill-mode: backwards; }
.stagger-5 { animation-delay: 0.25s; animation-fill-mode: backwards; }

/* ============================================
   Welcome Banner — Gradient hero section
   ============================================ */
.welcome-banner {
  background: linear-gradient(135deg, #22B573 0%, #1a9a60 35%, #15945A 65%, #0D6B3F 100%);
  border-radius: 16px;
  padding: 32px 36px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(34,181,115,0.25), 0 2px 8px rgba(0,0,0,0.08);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -40px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: 15%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.welcome-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.welcome-banner-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.welcome-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.welcome-subtitle {
  font-size: 14px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
  line-height: 1.6;
  max-width: 520px;
}
.welcome-subtitle strong {
  color: #fff;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}
.welcome-banner .welcome-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.welcome-banner .btn-welcome-outline {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.welcome-banner .btn-welcome-outline:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.welcome-banner .btn-welcome-outline:active {
  transform: translateY(0);
}
.welcome-banner .btn-welcome-export {
  background: white;
  color: var(--primary);
  border: 1px solid white;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.welcome-banner .btn-welcome-export:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.welcome-banner .btn-welcome-export:active {
  transform: translateY(0);
}
.welcome-banner .btn-welcome-export svg {
  width: 14px;
  height: 14px;
}

/* ============================================
   Trend Indicators
   ============================================ */
.trend-up   { display:inline-flex;align-items:center;gap:3px;font-size:11px;font-weight:600;color:#16A34A;background:#DCFCE7;padding:3px 10px;border-radius:20px; }
.trend-down { display:inline-flex;align-items:center;gap:3px;font-size:11px;font-weight:600;color:#DC2626;background:#FEE2E2;padding:3px 10px;border-radius:20px; }
.dark .trend-up   { color:#4ADE80; background:#14532D; }
.dark .trend-down { color:#F87171; background:#450A0A; }

/* ============================================
   Page Layout
   ============================================ */
.page-title { font-size: 24px; font-weight: 700; color: var(--heading-color); letter-spacing: -0.02em; line-height: 1.3; }
.page-subtitle { font-size: 14px; color: var(--muted-color); margin-top: 6px; line-height: 1.6; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 6px; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ============================================
   Search
   ============================================ */
.search-box { position: relative; }
.search-box .search-icon { position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none; }
.search-box input { padding-left: 38px; }

.global-search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  z-index: 100; max-height: 420px; overflow-y: auto;
  animation: fadeInDown 0.15s ease;
}
.search-result-item { display:flex;align-items:center;gap:12px;padding:10px 16px;cursor:pointer;transition:background 0.1s; }
.search-result-item:hover { background: var(--background); }
.search-group-label { font-size:10px;font-weight:700;letter-spacing:0.6px;text-transform:uppercase;color:var(--muted);padding:10px 16px 4px; }

/* ============================================
   Notifications
   ============================================ */
.notification-item { display:flex;gap:12px;padding:14px 16px;border-bottom:1px solid var(--border);cursor:pointer;transition:background 0.1s; }
.notification-item:hover { background: var(--background); }
.notification-item.unread { background: rgba(34,181,115,0.04); }
.notification-item:last-child { border-bottom: none; }

/* ============================================
   POS
   ============================================ */
.pos-product-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px; cursor: pointer;
  transition: all 0.15s ease; text-align: center;
}
.pos-product-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(34,181,115,0.15); transform: translateY(-2px); }
.pos-product-card.in-cart { border-color: var(--primary); background: var(--primary-light); }

/* ============================================
   Upload Zone
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 32px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--background);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }

/* ============================================
   Progress
   ============================================ */
.progress-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.6s ease; }

/* ============================================
   Tabs
   ============================================ */
.tab-nav { display:flex;border-bottom:1px solid var(--border);gap:0; }
.tab-btn { padding:10px 20px;font-size:14px;font-weight:500;color:var(--muted);cursor:pointer;border:none;background:none;border-bottom:2px solid transparent;margin-bottom:-1px;font-family:inherit;transition:all 0.15s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color:var(--primary);border-bottom-color:var(--primary);font-weight:600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1023px) {
  #sidebar { transform: translateX(-100%); z-index: 70; width: var(--sidebar-width) !important; }
  #sidebar.mobile-open { transform: translateX(0); }
  #main-wrapper { margin-left: 0 !important; }
}

#mobile-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 65; display: none;
}
#mobile-overlay.show { display: block; animation: fadeIn 0.2s ease; }

/* ============================================
   Misc Utilities
   ============================================ */
.text-primary { color: var(--primary); }
.text-muted { color: var(--muted); }
.bg-primary { background: var(--primary); }
.bg-primary-light { background: var(--primary-light); }
.border-primary { border-color: var(--primary); }

.divider { height:1px; background:var(--border); }

/* Avatar */
.avatar { border-radius: 50%; object-fit: cover; }
.avatar-placeholder { border-radius:50%;background:var(--primary-light);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:600; }

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .no-print { display: none !important; }
  #sidebar, #app-header, #mobile-overlay { display: none !important; }
  #main-wrapper { margin-left: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  @page { margin: 15mm; }
}

/* ============================================
   Chart Container
   ============================================ */
.chart-container { position: relative; }

/* ============================================
   Settings Tabs (left nav)
   ============================================ */
.settings-nav-item {
  display:flex;align-items:center;gap:10px;padding:10px 14px;
  border-radius:10px;font-size:14px;font-weight:500;
  color:var(--muted);cursor:pointer;transition:all 0.15s;
  text-decoration:none;
}
.settings-nav-item:hover { background:var(--background);color:var(--text); }
.settings-nav-item.active { background:var(--primary-light);color:var(--primary);font-weight:600; }

/* Color pills for roles */
.role-pill {
  display:inline-flex;align-items:center;padding:3px 12px;
  border-radius:20px;font-size:12px;font-weight:600;
}

/* ============================================
   Icon Background Utility Classes (dark-mode aware)
   Use these instead of hardcoded background/stroke colors on stat icons
   ============================================ */
/* Green / success */
.icon-bg-success { background:#DCFCE7; }
.icon-bg-success svg, .icon-bg-success .icon-svg { color:#16A34A; }
.dark .icon-bg-success { background:#14532D; }
.dark .icon-bg-success svg, .dark .icon-bg-success .icon-svg { color:#4ADE80; }

/* Red / danger */
.icon-bg-danger  { background:#FEE2E2; }
.icon-bg-danger svg, .icon-bg-danger .icon-svg { color:#DC2626; }
.dark .icon-bg-danger  { background:#450A0A; }
.dark .icon-bg-danger svg, .dark .icon-bg-danger .icon-svg { color:#F87171; }

/* Yellow / warning */
.icon-bg-warning { background:#FEF3C7; }
.icon-bg-warning svg, .icon-bg-warning .icon-svg { color:#D97706; }
.dark .icon-bg-warning { background:#451A03; }
.dark .icon-bg-warning svg, .dark .icon-bg-warning .icon-svg { color:#FCD34D; }

/* Blue / info */
.icon-bg-info    { background:#DBEAFE; }
.icon-bg-info svg, .icon-bg-info .icon-svg { color:#2563EB; }
.dark .icon-bg-info    { background:#1E3A5F; }
.dark .icon-bg-info svg, .dark .icon-bg-info .icon-svg { color:#60A5FA; }

/* Purple */
.icon-bg-purple  { background:#F3E8FF; }
.icon-bg-purple svg, .icon-bg-purple .icon-svg { color:#7E22CE; }
.dark .icon-bg-purple  { background:#2E1065; }
.dark .icon-bg-purple svg, .dark .icon-bg-purple .icon-svg { color:#C084FC; }

/* Orange */
.icon-bg-orange  { background:#FFF7ED; }
.icon-bg-orange svg, .icon-bg-orange .icon-svg { color:#C2410C; }
.dark .icon-bg-orange  { background:#431407; }
.dark .icon-bg-orange svg, .dark .icon-bg-orange .icon-svg { color:#FB923C; }

/* Primary */
.icon-bg-primary { background:var(--primary-light); }
.icon-bg-primary svg { color:var(--primary); }

/* ============================================
   Auth Pages (login, register, forgot-password, reset-password)
   ============================================ */
.auth-body {
  background: linear-gradient(135deg,#F0FDF4 0%,#EAF8F1 50%,#DBEAFE 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background 0.2s ease;
}
.dark .auth-body {
  background: linear-gradient(135deg,#0D2B1D 0%,#0F172A 50%,#1E1B4B 100%);
}

/* Animated background shapes for auth pages */
.auth-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 6s ease-in-out infinite;
}
.auth-bg-shape-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, rgba(34,181,115,0.3), rgba(34,181,115,0.1));
  top: -10%;
  right: -10%;
  animation-delay: 0s;
}
.auth-bg-shape-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(59,130,246,0.1));
  bottom: -5%;
  left: -5%;
  animation-delay: 2s;
}
.auth-bg-shape-3 {
  width: 250px;
  height: 250px;
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(245,158,11,0.1));
  top: 40%;
  left: 30%;
  animation-delay: 4s;
}
.dark .auth-bg-shape-1 { background: linear-gradient(135deg, rgba(34,181,115,0.15), rgba(34,181,115,0.05)); }
.dark .auth-bg-shape-2 { background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(59,130,246,0.05)); }
.dark .auth-bg-shape-3 { background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(245,158,11,0.05)); }

.auth-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  padding: 12px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}
.auth-logo-wrap:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}
.dark .auth-logo-wrap {
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.dark .auth-logo-wrap:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.auth-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #3B82F6, var(--primary));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}
.auth-card:hover {
  box-shadow: 0 12px 48px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}
.dark .auth-card {
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}
.dark .auth-card:hover {
  box-shadow: 0 12px 48px rgba(0,0,0,0.45);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.auth-divider {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 24px;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  text-decoration: none;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.auth-back-link:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.auth-demo-box {
  margin-top: 20px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(34,181,115,0.08) 0%, rgba(34,181,115,0.04) 100%);
  border-radius: 12px;
  border: 1px solid rgba(34,181,115,0.2);
  text-align: center;
  transition: all 0.2s ease;
}
.auth-demo-box:hover {
  border-color: rgba(34,181,115,0.4);
  box-shadow: 0 4px 16px rgba(34,181,115,0.1);
}
.dark .auth-demo-box {
  background: rgba(34,181,115,0.06);
  border-color: rgba(34,181,115,0.15);
}
.auth-demo-box-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.auth-demo-box-text {
  font-size: 12px;
  color: var(--text);
}

/* ============================================
   Dark Mode — Override inline hardcoded stat icon colors
   For elements that still use inline background/stroke, we inject
   targeted overrides below. Elements MUST have the helper class applied.
   ============================================ */

/* Inline-style override: elements with data-icon-color attribute */
.dark [data-icon="success"] { background:#14532D !important; }
.dark [data-icon="danger"]  { background:#450A0A !important; }
.dark [data-icon="warning"] { background:#451A03 !important; }
.dark [data-icon="info"]    { background:#1E3A5F !important; }
.dark [data-icon="purple"]  { background:#2E1065 !important; }
.dark [data-icon="orange"]  { background:#431407 !important; }

/* General dark mode helper: cards with inline background (stat sub-cards) */
.dark .stat-sub-card { background: rgba(255,255,255,0.05) !important; }

/* ============================================
   Dark Mode — Dropdown danger hover
   ============================================ */
.dark .dropdown-item.danger:hover { background: #450A0A; color: #F87171; }

/* ============================================
   Dark Mode — Toast icons
   ============================================ */
.dark .toast-success .toast-icon { background: #14532D; color: #4ADE80; }
.dark .toast-error   .toast-icon { background: #450A0A; color: #F87171; }
.dark .toast-warning .toast-icon { background: #451A03; color: #FCD34D; }
.dark .toast-info    .toast-icon { background: #1E3A5F; color: #60A5FA; }

/* ============================================
   Dark Mode — POS product cards
   ============================================ */
.dark .pos-product-card { background: var(--surface); }
.dark .pos-product-card.in-cart { background: var(--primary-light); }

/* ============================================
   Dark Mode — Upload Zone
   ============================================ */
.dark .upload-zone { background: rgba(255,255,255,0.03); }
.dark .upload-zone:hover, .dark .upload-zone.dragover { background: var(--primary-light); }

/* ============================================
   Dark Mode — Notification unread
   ============================================ */
.dark .notification-item.unread { background: rgba(34,181,115,0.06); }

/* ============================================
   Dark Mode — Modal
   ============================================ */
.dark .modal-backdrop { background: rgba(0,0,0,0.7); }
.dark .modal-box { box-shadow: 0 24px 64px rgba(0,0,0,0.5); }

/* ============================================
   Page Header — Professional Design
   ============================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
  padding: 20px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
.page-header .page-title {
  font-size: 26px; font-weight: 800; color: var(--text);
  line-height: 1.2; letter-spacing: -0.5px; margin-top: 6px;
}
.page-header .page-subtitle {
  font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5;
}
.page-header-actions {
  display: flex; gap: 10px; align-items: center; flex-shrink: 0;
}

/* ============================================
   Stat Cards — Professional with Icon
   ============================================ */
.stat-card {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-card-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-card-icon.icon-bg-primary { background: rgba(34,181,115,0.1); color: var(--primary); }
.stat-card-icon.icon-bg-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card-icon.icon-bg-danger  { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-card-icon.icon-bg-info    { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-card-icon.icon-bg-purple  { background: rgba(139,92,246,0.1); color: #8B5CF6; }
.stat-card-icon.icon-bg-success { background: rgba(34,181,115,0.1); color: var(--primary); }
.dark .stat-card-icon.icon-bg-primary { background: rgba(34,181,115,0.15); }
.dark .stat-card-icon.icon-bg-warning { background: rgba(245,158,11,0.15); }
.dark .stat-card-icon.icon-bg-danger  { background: rgba(239,68,68,0.15); }
.dark .stat-card-icon.icon-bg-info    { background: rgba(59,130,246,0.15); }
.dark .stat-card-icon.icon-bg-purple  { background: rgba(139,92,246,0.15); }

/* ============================================
   Filter Bar — Horizontal with gap
   ============================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 16px;
}
.filter-bar .search-box { flex: 1; min-width: 220px; }
.filter-bar .form-input,
.filter-bar .form-select {
  height: 40px; font-size: 13px; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border);
}

/* ============================================
   Utility Classes — Replace inline styles
   ============================================ */

/* Page structure */
.page-section { margin-bottom: 24px; }
.page-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.page-section-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.page-section-subtitle {
  font-size: 12px; color: var(--muted); margin-top: 2px;
}

/* Stat cards (utility) */
.stat-card-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px; font-weight: 500; color: var(--muted-color); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.stat-value {
  font-size: 28px; font-weight: 700; color: var(--heading-color); letter-spacing: -0.02em; line-height: 1.2;
}
.stat-sub-card {
  background: var(--background); border-radius: 10px; padding: 14px 16px 12px;
  transition: box-shadow 0.2s ease;
}
.stat-sub-card:hover { box-shadow: var(--shadow-sm); }
.stat-sub-label {
  font-size: 12px; color: var(--muted); font-weight: 500;
  line-height: 1.4;
}
.stat-sub-value {
  font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2;
}
@media (max-width: 768px) {
  .stat-sub-card { padding: 12px 14px 10px; border-radius: 8px; }
  .stat-sub-value { font-size: 18px; }
  .stat-sub-label { font-size: 11px; }
}
@media (max-width: 400px) {
  .stat-sub-card { padding: 10px 12px 8px; }
  .stat-sub-value { font-size: 16px; }
}

/* Avatar */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 13px; }

/* Card header layout */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.card-title {
  font-size: 16px; font-weight: 600; color: var(--heading-color); letter-spacing: -0.01em;
}
.card-subtitle {
  font-size: 13px; color: var(--muted-color); margin-top: 3px; line-height: 1.5;
}

/* Filter bar (utility) */
.filter-bar .form-input,
.filter-bar .form-select {
  height: 38px; font-size: 13px; min-width: 0;
}

/* Table utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.table-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--background); border-radius: 12px 12px 0 0;
}
.table-footer {
   display: flex; align-items: center; justify-content: space-between;
   padding: 16px 20px 20px 20px; border-top: 1px solid var(--border);
   gap: 16px; flex-wrap: wrap;
}
.table-footer-info {
  font-size: 13px; color: var(--muted); white-space: nowrap; flex-shrink: 0;
  font-weight: 500; letter-spacing: 0.01em;
}
.table-footer-actions {
    display: flex; align-items: center; gap: 8px; margin-left: auto;
}

/* ============================================
   Pagination — Clean, professional
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination .page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e2e5ea;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}
.dark .pagination .page-btn {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #d1d5db;
}
.pagination .page-btn:hover:not(:disabled):not(.active) {
  background: #f3f4f6;
  color: #111827;
  border-color: #d1d5db;
}
.dark .pagination .page-btn:hover:not(:disabled):not(.active) {
  background: rgba(255,255,255,0.1);
  color: #f3f4f6;
  border-color: rgba(255,255,255,0.2);
}
.pagination .page-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(34,181,115,0.3);
}
.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .page-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.pagination .page-ellipsis {
  min-width: 28px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  user-select: none;
}

/* ============================================
   Legacy ID selectors (dynamic pagination)
   ============================================ */
#products-table-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toggle switch */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}
.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}


/* Page footer */
.app-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px; flex-wrap: wrap; gap: 8px;
}
.app-footer-text {
  font-size: 12px; 
  color: #888;
}
.app-footer-links {
  display: flex; gap: 16px;
}

/* Print invoice */
@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #e5e7eb !important; }
}

/* ============================================
   Focus Visible — Keyboard navigation
   ============================================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn:focus-visible,
.nav-item:focus-visible,
.submenu-item:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .submenu { transition: none; }
}

/* ============================================
   Responsive — Full Coverage
   ============================================ */

/* Desktop Large (1200px+) */
@media (min-width: 1200px) {
  .welcome-banner { padding: 32px 36px; }
  .stat-value { font-size: 28px; }
  .page-title { font-size: 26px; }
}

/* Desktop (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .welcome-banner { padding: 24px 28px; }
  .welcome-title { font-size: 22px; }
  .stat-value { font-size: 24px; }
  .stat-card { padding: 16px 18px; gap: 12px; }
  .stat-card-icon { width: 44px; height: 44px; border-radius: 12px; }
  .page-title { font-size: 22px; }
  .page-header { padding: 18px 20px; }
  .filter-bar .form-input,
  .filter-bar .form-select { min-width: 140px; }
}

/* Tablet Landscape (991px) */
@media (max-width: 991px) {
  #sidebar { transform: translateX(-100%); z-index: 70; width: var(--sidebar-width) !important; }
  #sidebar.mobile-open { transform: translateX(0); }
  #main-wrapper { margin-left: 0 !important; }
  #mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 65; }
  #mobile-overlay.show { display: block; animation: fadeIn 0.2s ease; }

  .welcome-banner { flex-direction: column; align-items: flex-start; padding: 24px 28px; gap: 16px; }
  .welcome-banner-content { gap: 14px; }
  .welcome-banner-icon { width: 46px; height: 46px; border-radius: 12px; }
  .welcome-banner-icon svg { width: 22px; height: 22px; }
  .welcome-actions { width: 100%; justify-content: flex-start; }
  .welcome-title { font-size: 22px; }
  .welcome-subtitle { font-size: 13px; }

  .stat-value { font-size: 24px; }
  .page-title { font-size: 22px; }
  .page-header { padding: 18px 20px; gap: 12px; }
  .filter-bar { padding: 12px 14px; }
  .card { padding: 18px; }
}

/* Tablet Portrait (768px) */
@media (max-width: 768px) {
  .welcome-banner { padding: 20px 22px; border-radius: 12px; }
  .welcome-banner-content { gap: 12px; }
  .welcome-banner-icon { width: 40px; height: 40px; border-radius: 10px; }
  .welcome-banner-icon svg { width: 20px; height: 20px; }
  .welcome-title { font-size: 20px; }
  .welcome-subtitle { font-size: 13px; }
  .welcome-actions { flex-wrap: wrap; gap: 8px; }
  .welcome-actions .btn-welcome-outline,
  .welcome-actions .btn-welcome-export { padding: 7px 14px; font-size: 12px; }

  .stat-value { font-size: 22px; }
  .stat-card { padding: 16px 18px; gap: 12px; }
  .stat-card-icon { width: 44px; height: 44px; border-radius: 12px; }
  .stat-card-icon svg { width: 18px; height: 18px; }

  .page-title { font-size: 20px; }
  .page-subtitle { font-size: 12px; }
  .page-header { flex-direction: column; align-items: stretch; padding: 16px 18px; }
  .page-header-actions { justify-content: flex-start; flex-wrap: wrap; }

  .filter-bar { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .filter-bar .search-box { min-width: 100%; }
  .filter-bar .form-input,
  .filter-bar .form-select { width: 100%; min-width: 0; }

  .card { padding: 16px; border-radius: 12px; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  .table-footer { flex-direction: column; align-items: center; gap: 12px; padding: 14px 16px; }
  .table-footer-actions { margin-left: 0; gap: 6px; }
  .pagination .page-btn {
    min-width: 36px;
    height: 36px;
    font-size: 12px;
  }
  .pagination .page-btn svg {
    width: 15px;
    height: 15px;
  }
  .pagination .page-ellipsis {
    min-width: 26px;
    height: 36px;
    font-size: 12px;
  }

  .app-footer { flex-direction: column; text-align: center; gap: 6px; padding: 14px 0; }
  .app-footer-links { justify-content: center; }

  .breadcrumb { font-size: 11px; gap: 4px; }
  .badge { padding: 3px 10px; font-size: 11px; }
  .trend-up, .trend-down { font-size: 10px; padding: 2px 8px; }
}

/* Mobile Large (576px) */
@media (max-width: 576px) {
  main { padding: 12px !important; }

  .welcome-banner { padding: 18px 16px; border-radius: 10px; }
  .welcome-banner-content { gap: 10px; }
  .welcome-banner-icon { width: 36px; height: 36px; border-radius: 8px; }
  .welcome-banner-icon svg { width: 18px; height: 18px; }
  .welcome-title { font-size: 18px; }
  .welcome-subtitle { font-size: 12px; line-height: 1.5; }
  .welcome-actions { flex-direction: column; }
  .welcome-actions .btn-welcome-outline,
  .welcome-actions .btn-welcome-export { width: 100%; justify-content: center; }

  .stat-value { font-size: 20px; }
  .stat-card { padding: 14px 16px; gap: 10px; }
  .stat-card-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-label { font-size: 11px; }

  .page-title { font-size: 18px; }
  .page-subtitle { font-size: 11px; }
  .page-header { padding: 14px 16px; border-radius: 10px; }
  .page-header-actions { flex-direction: column; width: 100%; }
  .page-header-actions .btn { width: 100%; justify-content: center; }

  .filter-bar .search-box { min-width: 100%; }
  .filter-bar .form-input,
  .filter-bar .form-select { height: 38px; font-size: 12px; }

  .card { padding: 14px; border-radius: 10px; }
  .card-title { font-size: 14px; }

  .data-table { font-size: 12px; }
  .data-table thead th { padding: 10px 12px; font-size: 10px; }
  .data-table tbody td { padding: 10px 12px; }

  .table-footer { padding: 12px 14px; }
  .table-footer-info { font-size: 12px; }
  .pagination .page-btn {
    min-width: 34px;
    height: 34px;
    font-size: 12px;
    border-radius: 9px;
  }
  .pagination .page-btn svg {
    width: 14px;
    height: 14px;
  }
  .pagination .page-ellipsis {
    min-width: 22px;
    height: 34px;
    font-size: 12px;
  }

  .breadcrumb { display: none; }

  .btn { padding: 8px 14px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }
}

/* Mobile Small (400px) */
@media (max-width: 400px) {
  main { padding: 10px !important; }

  .welcome-banner { padding: 14px 12px; }
  .welcome-title { font-size: 16px; }
  .welcome-subtitle { font-size: 11px; }

  .stat-value { font-size: 18px; }
  .stat-card { padding: 12px 14px; gap: 8px; }
  .stat-card-icon { width: 36px; height: 36px; border-radius: 8px; }
  .stat-card-icon svg { width: 16px; height: 16px; }

  .page-title { font-size: 16px; }
  .page-header { padding: 12px 14px; }
  .page-header .page-title { margin-top: 0; }

  .card { padding: 12px; }

  .data-table { font-size: 11px; }
  .data-table thead th { padding: 8px 10px; font-size: 9px; letter-spacing: 0.4px; }
  .data-table tbody td { padding: 8px 10px; }

  .table-footer { padding: 10px 12px; }
  .table-footer-info { font-size: 11px; }
  .pagination .page-btn {
    min-width: 28px;
    height: 28px;
    font-size: 11px;
    border-radius: 6px;
  }
  .pagination .page-btn svg {
    width: 12px;
    height: 12px;
  }
  .pagination .page-ellipsis {
    min-width: 18px;
    height: 28px;
    font-size: 11px;
  }
  #products-table-pagination .btn svg,
  #sales-table-pagination .btn svg,
  #customers-table-pagination .btn svg,
  #purchases-table-pagination .btn svg,
  #categories-table-pagination .btn svg,
  #stock-adjustment-table-pagination .btn svg,
  #suppliers-table-pagination .btn svg,
  #expenses-table-pagination .btn svg,
  #users-table-pagination .btn svg {
    width: 14px;
    height: 14px;
  }

  .badge { padding: 2px 8px; font-size: 10px; border-radius: 14px; }
  .trend-up, .trend-down { font-size: 9px; padding: 2px 6px; }
}

/* Height-based adjustments */
@media (max-height: 600px) {
  .welcome-banner { padding: 16px 20px; }
  .welcome-title { font-size: 18px; }
  .stat-card { padding: 12px 16px; }
}

/* Landscape phone */
@media (max-width: 768px) and (orientation: landscape) {
  .welcome-banner { flex-direction: row; align-items: center; }
  .welcome-actions { width: auto; }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; min-width: 44px; }
  .btn-sm { min-height: 36px; }
  .nav-item { padding: 12px 14px; }
  .submenu-item { padding: 10px 14px; }
  .dropdown-item { padding: 12px 16px; }
  #products-table-pagination .btn,
  #sales-table-pagination .btn,
  #customers-table-pagination .btn,
  #purchases-table-pagination .btn,
  #categories-table-pagination .btn,
  #stock-adjustment-table-pagination .btn,
  #suppliers-table-pagination .btn,
  #expenses-table-pagination .btn,
  #users-table-pagination .btn {
    min-height: 40px;
    min-width: 40px;
  }
}

/* Print */
@media print {
  .no-print { display: none !important; }
  #sidebar, #app-header, #mobile-overlay { display: none !important; }
  #main-wrapper { margin-left: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  .welcome-banner { background: #f0f0f0 !important; color: #000 !important; }
  .btn { display: none !important; }
  @page { margin: 15mm; }
}

/* ============================================
   Dashboard — Premium Design System
   ============================================ */

/* Stat Cards — Modern with accent bar */
.dash-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.dash-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--info));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.dash-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.dash-stat-card:hover::before { opacity: 1; }
.dash-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dash-stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.dash-stat-value {
  font-size: 28px; font-weight: 800; color: var(--heading-color);
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 4px;
}
.dash-stat-profit { color: var(--primary); }
.dash-stat-label {
  font-size: 12px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;
}
.dash-stat-bar {
  height: 4px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.dash-stat-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.dark .dash-stat-card { background: var(--surface); }

/* Revenue Breakdown Card */
.dash-revenue-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--background);
  border-radius: 10px;
  transition: box-shadow 0.2s ease;
}
.dash-revenue-item:hover { box-shadow: var(--shadow-sm); }
.dash-revenue-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.dash-revenue-label {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.dash-revenue-desc {
  font-size: 11px; color: var(--muted); margin-top: 1px;
}
.dash-revenue-amount {
  font-size: 16px; font-weight: 700; color: var(--heading-color);
  letter-spacing: -0.02em;
}

/* Metric Cards — For Inventory/Users sections */
.dash-metric-card {
  text-align: center;
  background: var(--background);
  border-radius: 12px;
  padding: 20px 16px;
  transition: all 0.2s ease;
}
.dash-metric-card:hover {
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.dash-metric-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.dash-metric-value {
  font-size: 28px; font-weight: 800; color: var(--heading-color);
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 4px;
}
.dash-metric-label {
  font-size: 12px; font-weight: 500; color: var(--muted);
  letter-spacing: 0.3px;
}

/* Stock Overview Items */
.dash-stock-item {
  padding: 10px 14px;
  background: var(--background);
  border-radius: 10px;
  transition: box-shadow 0.2s ease;
}
.dash-stock-item:hover { box-shadow: var(--shadow-sm); }
.dash-stock-info {
  display: flex; align-items: center; gap: 8px;
}
.dash-stock-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dash-progress-track {
  height: 6px; background: var(--border); border-radius: 6px; overflow: hidden;
}
.dash-progress-fill {
  height: 100%; border-radius: 6px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Purchase Overview Items */
.dash-purchase-item {
  padding: 10px 14px;
  background: var(--background);
  border-radius: 10px;
  transition: box-shadow 0.2s ease;
}
.dash-purchase-item:hover { box-shadow: var(--shadow-sm); }
.dash-purchase-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Chart Section */
.dash-chart-total {
  font-size: 32px; font-weight: 800; color: var(--heading-color);
  letter-spacing: -0.03em; line-height: 1.1;
}
.dash-chart-subtitle {
  font-size: 13px; font-weight: 500; color: var(--muted);
}

/* Dark Mode Overrides */
.dark .dash-stat-card::before { opacity: 0; }
.dark .dash-stat-card:hover::before { opacity: 1; }
.dark .dash-revenue-item { background: rgba(255,255,255,0.04); }
.dark .dash-metric-card { background: rgba(255,255,255,0.04); }
.dark .dash-metric-card:hover { background: rgba(255,255,255,0.06); }
.dark .dash-stock-item { background: rgba(255,255,255,0.04); }
.dark .dash-purchase-item { background: rgba(255,255,255,0.04); }

/* Responsive */
@media (max-width: 768px) {
  .dash-stat-value { font-size: 24px; }
  .dash-stat-icon { width: 40px; height: 40px; }
  .dash-metric-value { font-size: 24px; }
  .dash-metric-icon { width: 40px; height: 40px; }
  .dash-chart-total { font-size: 26px; }
  .dash-revenue-amount { font-size: 14px; }
}
@media (max-width: 400px) {
  .dash-stat-card { padding: 16px; }
  .dash-stat-value { font-size: 22px; }
  .dash-metric-card { padding: 16px 12px; }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .submenu { transition: none; }
}
