/* =====================================================
   MercadoList - Design System
   Inspired by: Nubank, iFood, Todoist
   ===================================================== */

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

/* ─── CSS Variables ────────────────────────────────── */
:root {
  --primary:       #5B4FE8;
  --primary-dark:  #4338CA;
  --primary-light: #7C6FF7;
  --accent:        #00D09C;
  --accent-dark:   #00A87E;
  --danger:        #F43F5E;
  --warning:       #F59E0B;
  --info:          #3B82F6;

  --bg:            #F8F7FF;
  --bg-card:       #FFFFFF;
  --bg-input:      #F1F0FB;
  --bg-sidebar:    #FFFFFF;

  --text-primary:  #1E1B4B;
  --text-secondary:#6366F1;
  --text-muted:    #94A3B8;
  --text-light:    #CBD5E1;

  --border:        rgba(99,102,241,0.15);
  --border-focus:  rgba(91,79,232,0.5);
  --shadow-sm:     0 1px 3px rgba(91,79,232,0.08);
  --shadow:        0 4px 16px rgba(91,79,232,0.12);
  --shadow-lg:     0 12px 40px rgba(91,79,232,0.18);
  --shadow-card:   0 2px 12px rgba(30,27,75,0.06);

  --radius:        16px;
  --radius-sm:     10px;
  --radius-lg:     24px;
  --radius-full:   999px;

  --font-display:  'Sora', sans-serif;
  --font-body:     'Inter', sans-serif;

  --transition:    all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.12s ease;
  --transition-spring: all 0.35s cubic-bezier(0.34,1.56,0.64,1);

  --nav-h:         64px;
  --sidebar-w:     260px;

  --cat-acougue:   #EF4444;
  --cat-horti:     #22C55E;
  --cat-padaria:   #F59E0B;
  --cat-bebidas:   #3B82F6;
  --cat-laticinios:#84CC16;
  --cat-mercearia: #8B5CF6;
  --cat-limpeza:   #06B6D4;
  --cat-higiene:   #EC4899;
  --cat-congelados:#64748B;
  --cat-outros:    #94A3B8;
}

[data-theme="dark"] {
  --bg:            #0F0E1A;
  --bg-card:       #1A1830;
  --bg-input:      #231F3A;
  --bg-sidebar:    #150F2A;
  --text-primary:  #F0EEFF;
  --text-secondary:#9D95FF;
  --text-muted:    #6366F1;
  --text-light:    #4338CA;
  --border:        rgba(99,102,241,0.2);
  --border-focus:  rgba(124,111,247,0.6);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow:        0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.6);
  --shadow-card:   0 2px 12px rgba(0,0,0,0.3);
  --bg-sidebar:    #130E26;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

img { max-width: 100%; display: block; }
a  { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ─── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ─── Typography ─────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(1.8rem,4vw,2.8rem); }
h2 { font-size: clamp(1.4rem,3vw,2rem); }
h3 { font-size: clamp(1.1rem,2.5vw,1.5rem); }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: var(--transition);
}

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--primary);
}

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(91,79,232,0.35);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(91,79,232,0.12), rgba(124,111,247,0.08));
  color: var(--primary);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-icon { width: 20px; text-align: center; font-size: 1.05rem; }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

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

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.user-card:hover { background: var(--bg-input); }

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

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Top Bar ─────────────────────────────────────────── */
.topbar {
  height: var(--nav-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 14px rgba(91,79,232,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(91,79,232,0.45); transform: translateY(-1px); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #00B894);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,208,156,0.3);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: rgba(91,79,232,0.06); }

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

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #E11D48);
  color: #fff;
  box-shadow: 0 4px 14px rgba(244,63,94,0.3);
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-icon { padding: 9px; border-radius: var(--radius-sm); }
.btn-fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.4rem;
  box-shadow: var(--shadow-lg);
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 90;
}

/* ─── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: var(--transition);
}

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

/* ─── Stat Cards ──────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-card);
}

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

.stat-icon-wrap {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-label .required { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(91,79,232,0.1);
}

.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { opacity: 0.6; cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 40px; }
.input-icon-wrap .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1rem; }

/* ─── Modals ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,14,26,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  animation: fadeIn 0.2s ease forwards;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes slideUp { to { transform: translateY(0) scale(1); } }

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

.modal-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: var(--transition); font-size: 1.2rem; }
.modal-close:hover { background: var(--bg-input); color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Product Items ──────────────────────────────────── */
.product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px solid transparent;
  background: var(--bg-card);
  margin-bottom: 8px;
  cursor: pointer;
  animation: productIn 0.25s ease forwards;
}

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

.product-item:hover { border-color: var(--border); background: var(--bg-input); }

.product-item.pego {
  opacity: 0.6;
}

.product-item.pego .product-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.product-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition-spring);
  flex-shrink: 0;
  font-size: 0.75rem;
  color: transparent;
}

.product-item.pego .product-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.product-cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.product-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.product-price { text-align: right; flex-shrink: 0; }
.product-subtotal { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.product-unit-price { font-size: 0.72rem; color: var(--text-muted); }

.product-actions { display: flex; gap: 4px; }
.product-action-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.product-action-btn:hover { background: var(--bg-input); color: var(--primary); }
.product-action-btn.del:hover { color: var(--danger); }

/* ─── List Cards ──────────────────────────────────────── */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.list-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition-spring);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.list-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.list-card-header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}

