/* ============================================================
   ENTERPRISE POS — Global Styles v3.0
   Dark-first, glassmorphism, professional
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, .page-title, .card-title, .stat-value, .topbar-title, .logo-text strong {
  font-family: 'Manrope', 'Inter', sans-serif;
  letter-spacing: -0.3px;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── CSS Variables (Light "Studio" theme default) ───────────── */
:root {
  --bg-base:    #f6f7fb;
  --bg-surface: #ffffff;
  --bg-card:    #ffffff;
  --bg-card-hover: #f2f5fb;
  --bg-input:   #ffffff;
  --bg-sidebar: #0b1120;
  --bg-topbar:  rgba(255,255,255,0.88);

  --border:     rgba(15,23,42,0.08);
  --border-strong: rgba(15,23,42,0.16);

  --text-primary: #0b1120;
  --text-secondary: #475569;
  --text-muted: #7c8aa1;
  --text-dim:   #b6c0d0;

  --primary:    #4f46e5;
  --primary-light: rgba(79,70,229,0.10);
  --primary-hover: #4338ca;
  --primary-2:  #7c3aed;
  --secondary:  #06b6d4;
  --success:    #10b981;
  --success-light: rgba(16,185,129,0.12);
  --warning:    #f59e0b;
  --warning-light: rgba(245,158,11,0.13);
  --danger:     #ef4444;
  --danger-light: rgba(239,68,68,0.12);
  --info:       #0ea5e9;
  --info-light: rgba(14,165,233,0.12);

  --gradient-primary: linear-gradient(135deg, #4f46e5, #7c3aed 55%, #06b6d4);
  --gradient-ink: linear-gradient(135deg, #0b1120 0%, #141c33 45%, #1b2350 100%);

  --sidebar-w:  240px;
  --topbar-h:   60px;
  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  18px;
  --radius-xl:  26px;

  --shadow-sm:  0 1px 2px rgba(15,23,42,0.06);
  --shadow:     0 6px 24px -12px rgba(15,23,42,0.24);
  --shadow-lg:  0 18px 48px -20px rgba(15,23,42,0.30);
  --shadow-xl:  0 32px 80px -28px rgba(15,23,42,0.38);

  --transition: 0.18s ease;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
body.dark {
  --bg-base:    #070b17;
  --bg-surface: #0f1524;
  --bg-card:    #111829;
  --bg-card-hover: #16203a;
  --bg-input:   rgba(255,255,255,0.06);
  --bg-sidebar: #080d1a;
  --bg-topbar:  rgba(10,15,30,0.85);
  --border:     rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.18);
  --text-primary: #eef2ff;
  --text-secondary: #a8b3c8;
  --text-muted: #7484a0;
  --text-dim:   #46536e;
  --primary:    #818cf8;
  --primary-light: rgba(129,140,248,0.16);
  --primary-hover: #6366f1;
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.35);
  --shadow:     0 6px 24px rgba(0,0,0,0.45);
  --shadow-lg:  0 18px 48px rgba(0,0,0,0.55);
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  text-decoration: none;
}
.logo-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #0891b2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
  overflow: hidden;
}
.logo-text strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: -0.3px; }
.logo-text span { font-size: 11px; color: var(--text-muted); }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }
.nav-label {
  padding: 8px 20px 4px;
  font-size: 10px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 20px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; border: none; background: none; width: 100%;
  text-align: left; text-decoration: none;
  border-radius: 0; transition: color var(--transition), background var(--transition);
  position: relative;
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(16,185,129,0.22), rgba(16,185,129,0.06));
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 2px 2px 0;
  background: var(--primary);
}
.nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #10b981, #0891b2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info strong { display: block; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-info span { font-size: 10px; text-transform: capitalize; }

