/* ============================================================
   JYT Grocers — Premium Dark Theme Design System
   ============================================================ */

:root {
  /* Colors */
  --bg-base:       #0a0f1e;
  --bg-surface:    #111827;
  --bg-elevated:   #1a2235;
  --bg-card:       #1e2d40;
  --bg-hover:      #243042;

  --accent-1:      #10b981;
  --accent-2:      #14b8a6;
  --accent-grad:   linear-gradient(135deg, #10b981, #14b8a6);
  --accent-glow:   0 0 24px rgba(16,185,129,0.25);

  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #3b82f6;
  --success:       #10b981;

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

  --border:        rgba(255,255,255,0.07);
  --border-accent: rgba(16,185,129,0.3);

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);

  --sidebar-w:     260px;
  --topbar-h:      70px;

  --transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================ Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent-1); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ============================================================ Layout */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

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

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
}

/* ============================================================ Sidebar Header */
.sidebar-header {
  height: var(--topbar-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.brand-icon {
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-tagline {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================================================ Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elevated) transparent;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

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

.nav-item.active {
  background: rgba(16,185,129,0.12);
  color: var(--accent-1);
  box-shadow: inset 3px 0 0 var(--accent-1);
}

.nav-item svg { flex-shrink: 0; opacity: 0.8; }

/* ============================================================ Sidebar Footer */
.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-info {
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent-grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}

.user-name { font-size: 0.8rem; font-weight: 600; }
.user-role {
  font-size: 0.65rem;
  color: var(--accent-1);
  text-transform: capitalize;
  font-weight: 500;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  width: 100%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-logout:hover {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

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

/* ============================================================ Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-toggle {
  display: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}

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

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ============================================================ Page Content */
.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* ============================================================ Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-grad);
  color: white;
  box-shadow: 0 2px 12px rgba(16,185,129,0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(16,185,129,0.45);
}

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

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

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

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.2);
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ============================================================ Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.12); }

/* ============================================================ Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover { border-color: var(--border-accent); box-shadow: var(--accent-glow); }
.stat-card:hover::before { opacity: 1; }

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

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* ============================================================ Tables */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  flex-wrap: wrap;
}

.table-toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.table-toolbar-right { display: flex; align-items: center; gap: 10px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  min-width: 220px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

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

table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-elevated);
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}

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

tbody td {
  padding: 13px 16px;
  font-size: 0.865rem;
  vertical-align: middle;
}

.table-actions { display: flex; align-items: center; gap: 6px; }

/* ============================================================ Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success  { background: rgba(16,185,129,0.12); color: #10b981; }
.badge-warning  { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-danger   { background: rgba(239,68,68,0.12);  color: #ef4444; }
.badge-info     { background: rgba(59,130,246,0.12); color: #3b82f6; }
.badge-muted    { background: rgba(100,116,139,0.12); color: #64748b; }
.badge-purple   { background: rgba(139,92,246,0.12); color: #8b5cf6; }

/* ============================================================ Forms */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.form-control:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

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

select.form-control {
  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='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 2px; }

/* ============================================================ Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
  pointer-events: none;
}

.toggle-switch input:checked ~ .toggle-track { background: var(--accent-1); border-color: var(--accent-1); }
.toggle-switch input:checked ~ .toggle-thumb { transform: translateX(22px); background: white; }

.toggle-label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; }

/* ============================================================ Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.4,0,0.2,1);
}

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

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

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================ Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  animation: slideInRight 0.3s cubic-bezier(0.4,0,0.2,1);
  pointer-events: all;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }

.toast-icon { font-size: 16px; flex-shrink: 0; }

/* ============================================================ Login Page */
.login-page {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.15), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 40%),
    var(--bg-base);
  animation: bgPulse 10s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.login-card {
  position: relative;
  background: rgba(25, 27, 34, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

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

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo-icon {
  width: auto; height: 96px;
  max-width: 250px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
  margin: 0 auto 24px;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

.login-logo h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.login-logo p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-form .form-group input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.3s ease;
  outline: none;
  width: 100%;
  display: block;
}

.login-form .form-group input::placeholder { color: var(--text-muted); }

.login-form .form-group input:focus {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(16,185,129,0.5);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.15);
  transform: translateY(-2px);
}

.input-with-icon { position: relative; width: 100%; }
.input-with-icon input { padding-right: 44px; width: 100%; }

.toggle-password {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.toggle-password:hover { color: var(--text-primary); }

.login-error {
  font-size: 0.8rem;
  color: var(--danger);
  text-align: center;
  min-height: 18px;
  margin-top: -8px;
  margin-bottom: -4px;
}

.login-error:empty {
  display: none;
}

.btn-login { 
  width: 100%; 
  padding: 14px; 
  font-size: 1rem; 
  font-weight: 600;
  border-radius: var(--radius-md); 
  background: linear-gradient(to right, var(--accent-1), var(--accent-2));
  border: none;
  box-shadow: 0 4px 14px rgba(16,185,129,0.4);
  transition: all 0.3s ease;
  color: white;
  cursor: pointer;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,185,129,0.6);
}

.btn-login:active {
  transform: translateY(1px);
}

/* ============================================================ Shop */
.shop-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.shop-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--accent-glow);
}

