/**
 * SuperPos — Global Design System
 * Modern Admin Dashboard CSS
 * Ultra Clean | Compact | Professional | Dark Mode Ready
 */

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

/* ============================================================
   2. CSS VARIABLES — LIGHT THEME
   ============================================================ */
:root {
  /* Brand Colors */
  --primary:        #5046e5;
  --primary-dark:   #3d35c5;
  --primary-light:  #ede9fe;
  --primary-rgb:    80, 70, 229;

  /* Accent */
  --accent:         #0ea5e9;
  --accent-dark:    #0284c7;
  --accent-light:   #e0f2fe;

  /* Success / Warning / Danger / Info */
  --success:        #10b981;
  --success-bg:     #d1fae5;
  --warning:        #f59e0b;
  --warning-bg:     #fef3c7;
  --danger:         #ef4444;
  --danger-bg:      #fee2e2;
  --info:           #3b82f6;
  --info-bg:        #dbeafe;

  /* Neutral Greys */
  --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;

  /* Background */
  --bg-app:         #f0f2f5;
  --bg-card:        #ffffff;
  --card-bg:        #ffffff;
  --bg-sidebar:     #0f172a;
  --bg-sidebar-hover: rgba(255,255,255,0.07);
  --bg-sidebar-active: rgba(80,70,229,0.9);
  --bg-topbar:      #ffffff;
  --bg-input:       #ffffff;

  /* Text */
  --text-primary:   #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --text-sidebar:   rgba(255,255,255,0.75);
  --text-sidebar-active: #ffffff;

  /* Border */
  --border:         #e2e8f0;
  --border-focus:   var(--primary);

  /* Shadow */
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl:      0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.04);

  /* Sidebar */
  --sidebar-width:       230px;
  --sidebar-width-collapsed: 60px;
  --topbar-height:       54px;

  /* Typography */
  --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;

  /* Border Radius */
  --radius-sm:  4px;
  --radius:     8px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition:     all 0.18s ease;
  --transition-slow: all 0.3s ease;
}

/* ============================================================
   3. DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg-app:         #0f172a;
  --bg-card:        #1e293b;
  --bg-sidebar:     #0a0f1e;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --bg-topbar:      #1e293b;
  --bg-input:       #1e293b;

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

  --border:         rgba(255,255,255,0.08);
  --border-focus:   var(--primary);

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,0.3);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,0.35);

  --gray-50:        #1e293b;
  --gray-100:       #273548;
  --gray-200:       #334155;
}

/* ============================================================
   4. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-app);
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ============================================================
   5. TYPOGRAPHY
   ============================================================ */
h1 { font-size: 1.5rem;   font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.25rem;  font-weight: 700; line-height: 1.35; }
h3 { font-size: 1.1rem;   font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem;     font-weight: 600; }
h5 { font-size: 0.9375rem;font-weight: 600; }
h6 { font-size: 0.875rem; font-weight: 600; }

p { color: var(--text-secondary); margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

small  { font-size: 0.75rem; color: var(--text-muted); }
strong { font-weight: 600; }
code   { font-family: var(--font-mono); font-size: 0.8125rem; background: var(--gray-100); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }

.text-primary   { color: var(--primary)   !important; }
.text-success   { color: var(--success)   !important; }
.text-warning   { color: var(--warning)   !important; }
.text-danger    { color: var(--danger)    !important; }
.text-info      { color: var(--info)      !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ============================================================
   6. LAYOUT — SIDEBAR + TOPBAR
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: var(--transition-slow);
  overflow: hidden;
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo .logo-icon svg { width: 18px; height: 18px; fill: #fff; }

.sidebar-logo .logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.sidebar-logo .logo-text span {
  color: var(--primary);
  color: #818cf8;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-group {
  margin-bottom: 4px;
}

.sidebar-group-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: 10px 18px 4px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  margin: 1px 8px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.35);
}

.sidebar-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: var(--transition);
}

.sidebar-item:hover .nav-icon,
.sidebar-item.active .nav-icon { opacity: 1; }

.sidebar-item .nav-label { flex: 1; }

.sidebar-item .nav-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

