/* =============================================
   PayGfad POS - Styles v4.0
   Professional POS & Stock Management System
   MOBILE-FIRST Responsive Architecture
   ============================================= */

/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
  --primary: #e67e22;
  --primary-dark: #d35400;
  --primary-light: #f39c12;
  --primary-bg: #fef5ec;
  --primary-glow: rgba(230, 126, 34, 0.25);
  --secondary: #1a1a2e;
  --secondary-light: #16213e;
  --secondary-mid: #0f3460;
  --success: #27ae60;
  --success-bg: #eafaf1;
  --danger: #e74c3c;
  --danger-bg: #fdedec;
  --warning: #f39c12;
  --warning-bg: #fef9e7;
  --info: #3498db;
  --info-bg: #ebf5fb;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #ced4da;
  --gray-400: #adb5bd;
  --gray-500: #6c757d;
  --gray-600: #495057;
  --gray-700: #343a40;
  --gray-800: #212529;
  --gray-900: #0d1117;
  --sidebar-width: 260px;
  --header-height: 56px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 6px 10px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.15), 0 8px 16px rgba(0,0,0,0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-top: env(safe-area-inset-top, 0px);
}

/* =============================================
   RESET & BASE (Mobile-First)
   ============================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Body scroll lock when sidebar/cart is open on mobile */
body.sidebar-open,
body.cart-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

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

::selection {
  background: var(--primary-glow);
  color: var(--primary-dark);
}

img { max-width: 100%; height: auto; display: block; }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 70%, #1a1a2e 100%);
  position: relative;
  overflow: hidden;
  padding: 1rem;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 126, 34, 0.15) 0%, transparent 70%);
  top: -200px;
  right: -100px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 152, 219, 0.1) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.97);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: cardAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.8);
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 24px rgba(230, 126, 34, 0.35);
  animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(230, 126, 34, 0.35); }
  50% { box-shadow: 0 8px 32px rgba(230, 126, 34, 0.5); }
}

.login-logo i { color: white; font-size: 28px; }
.login-logo svg { color: white; width: 28px; height: 28px; }

.login-card h1 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
  letter-spacing: -0.025em;
}

.login-card p.subtitle {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
}

.login-card .form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}

.login-card .form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-left: 2.5rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 48px;
  -webkit-appearance: none;
}

.login-card .form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.login-card .input-icon {
  position: relative;
}

.login-card .input-icon i,
.login-card .input-icon svg {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
  transition: var(--transition);
  z-index: 1;
}

.login-card .input-icon:focus-within i,
.login-card .input-icon:focus-within svg {
  color: var(--primary);
}

.login-card .btn-login {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(230, 126, 34, 0.4);
  margin-top: 1.25rem;
  min-height: 52px;
}

.login-card .btn-login:active {
  transform: scale(0.97);
}

.login-card .btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-footer {
  text-align: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
  color: var(--gray-400);
  font-size: 0.6875rem;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group { margin-bottom: 0.875rem; }

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: var(--transition);
  background: white;
  color: var(--gray-800);
  min-height: 44px;
  -webkit-appearance: none;
}

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