.product-category-path {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.product-rate {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.product-unit { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

.product-stock {
  font-size: 0.73rem;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
}

.product-stock.in-stock   { background: rgba(16,185,129,0.1); color: var(--accent-1); }
.product-stock.low-stock  { background: rgba(245,158,11,0.1); color: var(--warning); }
.product-stock.unlimited  { background: rgba(100,116,139,0.1); color: var(--text-muted); }

.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}

.qty-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 700;
  transition: var(--transition);
}

.qty-btn:hover { background: var(--bg-hover); color: var(--accent-1); }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.qty-display {
  min-width: 38px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 4px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  height: 34px;
  display: flex; align-items: center; justify-content: center;
}

.product-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ============================================================ Cart Sidebar */
.cart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
  max-height: calc(100vh - var(--topbar-h) - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.cart-title { font-weight: 700; font-size: 0.95rem; }
.cart-count {
  background: var(--accent-1);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
}

.cart-items { flex: 1; overflow-y: auto; padding: 10px; scrollbar-width: thin; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.cart-item:hover { background: var(--bg-elevated); }

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name  { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-rate  { font-size: 0.75rem; color: var(--text-muted); }
.cart-item-sub   { font-size: 0.82rem; font-weight: 700; color: var(--accent-1); white-space: nowrap; }

.cart-item-qty {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600;
}

.cart-item-qty button {
  width: 22px; height: 22px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: var(--transition);
}

.cart-item-qty button:hover { background: var(--accent-1); color: white; }

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 30px;
  text-align: center;
}

.cart-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cart-total-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.cart-total-amount { font-size: 1.2rem; font-weight: 800; }

/* ============================================================ Order status badges */
.status-pending    { background: rgba(245,158,11,0.12); color: #f59e0b; }
.status-processing { background: rgba(59,130,246,0.12); color: #3b82f6; }
.status-completed  { background: rgba(16,185,129,0.12); color: #10b981; }
.status-cancelled  { background: rgba(239,68,68,0.12);  color: #ef4444; }

/* ============================================================ Order details expand */
.order-row-details {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

.order-items-table {
  width: 100%;
  font-size: 0.82rem;
}

.order-items-table th {
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.order-items-table td { padding: 8px 12px; }

/* ============================================================ Checkout */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 24px;
  align-items: start;
}

.checkout-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
}

/* ============================================================ Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state-icon { font-size: 48px; margin-bottom: 4px; }
.empty-state h3   { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-state p    { font-size: 0.85rem; }

/* ============================================================ Loading */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============================================================ Inventory badge */
.inventory-on  { background: rgba(16,185,129,0.12); color: var(--accent-1); }
.inventory-off { background: rgba(100,116,139,0.12); color: var(--text-muted); }

/* ============================================================ Confirm dialog */
.confirm-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; }

/* ============================================================ Animations */
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp    { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============================================================ Responsive */
@media (max-width: 1024px) {
  .shop-layout     { grid-template-columns: 1fr; }
  .checkout-layout { grid-template-columns: 1fr; }
  .cart-panel      { position: static; max-height: 400px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.visible { display: block; }
  .main-wrapper { margin-left: 0; }
  .menu-toggle  { display: flex; }
  .page-content { padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 800px; }
  .login-card { padding: 30px 20px; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr; }
  .stats-grid    { grid-template-columns: 1fr; }
}

/* ============================================================ Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-accent); }

/* ============================================================ Misc */
.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent-1); }
.text-danger  { color: var(--danger); }
.font-bold    { font-weight: 700; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.w-full       { width: 100%; }
.divider      { height: 1px; background: var(--border); margin: 16px 0; }