/* Has sub-menu arrow */
.sidebar-item .nav-arrow {
  width: 14px; height: 14px;
  opacity: 0.5;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.sidebar-submenu.open { max-height: 500px; }

.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 42px;
  margin: 1px 8px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-subitem:before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  flex-shrink: 0;
}

.sidebar-subitem:hover { color: rgba(255,255,255,0.9); text-decoration: none; }
.sidebar-subitem.active { color: #fff; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-toggle {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: var(--transition);
}

.topbar-toggle:hover { background: var(--gray-100); color: var(--text-primary); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex: 1;
}

.topbar-breadcrumb .breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topbar-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
}

.topbar-btn:hover { background: var(--gray-100); color: var(--text-primary); }

.topbar-btn .badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--bg-topbar);
}

.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: var(--transition);
}

.topbar-avatar:hover { border-color: var(--primary); }

/* Page Content */
.page-content {
  flex: 1;
  padding: 20px;
}

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

.page-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* ============================================================
   7. CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* ── Stat Cards ────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

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

.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.blue   { background: var(--info-bg);    color: var(--info);    }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg);  color: var(--danger);  }
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.cyan   { background: var(--accent-light); color: var(--accent); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-change {
  font-size: 0.75rem; font-weight: 600; margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger);  }

/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Sizes */
.btn-xs { padding: 4px 9px; font-size: 0.75rem; }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; }
.btn-lg { padding: 10px 20px; font-size: 0.9375rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius); }
.btn-icon-sm { width: 26px; height: 26px; padding: 0; border-radius: var(--radius-sm); }

/* Variants */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(var(--primary-rgb),0.2);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-secondary {
  background: var(--gray-100);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--gray-200); color: var(--text-primary); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

/* Loading state */
.btn.loading { pointer-events: none; }
.btn.loading::before {
  content: '';
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 4px;
}

/* ============================================================
   9. FORMS
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; min-width: 0; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: 0.8125rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--gray-100); cursor: not-allowed; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { 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='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px; cursor: pointer; }

.form-control-sm { padding: 5px 9px; font-size: 0.8rem; }
.form-control-lg { padding: 9px 12px; font-size: 0.9rem; }

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  flex: 1;
  border-radius: 0;
}

.input-group .form-control:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }

.input-group-text {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--gray-100);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.input-group-text:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.input-group-text:last-child  { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }

/* Checkbox & Radio */
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.form-check-input {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  accent-color: var(--primary);
}

.form-switch .form-check-input {
  width: 36px; height: 20px;
  border-radius: var(--radius-full);
}

.form-check-label { font-size: 0.8125rem; color: var(--text-primary); cursor: pointer; }

/* Invalid feedback */
.invalid-feedback { display: block; color: var(--danger); font-size: 0.75rem; margin-top: 3px; }
.valid-feedback   { display: block; color: var(--success); font-size: 0.75rem; margin-top: 3px; }

/* ============================================================
   10. TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  padding: 9px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  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;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--gray-50); }

.table-striped tbody tr:nth-child(even) td { background: var(--gray-50); }
.table-striped tbody tr:nth-child(even):hover td { background: var(--gray-100); }

tfoot td {
  padding: 9px 12px;
  font-weight: 600;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* Sort indicators */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th.sort-asc::after  { content: ' ↑'; font-size: 0.65em; }
th.sort-desc::after { content: ' ↓'; font-size: 0.65em; }

/* ============================================================
   11. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.6;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-bg);    color: var(--success); }
.badge-warning { background: var(--warning-bg);    color: var(--warning); }
.badge-danger  { background: var(--danger-bg);     color: var(--danger);  }
.badge-info    { background: var(--info-bg);        color: var(--info);   }
.badge-muted   { background: var(--gray-100);      color: var(--text-muted); }
.badge-dark    { background: var(--gray-800);      color: #fff; }

.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================================
   12. ALERTS / TOAST
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-bg); color: #065f46; border-color: #a7f3d0; }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: #fde68a; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border-color: #fca5a5; }
.alert-info    { background: var(--info-bg);     color: #1e40af; border-color: #93c5fd; }

/* Toast — top-right, compact */
#toast-container {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-size: 0.78rem;
  animation: slideInRight 0.22s ease;
  cursor: pointer;
  min-width: 210px;
  max-width: 320px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  pointer-events: all;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: currentColor;
}

