/* =============================================
   BIKE SPARE PARTS SHOP MANAGEMENT SYSTEM
   Minimal, Professional Business Dashboard
   ============================================= */

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

:root {
  --sidebar-w: 220px;
  --header-h: 56px;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #0891b2;
  --info-light: #ecfeff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --radius: 6px;
  --radius-lg: 8px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- LAYOUT ---- */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.2s;
}

.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

.sidebar-user {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}
.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 11px;
  color: var(--gray-400);
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav-item.active {
  background: rgba(37,99,235,0.15);
  color: var(--white);
  border-left-color: var(--primary);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 12px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  width: 100%;
}
.btn-logout:hover { color: var(--danger); }

/* ---- MAIN AREA ---- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 50;
}
.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-warning { background: var(--warning); color: var(--white); border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background: #b45309; }

.btn-outline {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-300); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px; gap: 0; }
.btn-block { width: 100%; justify-content: center; }

/* ---- FORM CONTROLS ---- */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.form-label .req { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-control:disabled { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
.form-control.is-invalid { border-color: var(--danger); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 70px; }

.form-row { display: grid; gap: 12px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 3px; }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
}
.card-body { padding: 16px; }
.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 4px;
  line-height: 1.2;
}
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.warning { color: var(--warning); }
.stat-value.primary { color: var(--primary); }
.stat-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ---- TABLES ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tfoot td {
  padding: 9px 12px;
  font-weight: 600;
  background: var(--gray-50);
  border-top: 2px solid var(--border);
}
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: 'Courier New', monospace; font-size: 12px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-info { background: var(--info-light); color: var(--info); }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1060px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.btn-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.btn-close:hover { color: var(--gray-700); background: var(--gray-100); }

/* ---- SEARCH BAR ---- */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.search-bar input {
  padding-left: 34px;
}
.search-bar .search-icon {
  position: absolute;
  left: 10px;
  color: var(--gray-400);
  pointer-events: none;
  width: 14px;
  height: 14px;
}
.search-bar .clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 2px;
}
.search-bar .clear-btn:hover { color: var(--gray-700); }

