/* =============================================
   J. FILHO IMPORT'S — DESIGN SYSTEM
   Gestão de Vendas e Estoque
   ============================================= */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* ---------- CSS CUSTOM PROPERTIES — LIGHT THEME (default) ---------- */
:root {
  /* Primary Palette — Gold */
  --primary: #B8952C;
  --primary-hover: #9F7F22;
  --primary-light: #faf5e4;
  --primary-gradient: linear-gradient(135deg, #C5A55A 0%, #D4AF37 50%, #B8952C 100%);

  /* Accent — Silver */
  --accent: #8C8C8C;
  --accent-light: #f0f0f0;

  /* Semantic */
  --success: #10b981;
  --success-light: #d1fae5;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* Neutral */
  --bg-base: #f5f3ef;
  --bg-surface: #ffffff;
  --bg-elevated: #faf8f5;
  --bg-hover: #f5f3ef;

  --text-primary: #1a1714;
  --text-secondary: #5c5549;
  --text-tertiary: #9c9488;
  --text-inverse: #ffffff;

  --border: #e8e3da;
  --border-hover: #d4ccbf;
  --divider: #f5f3ef;

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

  /* Sizing */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-blur: 12px;
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"] {
  --primary: #D4AF37;
  --primary-hover: #C5A55A;
  --primary-light: rgba(212, 175, 55, 0.12);

  --accent: #A8A9AD;
  --accent-light: rgba(168, 169, 173, 0.12);

  --success: #34d399;
  --success-light: rgba(16, 185, 129, 0.15);
  --success-bg: rgba(16, 185, 129, 0.08);
  --warning: #fbbf24;
  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.08);
  --danger: #f87171;
  --danger-light: rgba(239, 68, 68, 0.15);
  --danger-bg: rgba(239, 68, 68, 0.08);
  --info: #60a5fa;
  --info-light: rgba(59, 130, 246, 0.15);

  --bg-base: #0a0a0a;
  --bg-surface: #141414;
  --bg-elevated: #1e1e1e;
  --bg-hover: #1e1e1e;

  --text-primary: #f0ece4;
  --text-secondary: #a8a196;
  --text-tertiary: #a69f95;
  --text-inverse: #0a0a0a;

  --border: #2a2520;
  --border-hover: #3d3630;
  --divider: #1a1714;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.6), 0 8px 10px -6px rgba(0,0,0,0.5);

  --glass-bg: rgba(20, 20, 20, 0.8);
  --glass-border: rgba(42, 37, 32, 0.5);
  --glass-blur: 12px;
}

/* ---------- THEME TRANSITION ---------- */
body,
.sidebar,
.topbar,
.card,
.btn,
.form-input,
.table,
.badge,
.modal-overlay,
.toast {
  transition: background-color var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base);
}

/* ---------- TYPOGRAPHY ---------- */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
h2 { font-size: 1.375rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
p { color: var(--text-secondary); }
small { font-size: 0.8125rem; color: var(--text-tertiary); }

/* ---------- LAYOUT ---------- */
.hidden { display: none !important; }

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 24px 32px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  animation: fadeInUp 0.35s ease;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0a0a0a 0%, #111111 50%, #0a0a0a 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid rgba(212, 175, 55, 0.1);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.sidebar-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-brand h2 {
  color: #f1f5f9;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand small {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(212, 175, 55, 0.12);
  color: #D4AF37;
}

.nav-item.active i {
  color: #D4AF37;
}

.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1714;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;
  font-size: 0.8125rem;
  color: #e2e8f0;
}

.sidebar-user-info small {
  color: #64748b;
  font-size: 0.75rem;
}

.btn-logout-sidebar {
  background: none;
  border: none;
  color: #64748b;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout-sidebar:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ---------- TOPBAR ---------- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
}

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

.topbar-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 6px;
  border-radius: var(--radius-sm);
}

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

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle i {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

.stat-card:hover::before {
  opacity: 1;
}

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

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }
.stat-icon.accent { background: var(--accent-light); color: var(--accent); }

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

.stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

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

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