.toast-success { background: #fff; color: var(--success); border-color: var(--success-bg); }
.toast-error   { background: #fff; color: var(--danger);  border-color: var(--danger-bg);  }
.toast-warning { background: #fff; color: var(--warning); border-color: var(--warning-bg); }
.toast-info    { background: #fff; color: var(--info);    border-color: var(--info-bg);    }

.toast-body { flex: 1; color: var(--text-primary); }
.toast-title { font-weight: 600; font-size: 0.775rem; margin-bottom: 1px; }
.toast-message { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.35; }

.toast-close { width: 14px; height: 14px; cursor: pointer; opacity: 0.45; flex-shrink: 0; margin-top: 1px; }
.toast-close:hover { opacity: 1; }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.3;
  animation: toastProgress 4s linear forwards;
}

/* ============================================================
   13. DROPDOWNS
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: 4px;
  display: none;
  animation: fadeScale 0.15s ease;
}

.dropdown-menu.show  { display: block; }
.dropdown-menu.left  { right: auto; left: 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  transition: var(--transition);
}

.dropdown-item:hover { background: var(--gray-100); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }
.dropdown-item svg { width: 15px; height: 15px; opacity: 0.7; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}

.modal-sm { max-width: 360px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 1000px; }

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

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

.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: var(--transition);
}

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

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   15. PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-info { font-size: 0.8rem; color: var(--text-muted); }

.pagination-links {
  display: flex;
  align-items: center;
  gap: 3px;
}

.page-btn {
  min-width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
}

.page-btn:hover  { background: var(--gray-100); color: var(--text-primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.disabled { opacity: 0.35; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--text-muted); font-size: 0.875rem; }

/* ============================================================
   16. SEARCH / FILTERS
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 9px;
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  padding-left: 32px !important;
  min-width: 220px;
}

/* ============================================================
   17. TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   18. EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  text-align: center;
  gap: 10px;
}

.empty-icon {
  width: 56px; height: 56px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.empty-icon svg { width: 26px; height: 26px; }

.empty-title { font-size: 1rem; font-weight: 600; }
.empty-message { font-size: 0.8125rem; color: var(--text-muted); max-width: 300px; }

/* ============================================================
   19. LOADER / SPINNER
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}

[data-theme="dark"] .page-loader { background: rgba(15,23,42,0.7); }

/* ============================================================
   20. GRID / UTILITIES
   ============================================================ */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-5 { grid-template-columns: repeat(5, 1fr); gap: 16px; }
.grid-6 { grid-template-columns: repeat(6, 1fr); gap: 16px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }

.d-none    { display: none !important; }
.d-flex    { display: flex !important; }
.d-block   { display: block !important; }
.d-inline  { display: inline !important; }
.d-inline-flex { display: inline-flex !important; }

.w-full  { width: 100%; }
.h-full  { height: 100%; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rounded     { border-radius: var(--radius); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow   { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.border { border: 1px solid var(--border); }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

/* ============================================================
   21. SIDEBAR COLLAPSED — COMPLETELY HIDE & FULL WIDTH CONTENT
   ============================================================ */
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  visibility: hidden;
  pointer-events: none;
}

body.sidebar-collapsed .main-content {
  margin-left: 0 !important;
  width: 100% !important;
}

/* ============================================================
   22. ANIMATIONS
   ============================================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeScale {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin  { animation: spin 1s linear infinite; }

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

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   23. AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
}

.auth-left {
  flex: 1;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--primary-rgb),0.15) 0%, transparent 70%);
  top: -100px; right: -100px;
}

.auth-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,0.12) 0%, transparent 70%);
  bottom: -80px; left: -60px;
}

.auth-right {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 36px;
  background: var(--bg-card);
  overflow-y: auto;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-decoration: none;
}

.auth-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 24px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   24. POS LAYOUT
   ============================================================ */
.pos-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

.pos-products {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--border);
}

.pos-cart {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

.pos-cart-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

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

.pos-totals td {
  padding: 4px 0;
  font-size: 0.8125rem;
}

.pos-total-final td { font-size: 1rem; font-weight: 700; padding-top: 8px; }

/* ============================================================
   25. CHART CONTAINERS
   ============================================================ */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas { max-width: 100%; }

/* ============================================================
   26. PROGRESS BARS
   ============================================================ */
.progress {
  height: 6px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.6s ease;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger);  }

/* ============================================================
   27. TOOLTIPS
   ============================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9999;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ============================================================
   28. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .auth-left { display: none; }
  .auth-right { width: 100%; }
  .pos-cart { width: 300px; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .page-content { padding: 14px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .pos-layout { flex-direction: column; }
  .pos-cart { width: 100%; height: 50vh; border-right: none; border-top: 1px solid var(--border); }
}

/* ============================================================
   29. PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .page-header .btn-group,
  .no-print { display: none !important; }

  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }

  body { font-size: 12px; color: #000; background: #fff; }
  a { color: #000; }
}

/* ============================================================
   30. MISC UTILITIES
   ============================================================ */
.cursor-pointer { cursor: pointer; }
.user-select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.divide-y > * + * { border-top: 1px solid var(--border); }
.divide-x > * + * { border-left: 1px solid var(--border); }

/* Glassmorphism */
.glass {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
}

[data-theme="dark"] .glass {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
}

/* Avatar */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }

/* Status indicators */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online  { background: var(--success); }
.status-dot.offline { background: var(--gray-400); }
.status-dot.busy    { background: var(--danger); }
.status-dot.away    { background: var(--warning); }

/* RTL Support */
[dir="rtl"] .sidebar { right: 0; left: auto; }
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }


/* ============================================================
   POS — FULLSCREEN MODE (hide sidebar + topbar, no main scroll)
   ============================================================ */
html:has(body.pos-fullscreen),
body.pos-fullscreen {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.pos-fullscreen .sidebar,
body.pos-fullscreen .sidebar-overlay,
body.pos-fullscreen .topbar { display: none !important; }
body.pos-fullscreen .main-content { margin-left: 0 !important; height: 100vh !important; overflow: hidden !important; }
body.pos-fullscreen .page-content { padding: 0 !important; height: 100vh !important; overflow: hidden !important; }

/* Wrapper to hold topbar + pos-layout within exactly 100vh */
.pos-screen-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================================
   POS — SUPERFAST BILLING LAYOUT
   ============================================================ */

/* ── POS Top Bar ─────────────────────────────────────────── */
.pos-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1050;
}

.pos-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pos-location-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pos-location-label svg { width: 14px; height: 14px; opacity: .6; }

.pos-datetime-badge {
  padding: 3px 10px;
  background: linear-gradient(135deg, #f59e0b 0%, #eab308 100%);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pos-datetime-badge .live-dot {
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: pos-pulse 1.5s ease-in-out infinite;
}

@keyframes pos-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.pos-topbar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.pos-topbar-actions .pos-tb-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.pos-topbar-actions .pos-tb-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
  border-color: var(--primary);
}

.pos-topbar-actions .pos-tb-btn svg { width: 14px; height: 14px; }

/* POS Topbar Tooltips Fix */
.pos-topbar-actions [data-tooltip] {
  position: relative;
}

.pos-topbar-actions [data-tooltip]::after,
.pos-customer-row [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  font-size: 0.68rem;
  padding: 4px 8px;
  font-weight: 500;
  pointer-events: none;
  background: var(--gray-900);
}

.pos-topbar-actions [data-tooltip]::before,
.pos-customer-row [data-tooltip]::before {
  content: '';
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent var(--gray-900) transparent;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 20000;
}

.pos-topbar-actions [data-tooltip]:hover::before,
.pos-customer-row [data-tooltip]:hover::before {
  opacity: 1;
}

.pos-topbar-actions .pos-tb-btn:last-child[data-tooltip]::after,
.pos-topbar-actions .pos-tb-btn:nth-last-child(2)[data-tooltip]::after {
  left: auto;
  right: 0;
  transform: none;
}

.pos-topbar-actions .pos-tb-btn:last-child[data-tooltip]::before,
.pos-topbar-actions .pos-tb-btn:nth-last-child(2)[data-tooltip]::before {
  left: auto;
  right: 10px;
  transform: none;
}

.pos-add-expense-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.pos-add-expense-btn:hover { border-color: var(--primary); color: var(--primary); }
.pos-add-expense-btn svg { width: 14px; height: 14px; }

/* ── POS Layout — Cart LEFT, Products RIGHT ──────────── */
.pos-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 44px);
  overflow: hidden;
  background: var(--bg-app);
  contain: layout style;
}

