/* =============================================
   Kiosco MyM — Design System & Global Styles
   ============================================= */

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

/* === CSS Variables === */
:root {
  --bg-primary: #080812;
  --bg-secondary: #0f0f1e;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(108, 99, 255, 0.6);

  --text-primary: #e8eaf6;
  --text-secondary: #94a3b8;
  --text-muted: #4a5568;

  --accent: #6c63ff;
  --accent-light: rgba(108, 99, 255, 0.15);
  --accent2: #2dd4bf;
  --accent2-light: rgba(45, 212, 191, 0.12);

  --gradient: linear-gradient(135deg, #6c63ff 0%, #2dd4bf 100%);
  --gradient-soft: linear-gradient(135deg, rgba(108,99,255,0.2) 0%, rgba(45,212,191,0.1) 100%);
  --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.08) 0%, transparent 60%),
                 radial-gradient(ellipse at 80% 20%, rgba(45,212,191,0.06) 0%, transparent 60%);

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --info: #60a5fa;
  --info-light: rgba(96, 165, 250, 0.12);

  --sidebar-width: 240px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --transition: 0.2s ease;
}

/* === Light Theme Overrides === */
[data-theme="light"] {
  --bg-primary: #f0f2f8;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.09);
  --border-focus: rgba(108, 99, 255, 0.5);

  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #94a3b8;

  --accent: #6c63ff;
  --accent-light: rgba(108, 99, 255, 0.12);
  --accent2: #0d9488;
  --accent2-light: rgba(13, 148, 136, 0.1);

  --gradient: linear-gradient(135deg, #6c63ff 0%, #2dd4bf 100%);
  --gradient-soft: linear-gradient(135deg, rgba(108,99,255,0.15) 0%, rgba(45,212,191,0.08) 100%);
  --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.06) 0%, transparent 60%),
                 radial-gradient(ellipse at 80% 20%, rgba(45,212,191,0.04) 0%, transparent 60%);

  --success: #059669;
  --success-light: rgba(5, 150, 105, 0.1);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);
  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.1);
  --info: #2563eb;
  --info-light: rgba(37, 99, 235, 0.1);

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
  background-image: var(--gradient-bg);
  background-attachment: fixed;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.35); }

/* === Typography === */
h1, h2, h3, h4, h5 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s;
}
.btn:active::after { opacity: 0.08; }

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,0.15); }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover { background: rgba(248,113,113,0.2); }

.btn-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.2);
}
.btn-success:hover { background: rgba(16,185,129,0.2); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-icon-sm { padding: 6px; width: 30px; height: 30px; justify-content: center; }

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

/* === Form Controls === */
.form-group { display: flex; flex-direction: column; gap: 6px; }

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

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: var(--border-focus);
  background: rgba(108, 99, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

[data-theme="light"] .form-control {
  color: var(--text-primary);
}
[data-theme="light"] .form-control::placeholder { color: var(--text-muted); }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

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

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-accent { background: var(--accent-light); color: var(--accent); }

.badge-transfer {
  background: rgba(251,191,36,0.15);
  color: #f59e0b;
  border: 1px solid rgba(251,191,36,0.3);
}
.badge-qr {
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.3);
}

[data-theme="light"] .badge-transfer,
[data-theme="light"] .badge-qr {
  background: transparent;
  color: #000000;
  border: none;
}

/* === Tables === */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  /* Indicador visual sutil: fade derecho cuando hay scroll */
  background:
    linear-gradient(to right, var(--bg-secondary) 0%, transparent 20px) left center / 20px 100% no-repeat,
    linear-gradient(to left,  rgba(108,99,255,0.08) 0%, transparent 40px) right center / 40px 100% no-repeat;
  background-attachment: local, scroll;
}

table {
  width: max-content;   /* Mantiene el ancho natural, fuerza scroll si es necesario */
  min-width: 100%;      /* Ocupa al menos el 100% del wrapper */
  border-collapse: collapse;
}

thead th {
  background: rgba(0,0,0,0.02);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: normal;
  line-height: 1.3;
}

[data-theme="light"] thead th {
  background: rgba(108, 99, 255, 0.04);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(108,99,255,0.04); }

[data-theme="light"] tbody tr:hover { background: rgba(108, 99, 255, 0.05); }

tbody td {
  padding: 12px 10px;
  color: var(--text-primary);
  vertical-align: middle;
  font-size: 13px;
}

