/* ============================================================
   SCOUT SHOP — Design System (POSnova Blue Theme)
   ============================================================ */

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

/* ---- Design Tokens ---- */
:root {
  --primary:        #2563EB;
  --primary-light:  #3B82F6;
  --primary-dark:   #1D4ED8;
  --primary-dim:    rgba(37, 99, 235, 0.10);
  --primary-glow:   rgba(37, 99, 235, 0.22);

  --accent:         #06B6D4;   /* Cyan accent */
  --accent-dim:     rgba(6, 182, 212, 0.12);

  --bg-color:       #F1F5F9;
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --surface-3:      #EFF6FF;

  --border:         #E2E8F0;
  --border-light:   #F1F5F9;

  --text-dark:      #0F172A;
  --text-dim:       #334155;
  --text-muted:     #64748B;

  --paid:           #10B981;
  --paid-dim:       rgba(16, 185, 129, 0.12);
  --unpaid:         #F59E0B;
  --unpaid-dim:     rgba(245, 158, 11, 0.12);
  --cancelled:      #EF4444;
  --cancelled-dim:  rgba(239, 68, 68, 0.12);
  --danger:         #EF4444;

  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
  --shadow:         0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg:      0 12px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-blue:    0 8px 24px rgba(37,99,235,0.18);

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

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-color);
  color: var(--text-dark);
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::selection { background: var(--primary); color: #fff; }

/* ============================================================
   LOADING SCREEN
   ============================================================ */
#loading-screen {
  position: fixed; inset: 0;
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999; gap: 24px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
#auth-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #EFF6FF 0%, #F1F5F9 50%, #F0F9FF 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998; padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-blue);
}
.auth-title {
  font-size: 22px; font-weight: 800;
  text-align: center; margin-bottom: 4px; color: var(--text-dark);
}
.auth-sub {
  font-size: 13px; color: var(--text-muted);
  text-align: center; margin-bottom: 28px;
}

/* ============================================================
   HAMBURGER MENU OVERLAY (Mobile)
   ============================================================ */
#mobile-menu-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150; opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
#mobile-menu-overlay.open { opacity: 1; pointer-events: all; }

#mobile-menu {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(300px, 80vw);
  background: var(--surface);
  z-index: 160;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.12);
}
#mobile-menu.open { transform: translateX(0); }

.menu-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.menu-brand {
  display: flex; align-items: center; gap: 10px;
}
.menu-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.menu-brand-text { font-size: 15px; font-weight: 800; color: var(--text-dark); }
.menu-close {
  width: 32px; height: 32px; border-radius: 99px;
  background: var(--surface-2); border: none; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); transition: var(--transition);
}
.menu-close:hover { background: var(--border); color: var(--text-dark); }

.menu-user {
  padding: 14px 20px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
}
.menu-user-name { font-size: 15px; font-weight: 700; }
.menu-user-role { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.menu-section-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 12px 20px 6px;
}

.menu-items { flex: 1; overflow-y: auto; padding: 4px 0; }

.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer;
  transition: var(--transition);
  border: none; background: transparent; width: 100%;
  text-align: left; color: var(--text-dim);
  font-size: 14px; font-weight: 600;
}
.menu-item:hover  { background: var(--surface-2); color: var(--text-dark); }
.menu-item.active { background: var(--primary-dim); color: var(--primary); }
.menu-item svg    { width: 20px; height: 20px; flex-shrink: 0; }

.menu-divider { height: 1px; background: var(--border); margin: 6px 16px; }

.menu-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.05);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 10px 4px 6px;
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: var(--transition); position: relative;
  -webkit-appearance: none;
  appearance: none;
}
.nav-item:active { opacity: 0.7; }
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: '';
  position: absolute; top: 0; left: 25%; right: 25%;
  height: 2.5px; background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.3px; }