/* ── LEFT: Cart Panel ─────────────────────────────────── */
.pos-cart {
  width: 56%;
  min-width: 480px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-right: 2px solid var(--border);
  overflow: hidden;
}

/* Cart Header: Customer + Search */
.pos-cart-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pos-customer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pos-customer-row .customer-icon {
  width: 30px; height: 30px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pos-customer-row .customer-icon svg { width: 15px; height: 15px; }

.pos-customer-row select {
  flex: 1;
  min-width: 0;
}

.pos-customer-row .pos-cust-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.pos-customer-row .pos-cust-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.pos-customer-row .pos-cust-btn svg { width: 13px; height: 13px; }

/* Search bar */
.pos-search-row {
  position: relative;
}

.pos-search-row .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.pos-search-row input {
  padding-left: 34px !important;
  height: 36px;
  font-size: .82rem;
}

/* Cart Table */
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.pos-cart-items::-webkit-scrollbar { width: 5px; }
.pos-cart-items::-webkit-scrollbar-track { background: transparent; }
.pos-cart-items::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

.pos-cart-table {
  width: 100%;
  border-collapse: collapse;
}

.pos-cart-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
}

.pos-cart-table thead th {
  padding: 8px 8px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  white-space: nowrap;
}

.pos-cart-table thead th:first-child { padding-left: 14px; }