/* ---- FILTERS BAR ---- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filters-bar .search-bar { flex: 1; min-width: 200px; }
.filters-bar select { width: auto; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 12px 0 0;
}
.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--gray-600);
}
.page-btn:hover { background: var(--gray-50); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: var(--white); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 12px; color: var(--gray-500); margin-right: 8px; }

/* ---- TABS ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  margin-bottom: 16px;
}
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font);
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--gray-800); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-success { background: var(--success-light); color: #14532d; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #7f1d1d; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #78350f; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: #164e63; border: 1px solid #a5f3fc; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; color: var(--gray-500); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ---- POS SPECIFIC ---- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  height: calc(100vh - var(--header-h) - 40px);
  max-height: calc(100vh - var(--header-h) - 40px);
}
.pos-left { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pos-right { display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.pos-cart-wrapper { flex: 1; overflow-y: auto; }
.pos-right .card { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.pos-right .card-body { flex: 1; overflow-y: auto; }

.product-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
}
.product-search-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
.product-search-item:last-child { border-bottom: none; }
.product-search-item:hover { background: var(--primary-light); }
.product-search-item .psi-name { font-weight: 500; color: var(--gray-800); font-size: 13px; }
.product-search-item .psi-sku { font-size: 11px; color: var(--gray-400); }
.product-search-item .psi-price { font-size: 13px; font-weight: 600; color: var(--primary); }
.product-search-item .psi-stock { font-size: 11px; color: var(--gray-400); text-align: right; }
.product-search-item.out-of-stock .psi-stock { color: var(--danger); }

.sale-type-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sale-type-btn {
  flex: 1;
  padding: 7px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-500);
  border: none;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.sale-type-btn.active.retail { background: var(--primary); color: var(--white); }
.sale-type-btn.active.wholesale { background: var(--warning); color: var(--white); }

.cart-table input[type="number"] {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  text-align: right;
  outline: none;
}
.cart-table input[type="number"]:focus { border-color: var(--primary); }
.remove-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-300);
  padding: 4px;
  border-radius: 4px;
}
.remove-item-btn:hover { color: var(--danger); background: var(--danger-light); }

.payment-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}
.payment-total-row.grand {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  border-bottom: none;
  padding-top: 10px;
}
.payment-total-row.balance { color: var(--danger); font-weight: 600; }
.payment-total-row.paid { color: var(--success); font-weight: 600; }

/* ---- QUICK ACTIONS ---- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  font-family: var(--font);
  transition: all 0.15s;
}
.quick-action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.quick-action-btn svg { width: 20px; height: 20px; }

/* ---- PROFILE PAGES ---- */
.profile-header {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}
.profile-info h2 { font-size: 17px; font-weight: 600; color: var(--gray-900); }
.profile-info p { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.profile-stats {
  margin-left: auto;
  display: flex;
  gap: 24px;
}
.profile-stat { text-align: right; }
.profile-stat .value { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.profile-stat .label { font-size: 11px; color: var(--gray-400); }

/* ---- LOGIN ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-900);
  padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-title { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--gray-500); margin-bottom: 24px; }

/* ---- TOAST ---- */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
}
.toast-success { background: #15803d; color: var(--white); }
.toast-error { background: var(--danger); color: var(--white); }
.toast-warning { background: var(--warning); color: var(--white); }
.toast-info { background: var(--info); color: var(--white); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- SECTION HEADER ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
}

/* ---- DIVIDER ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---- TOGGLE ---- */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 20px;
  transition: 0.2s;
}
.toggle-slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ---- COLORFUL WIDGETS ---- */
.module-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.widget-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.widget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.widget-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}
.widget-card.blue::before { background: linear-gradient(180deg, #3b82f6, #1d4ed8); }
.widget-card.green::before { background: linear-gradient(180deg, #10b981, #059669); }
.widget-card.purple::before { background: linear-gradient(180deg, #8b5cf6, #6d28d9); }
.widget-card.amber::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.widget-card.rose::before { background: linear-gradient(180deg, #f43f5e, #e11d48); }
.widget-card.cyan::before { background: linear-gradient(180deg, #06b6d4, #0891b2); }
.widget-card.indigo::before { background: linear-gradient(180deg, #6366f1, #4f46e5); }

.widget-content {
  display: flex;
  flex-direction: column;
}
.widget-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
}
.widget-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 4px;
  line-height: 1.2;
}
.widget-sub {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 3px;
}

.widget-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 12px;
}
.widget-icon svg { width: 20px; height: 20px; }

.widget-card.blue .widget-icon { background: #eff6ff; color: #2563eb; }
.widget-card.green .widget-icon { background: #ecfdf5; color: #059669; }
.widget-card.purple .widget-icon { background: #f5f3ff; color: #7c3aed; }
.widget-card.amber .widget-icon { background: #fffbeb; color: #d97706; }
.widget-card.rose .widget-icon { background: #fff1f2; color: #e11d48; }
.widget-card.cyan .widget-icon { background: #ecfeff; color: #0891b2; }
.widget-card.indigo .widget-icon { background: #eef2ff; color: #4f46e5; }

/* ---- DASHBOARD CHARTS ---- */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}
.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--gray-600);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
}

/* ---- PRINT STYLES ---- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-area { margin: 0; }
  .page-content { padding: 0; overflow: visible; }
}

/* ---- SIDEBAR BACKDROP ---- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop.active {
  display: block;
}

/* ---- RESPONSIVE BREAKPOINTS ---- */

/* Tablet & Smaller Laptops (<= 1024px) */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .module-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr 340px; }
  .chart-canvas-wrapper { height: 200px; }
}

/* Tablets (<= 900px) */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-area {
    margin-left: 0;
    width: 100%;
  }
  
  #menu-toggle {
    display: inline-flex !important;
  }
  
  .pos-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .pos-cart-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 16px;
  }

  .form-row.cols-3, .form-row.cols-4 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .page-content {
    padding: 12px;
  }
  
  .topbar {
    padding: 0 12px;
  }
  
  .topbar-title {
    font-size: 15px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .module-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .widget-card {
    padding: 12px 14px;
  }
  
  .widget-value {
    font-size: 17px;
  }
  
  .quick-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .filters-bar .search-bar,
  .filters-bar select,
  .filters-bar input,
  .filters-bar .btn {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .report-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .report-nav .btn {
    flex-shrink: 0;
  }
  
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .profile-stats {
    width: 100%;
    justify-content: space-around;
    margin-top: 10px;
  }
  
  .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh;
  }
  
  .pos-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 8px !important;
  }
  
  .table-wrapper {
    margin: 0 -12px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  table th, table td {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* Extra Small Phones (<= 400px) */
@media (max-width: 400px) {
  .quick-actions {
    grid-template-columns: 1fr;
  }
  .topbar-actions .btn span {
    display: none;
  }
}
