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

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  /* Primary */
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  
  /* Success */
  --success: #059669;
  --success-light: #34d399;
  --success-bg: #ecfdf5;
  
  /* Danger */
  --danger: #dc2626;
  --danger-light: #f87171;
  --danger-bg: #fef2f2;
  
  /* Warning */
  --warning: #d97706;
  --warning-light: #fbbf24;
  --warning-bg: #fffbeb;
  
  /* Info */
  --info: #0284c7;
  --info-bg: #e0f2fe;
  
  /* Grays */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;
  
  /* Backgrounds */
  --bg-base: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-sidebar: #1e1b4b;
  
  /* Sidebar */
  --sidebar-text: #c7d2fe;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: rgba(255, 255, 255, 0.15);
  
  /* Borders */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  
  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  /* Radius */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: 150ms ease;
  --transition-slow: 300ms ease;
  
  /* Typography */
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  /* Sizing */
  --sidebar-width: 230px;
  --topbar-height: 58px;
}

/* ==========================================================================
   DARK THEME
   ========================================================================== */
[data-theme="dark"] {
  --bg-base: #0c0a1e;
  --bg-surface: #13113a;
  --bg-elevated: #1a1740;
  --bg-sidebar: #0c0a1e;
  
  --border: #2d2a5e;
  --border-strong: #3d3a6e;
  
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

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

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul, ol {
  list-style: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--gray-700);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}

/* ==========================================================================
   LAYOUT SHELL
   ========================================================================== */
.pos-shell {
  display: grid;
  grid-template-rows: var(--topbar-height) 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
}

.pos-body {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  overflow: hidden;
  height: 100%;
  transition: grid-template-columns var(--transition-slow);
}

.pos-body.sidebar-collapsed {
  grid-template-columns: 60px 1fr;
}

.pos-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

.pos-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.pos-content.no-pad {
  padding: 0;
  overflow: hidden;
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.pos-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  z-index: 100;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-center {
  flex: 1;
  justify-content: center;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
}

.topbar-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.topbar-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.topbar-view-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-cashier-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.cashier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.cashier-dot.open { background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.cashier-dot.closed { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-bg); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-full);
  transition: background var(--transition);
}

.topbar-user:hover {
  background: var(--bg-elevated);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: none;
}
@media (min-width: 640px) {
  .topbar-user-name { display: block; }
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   ========================================================================== */
.pos-sidebar {
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-slow);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-content {
  flex: 1;
  padding: 16px 0;
}

.nav-section {
  margin-bottom: 16px;
}

.nav-section-label {
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  padding: 16px 16px 6px;
  white-space: nowrap;
}

.pos-body.sidebar-collapsed .nav-section-label {
  display: none;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  position: relative;
  white-space: nowrap;
}

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

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  border-left-color: var(--primary-light);
  font-weight: 600;
}

.nav-icon {
  font-size: 20px;
  margin-right: 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.pos-body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
}
.pos-body.sidebar-collapsed .nav-icon {
  margin-right: 0;
  font-size: 22px;
}
.pos-body.sidebar-collapsed .nav-text {
  display: none;
}
.pos-body.sidebar-collapsed .nav-badge {
  position: absolute;
  top: 6px;
  right: 12px;
}

.nav-text {
  flex: 1;
  text-align: left;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  padding: 0 4px;
  margin-left: 8px;
}

.nav-badge-warn {
  background: var(--warning);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  white-space: nowrap;
}

.pos-body.sidebar-collapsed .sidebar-footer {
  padding: 16px 8px;
  font-size: 9px;
}

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

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

/* Variants */
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #047857;
}

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

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

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

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-elevated);
}

/* Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 800;
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 4px; }
.btn-icon.btn-lg { width: 44px; height: 44px; padding: 10px; }

.btn-full {
  width: 100%;
}

.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.form-control:disabled {
  background: var(--bg-base);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-row.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.input-group {
  display: flex;
  align-items: stretch;
}

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

.input-group .form-control:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group .form-control:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-addon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
}

.input-addon:first-child {
  border-right: none;
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.input-addon:last-child {
  border-left: none;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.search-input-wrap {
  position: relative;
  width: 100%;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap .form-control {
  padding-left: 36px;
}

/* Switch Toggle */
.form-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.form-switch input[type=checkbox] {
  display: none;
}
.switch-slider {
  width: 44px;
  height: 24px;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition);
}
.switch-slider::after {
  content: '';
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.form-switch input:checked + .switch-slider {
  background: var(--primary);
}
.form-switch input:checked + .switch-slider::after {
  transform: translateX(20px);
}

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

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

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

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

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-bg), white);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.03);
}

.table-empty {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
.table-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--border-strong);
}
.table-empty p {
  font-size: 14px;
}

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ==========================================================================
   POS SALE SCREEN (CRITICAL LAYOUT)
   ========================================================================== */
.pos-sale-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
}

/* LEFT - Products panel */
.pos-products-panel {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-products-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.pos-category-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  background: var(--bg-surface);
  scrollbar-width: none;
}
.pos-category-tabs::-webkit-scrollbar { display: none; }

.pos-cat-tab {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  background: transparent;
  color: var(--text-secondary);
}

.pos-cat-tab.active, .pos-cat-tab:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.pos-product-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  align-content: start;
}

.product-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  position: relative;
  user-select: none;
}

.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
  transform: translateY(-1px);
}

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

.product-card.out-of-stock {
  opacity: 0.45;
  cursor: not-allowed;
}
.product-card.out-of-stock:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.product-card-img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.product-card-emoji {
  font-size: 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.product-card-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
}

.product-card-stock {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.9);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* CENTER - Cart panel */
.pos-cart-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
}

.pos-cart-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.pos-cart-body {
  flex: 1;
  overflow-y: auto;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cart-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.cart-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cart-table tbody tr:hover {
  background: var(--bg-elevated);
}

.cart-qty-input {
  width: 60px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 4px 6px;
  font-size: 13px;
  background: var(--bg-surface);
}

.cart-disc-input {
  width: 70px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 4px 6px;
  font-size: 12px;
  background: var(--bg-surface);
}

.cart-remove-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
}
.cart-remove-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.pos-cart-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

/* RIGHT - Payment panel */
.pos-payment-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}

.pos-totals-section {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.totals-row.total-final {
  padding: 12px 0 8px;
  border-top: 2px solid var(--border-strong);
  margin-top: 8px;
}

.totals-row.total-final .totals-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.totals-row.total-final .totals-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-mono);
}

.pos-payment-section {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.payment-method-btn {
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.payment-method-btn .pm-icon {
  font-size: 20px;
}
.payment-method-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.payment-method-btn.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

.change-display {
  background: var(--success-bg);
  border: 1px solid var(--success-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.btn-checkout {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--success), #047857);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.btn-checkout:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

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

.btn-checkout:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  width: 100%;
  animation: modalIn 0.2s ease;
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 980px; }

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover {
  color: var(--text-primary);
}

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

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-left: 4px solid;
  animation: slideInRight 0.25s ease;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

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

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

.toast-message {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

.toast.hiding {
  opacity: 0;
}

/* ==========================================================================
   BADGES
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

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

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ==========================================================================
   SETUP WIZARD
   ========================================================================== */
.wizard-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wizard-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 760px;
  overflow: hidden;
}

.wizard-brand {
  background: linear-gradient(135deg, #1e1b4b, #4338ca);
  color: white;
  padding: 32px;
  text-align: center;
}

.wizard-brand-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.wizard-brand h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}

.wizard-brand p {
  opacity: 0.75;
  font-size: 15px;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 32px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.wizard-step.active {
  color: var(--primary);
}
.wizard-step.done {
  color: var(--success);
}

.wizard-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-500);
  transition: all var(--transition-slow);
}

.wizard-step.active .wizard-step-circle {
  background: var(--primary);
  color: white;
}
.wizard-step.done .wizard-step-circle {
  background: var(--success);
  color: white;
}

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  margin: 0 8px;
  margin-bottom: 24px;
}

.wizard-step.done + .wizard-step-line {
  background: var(--success);
}

.wizard-content {
  padding: 32px;
  max-height: 50vh;
  overflow-y: auto;
}

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-actions {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
}

.wizard-done {
  text-align: center;
  padding: 20px 0;
}

.wizard-done-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
}