.pos-cart-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}

.pos-cart-table tbody tr:hover { background: rgba(var(--primary-rgb), .03); }

.pos-cart-table tbody td {
  padding: 7px 8px;
  font-size: .8rem;
  vertical-align: middle;
}

.pos-cart-table tbody td:first-child { padding-left: 14px; }

/* Cart item name cell */
.pos-item-name {
  font-weight: 600;
  font-size: .8rem;
  color: var(--primary);
  line-height: 1.3;
  cursor: pointer;
}

.pos-item-name:hover { text-decoration: underline; }

.pos-item-meta {
  font-size: .67rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Quantity stepper */
.pos-qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 28px;
}

.pos-qty-stepper button {
  width: 26px;
  height: 100%;
  border: none;
  background: var(--gray-50);
  color: var(--danger);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pos-qty-stepper button:last-child { color: var(--success); }

.pos-qty-stepper button:hover { background: var(--gray-200); }

.pos-qty-stepper input {
  width: 42px;
  height: 100%;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-size: .82rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-primary);
  -moz-appearance: textfield;
  outline: none;
}

.pos-qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.pos-qty-unit {
  display: block;
  font-size: .62rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

/* Delete btn */
.pos-delete-btn {
  width: 26px; height: 26px;
  border: none;
  background: rgba(239, 68, 68, .08);
  color: var(--danger);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.pos-delete-btn:hover {
  background: var(--danger);
  color: #fff;
}

.pos-delete-btn svg { width: 14px; height: 14px; }

/* ── Cart Footer — Inline Totals ──────────────────────── */
.pos-cart-footer {
  flex-shrink: 0;
  border-top: 2px solid var(--border);
  background: var(--bg-card);
}

.pos-totals-row {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.pos-total-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .76rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pos-total-item .label {
  font-weight: 600;
  text-transform: uppercase;
  font-size: .65rem;
  letter-spacing: .03em;
}

.pos-total-item .value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: .85rem;
}

.pos-total-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* Discount / Shipping inline controls */
.pos-inline-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pos-inline-ctrl input[type="number"] {
  width: 55px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: .76rem;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  height: 24px;
}

.pos-inline-ctrl input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), .1);
}

.pos-inline-ctrl select {
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  background: var(--bg-input);
  color: var(--text-primary);
  height: 24px;
  cursor: pointer;
}