/* === App Layout === */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;   /* Contiene el layout sin bloquear scroll táctil de hijos */
  overflow-x: hidden;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo svg {
  width: 22px;
  height: 22px;
  color: #fff;
  stroke: #fff;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-link:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

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

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Icon utility — inline SVG buttons */
.btn-icon-svg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-icon-svg svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Search icon SVG */
.search-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.user-info:hover { background: rgba(0,0,0,0.05); }

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

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

.page-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.page-content { padding: 24px 32px 32px; flex: 1; }

/* === Stats Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

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

.stat-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.12); }
.stat-card:hover::before { opacity: 1; }

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

.stat-icon.purple { background: var(--accent-light); }
.stat-icon.teal { background: var(--accent2-light); }
.stat-icon.green { background: var(--success-light); }
.stat-icon.red { background: var(--danger-light); }
.stat-icon.yellow { background: var(--warning-light); }
.stat-icon.blue { background: var(--info-light); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Alerts === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.3s ease;
}
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }

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

.modal-overlay.hidden { display: none; }

/* Overlay siempre centrado (ej: cámara) — sobreescribe el bottom sheet de mobile */
.modal-overlay-centered {
  align-items: center !important;
  padding: 20px !important;
}
.modal-overlay-centered .modal {
  border-radius: var(--radius-lg) !important;
  max-height: 90vh;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

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

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

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
  line-height: 1;
}
.btn-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

/* === Search & Filter Bar === */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-input {
  padding-left: 38px !important;
  text-overflow: ellipsis;
  width: 100%;
}

.filter-select {
  min-width: 150px;
  width: auto;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: normal;
}

/* === Loading === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
  gap: 12px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
  gap: 8px;
  text-align: center;
}

.empty-state-icon { font-size: 48px; opacity: 0.4; margin-bottom: 8px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.empty-state-text { font-size: 14px; color: var(--text-secondary); }

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 500;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: slideLeft 0.3s ease;
  border: 1px solid rgba(255,255,255,0.15);
}

.toast-success { background: rgba(16,185,129,0.9); color: white; }
.toast-error { background: rgba(248,113,113,0.9); color: white; }
.toast-warning { background: rgba(245,158,11,0.9); color: white; }
.toast-info { background: rgba(96,165,250,0.9); color: white; }

/* === Stock indicator === */
.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.stock-ok { background: var(--success-light); color: var(--success); }
.stock-low { background: var(--warning-light); color: var(--warning); }
.stock-out { background: var(--danger-light); color: var(--danger); }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideLeft { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

.animate-in { animation: slideUp 0.3s ease; }

/* === Grid helpers === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* === Utility: hide text on mobile, keep icon === */
.btn-label-desktop { display: inline; }
@media (max-width: 480px) {
  .btn-label-desktop { display: none; }
}

/* === Hamburger Button === */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.hamburger-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.hamburger-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all var(--transition);
}

/* === Sidebar Overlay === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}
.sidebar-overlay.active {
  display: block;
}

/* === Responsive === */
@media (max-width: 768px) {
  /* Show hamburger */
  .hamburger-btn { display: flex; }

  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content full width */
  .main-content {
    margin-left: 0;
  }

  /* Page header reduced padding */
  .page-header {
    padding: 16px 16px 0;
    gap: 10px;
  }
  .page-content {
    padding: 16px 16px 24px;
  }

  /* Page title smaller */
  .page-title { font-size: 1.25rem; }
  .page-subtitle { font-size: 13px; }

  /* Stats grid 2 columns on tablet */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Grids collapse to 1 col */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Stat card compact */
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-value { font-size: 1.4rem; }

  /* Filter bar column */
  .filter-bar { flex-direction: column; gap: 12px; align-items: stretch; }
  .filter-bar > * { width: 100%; }
  .search-wrapper { min-width: 0; width: 100%; }
  .filter-select { min-width: 0; width: 100%; }

  /* Modals full width on mobile */
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal-header { padding: 16px 18px 12px; }
  .modal-body { padding: 16px 18px; gap: 12px; }
  .modal-footer { padding: 12px 18px 20px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  /* Toast full width */
  .toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
    align-items: stretch;
  }
  .toast { max-width: 100%; }

  /* Tables horizontally scrollable */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  tbody td, thead th { white-space: nowrap; }
  table { width: max-content; min-width: 100%; }


  /* Buttons touch-friendly */
  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  .btn-lg { min-height: 50px; }

  /* Card header wrap */
  .card-header { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 480px) {
  /* Stats to 1 col on small phones */
  .stats-grid { grid-template-columns: 1fr; }

  /* Page header stack */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Stat card horizontal layout kept, but value smaller */
  .stat-value { font-size: 1.3rem; }

  /* Modal full screen feel */
  .modal { max-height: 95vh; }
}

/* === Theme Toggle Button === */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition);
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  line-height: 1;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(20deg) scale(1.08);
}

/* Light mode specific overrides for components with hardcoded rgba */
[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .stat-card:hover {
  border-color: rgba(108, 99, 255, 0.2);
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.1);
}

[data-theme="light"] .btn-close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text-primary);
}

[data-theme="light"] .low-stock-cat,
[data-theme="light"] .low-stock-min {
  color: var(--text-muted) !important;
}

[data-theme="light"] #current-date {
  color: var(--text-secondary) !important;
}

[data-theme="light"] .barcode-field {
  color: #000000 !important;
}

/* Smooth theme transition */
body, .sidebar, .card, .modal, .stat-card, .nav-link, .form-control, .btn-secondary {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}