.wizard-summary {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 16px;
  text-align: left;
  border: 1px solid var(--border);
}

/* ==========================================================================
   BIZ TYPE GRID
   ========================================================================== */
.biz-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.biz-type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-surface);
}

.biz-type-card:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.biz-type-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.biz-type-card-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.biz-type-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: rgba(255,255,255,0.98);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 4px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  transition: all var(--transition);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.2);
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  animation: shake 0.4s ease;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.pin-btn {
  height: 56px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
}

.pin-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.pin-btn:active {
  transform: scale(0.95);
}

.pin-btn-clear {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-light);
  font-size: 16px;
}

.pin-btn-enter {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
  font-size: 16px;
}

.pin-btn-enter:hover {
  background: var(--primary-dark);
  color: white;
}

.login-users {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-user-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

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

.login-user-item.selected {
  background: var(--primary-bg);
}

.login-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  border: 2px solid transparent;
}

.login-user-item.selected .login-user-avatar {
  border-color: var(--primary);
}

.login-user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ==========================================================================
   RECEIPT
   ========================================================================== */
.receipt {
  font-family: var(--font-mono);
  font-size: 12px;
  width: 300px;
  margin: 0 auto;
  padding: 16px;
  background: white;
  color: #000;
}

.receipt-header {
  text-align: center;
  margin-bottom: 10px;
}

.receipt-divider {
  border-top: 1px dashed #666;
  margin: 8px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.receipt-total {
  font-size: 16px;
  font-weight: bold;
}

.receipt-footer {
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

@media print {
  body > *:not(#print-area) {
    display: none !important;
  }
  #print-area {
    display: block !important;
  }
  .receipt {
    width: 100%;
    margin: 0;
    padding: 0;
  }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

/* Gaps */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }

/* Sizing */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-w-0 { min-width: 0; }

/* Padding */
.p-1 { padding: 4px; } .px-1 { padding-left: 4px; padding-right: 4px; } .py-1 { padding-top: 4px; padding-bottom: 4px; }
.p-2 { padding: 8px; } .px-2 { padding-left: 8px; padding-right: 8px; } .py-2 { padding-top: 8px; padding-bottom: 8px; }
.p-3 { padding: 12px; } .px-3 { padding-left: 12px; padding-right: 12px; } .py-3 { padding-top: 12px; padding-bottom: 12px; }
.p-4 { padding: 16px; } .px-4 { padding-left: 16px; padding-right: 16px; } .py-4 { padding-top: 16px; padding-bottom: 16px; }
.p-5 { padding: 20px; } .px-5 { padding-left: 20px; padding-right: 20px; } .py-5 { padding-top: 20px; padding-bottom: 20px; }
.p-6 { padding: 24px; } .px-6 { padding-left: 24px; padding-right: 24px; } .py-6 { padding-top: 24px; padding-bottom: 24px; }

/* Margins */
.mt-1 { margin-top: 4px; } .mb-1 { margin-bottom: 4px; }
.mt-2 { margin-top: 8px; } .mb-2 { margin-bottom: 8px; }
.mt-3 { margin-top: 12px; } .mb-3 { margin-bottom: 12px; }
.mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 16px; }
.mt-5 { margin-top: 20px; } .mb-5 { margin-bottom: 20px; }
.mt-6 { margin-top: 24px; } .mb-6 { margin-bottom: 24px; }
.mt-8 { margin-top: 32px; } .mb-8 { margin-bottom: 32px; }

/* Typography */
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-inverse { color: var(--text-inverse); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.font-mono { font-family: var(--font-mono); }

/* Borders & Display */
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: var(--radius-full); }
.divider { border-top: 1px solid var(--border); margin: 16px 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; color: var(--text-muted); }