.pos-inline-ctrl .chk-label {
  font-size: .68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

/* Shipping row */
.pos-shipping-row {
  display: flex;
  align-items: center;
  padding: 4px 14px 8px;
  gap: 8px;
}

/* ── Coupon Row ──────────────────────────────────────── */
.pos-coupon-row {
  padding: 6px 14px 8px;
}

.pos-coupon-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50, #f8fafc);
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 5px 8px;
}

.pos-coupon-input-group .coupon-icon {
  flex-shrink: 0;
  color: var(--primary, #5046e5);
  opacity: .65;
}

.pos-coupon-input-group .form-control {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 2px 4px;
}

.pos-coupon-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(16, 185, 129, .08);
  border: 1px solid rgba(16, 185, 129, .25);
  border-radius: 8px;
  padding: 6px 10px;
}

.coupon-applied-info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #059669;
  font-size: .78rem;
  font-weight: 600;
}

.coupon-code-badge {
  background: rgba(16, 185, 129, .15);
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: .76rem;
  letter-spacing: .06em;
  color: #047857;
}

.coupon-discount-text {
  font-weight: 700;
  color: #059669;
  font-size: .82rem;
}

/* ── Grand Total ──────────────────────────────────────── */
.pos-grand-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 16px;
  background: linear-gradient(135deg, #5046e5 0%, #7c3aed 100%);
  gap: 16px;
}

.pos-grand-total .gt-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.8);
}

.pos-grand-total .gt-amount {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
  line-height: 1;
}

/* ── Action Buttons Bar ───────────────────────────────── */
.pos-action-bar {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  gap: 6px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.pos-action-bar .pos-act-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 56px;
  gap: 3px;
  text-align: center;
}

.pos-action-bar .pos-act-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.pos-action-bar .pos-act-btn svg { width: 15px; height: 15px; }

.pos-action-bar .pos-act-btn.cancel-btn {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239,68,68,.06);
}

.pos-action-bar .pos-act-btn.cancel-btn:hover {
  background: var(--danger);
  color: #fff;
}

.pos-act-spacer { flex: 1; }

.pos-pay-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.pos-pay-btn svg { width: 15px; height: 15px; }

.pos-pay-btn.multi-pay {
  background: linear-gradient(135deg, #5046e5 0%, #7c3aed 100%);
  color: #fff;
}

.pos-pay-btn.multi-pay:hover {
  background: linear-gradient(135deg, #3d35c5 0%, #6d28d9 100%);
  box-shadow: 0 4px 12px rgba(80,70,229,.3);
}

.pos-pay-btn.cash-pay {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.pos-pay-btn.cash-pay:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}

.pos-recent-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.pos-recent-btn:hover {
  box-shadow: 0 4px 12px rgba(14,165,233,.3);
}

.pos-recent-btn svg { width: 14px; height: 14px; }

/* ── RIGHT: Products Catalog Panel ───────────────────── */
.pos-products {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 300px;
  background: var(--bg-app);
  overflow: hidden;
}

/* Tab bar */
.pos-tab-bar {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 2px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  gap: 0;
}

.pos-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}

.pos-tab:hover { color: var(--text-primary); }

.pos-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.pos-tab svg { width: 15px; height: 15px; }

.pos-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.pos-tab.active .tab-count {
  background: var(--primary);
}

/* Featured section header */
.pos-featured-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px 4px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pos-featured-header svg { width: 14px; height: 14px; }

/* Products Grid — Small & Responsive */
.pos-product-grid {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  align-content: start;
}

.pos-product-grid::-webkit-scrollbar { width: 5px; }
.pos-product-grid::-webkit-scrollbar-track { background: transparent; }
.pos-product-grid::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* Infinite Scroll Loader & End Badges */
.pos-product-loader, .pos-product-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  font-size: .8rem;
  color: var(--text-muted);
  width: 100%;
}

.pos-loader-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: posSpinner .6s linear infinite;
}

@keyframes posSpinner {
  to { transform: rotate(360deg); }
}