.form-control::placeholder { color: var(--gray-400); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.form-control-sm { padding: 0.375rem 0.625rem; font-size: 0.8125rem; min-height: 36px; }

.form-control-lg { padding: 0.75rem 1rem; font-size: 1rem; min-height: 48px; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.btn-primary:active { box-shadow: 0 2px 8px var(--primary-glow); }

.btn-success { background: var(--success); color: white; }
.btn-success:active { background: #219a52; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:active { background: #c0392b; }

.btn-info { background: var(--info); color: white; }
.btn-info:active { background: #2980b9; }

.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:active { background: var(--gray-300); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:active { background: var(--gray-50); border-color: var(--gray-400); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; min-height: 36px; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-xl { padding: 1rem 2.25rem; font-size: 1.125rem; font-weight: 700; }

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

.btn-block { width: 100%; }

/* =============================================
   LAYOUT (Mobile-First: sidebar hidden)
   ============================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Sidebar Overlay (mobile only) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: none;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active {
  display: block;
}

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

/* Sidebar (Mobile: hidden, slides in) */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  overflow: hidden;
  touch-action: pan-y;
  /* Mobile-first: hidden off-screen */
  transform: translateX(-100%);
  will-change: transform;
}

.sidebar.open {
  transform: translateX(0);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

.sidebar-logo i { font-size: 17px; color: white; }
.sidebar-logo svg { width: 17px; height: 17px; color: white; }

.sidebar-brand h2 { font-size: 1rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.sidebar-brand span { font-size: 0.625rem; color: rgba(255,255,255,0.45); font-weight: 500; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

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

.nav-section {
  padding: 0.875rem 1.25rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  margin: 1px 0;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(230, 126, 34, 0.15) 0%, rgba(230, 126, 34, 0.05) 100%);
  color: var(--primary-light);
  border-left-color: var(--primary);
}

.nav-item i { width: 20px; text-align: center; font-size: 0.9375rem; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition-fast);
  min-height: 44px;
}

.sidebar-user:active { background: rgba(255,255,255,0.08); }

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: white;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.625rem; color: rgba(255,255,255,0.4); text-transform: capitalize; }

/* Main content (Mobile: full width, no sidebar margin) */
.main-content {
  flex: 1;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top header (Mobile) */
.top-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  padding-top: var(--safe-area-top);
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.top-header-left h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.shop-badge {
  display: none;
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Menu toggle button - visible on mobile */
#menu-toggle {
  display: flex;
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--gray-600);
  font-size: 1.125rem;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

#menu-toggle:active {
  background: var(--gray-50);
  border-color: var(--primary);
  color: var(--primary);
}

/* Hide "Deconnexion" text on mobile */
.btn-text-desktop {
  display: none;
}

.top-header-right .btn {
  min-height: 40px;
  min-width: 40px;
  padding: 0.5rem;
}

/* Content area (Mobile) */
.content-area {
  flex: 1;
  padding: 0.75rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  transition: var(--transition-fast);
}

.card-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

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

/* =============================================
   KPI CARDS (Mobile: 2x2 grid)
   ============================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 0.875rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  opacity: 0.05;
  transform: translate(15px, -15px);
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.125rem;
}
.kpi-icon svg { width: 1.125rem; height: 1.125rem; }

.kpi-icon.amber { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #d97706; }
.kpi-icon.green { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); color: #059669; }
.kpi-icon.blue { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #2563eb; }
.kpi-icon.red { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #dc2626; }
.kpi-icon.purple { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); color: #7c3aed; }

.kpi-info { min-width: 0; }
.kpi-info h4 { font-size: 0.6875rem; color: var(--gray-500); font-weight: 500; line-height: 1.3; }
.kpi-value { font-size: 1.25rem; font-weight: 800; color: var(--gray-900); line-height: 1.2; letter-spacing: -0.02em; }
.kpi-change { font-size: 0.6875rem; font-weight: 600; }
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }

/* =============================================
   TABLES (Mobile: horizontally scrollable)
   ============================================= */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.5rem;
  padding: 0 0.25rem;
}

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

thead { background: var(--gray-50); }

th {
  padding: 0.625rem 0.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tbody tr { transition: var(--transition-fast); }
tbody tr:active { background: var(--primary-bg); }
tbody tr:last-child td { border-bottom: none; }

/* =============================================
   BADGES / TAGS
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 0.375rem;
}

.badge-dot.badge-success::before { background: var(--success); }
.badge-dot.badge-danger::before { background: var(--danger); }
.badge-dot.badge-warning::before { background: var(--warning); }

/* =============================================
   MODAL (Mobile: slides up from bottom)
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
  animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
}

.modal {
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}

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

.modal-sm,
.modal-md,
.modal-lg,
.modal-xl {
  max-width: 100%;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

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

.modal-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:active { background: var(--danger-bg); color: var(--danger); }

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  padding-bottom: calc(0.75rem + var(--safe-area-bottom));
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: white;
}

.modal-footer .btn {
  flex: 1;
  min-width: 100px;
}

/* =============================================
   POS LAYOUT (Mobile: single column, cart overlay)
   ============================================= */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  height: calc(100vh - var(--header-height) - 1.5rem);
  height: calc(100dvh - var(--header-height) - 1.5rem);
  position: relative;
}

.pos-products {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: 100%;
}

.pos-search {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pos-search input {
  flex: 1;
  padding: 0.625rem 1rem 0.625rem 2.25rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23adb5bd' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 0.75rem center;
  transition: var(--transition);
  min-height: 48px;
}

.pos-search input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: white;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.pos-categories {
  padding: 0.375rem 0.75rem;
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--gray-100);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  flex-shrink: 0;
}

.pos-categories::-webkit-scrollbar { height: 0; }

.cat-pill {
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: 1.5px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  transition: var(--transition-fast);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.cat-pill:active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.cat-pill.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.pos-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.625rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

.pos-product-card {
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 0.625rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: white;
  position: relative;
  min-height: 110px;
  -webkit-tap-highlight-color: transparent;
}

.pos-product-card:active {
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
  transform: scale(0.97);
}

.pos-product-card.out-of-stock {
  opacity: 0.5;
  cursor: not-allowed;
}

.pos-product-card.out-of-stock:active {
  transform: none;
  box-shadow: none;
  border-color: var(--gray-100);
}

.pos-product-img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.375rem;
  color: var(--gray-400);
  font-size: 1.125rem;
  overflow: hidden;
}
.pos-product-img svg { width: 1.125rem; height: 1.125rem; }
.pos-product-img img { width: 100%; height: 100%; object-fit: cover; }

.pos-product-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.3;
  margin-bottom: 0.125rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pos-product-desc {
  font-size: 0.625rem;
  color: var(--gray-400);
  line-height: 1.3;
  margin-bottom: 0.125rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pos-product-price {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.pos-product-stock {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  font-size: 0.5625rem;
  padding: 0.0625rem 0.3125rem;
  border-radius: 6px;
  font-weight: 600;
}

.pos-product-stock.ok { background: #d1fae5; color: #065f46; }
.pos-product-stock.low { background: #fef3c7; color: #92400e; }
.pos-product-stock.out { background: #fee2e2; color: #991b1b; }

/* =============================================
   CART (Mobile: slides up from bottom as overlay)
   ============================================= */
.pos-cart {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 75vh;
  height: 75dvh;
  z-index: 45;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  flex-direction: column;
  background: white;
  overflow: hidden;
}

.pos-cart.open {
  display: flex;
  animation: slideCartUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideCartUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.cart-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  flex-shrink: 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.cart-header h3 { font-size: 0.9375rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.cart-header .cart-count { background: var(--primary); padding: 0.0625rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }

.cart-customer-bar {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.375rem 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.cart-item {
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--gray-50);
  transition: var(--transition-fast);
  min-height: 56px;
}

.cart-item:active { background: var(--gray-50); }

.cart-item-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.75rem;
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-thumb svg { width: 0.875rem; height: 0.875rem; }

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.8125rem; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 0.6875rem; color: var(--gray-500); }

.cart-qty {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.cart-qty button {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-600);
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.cart-qty button:active { border-color: var(--primary); color: var(--primary); }

.cart-qty span { min-width: 24px; text-align: center; font-weight: 700; font-size: 0.875rem; }

.cart-item-total { font-weight: 700; font-size: 0.8125rem; color: var(--gray-800); min-width: 60px; text-align: right; }

.cart-item-remove {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--danger-bg);
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.cart-item-remove:active { background: var(--danger); color: white; }

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  padding: 1.5rem;
}

.cart-empty i { font-size: 2.5rem; margin-bottom: 0.75rem; }
.cart-empty svg { width: 2.5rem; height: 2.5rem; margin-bottom: 0.75rem; }
.cart-empty p { font-size: 0.8125rem; }

.cart-summary {
  border-top: 1px solid var(--gray-200);
  padding: 0.625rem 0.75rem;
  background: var(--gray-50);
  flex-shrink: 0;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.8125rem;
}

.cart-summary-row.total {
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--gray-900);
  border-top: 2px solid var(--gray-300);
  padding-top: 0.375rem;
  margin-top: 0.375rem;
}

.cart-payment {
  padding: 0.625rem 0.75rem;
  padding-bottom: calc(0.625rem + var(--safe-area-bottom));
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.payment-method {
  padding: 0.625rem 0.375rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.6875rem;
  font-weight: 500;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.payment-method i { display: block; font-size: 1rem; margin-bottom: 0.125rem; }
.payment-method svg { display: block; width: 1rem; height: 1rem; margin: 0 auto 0.125rem; }
.payment-method:active { border-color: var(--primary); }
.payment-method.active { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-dark); box-shadow: 0 2px 8px var(--primary-glow); }

.cart-amount-paid { margin-bottom: 0.5rem; }
.cart-change {
  font-size: 0.8125rem;
  color: var(--success);
  font-weight: 600;
  text-align: center;
  padding: 0.25rem;
}

.btn-checkout {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px var(--primary-glow);
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
}

.btn-checkout:active { transform: scale(0.97); }
.btn-checkout:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none; }

/* Cart close button (Mobile only) */
.cart-close-btn {
  display: flex;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.cart-close-btn:active { background: rgba(255, 255, 255, 0.25); }

/* =============================================
   MOBILE CART TOGGLE BUTTON
   ============================================= */
.mobile-cart-toggle {
  display: flex;
  position: fixed;
  bottom: calc(0.75rem + var(--safe-area-bottom));
  right: 0.75rem;
  z-index: 25;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(230, 126, 34, 0.5);
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.mobile-cart-toggle:active {
  transform: scale(0.95);
}

.mobile-cart-toggle .cart-badge {
  background: white;
  color: var(--primary-dark);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* =============================================
   RECEIPT
   ============================================= */
.receipt {
  max-width: 320px;
  margin: 0 auto;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
}

.receipt-header { text-align: center; margin-bottom: 0.75rem; border-bottom: 1px dashed var(--gray-300); padding-bottom: 0.75rem; }
.receipt-header h3 { font-size: 1rem; }
.receipt-items { border-bottom: 1px dashed var(--gray-300); padding-bottom: 0.625rem; margin-bottom: 0.625rem; }
.receipt-item { display: flex; justify-content: space-between; margin-bottom: 0.25rem; font-size: 0.75rem; }
.receipt-total { font-weight: 700; font-size: 1rem; text-align: right; margin-top: 0.5rem; }

/* =============================================
   TOAST / NOTIFICATIONS
   ============================================= */
.toast-container {
  position: fixed;
  top: auto;
  bottom: calc(5rem + var(--safe-area-bottom));
  right: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: none;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  animation: toastSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
  pointer-events: all;
}

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

.toast-success { background: linear-gradient(135deg, #065f46 0%, #047857 100%); color: white; }
.toast-error { background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%); color: white; }
.toast-warning { background: linear-gradient(135deg, #92400e 0%, #b45309 100%); color: white; }
.toast-info { background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%); color: white; }

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  font-size: 1rem;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:active { opacity: 1; }

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}

.pagination button {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: var(--transition-fast);
  min-height: 36px;
  min-width: 36px;
}

.pagination button:active { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

.pagination-info { font-size: 0.8125rem; color: var(--gray-500); margin: 0 0.5rem; }

/* =============================================
   FILTERS / TOOLBAR
   ============================================= */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  justify-content: flex-end;
}

.search-box {
  position: relative;
  min-width: 0;
  flex: 1;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
  min-height: 44px;
}

.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.search-box i { position: absolute; left: 0.625rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 0.875rem; }
.search-box svg { position: absolute; left: 0.625rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); width: 0.875rem; height: 0.875rem; }

/* =============================================
   STOCK INDICATORS
   ============================================= */
.stock-bar {
  width: 50px;
  height: 5px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.stock-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.stock-bar-fill.green { background: var(--success); }
.stock-bar-fill.yellow { background: var(--warning); }
.stock-bar-fill.red { background: var(--danger); }

/* =============================================
   CHARTS
   ============================================= */
.chart-container { position: relative; width: 100%; max-height: 250px; }

/* =============================================
   GRID LAYOUTS (Mobile: single column)
   ============================================= */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }

/* =============================================
   TABS
   ============================================= */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { height: 0; }

.tab {
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.tab:active { color: var(--gray-700); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
}

.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state svg { width: 2.5rem; height: 2.5rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1rem; color: var(--gray-600); margin-bottom: 0.375rem; }
.empty-state p { font-size: 0.8125rem; margin-bottom: 1rem; }

/* =============================================
   LOADING
   ============================================= */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0.625rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* =============================================
   PRODUCT IMAGE THUMBNAIL
   ============================================= */
.product-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.875rem;
  overflow: hidden;
  flex-shrink: 0;
}

.product-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* =============================================
   IMAGE UPLOAD
   ============================================= */
.image-upload {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-400);
  overflow: hidden;
  position: relative;
}

.image-upload:active { border-color: var(--primary); color: var(--primary); }
.image-upload i { font-size: 1.25rem; margin-bottom: 0.25rem; }
.image-upload svg { width: 1.25rem; height: 1.25rem; margin-bottom: 0.25rem; }
.image-upload span { font-size: 0.625rem; }

.image-upload img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =============================================
   UTILITY CLASSES
   ============================================= */
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.6875rem; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============================================
   CREDIT MODULE SPECIFIC
   ============================================= */
.credit-summary-card {
  padding: 0.75rem;
  border-radius: var(--radius);
  text-align: center;
  flex: 1;
  min-width: 120px;
}

.credit-summary-card .credit-label {
  font-size: 0.6875rem;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.credit-summary-card .credit-value {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}

.credit-transaction-list {
  max-height: 250px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.credit-customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  gap: 0.5rem;
}

.credit-customer-row:active {
  background: var(--gray-50);
}

/* =============================================
   VENDOR CARD
   ============================================= */
.vendor-card {
  text-align: center;
  padding: 1.25rem 1rem;
}

.vendor-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: white;
  margin: 0 auto 0.625rem;
}

/* =============================================
   CATEGORY CARD
   ============================================= */
.category-card-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  font-size: 1.125rem;
  flex-shrink: 0;
}

/* =============================================
   CUSTOMER CARD (mobile alternative to table)
   ============================================= */
.customer-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.customer-card:last-child {
  border-bottom: none;
}

.customer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--info) 0%, #2980b9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  color: white;
  flex-shrink: 0;
}

.customer-card-info {
  flex: 1;
  min-width: 0;
}

.customer-card-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* =============================================
   EXPENSE CARD (mobile alternative to table)
   ============================================= */
.expense-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  gap: 0.5rem;
}

.expense-card:last-child {
  border-bottom: none;
}

.expense-card-info {
  flex: 1;
  min-width: 0;
}

.expense-card-amount {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--danger);
  white-space: nowrap;
}

/* =============================================
   VENDOR DASHBOARD
   ============================================= */
.vendor-open-register-btn {
  width: 100%;
  max-width: 400px;
  display: block;
  margin: 0 auto;
}

/* =============================================
   RESPONSIVE: SMALL MOBILE (max-width: 374px)
   ============================================= */
@media (max-width: 374px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .kpi-card {
    padding: 0.625rem;
    gap: 0.5rem;
  }

  .kpi-value {
    font-size: 1.0625rem;
  }

  .kpi-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .kpi-icon svg { width: 1rem; height: 1rem; }

  .pos-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.375rem;
  }

  .pos-product-card {
    padding: 0.5rem;
    min-height: 95px;
  }

  .pos-product-img {
    width: 40px;
    height: 40px;
  }

  .pos-product-name {
    font-size: 0.6875rem;
  }

  .pos-product-price {
    font-size: 0.8125rem;
  }

  .top-header-left h1 {
    font-size: 0.875rem;
    max-width: 100px;
  }

  .content-area {
    padding: 0.5rem;
  }

  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================
   RESPONSIVE: TABLET (min-width: 480px)
   ============================================= */
@media (min-width: 480px) {
  .payment-methods {
    grid-template-columns: repeat(4, 1fr);
  }

  .kpi-grid {
    gap: 0.75rem;
  }

  .kpi-value {
    font-size: 1.375rem;
  }

  .kpi-icon {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
  }
}

/* =============================================
   RESPONSIVE: LARGE MOBILE / SMALL TABLET (min-width: 640px)
   ============================================= */
@media (min-width: 640px) {
  :root {
    --header-height: 60px;
  }

  .content-area {
    padding: 1rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-left,
  .toolbar-right {
    width: auto;
  }

  .toolbar-right {
    justify-content: flex-end;
  }

  .search-box {
    min-width: 220px;
  }

  .table-container {
    margin: 0;
    padding: 0;
  }

  .toast-container {
    top: 1rem;
    bottom: auto;
    right: 1rem;
    left: auto;
    max-width: calc(100vw - 2rem);
  }

  .toast {
    max-width: 400px;
    animation-name: toastSlideInDesktop;
  }

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

/* =============================================
   RESPONSIVE: TABLET (min-width: 769px)
   ============================================= */
@media (min-width: 769px) {
  :root {
    --header-height: 64px;
  }

  /* Sidebar always visible */
  .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
  }

  .sidebar-overlay {
    display: none !important;
  }

  /* Hide menu toggle on tablet+ */
  #menu-toggle {
    display: none;
  }

  /* Main content with sidebar margin */
  .main-content {
    margin-left: var(--sidebar-width);
  }

  /* Show shop badge */
  .shop-badge {
    display: inline-flex;
    background: var(--primary-bg);
    color: var(--primary-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
  }

  /* Show logout text */
  .btn-text-desktop {
    display: inline;
  }

  .top-header {
    padding: 0 1.5rem;
  }

  .top-header-left h1 {
    font-size: 1.25rem;
    max-width: none;
  }

  .top-header-right .btn {
    min-height: 44px;
    min-width: auto;
    padding: 0.625rem 1.25rem;
  }

  /* Content area */
  .content-area {
    padding: 1.5rem;
  }

  /* POS Layout: 2 columns */
  .pos-layout {
    grid-template-columns: 1fr 320px;
    gap: 0.75rem;
    height: calc(100vh - var(--header-height) - 3rem);
    height: calc(100dvh - var(--header-height) - 3rem);
  }

  /* Cart: inline, not overlay */
  .pos-cart {
    display: flex !important;
    position: static !important;
    height: auto !important;
    max-height: none !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow) !important;
    animation: none !important;
  }

  /* Hide mobile cart toggle */
  .mobile-cart-toggle {
    display: none !important;
  }

  /* Hide cart close button on desktop */
  .cart-close-btn {
    display: none !important;
  }

  /* Cart items */
  .cart-item {
    padding: 0.75rem 1rem;
  }

  .cart-summary {
    padding: 0.75rem 1rem;
  }

  .cart-payment {
    padding: 0.75rem 1rem;
    padding-bottom: 1rem;
  }

  /* Product grid larger */
  .pos-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .pos-product-card {
    padding: 0.875rem;
    min-height: 120px;
  }

  .pos-product-img {
    width: 56px;
    height: 56px;
  }

  /* Modal: centered on tablet+ */
  .modal-overlay {
    align-items: center;
    padding: 1rem;
  }

  .modal {
    border-radius: var(--radius-lg);
    max-height: 85vh;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .modal-sm { max-width: 420px; }
  .modal-md { max-width: 560px; }
  .modal-lg { max-width: 720px; }
  .modal-xl { max-width: 900px; }

  .modal-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-footer {
    padding: 1rem 1.5rem;
    padding-bottom: 1rem;
  }

  .modal-footer .btn {
    flex: 0;
    min-width: 120px;
  }

  /* Grid layouts tablet */
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Login card bigger */
  .login-card {
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
  }

  .login-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  .login-card h1 {
    font-size: 1.75rem;
  }

  /* Hover effects for pointer devices */
  .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

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

  .nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.9);
  }

  .sidebar-user:hover {
    background: rgba(255,255,255,0.05);
  }

  .pos-product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
    transform: translateY(-3px);
  }

  .kpi-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
  }

  .cat-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .cart-item:hover {
    background: var(--gray-50);
  }

  .cart-qty button:hover {
    border-color: var(--primary);
    color: var(--primary);
  }

  .cart-item-remove:hover {
    background: var(--danger);
    color: white;
  }

  .payment-method:hover {
    border-color: var(--primary);
  }

  .btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.45);
  }

  .btn-primary:hover {
    box-shadow: 0 4px 12px var(--primary-glow);
  }

  .btn-success:hover { background: #219a52; }
  .btn-danger:hover { background: #c0392b; }
  .btn-info:hover { background: #2980b9; }
  .btn-secondary:hover { background: var(--gray-300); }
  .btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

  .modal-close:hover { background: var(--danger-bg); color: var(--danger); }

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

  .image-upload:hover { border-color: var(--primary); color: var(--primary); }

  #menu-toggle:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
  }

  .mobile-cart-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(230, 126, 34, 0.6);
  }

  .login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.5);
  }

  .toast-close:hover { opacity: 1; }
}