/* ── Main Wrap ───────────────────────────────────────────────── */
.main-wrap {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 20px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.menu-btn {
  display: none; width: 36px; height: 36px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary);
  font-size: 16px; align-items: center; justify-content: center;
}
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; truncate; }
.topbar-time { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

/* ── Page Content ────────────────────────────────────────────── */
.page-content {
  flex: 1; overflow-y: auto; padding: 24px;
}
.page-content::-webkit-scrollbar { width: 4px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
  flex-wrap: wrap;
}
.page-header-left {}
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.emerald::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.stat-card.blue::before    { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card.purple::before  { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card.amber::before   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.red::before     { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card.cyan::before    { background: linear-gradient(90deg, #06b6d4, #38bdf8); }
.stat-card.indigo::before  { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card.rose::before    { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.stat-card.emerald .stat-icon { background: var(--success-light); }
.stat-card.blue .stat-icon    { background: rgba(59,130,246,0.12); }
.stat-card.purple .stat-icon  { background: rgba(139,92,246,0.12); }
.stat-card.amber .stat-icon   { background: var(--warning-light); }
.stat-card.red .stat-icon     { background: var(--danger-light); }
.stat-card.cyan .stat-icon    { background: rgba(6,182,212,0.12); }
.stat-card.indigo .stat-icon  { background: var(--primary-light); }
.stat-card.rose .stat-icon    { background: rgba(244,63,94,0.12); }

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-top: 4px; }
.stat-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-trend { font-size: 11px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 18px 20px 20px; }

/* ── Grid layouts ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  padding: 10px 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
td { padding: 12px 12px; vertical-align: middle; }
.td-right { text-align: right; }
.td-center { text-align: center; }
.mono { font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace; font-size: 12px; }
.profit { color: var(--success); font-weight: 600; }
.loss { color: var(--danger); font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  white-space: nowrap; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, #10b981, #0891b2);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 12px rgba(16,185,129,0.32);
}
.btn-primary:hover { background: linear-gradient(135deg, #059669, #0e7490); box-shadow: 0 6px 22px rgba(16,185,129,0.45); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-card-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-card); }
.btn-success { background: rgba(34,197,94,0.15); color: var(--success); border-color: rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-warning { background: var(--warning-light); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Form Inputs ─────────────────────────────────────────────── */
.input, .select, textarea {
  width: 100%; padding: 10px 13px; font-size: 13.5px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}
.input::placeholder { color: var(--text-dim); }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-purple  { background: rgba(139,92,246,0.12); color: var(--secondary); }
.badge-gray    { background: rgba(100,116,139,0.12); color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 920px; }
.modal-sm { max-width: 400px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 0;
}
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.modal-close:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); background: var(--danger-light); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 22px;
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  min-width: 260px; max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  border: 1px solid transparent;
}
.toast-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.toast-success { background: rgba(15,23,42,0.95); border-color: rgba(34,197,94,0.3); color: #fff; }
.toast-success .toast-icon { background: var(--success); color: #fff; }
.toast-error { background: rgba(15,23,42,0.95); border-color: rgba(239,68,68,0.3); color: #fff; }
.toast-error .toast-icon { background: var(--danger); color: #fff; }
.toast-warning { background: rgba(15,23,42,0.95); border-color: rgba(245,158,11,0.3); color: #fff; }
.toast-warning .toast-icon { background: var(--warning); color: #fff; }
.toast-info { background: rgba(15,23,42,0.95); border-color: rgba(56,189,248,0.3); color: #fff; }
.toast-info .toast-icon { background: var(--info); color: #fff; }
.toast.hiding { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes toastOut { from { opacity:1; transform: translateX(0); } to { opacity:0; transform: translateX(20px); } }

/* ── Skeleton Loading ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-strong) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
  border-radius: 6px;
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin: 6px 0; }
.skeleton-title { height: 20px; width: 60%; }
.skeleton-card { height: 100px; }

/* ── Empty States ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-text { font-size: 13px; }

/* ── Section Label ───────────────────────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  margin-bottom: 12px; padding-left: 2px;
}

/* ── Divider ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Search Bar ──────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px; pointer-events: none;
}
.search-wrap .input { padding-left: 34px; }

/* ── POS / Sales Layout ──────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  height: calc(100vh - var(--topbar-h) - 48px);
}
.pos-left { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: hidden; }
.pos-right { display: flex; flex-direction: column; gap: 0; min-height: 0; overflow: hidden; }

.pos-search-bar {
  display: flex; gap: 10px; align-items: center; flex-shrink: 0; flex-wrap: wrap;
}
.pos-search-bar .search-wrap { min-width: 180px; }
.pos-search-bar #scannerStatus { margin-left: auto; }
.pos-search-bar .input { flex: 1; }
.pos-filter-row {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap;
}
.cat-chip {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  overflow-y: auto; padding-right: 4px; padding-bottom: 12px;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  grid-auto-rows: auto;
}
.product-grid::-webkit-scrollbar { width: 4px; }
.product-grid::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  cursor: pointer; text-align: left; width: 100%;
  display: flex; flex-direction: column; justify-content: flex-start;
  min-height: 104px; height: auto;
  transition: all var(--transition); position: relative; overflow: visible;
}
.product-card:hover:not(:disabled) {
  border-color: var(--primary); background: var(--bg-card-hover);
  transform: translateY(-1px); box-shadow: var(--shadow-sm);
}
.product-card:disabled { opacity: 0.5; cursor: not-allowed; }
.product-card.out-of-stock { opacity: 0.45; }
.p-img {
  width: 100%; height: 72px; object-fit: cover;
  border-radius: 8px; margin-bottom: 8px;
  background: var(--border);
}
.p-code { font-size: 10px; color: var(--text-muted); font-family: monospace; }
.p-name { font-size: 13px; font-weight: 600; margin: 4px 0; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-cat  { font-size: 11px; color: var(--text-muted); }
.p-price { font-size: 14px; font-weight: 700; color: var(--primary); }
.p-stock { font-size: 11px; color: var(--text-muted); }
.p-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ── Cart ────────────────────────────────────────────────────── */
.cart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden; height: 100%;
}
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.cart-title { font-size: 14px; font-weight: 700; }
.cart-count { background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.cart-items { flex: 1; overflow-y: auto; padding: 10px; }
.cart-items::-webkit-scrollbar { width: 3px; }
.cart-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.cart-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 8px; border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.cart-item:hover { background: var(--bg-card-hover); }
.cart-item-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; margin-bottom: 3px; }
.cart-item-price { font-size: 11px; color: var(--text-muted); }
.cart-item-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.qty-btn {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.qty-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.qty-val { font-size: 13px; font-weight: 700; min-width: 24px; text-align: center; }
.cart-remove { color: var(--text-dim); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; border: none; background: none; transition: color var(--transition); }
.cart-remove:hover { color: var(--danger); }

.cart-totals {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
}
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; color: var(--text-secondary); }
.total-row.grand { font-size: 16px; font-weight: 800; color: var(--text-primary); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }

.cart-actions {
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.cart-customer {
  display: flex; gap: 6px;
}
.cart-customer .input { flex: 1; font-size: 12px; padding: 8px 10px; }
.checkout-btn {
  width: 100%; padding: 14px; font-size: 15px; font-weight: 700;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff; border: none; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(34,197,94,0.35);
}
.checkout-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(34,197,94,0.45); }
.checkout-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.hold-btn {
  background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-sm); padding: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); display: flex; align-items: center; gap: 6px; justify-content: center;
}
.hold-btn:hover { background: rgba(245,158,11,0.2); }
.void-btn {
  background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm); padding: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); display: flex; align-items: center; gap: 6px; justify-content: center;
}
.void-btn:hover { background: rgba(239,68,68,0.2); }

/* ── Inventory ───────────────────────────────────────────────── */
.inv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }

/* ── Receipt / Thermal ───────────────────────────────────────── */
.receipt-wrap {
  font-family: 'Courier New', monospace;
  background: #fff; color: #111;
  padding: 24px 20px; width: 100%; max-width: 320px;
  margin: 0 auto; font-size: 12px;
}
.receipt-wrap .receipt-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.receipt-divider { border: none; border-top: 1px dashed #bbb; margin: 10px 0; }
.receipt-row { display: flex; justify-content: space-between; margin: 3px 0; font-size: 12px; }
.receipt-bold { font-weight: 700; }
.receipt-total { font-size: 15px; font-weight: 700; border-top: 2px solid #111; padding-top: 8px; }

/* ── Scanner Tabs ────────────────────────────────────────────── */
.scanner-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.scanner-tab {
  padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.scanner-tab.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── Charts placeholder ──────────────────────────────────────── */
.chart-wrap {
  padding: 16px 20px 20px;
  min-height: 220px;
  position: relative;
}
.chart-bars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 160px; padding: 0 4px;
}
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--primary), rgba(99,102,241,0.4));
  transition: height 0.5s cubic-bezier(.34,1.56,.64,1);
  min-height: 4px;
  position: relative;
}
.chart-bar:hover::after {
  content: attr(data-tip);
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
  background: var(--bg-surface); border: 1px solid var(--border);
  font-size: 10px; padding: 3px 7px; border-radius: 4px; white-space: nowrap;
  color: var(--text-primary); pointer-events: none;
}
.chart-label { font-size: 10px; color: var(--text-muted); text-align: center; }

/* ── Quick Action Buttons ────────────────────────────────────── */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 20px 20px; }
.quick-btn {
  flex: 1; min-width: 120px; padding: 14px 16px;
  background: var(--bg-card-hover); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-align: center;
  transition: all var(--transition); color: var(--text-secondary); font-size: 13px; font-weight: 600;
}
.quick-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.quick-btn .quick-icon { font-size: 22px; margin-bottom: 6px; display: block; }

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
}

/* ── Loading overlay ─────────────────────────────────────────── */
#loadingOverlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(10,14,26,0.95); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(99,102,241,0.25);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: slideUp 0.25s ease forwards; }

/* ── Discount / note row in cart ─────────────────────────────── */
.discount-row { display: flex; gap: 6px; }
.discount-row .input { flex: 1; font-size: 12px; padding: 7px 10px; }

/* ── Payment methods ─────────────────────────────────────────── */
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.pay-method-btn {
  padding: 8px 4px; text-align: center; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-input);
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  transition: all var(--transition);
}
.pay-method-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pay-method-btn:hover { border-color: var(--primary); color: var(--primary); }
.pay-method-icon { display: block; font-size: 16px; margin-bottom: 3px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr 320px; }
  .inv-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; transform: translateX(-100%); z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .menu-btn { display: flex !important; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-right { height: auto; }
  .pos-left { height: auto; }
  .product-grid { height: 380px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 14px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .inv-stats { grid-template-columns: 1fr 1fr; }
  .modal { border-radius: var(--radius-lg); }
  .topbar { padding: 0 14px; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 16px 16px 0; }
  .modal-footer { padding: 0 16px 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 18px; }
  .page-title { font-size: 18px; }
  .pos-layout { gap: 12px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .pos-search-bar #scannerStatus { margin-left: 0; width: 100%; justify-content: center; }
}

/* ── Highlight / focus ───────────────────────────────────────── */
::selection { background: rgba(99,102,241,0.35); color: #fff; }


/* ============================================================
   v4 — Studio refinements + AI Intelligence panel
   ============================================================ */
.stat-card {
  box-shadow: var(--shadow-sm);
}
.stat-card::before { height: 3px; }
.stat-card::after {
  content: ''; position: absolute; left: 20px; right: 20px; bottom: 16px; height: 2px;
  border-radius: 2px; opacity: 0.85;
  background: linear-gradient(90deg, currentColor, transparent);
}
.stat-card { padding-bottom: 28px; }
.stat-card.emerald { color: #10b981; } .stat-card.blue { color: #3b82f6; }
.stat-card.purple { color: #8b5cf6; }  .stat-card.amber { color: #f59e0b; }
.stat-card.red { color: #ef4444; }     .stat-card.cyan { color: #06b6d4; }
.stat-card.indigo { color: #6366f1; }  .stat-card.rose { color: #f43f5e; }
.stat-card .stat-label, .stat-card .stat-sub { color: var(--text-muted); }
.stat-card .stat-value { color: var(--text-primary); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.card { box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--gradient-primary) !important; border-color: transparent !important; color: #fff !important; }
.btn-primary:hover { filter: brightness(1.06); }

/* AI Intelligence panel — dark inked strip */
.ai-panel {
  background: var(--gradient-ink);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 24px;
  color: #eef2ff;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.ai-panel::after {
  content: ''; position: absolute; inset: -40% -10% auto auto; width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(124,58,237,0.45), transparent 62%);
  pointer-events: none;
}
.ai-panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; position:relative; z-index:1; }
.ai-title { display:flex; align-items:center; gap:10px; font-family:'Manrope',sans-serif; font-weight:800; font-size:15px; letter-spacing:-0.2px; }
.ai-dot { width:9px; height:9px; border-radius:50%; background:#22d3ee; box-shadow:0 0 0 4px rgba(34,211,238,0.18); animation: aiPulse 1.8s infinite; }
@keyframes aiPulse { 50% { box-shadow:0 0 0 9px rgba(34,211,238,0.02); } }
.ai-chip { font-size:11px; font-weight:600; padding:5px 10px; border-radius:999px; background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.12); color:#c7d2fe; }
.ai-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; position:relative; z-index:1; }
.ai-tile {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: var(--transition);
}
.ai-tile:hover { background: rgba(255,255,255,0.10); transform: translateY(-2px); }
.ai-tile-label { font-size:11px; text-transform:uppercase; letter-spacing:0.6px; color:#94a3c4; font-weight:600; }
.ai-tile-value { font-size:21px; font-weight:800; margin-top:6px; letter-spacing:-0.4px; }
.ai-tile-sub { font-size:11.5px; color:#9fb0cc; margin-top:4px; }
.ai-tile.good .ai-tile-value { color:#34d399; }
.ai-tile.warn .ai-tile-value { color:#fbbf24; }
.ai-tile.bad  .ai-tile-value { color:#fb7185; }
.ai-tile.info .ai-tile-value { color:#67e8f9; }
.ai-spark { display:flex; align-items:flex-end; gap:3px; height:34px; margin-top:10px; }
.ai-spark i { flex:1; border-radius:2px 2px 0 0; background:linear-gradient(180deg,#818cf8,#22d3ee); opacity:0.85; }
.ai-notes { margin-top:16px; display:flex; flex-wrap:wrap; gap:8px; position:relative; z-index:1; }
.ai-note { font-size:12px; padding:7px 12px; border-radius:999px; background:rgba(255,255,255,0.07); border:1px solid rgba(255,255,255,0.10); color:#dbe3f5; }

/* ── Barcode Scanner UI ─────────────────────────────────────── */
.scan-chip{
  display:inline-flex;align-items:center;gap:6px;white-space:nowrap;
  padding:7px 12px;border-radius:999px;font-size:12px;font-weight:600;
  border:1px solid var(--border);background:var(--surface-2,rgba(15,23,42,.04));
  color:var(--text-muted);transition:all .2s ease;
}
.scan-chip.busy{border-color:var(--primary);color:var(--primary);
  background:color-mix(in srgb,var(--primary) 12%,transparent);
  box-shadow:0 0 0 4px color-mix(in srgb,var(--primary) 12%,transparent);}
.scan-chip.hit{border-color:var(--success);color:var(--success);
  background:color-mix(in srgb,var(--success) 14%,transparent);}
.scan-chip.miss{border-color:var(--danger);color:var(--danger);
  background:color-mix(in srgb,var(--danger) 14%,transparent);}
.scan-dot{width:9px;height:9px;border-radius:50%;background:var(--text-muted);flex-shrink:0;}
.scan-chip.connected{border-color:var(--success);color:var(--success);
  background:color-mix(in srgb,var(--success) 12%,transparent);}
.scan-chip.connected .scan-dot{background:var(--success);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--success) 25%,transparent);
  animation:scanPulse 1.8s ease-in-out infinite;}
.scan-chip.disconnected{border-color:var(--danger);color:var(--danger);
  background:color-mix(in srgb,var(--danger) 10%,transparent);}
.scan-chip.disconnected .scan-dot{background:var(--danger);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 22%,transparent);}
.scan-chip.busy .scan-dot{background:var(--primary);}
.scan-chip.hit .scan-dot{background:var(--success);}
.scan-chip.miss .scan-dot{background:var(--danger);}
@keyframes scanPulse{0%,100%{opacity:1;}50%{opacity:.45;}}
.cart-item-flash{animation:cartFlash .7s ease;}
@keyframes cartFlash{
  0%{background:color-mix(in srgb,var(--success) 26%,transparent);transform:scale(1.015);}
  100%{background:transparent;transform:scale(1);}
}