/* Product Card — Small Compact Size */
.pos-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 6px 5px;
  cursor: pointer;
  transition: all .18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.pos-product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(var(--primary-rgb), .15);
  transform: translateY(-2px);
}

.pos-product-card:active {
  transform: translateY(0);
  box-shadow: none;
}

.pos-product-card.pos-card-oos {
  opacity: .5;
  cursor: not-allowed;
}

.pos-product-card.pos-card-oos:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

/* Product Image — Compact Height */
.pos-prod-img {
  width: 100%;
  height: 70px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--gray-50);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pos-prod-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pos-prod-img .no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
}

.pos-prod-img .no-img svg {
  width: 22px; height: 22px;
  color: var(--gray-300);
}

/* Product Info — Small Typography */
.pos-prod-name {
  font-weight: 600;
  font-size: .68rem;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  height: 2.5em;
}

.pos-prod-sku {
  font-size: .58rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pos-prod-price {
  font-weight: 700;
  font-size: .78rem;
  color: var(--primary);
  margin-top: auto;
}

.pos-prod-stock {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: .55rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  line-height: 1.3;
}

.pos-prod-stock.in-stock {
  background: var(--success-bg);
  color: #065f46;
}

.pos-prod-stock.low-stock {
  background: var(--warning-bg);
  color: #92400e;
}

.pos-prod-stock.out-stock {
  background: var(--danger-bg);
  color: #991b1b;
}

/* Category row in product grid */
.pos-category-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.pos-category-row::-webkit-scrollbar { height: 0; }

.pos-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.pos-cat-pill:hover,
.pos-cat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Coupon & Payment hidden panels (inside footer) ───── */
.pos-extra-panel {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  display: none;
}

.pos-extra-panel.show { display: block; }

/* ── Empty cart state ─────────────────────────────────── */
.pos-empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  color: var(--text-muted);
  text-align: center;
}

.pos-empty-cart svg {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
  margin-bottom: 12px;
}

.pos-empty-cart .empty-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.pos-empty-cart .empty-msg {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ── Payment split panel (inside action area) ─────────── */
.pos-payment-panel {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin: 0 14px 8px;
}

.pos-payment-title {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

/* Change due row */
.pos-change-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.25);
  border-radius: var(--radius);
  margin-top: 6px;
}

.pos-change-row .change-label {
  font-size: .76rem;
  color: var(--success);
  font-weight: 600;
}

.pos-change-row .change-amount {
  font-size: 1rem;
  font-weight: 800;
  color: var(--success);
}

/* ── Responsive Grid ─────────────────────────────────── */
@media (min-width: 1600px) {
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (max-width: 1200px) {
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 6px; }
}

@media (max-width: 992px) {
  .pos-layout { flex-direction: column; height: auto; }
  .pos-cart { width: 100%; min-width: 0; border-right: none; border-bottom: 2px solid var(--border); max-height: 55vh; }
  .pos-products { min-height: 45vh; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
}

@media (max-width: 768px) {
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); padding: 6px; gap: 5px; }
  .pos-topbar { flex-wrap: wrap; }
  .pos-action-bar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); padding: 4px; gap: 4px; }
}

/* ── Dark mode POS fixes ─────────────────────────────── */
[data-theme="dark"] .pos-prod-img .no-img {
  background: linear-gradient(135deg, var(--gray-50) 0%, #273548 100%);
}

[data-theme="dark"] .pos-prod-stock.in-stock {
  background: rgba(16,185,129,.15);
  color: #6ee7b7;
}

[data-theme="dark"] .pos-prod-stock.low-stock {
  background: rgba(245,158,11,.15);
  color: #fcd34d;
}

[data-theme="dark"] .pos-prod-stock.out-stock {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
}

[data-theme="dark"] .pos-qty-stepper {
  border-color: rgba(255,255,255,.1);
}

[data-theme="dark"] .pos-qty-stepper button {
  background: rgba(255,255,255,.05);
}

[data-theme="dark"] .pos-qty-stepper input {
  border-color: rgba(255,255,255,.1);
  background: transparent;
}

/* ── POS Item Edit Modal (discount + note per item) ──── */
.pos-item-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: pos-fade-in .15s ease;
}