.nav-badge {
  position: absolute; top: 6px; right: calc(50% - 20px);
  background: var(--cancelled); color: #fff;
  font-size: 8.5px; font-weight: 800;
  min-width: 15px; height: 15px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* Hamburger button in nav */
#hamburger-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; cursor: pointer;
  transition: var(--transition); flex-shrink: 0;
}
#hamburger-btn:hover { background: var(--primary-dim); border-color: var(--primary-light); }
.hamburger-line {
  width: 16px; height: 2px;
  background: var(--text-dim); border-radius: 2px;
  transition: var(--transition);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

.page { display: none; flex-direction: column; min-height: 100dvh; }
.page.active { display: flex; }

.page-content { flex: 1; padding-bottom: 80px; overflow-y: auto; }

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.page-title { font-size: 17px; font-weight: 700; flex: 1; color: var(--text-dark); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.stat-card {
  padding: 18px; display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-change { font-size: 12px; color: var(--text-muted); }
.stat-icon {
  position: absolute; right: 14px; top: 14px;
  opacity: 0.08; width: 40px; height: 40px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: var(--transition);
  white-space: nowrap; -webkit-appearance: none; appearance: none; line-height: 1;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; box-shadow: var(--shadow-blue); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%); }
.btn-blue   { background: var(--primary); color: #fff; }
.btn-blue:hover { background: var(--primary-dark); }
.btn-ghost  { background: transparent; color: var(--text-dark); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-danger { background: var(--cancelled); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm     { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg     { padding: 15px 24px; font-size: 15px; border-radius: var(--radius-md); width: 100%; }
.btn-icon   { padding: 9px; border-radius: var(--radius-sm); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.input-field {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px; color: var(--text-dark);
  width: 100%; transition: var(--transition);
  -webkit-appearance: none; appearance: none; font-family: inherit;
}
.input-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.input-field::placeholder { color: var(--text-muted); }
select.input-field { cursor: pointer; }
textarea.input-field { resize: vertical; min-height: 80px; }

/* Search */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; pointer-events: none; }
.search-field {
  width: 100%; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 11px 14px 11px 38px;
  font-size: 14px; color: var(--text-dark);
  font-family: inherit; transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.search-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.search-field::placeholder { color: var(--text-muted); }

/* ============================================================
   PRODUCT GRID
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px; padding: 14px;
}
.product-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; transition: var(--transition); position: relative;
  box-shadow: var(--shadow-sm);
}
.product-card:active { transform: scale(0.95); }
.product-card:hover  { border-color: var(--primary-light); box-shadow: var(--shadow); transform: translateY(-2px); }
.product-img   { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: block; }
.product-img-placeholder {
  width: 100%; aspect-ratio: 1;
  background: linear-gradient(135deg, var(--surface-3) 0%, var(--surface-2) 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--border);
}
.product-info  { padding: 9px 10px 10px; }
.product-name  { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; color: var(--text-dark); }
.product-price { font-size: 14px; font-weight: 800; color: var(--primary); }
.product-stock-badge {
  position: absolute; top: 7px; right: 7px;
  padding: 3px 7px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.stock-ok    { background: var(--paid-dim);      color: var(--paid); }
.stock-low   { background: var(--unpaid-dim);    color: var(--unpaid); }
.stock-empty { background: var(--cancelled-dim); color: var(--cancelled); }

/* ============================================================
   POS CART PANEL
   ============================================================ */
#cart-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  position: fixed; bottom: 60px; left: 0; right: 0;
  z-index: 80; transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  max-height: 75dvh; display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.10);
}
#cart-panel.open { transform: translateY(0); }
.cart-handle { width: 32px; height: 3px; background: var(--border); border-radius: 99px; margin: 10px auto 6px; flex-shrink: 0; }
.cart-items  { flex: 1; overflow-y: auto; padding: 0 16px; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info  { flex: 1; min-width: 0; }
.cart-item-name  { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.qty-control { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dark); cursor: pointer; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.qty-btn:active { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(0.9); }
.qty-value  { font-size: 14px; font-weight: 700; min-width: 22px; text-align: center; }
.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.cart-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cart-total-label  { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.cart-total-amount { font-size: 22px; font-weight: 800; color: var(--text-dark); }

/* Cart FAB */
#cart-fab {
  position: fixed; bottom: 70px; right: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  width: 52px; height: 52px; border-radius: var(--radius-md);
  display: none; align-items: center; justify-content: center;
  box-shadow: var(--shadow-blue);
  cursor: pointer; z-index: 90; border: none; transition: var(--transition);
}
#cart-fab:active { transform: scale(0.92); }
#cart-fab-count {
  position: absolute; top: -5px; right: -5px;
  background: var(--cancelled); color: #fff;
  font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ============================================================
   QR SCAN POPUP MODAL
   ============================================================ */
#qr-confirm-modal .modal-sheet {
  max-height: 70dvh;
}
.qr-product-preview {
  background: linear-gradient(135deg, var(--surface-3) 0%, #EFF6FF 100%);
  border: 1.5px solid var(--primary-dim);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}
.qr-product-preview .product-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.qr-qty-control {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin: 16px 0;
}
.qr-qty-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-dim); border: 1.5px solid var(--primary-light);
  color: var(--primary); font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.qr-qty-btn:active { background: var(--primary); color: #fff; }
.qr-qty-value {
  font-size: 32px; font-weight: 800; min-width: 60px;
  text-align: center; color: var(--text-dark);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700;
}
.badge-paid      { background: var(--paid-dim);      color: var(--paid); }
.badge-unpaid    { background: var(--unpaid-dim);     color: var(--unpaid); }
.badge-cancelled { background: var(--cancelled-dim);  color: var(--cancelled); }

/* ============================================================
   TABLE
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--surface-2); color: var(--text-muted);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; padding: 11px 14px; text-align: left; white-space: nowrap;
}
.data-table td {
  padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr { transition: var(--transition); }
.data-table tbody tr:hover td { background: var(--surface-3); }

/* ============================================================
   MODAL / BOTTOM SHEET
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 200; display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--border);
  width: 100%; max-height: 92dvh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-drag { width: 32px; height: 3px; background: var(--border); border-radius: 99px; margin: 10px auto 0; }
.modal-header { padding: 12px 18px 0; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.modal-title  { font-size: 17px; font-weight: 700; flex: 1; color: var(--text-dark); }
.modal-close  {
  width: 30px; height: 30px; border-radius: 99px;
  background: var(--surface-2); border: none; color: var(--text-dark);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 17px; transition: var(--transition);
}
.modal-close:hover { background: var(--border); }
.modal-body   { padding: 14px 18px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 0 18px 4px; display: flex; gap: 9px; flex-shrink: 0; }

/* ============================================================
   SCANNER OVERLAY
   ============================================================ */
#scanner-overlay {
  position: fixed; inset: 0; background: #000;
  z-index: 300; display: none; flex-direction: column; align-items: center; justify-content: center;
}
#scanner-overlay.open { display: flex; }
#scanner-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-ui { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.scanner-frame { width: 220px; height: 220px; position: relative; }
.scanner-corner {
  position: absolute; width: 24px; height: 24px;
  border-color: #fff; border-style: solid; border-width: 0;
}
.scanner-corner.tl { top:0; left:0; border-top-width:3px; border-left-width:3px; border-radius:4px 0 0 0; }
.scanner-corner.tr { top:0; right:0; border-top-width:3px; border-right-width:3px; border-radius:0 4px 0 0; }
.scanner-corner.bl { bottom:0; left:0; border-bottom-width:3px; border-left-width:3px; border-radius:0 0 0 4px; }
.scanner-corner.br { bottom:0; right:0; border-bottom-width:3px; border-right-width:3px; border-radius:0 0 4px 0; }
.scanner-line {
  position: absolute; left: 3px; right: 3px; height: 1.5px;
  background: var(--primary-light); box-shadow: 0 0 8px var(--primary-light);
  animation: scan-line 2s ease-in-out infinite;
}
@keyframes scan-line { 0%,100% { top:3px; } 50% { top:calc(100% - 3px); } }
.scanner-hint { color: rgba(255,255,255,0.7); font-size: 13px; font-weight: 500; }
#scanner-close {
  position: absolute; top: max(20px, env(safe-area-inset-top)); right: 18px; z-index: 2;
  width: 38px; height: 38px; border-radius: 99px;
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: calc(100% - 28px); max-width: 340px;
}
.toast {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px; font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease forwards;
  pointer-events: auto;
}
.toast.error   { border-color: rgba(239,68,68,0.35); }
.toast.warning { border-color: rgba(245,158,11,0.35); }
.toast.success { border-color: rgba(16,185,129,0.35); }
.toast-dot { width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0; }
.toast.success .toast-dot { background: var(--paid); }
.toast.error   .toast-dot { background: var(--cancelled); }
.toast.warning .toast-dot { background: var(--unpaid); }
@keyframes toast-in { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:none; } }

/* ============================================================
   QR MANAGER SECTION
   ============================================================ */
.qr-manager-card {
  background: linear-gradient(135deg, #EFF6FF 0%, var(--surface) 100%);
  border: 1.5px solid var(--primary-dim);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 14px 14px;
}
.qr-product-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.qr-product-item:last-child { border-bottom: none; }
.qr-mini-canvas {
  width: 52px; height: 52px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.qr-mini-canvas canvas { width: 50px !important; height: 50px !important; }

/* ============================================================
   UTILITIES
   ============================================================ */
.divider   { height: 1px; background: var(--border); margin: 14px 0; }
.row       { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col       { display: flex; flex-direction: column; gap: 8px; }
.p-page    { padding: 14px 16px; }
.gap-list  { display: flex; flex-direction: column; gap: 10px; }
.section-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 16px 16px 8px;
}
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-muted); }
.empty-state svg { width: 42px; height: 42px; margin: 0 auto 14px; display: block; opacity: 0.25; }
.empty-state p { font-size: 14px; }
.text-primary { color: var(--primary); }
.text-muted  { color: var(--text-muted); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

/* Gradient accent for stat cards */
.stat-blue   { background: linear-gradient(135deg, #EFF6FF 0%, var(--surface) 100%); border-color: var(--primary-dim); }
.stat-green  { background: linear-gradient(135deg, #ECFDF5 0%, var(--surface) 100%); border-color: rgba(16,185,129,0.2); }
.stat-orange { background: linear-gradient(135deg, #FFFBEB 0%, var(--surface) 100%); border-color: rgba(245,158,11,0.2); }
.stat-cyan   { background: linear-gradient(135deg, #ECFEFF 0%, var(--surface) 100%); border-color: rgba(6,182,212,0.2); }

/* Lazy load */
img[data-src] { opacity: 0; transition: opacity 0.3s; }
img.loaded    { opacity: 1; }

/* Pill tabs */
.pill-tabs { display: flex; gap: 6px; padding: 12px 14px; overflow-x: auto; scrollbar-width: none; }
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tab {
  padding: 7px 16px; border-radius: 99px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; white-space: nowrap; transition: var(--transition); flex-shrink: 0;
}
.pill-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 500px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(162px,1fr)); }
}
@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); }
  .modal-overlay { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius-xl); max-width: 520px; margin: auto;
    border: 1px solid var(--border);
  }
  #cart-panel {
    border-radius: var(--radius-xl); max-width: 520px;
    left: 50%; transform: translateX(-50%) translateY(105%); right: auto;
  }
  #cart-panel.open { transform: translateX(-50%) translateY(0); }
  #cart-fab { right: calc(50% - 296px); }
}