/* =============================================
   RESPONSIVE: DESKTOP (min-width: 1025px)
   ============================================= */
@media (min-width: 1025px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }

  .kpi-card {
    padding: 1.25rem;
  }

  .kpi-value {
    font-size: 1.625rem;
  }

  .kpi-icon {
    width: 52px;
    height: 52px;
    font-size: 1.375rem;
    border-radius: 14px;
  }

  .kpi-icon svg { width: 1.375rem; height: 1.375rem; }

  .pos-layout {
    grid-template-columns: 1fr 380px;
    gap: 1rem;
  }

  .pos-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .pos-search input {
    font-size: 0.9375rem;
  }
}

/* =============================================
   RESPONSIVE: LARGE DESKTOP (min-width: 1200px)
   ============================================= */
@media (min-width: 1200px) {
  .pos-layout {
    grid-template-columns: 1fr 400px;
  }

  .pos-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .content-area {
    padding: 2rem;
  }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
  body {
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
  }

  /* Hide everything except receipt */
  .sidebar,
  .sidebar-overlay,
  .top-header,
  .mobile-cart-toggle,
  .toast-container,
  .pos-products,
  .pos-layout > .pos-products,
  .btn,
  .cart-payment,
  .cart-summary,
  .cart-items,
  .cart-header,
  .cart-customer-bar,
  .pos-cart .cart-header,
  .pos-cart .cart-items,
  .pos-cart .cart-summary,
  .pos-cart .cart-payment,
  .mobile-cart-toggle,
  #menu-toggle,
  .pagination,
  .toolbar,
  nav,
  .sidebar-footer {
    display: none !important;
  }

  .app-layout > .main-content > .content-area > *:not(.modal-overlay) {
    display: none !important;
  }

  /* Also show receipt by ID if it's standalone */
  #receipt-content,
  #receipt-content * {
    visibility: visible !important;
  }

  #receipt-content {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
  }

  /* Show the receipt modal */
  .modal-overlay {
    display: flex !important;
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    z-index: auto !important;
    animation: none !important;
  }

  .modal {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    animation: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .modal-header,
  .modal-footer {
    display: none !important;
  }

  .modal-body {
    padding: 0 !important;
  }

  .receipt {
    max-width: 100% !important;
    padding: 0 !important;
    font-size: 12px !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-area {
    padding: 0 !important;
  }
}

/* =============================================
   TOUCH & HOVER IMPROVEMENTS
   ============================================= */

/* Disable hover effects on touch devices */
@media (hover: none) {
  .btn:hover {
    transform: none;
    box-shadow: none;
  }

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

  .kpi-card:hover {
    transform: none;
    box-shadow: var(--shadow);
  }

  .card:hover {
    box-shadow: var(--shadow);
  }

  .btn-checkout:hover {
    transform: none;
  }

  .login-card .btn-login:hover {
    transform: none;
  }

  .mobile-cart-toggle:hover {
    transform: none;
  }

  /* Active/pressed states for touch feedback */
  .pos-product-card:active {
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
    transform: scale(0.97);
  }

  .btn:active {
    transform: scale(0.97);
  }

  .payment-method:active {
    border-color: var(--primary);
    background: var(--primary-bg);
  }

  .cat-pill:active {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-dark);
  }

  .nav-item:active {
    background: rgba(255,255,255,0.08);
  }
}