@keyframes pos-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pos-item-edit-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 380px;
  max-width: 95vw;
  overflow: hidden;
  animation: pos-slide-up .2s ease;
}

@keyframes pos-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

.pos-item-edit-header h4 {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.pos-item-edit-close {
  width: 28px; height: 28px;
  border: none;
  background: var(--gray-100);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
}

.pos-item-edit-close:hover {
  background: var(--danger);
  color: #fff;
}

.pos-item-edit-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-item-edit-body .edit-field label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.pos-item-edit-body .edit-field input,
.pos-item-edit-body .edit-field textarea,
.pos-item-edit-body .edit-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .84rem;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.pos-item-edit-body .edit-field input:focus,
.pos-item-edit-body .edit-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}

.pos-item-edit-body .edit-field textarea {
  resize: vertical;
  min-height: 60px;
}

.pos-item-edit-body .edit-row {
  display: flex;
  gap: 10px;
}

.pos-item-edit-body .edit-row .edit-field { flex: 1; }

.pos-item-edit-footer {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

.pos-item-edit-footer .btn { flex: 1; }

/* ── Inline Price Editor ──────────────────────────── */
.pos-price-edit {
  width: 75px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: .82rem;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  -moz-appearance: textfield;
}

.pos-price-edit:hover {
  border-color: var(--border);
  background: var(--gray-50);
}

.pos-price-edit:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), .15);
  cursor: text;
}

.pos-price-edit::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Performance: GPU compositing hints ────────────── */
.pos-product-card {
  will-change: transform;
  contain: layout style paint;
}

.pos-cart-items {
  will-change: scroll-position;
  contain: strict;
}

.pos-product-grid {
  will-change: scroll-position;
  contain: strict;
}

/* ── Compact List View for Product Grid ────────────── */
.pos-product-grid.pos-compact-view {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pos-product-grid.pos-compact-view .pos-product-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  text-align: left;
  min-height: 44px;
}

.pos-product-grid.pos-compact-view .pos-prod-img {
  width: 32px;
  height: 32px;
  margin-bottom: 0;
  margin-right: 10px;
  flex-shrink: 0;
}

.pos-product-grid.pos-compact-view .pos-prod-name {
  -webkit-line-clamp: 1;
  margin-bottom: 0;
  font-size: .8rem;
  flex: 1;
}

.pos-product-grid.pos-compact-view .pos-prod-sku {
  margin-bottom: 0;
  margin-right: 12px;
  font-size: .7rem;
}

.pos-product-grid.pos-compact-view .pos-prod-price {
  font-size: .85rem;
  margin-right: 10px;
}

.pos-product-grid.pos-compact-view .pos-prod-stock {
  position: static;
  margin-left: 6px;
}

/* ── Customer Due / Credit Limit Badge ────────────── */
.pos-customer-due-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .7rem;
  margin-top: 4px;
}

.pos-customer-due-badge .due-amount {
  font-weight: 700;
  color: var(--danger);
}

.pos-customer-due-badge .credit-limit {
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Hotkeys Cheatsheet Table ─────────────────────── */
.hotkeys-table {
  width: 100%;
  border-collapse: collapse;
}

.hotkeys-table tr {
  border-bottom: 1px solid var(--border);
}

.hotkeys-table td {
  padding: 8px 6px;
  font-size: .8rem;
}

.hotkeys-table kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,.1);
}

/* ── Customer Live Search Dropdown & Not Found ───── */
.customer-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}

.customer-search-item {
  padding: 8px 12px;
  font-size: .8rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.customer-search-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.customer-not-found-btn {
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: rgba(80,70,229,.08);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.customer-not-found-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Product Live Search Dropdown Slim Rows ────────── */
.product-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 105;
  margin-top: 4px;
}

.prod-search-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: .8rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}

.prod-search-row-item:hover,
.prod-search-row-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.prod-search-row-item .prod-title {
  font-weight: 600;
}

.prod-search-row-item .prod-sub {
  font-size: .7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: 6px;
}

.prod-search-row-item .prod-price {
  font-weight: 700;
  color: var(--primary);
  font-size: .82rem;
}

.prod-search-row-item .prod-stock-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 8px;
}