.cursor-pointer { cursor: pointer; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky-top { position: sticky; top: 0; z-index: 10; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1200px) {
  .pos-sale-layout {
    grid-template-columns: 240px 1fr 300px;
  }
  :root {
    --sidebar-width: 200px;
  }
}

@media (max-width: 960px) {
  .pos-body {
    grid-template-columns: 1fr;
  }
  .pos-sidebar {
    position: fixed;
    left: -100%;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    width: 260px;
    z-index: 200;
    transition: left var(--transition-slow);
  }
  .pos-sidebar.mobile-open {
    left: 0;
    box-shadow: var(--shadow-xl);
  }
  .pos-sale-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .biz-type-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════
   FACILISIMO POS - MODO MOBILE "PALMA DE TU MANO"
   ══════════════════════════════════════════════════════════════ */

/* ── Toggle chip en topbar ───────────────────────────────────── */
.mode-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}
.mode-toggle-btn {
  padding: 4px 10px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,0.35);
}

/* ── MOBILE POS LAYOUT ───────────────────────────────────────── */
.mobile-pos-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
  overflow: hidden;
  position: relative;
}

/* Top search bar */
.mobile-pos-search {
  padding: 10px 12px 6px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}
.mobile-pos-search input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-sans, 'Inter', sans-serif);
}
.mobile-pos-search input:focus { outline: none; border-color: var(--primary); }

/* Category pills */
.mobile-cat-pills {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.mobile-cat-pills::-webkit-scrollbar { display: none; }
.mobile-cat-pill {
  padding: 5px 14px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans, 'Inter', sans-serif);
}
.mobile-cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Product grid */
.mobile-product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 80px; /* space for FAB */
}
@media (min-width: 480px) {
  .mobile-product-grid { grid-template-columns: repeat(4, 1fr); }
}

.mobile-product-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mobile-product-card:active {
  transform: scale(0.94);
  background: var(--primary-bg);
  border-color: var(--primary);
}
.mobile-product-card.out-of-stock {
  opacity: 0.45;
  pointer-events: none;
}
.mobile-product-card-img {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 6px;
  background: var(--bg-elevated);
}
.mobile-product-card-emoji {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 6px;
}
.mobile-product-card-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mobile-product-card-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.mobile-product-card-stock {
  position: absolute;
  top: 5px; right: 5px;
  font-size: 9px;
  font-weight: 700;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 99px;
  padding: 1px 5px;
}
.mobile-product-card-stock.low {
  background: var(--warning-bg);
  color: var(--warning);
}
.mobile-product-card-qty-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-surface);
}