/* =============================================
   SAFE AREA INSETS (Notched devices)
   ============================================= */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .cart-payment {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }

  .mobile-cart-toggle {
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }

  .modal-footer {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .toast-container {
    bottom: calc(5rem + env(safe-area-inset-bottom));
  }
}

/* =============================================
   LANDSCAPE ORIENTATION (Mobile)
   ============================================= */
@media (max-height: 500px) and (orientation: landscape) {
  .pos-cart {
    height: 85vh;
    height: 85dvh;
  }

  .pos-layout {
    height: calc(100vh - var(--header-height) - 1rem);
    height: calc(100dvh - var(--header-height) - 1rem);
  }

  .login-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
  }

  .login-card {
    padding: 1.25rem;
  }

  .login-card h1 {
    font-size: 1.25rem;
    margin-bottom: 0;
  }

  .login-card p.subtitle {
    margin-bottom: 0.75rem;
  }

  .login-card .form-group {
    margin-bottom: 0.5rem;
  }

  .login-card .btn-login {
    margin-top: 0.5rem;
    min-height: 44px;
  }

  .login-footer {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }

  .kpi-value {
    font-size: 1rem;
  }
}

/* =============================================
   HIGH CONTRAST MODE
   ============================================= */
@media (prefers-contrast: high) {
  .pos-product-card {
    border-width: 2px;
  }

  .btn-outline {
    border-width: 2px;
  }

  .form-control {
    border-width: 2px;
  }

  .badge {
    border: 1px solid currentColor;
  }
}

/* =============================================
   REDUCED MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .sidebar {
    transition: none !important;
  }

  .pos-cart {
    animation: none !important;
  }

  .login-logo {
    animation: none !important;
  }
}

/* =============================================
   FOCUS STATES (Accessibility)
   ============================================= */
.btn:focus-visible,
.form-control:focus-visible,
.cat-pill:focus-visible,
.payment-method:focus-visible,
.nav-item:focus-visible,
.pagination button:focus-visible,
#menu-toggle:focus-visible,
.modal-close:focus-visible,
.cart-qty button:focus-visible,
.cart-item-remove:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* =============================================
   CUSTOMER SELECT MODAL (POS)
   ============================================= */
.pos-cust-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  min-height: 56px;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.pos-cust-row:active {
  background: var(--primary-bg);
}

@media (min-width: 769px) {
  .pos-cust-row:hover {
    background: var(--primary-bg);
  }
}

/* =============================================
   EXPORT PAGE
   ============================================= */
.export-card .btn-block {
  margin-bottom: 0.5rem;
}

.export-card .btn-block:last-child {
  margin-bottom: 0;
}

/* =============================================
   SETTINGS PAGE
   ============================================= */
.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