.btn-primary {
  background: var(--primary-gradient);
  color: #1a1714;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

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

.btn-success:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
}

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

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- FORMS ---------- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input.error {
  border-color: var(--danger);
}

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

.form-select {
  appearance: none;
  background-image: 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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

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

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

/* Image Upload */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-elevated);
  position: relative;
}

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

.image-upload-area.has-image {
  padding: 8px;
  border-style: solid;
  border-color: var(--primary);
}

.image-upload-area i {
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.image-upload-area p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.image-upload-area small {
  display: block;
  margin-top: 4px;
}

.image-preview {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.image-preview-wrapper {
  position: relative;
}

.image-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.image-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* ---------- TABLE ---------- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

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

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

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

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

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

.table .text-right {
  text-align: right;
}

.table .text-center {
  text-align: center;
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-neutral {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

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

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.modal-lg {
  max-width: 640px;
}

.modal-xl {
  max-width: 900px;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.modal-icon.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.modal h3 {
  text-align: center;
  margin-bottom: 8px;
}

.modal p {
  text-align: center;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 120px;
}

/* ---------- TOASTS ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.info::before { background: var(--info); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

.toast-message {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  animation: toastProgress 3.5s linear forwards;
}

/* ---------- LOGIN SCREEN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(-45deg, #000000, #0a0a0a, #111111, #050505);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  border-radius: 50%;
}

.login-screen::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(168, 169, 173, 0.05) 0%, transparent 70%);
  bottom: -200px;
  left: -200px;
  border-radius: 50%;
}

.login-card {
  background: rgba(14, 14, 14, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5), 0 0 80px rgba(212, 175, 55, 0.03);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto 16px;
  border: 2px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.15), 0 0 40px rgba(212, 175, 55, 0.05);
}

.login-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-logo-icon i {
  color: white;
  width: 32px;
  height: 32px;
}

.login-logo h1 {
  color: #D4AF37;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-logo p {
  color: #94a3b8;
  font-size: 0.875rem;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .form-label {
  color: #cbd5e1;
}

.login-form .form-input {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(212, 175, 55, 0.15);
  color: #f0ece4;
  padding: 12px 16px;
}

.login-form .form-input:focus {
  border-color: #D4AF37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.login-form .form-input::placeholder {
  color: #64748b;
}

.login-form .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  margin-top: 8px;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #f87171;
  font-size: 0.8125rem;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
}

.login-error.show {
  display: flex;
}

/* ---------- DASHBOARD ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 4px;
}

.low-stock-list {
  list-style: none;
}

.low-stock-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.low-stock-item:last-child {
  border-bottom: none;
}

.low-stock-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.low-stock-info {
  flex: 1;
  min-width: 0;
}

.low-stock-info strong {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.low-stock-info small {
  color: var(--text-tertiary);
}

.recent-sales-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.recent-sales-item:last-child {
  border-bottom: none;
}

.recent-sale-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recent-sale-product-img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: transparent;
}

.recent-sale-details strong {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.recent-sale-details small {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.recent-sale-value {
  font-weight: 700;
  color: var(--success);
  font-size: 0.875rem;
}

/* ---------- PRODUCTS ---------- */
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  width: 18px;
  height: 18px;
}

.search-box .form-input {
  padding-left: 42px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

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

.product-card-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: transparent;
}

.product-card-body {
  padding: 16px;
}

.product-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.product-card-variant {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.product-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.product-card-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
}

.product-card-cost {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.product-card-stock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 12px;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}

.product-card-stock span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.product-card-actions {
  display: flex;
  gap: 8px;
}

.product-card-actions .btn {
  flex: 1;
  font-size: 0.8125rem;
  padding: 8px 12px;
}

/* ---------- SALES WIZARD ---------- */
.wizard-container {
  max-width: 700px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-step-number {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  border: 2px solid var(--border);
  color: var(--text-tertiary);
  background: var(--bg-surface);
  transition: all var(--transition-base);
}

.wizard-step.active .wizard-step-number {
  background: var(--primary-gradient);
  border-color: var(--primary);
  color: white;
}

.wizard-step.completed .wizard-step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.wizard-step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.wizard-step.active .wizard-step-label {
  color: var(--text-primary);
  font-weight: 600;
}

.wizard-step.completed .wizard-step-label {
  color: var(--success);
}

.wizard-divider {
  width: 48px;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.wizard-divider.completed {
  background: var(--success);
}

.wizard-body {
  animation: fadeInUp 0.3s ease;
}

.wizard-product-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.wizard-product-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: transparent;
}

.wizard-product-info h3 {
  margin-bottom: 2px;
}

.wizard-product-info small {
  color: var(--text-tertiary);
}

.wizard-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
}

/* Expense Items */
.expense-item {
  display: grid;
  grid-template-columns: 1fr 1.5fr 120px 40px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}

.expense-item .btn-remove-expense {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.expense-item .btn-remove-expense:hover {
  background: var(--danger-light);
}

.expenses-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-weight: 600;
}

/* Summary */
.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-row-value {
  font-weight: 600;
  color: var(--text-primary);
}

.summary-row.total {
  border-top: 2px solid var(--border);
  border-bottom: none;
  margin-top: 8px;
  padding-top: 16px;
}

.summary-row.total .summary-row-label {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.summary-row.total .summary-row-value {
  font-size: 1.25rem;
  font-weight: 800;
}

.summary-row.total .summary-row-value.positive {
  color: var(--success);
}

.summary-row.total .summary-row-value.negative {
  color: var(--danger);
}

/* ---------- HISTORY ---------- */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: end;
}

.filters-bar .form-group {
  margin-bottom: 0;
  min-width: 160px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-cell img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: transparent;
}

/* ---------- REPORTS ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.chart-card h3 {
  margin-bottom: 16px;
}

.chart-wrapper {
  position: relative;
  height: 300px;
}

.expenses-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.expense-category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.expense-category-card .category-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  background: var(--primary-light);
  color: var(--primary);
}

.expense-category-card .category-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.expense-category-card .category-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state i {
  width: 64px;
  height: 64px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto 20px;
}

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

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

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

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

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

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

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

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ---------- RESPONSIVE ---------- */
/* Bottom Nav (Mobile Only) */
.bottom-nav {
  display: none;
}

/* Mobile overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}

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

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 10px);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 0;
    margin: 0;
    background: transparent !important;
  }

  .bottom-nav-item i {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }
  
  .bottom-nav-item.active i {
    color: var(--primary);
  }

  .sidebar {
    display: none; /* Hide sidebar completely on mobile in favor of bottom nav */
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .btn-mobile-menu {
    display: none; /* No longer needed with bottom nav */
  }

  .topbar {
    padding: 0 16px;
  }

  .page-content {
    padding: 16px;
    padding-bottom: 90px; /* Space for bottom nav */
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
    align-items: center;
  }
  
  .btn {
    padding: 12px 20px; /* Larger tap targets */
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .products-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

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

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

  .expense-item {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filter-actions {
    margin-left: 0;
    width: 100%;
  }

  .filter-actions .btn {
    flex: 1;
  }

  .table th,
  .table td {
    padding: 8px 12px;
    font-size: 0.8125rem;
  }

  .wizard-steps {
    flex-wrap: wrap;
    gap: 8px;
  }

  .wizard-divider {
    width: 24px;
    margin: 0 4px;
  }

  .wizard-step-label {
    display: none;
  }

  .login-card {
    padding: 32px 24px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    top: 12px;
  }

  .modal {
    padding: 24px;
    margin: 16px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .expenses-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.375rem;
  }

  .product-card-actions {
    flex-direction: column;
  }

  .expenses-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- PRINT ---------- */
@media print {
  .sidebar,
  .topbar,
  .toast-container,
  .btn,
  .filters-bar,
  .products-toolbar,
  .product-card-actions,
  .modal-overlay {
    display: none !important;
  }

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

  .page-content {
    padding: 0 !important;
    max-width: 100% !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card,
  .stat-card,
  .table-container {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }

  .table th {
    background: #f0f0f0 !important;
  }
}

/* ---------- UTILITY CLASSES ---------- */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