/* ── CART DRAWER (bottom sheet) ──────────────────────────────── */
.mobile-cart-drawer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  z-index: 200;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.mobile-cart-drawer.open {
  transform: translateY(0);
}
.mobile-cart-handle {
  width: 40px; height: 4px;
  background: var(--border-strong);
  border-radius: 99px;
  margin: 10px auto 0;
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-cart-title {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
}
.mobile-cart-count {
  background: var(--primary);
  color: #fff;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.mobile-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.mobile-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.mobile-cart-item-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.mobile-cart-item-price {
  font-size: 12px;
  color: var(--text-muted);
}
.mobile-qty-ctrl {
  display: flex; align-items: center; gap: 6px;
}
.mobile-qty-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-qty-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mobile-qty-btn.remove { border-color: var(--danger-light); color: var(--danger); }
.mobile-qty-num {
  font-size: 14px; font-weight: 700;
  min-width: 24px; text-align: center;
  color: var(--text-primary);
}

/* Totals + pay button */
.mobile-cart-totals {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.mobile-totals-row {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 4px;
}
.mobile-totals-row.total {
  font-size: 20px; font-weight: 800;
  color: var(--text-primary);
  margin: 8px 0;
}
.mobile-pay-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #1a56db, #4f46e5);
  color: #fff;
  font-size: 17px; font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 24px rgba(79,70,229,0.4);
  transition: all 0.15s;
  font-family: var(--font-sans, 'Inter', sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.mobile-pay-btn:active { transform: scale(0.97); box-shadow: 0 3px 12px rgba(79,70,229,0.3); }
.mobile-pay-btn:disabled { opacity: 0.5; pointer-events: none; }

/* ── FLOATING ACTION BUTTON (cart) ───────────────────────────── */
.mobile-fab {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1a56db, #4f46e5);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 14px 28px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(79,70,229,0.45);
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
  z-index: 100;
  font-family: var(--font-sans, 'Inter', sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.mobile-fab:active { transform: translateX(-50%) scale(0.96); }
.mobile-fab.hidden { opacity: 0; pointer-events: none; }
.mobile-fab-count {
  background: rgba(255,255,255,0.25);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 13px;
}
.mobile-fab-total {
  font-size: 15px;
  font-weight: 800;
}

/* ── PAYMENT BOTTOM SHEET ───────────────────────────────────── */
.mobile-payment-sheet {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.mobile-payment-sheet.open { transform: translateX(0); }
.mobile-payment-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.mobile-payment-back {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-payment-title {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.mobile-payment-body {
  flex: 1; overflow-y: auto; padding: 16px;
}
.mobile-total-display {
  text-align: center;
  padding: 20px 0;
}
.mobile-total-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.mobile-total-amount {
  font-size: 44px; font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.mobile-method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.mobile-method-btn {
  padding: 14px 10px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-sans, 'Inter', sans-serif);
}
.mobile-method-btn.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.mobile-method-btn:active { transform: scale(0.96); }
.mobile-method-icon { font-size: 24px; }
.mobile-method-name { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-align: center; }
.mobile-method-btn.selected .mobile-method-name { color: var(--primary); }

/* Numpad for cash */
.mobile-numpad-wrap { margin-top: 8px; }
.mobile-numpad-display {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: right;
  font-size: 28px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.mobile-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mobile-numpad-key {
  padding: 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  font-size: 20px; font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.1s;
  font-family: var(--font-sans, 'Inter', sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.mobile-numpad-key:active { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(0.95); }
.mobile-numpad-key.del { font-size: 18px; }
.mobile-numpad-key.exact { background: var(--success-bg); color: var(--success); border-color: var(--success-light); font-size: 13px; font-weight: 700; }
.mobile-numpad-key.exact:active { background: var(--success); color: #fff; }

.mobile-change-box {
  background: var(--success-bg);
  border: 1.5px solid var(--success-light);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
  margin-top: 10px;
}
.mobile-change-label { font-size: 12px; color: var(--success); font-weight: 600; }
.mobile-change-amount { font-size: 28px; font-weight: 800; color: var(--success); }

.mobile-pay-confirm-btn {
  width: 100%;
  padding: 18px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #057a55, #059669);
  color: #fff;
  font-size: 18px; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(5,122,85,0.4);
  transition: all 0.15s;
  margin-top: 12px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.mobile-pay-confirm-btn:active { transform: scale(0.97); }
.mobile-pay-confirm-btn:disabled { opacity: 0.5; pointer-events: none; }

/* ── SUCCESS ANIMATION ───────────────────────────────────────── */
.mobile-success-overlay {
  position: absolute; inset: 0;
  background: var(--bg-surface);
  z-index: 500;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 24px;
  animation: mobileSuccessIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes mobileSuccessIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}
.mobile-success-icon {
  font-size: 72px;
  animation: mobileSuccessPop 0.5s 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes mobileSuccessPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.mobile-success-title { font-size: 26px; font-weight: 800; color: var(--success); margin: 12px 0 4px; }
.mobile-success-total { font-size: 44px; font-weight: 800; color: var(--text-primary); margin: 4px 0; }
.mobile-success-change { font-size: 16px; color: var(--text-muted); margin-bottom: 24px; }
.mobile-success-new-btn {
  width: 100%; max-width: 300px;
  padding: 16px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, #1a56db, #4f46e5);
  color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(79,70,229,0.4);
  font-family: var(--font-sans, 'Inter', sans-serif);
}

/* ── Responsive: on desktop show toggle, on mobile auto-mobile ─ */
@media (max-width: 640px) {
  /* Force hide sidebar on mobile */
  .pos-sidebar { display: none !important; }
  .pos-body { grid-template-columns: 1fr !important; }
}