.list-card-header::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.list-card-icon { font-size: 2rem; }
.list-card-menu { color: rgba(255,255,255,0.7); transition: var(--transition); padding: 4px; border-radius: 6px; }
.list-card-menu:hover { background: rgba(255,255,255,0.15); color: #fff; }

.list-card-body { padding: 16px 20px; }
.list-card-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.list-card-stats { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); }
.list-card-stat { display: flex; align-items: center; gap: 4px; }

.list-progress { margin-top: 12px; }
.progress-bar {
  height: 5px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

.list-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-total { font-family: var(--font-display); font-weight: 700; color: var(--primary); font-size: 1.1rem; }

/* ─── Category Chips ─────────────────────────────────── */
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chip {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid;
  transition: var(--transition);
  cursor: pointer;
}
.cat-chip.active { color: #fff !important; }

/* ─── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 340px;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes toastIn { from { opacity:0; transform:translateX(60px); } }

.toast.success .toast-icon { color: var(--accent); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--info); }

/* ─── Auth Pages ──────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.auth-visual {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.auth-visual::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -150px; right: -150px;
}

.auth-visual::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  bottom: -80px; left: -80px;
}

.auth-visual-content { position: relative; z-index: 1; text-align: center; color: #fff; }
.auth-visual h2 { font-size: 2rem; margin-bottom: 12px; }
.auth-visual p { opacity: 0.8; font-size: 1rem; line-height: 1.6; }

.auth-features { margin-top: 40px; display: flex; flex-direction: column; gap: 16px; }
.auth-feature { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.9); font-size: 0.9rem; }
.auth-feature-icon { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.auth-form-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--bg);
}

.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-form-logo { text-align: center; margin-bottom: 32px; }
.auth-form-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.auth-form-sub { color: var(--text-muted); font-size: 0.9rem; }

/* ─── Dashboard ───────────────────────────────────────── */
.page { padding: 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 1.4rem; font-weight: 800; }
.page-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '🛒';
  position: absolute;
  right: 24px; top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  opacity: 0.15;
}

.welcome-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.welcome-sub { opacity: 0.85; font-size: 0.9rem; margin-top: 4px; }

/* ─── Shopping Mode ──────────────────────────────────── */
.shopping-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  padding: 20px 24px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}

.shopping-progress-label { font-size: 0.8rem; opacity: 0.8; margin-bottom: 6px; display: flex; justify-content: space-between; }
.shopping-progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 99px;
  overflow: hidden;
}
.shopping-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(0,208,156,0.5);
}

.shopping-total {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.cat-group { margin-bottom: 20px; }
.cat-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 4px;
  margin-bottom: 8px;
}

/* ─── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-emoji { font-size: 4rem; margin-bottom: 16px; display: block; }
.empty-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-text { font-size: 0.9rem; line-height: 1.6; }

/* ─── QR Modal ────────────────────────────────────────── */
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 16px 0; }
.qr-wrap canvas { border-radius: 12px; border: 4px solid var(--border); }
.share-link-box { background: var(--bg-input); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.8rem; word-break: break-all; color: var(--text-muted); }

/* ─── Admin ───────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 10px 16px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 12px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-input); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; }
.badge-success { background: rgba(34,197,94,0.12); color: #16A34A; }
.badge-danger  { background: rgba(244,63,94,0.12);  color: #BE123C; }
.badge-primary { background: rgba(91,79,232,0.12);  color: var(--primary); }

/* ─── Install Banner ─────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 80px; left: 16px; right: 16px;
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  animation: slideUp 0.4s ease;
}
.install-icon { font-size: 2rem; flex-shrink: 0; }
.install-text { flex: 1; }
.install-title { font-weight: 700; font-size: 0.9rem; }
.install-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ─── Loading ─────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s;
}
.loading-logo { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--primary); margin-bottom: 24px; }
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--bg-input);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Autocomplete ────────────────────────────────────── */
.autocomplete-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
  z-index: 300;
  margin-top: 4px;
}
.autocomplete-item { padding: 10px 14px; font-size: 0.875rem; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.autocomplete-item:hover { background: var(--bg-input); }

/* ─── Divider ─────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.divider-text { position: relative; text-align: center; margin: 20px 0; }
.divider-text::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.divider-text span { position: relative; background: var(--bg); padding: 0 12px; font-size: 0.8rem; color: var(--text-muted); }

/* ─── Theme Toggle ────────────────────────────────────── */
.theme-toggle {
  width: 44px; height: 24px;
  background: var(--bg-input);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border);
}
.theme-toggle.on { background: var(--primary); border-color: var(--primary); }
.theme-toggle-dot {
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: var(--transition-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.theme-toggle.on .theme-toggle-dot { transform: translateX(20px); }

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-side { padding: 32px 24px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 150;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 140;
    backdrop-filter: blur(4px);
  }
  .sidebar-overlay.active { display: block; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .list-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .btn-fab { bottom: 80px; }

  /* Bottom Nav Mobile */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 0;
  }

  .bottom-nav-item.active { color: var(--primary); }
  .bottom-nav-icon { font-size: 1.3rem; }
  
  .main-content { padding-bottom: 64px; }
  
  .modal { max-height: 95vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .sidebar-overlay { display: none !important; }
}

/* ─── Animations ──────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse { animation: pulse 2s ease infinite; }

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* ─── Print ───────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn-fab, .bottom-nav, .modal-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .product-item.pego { display: block !important; }
}
