/* ===========================
   CELNET ESTOQUE – DESIGN SYSTEM
   =========================== */

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

:root {
  --primary: #CC0000;
  --primary-hover: #B30000;
  --primary-light: rgba(204, 0, 0, 0.08);
  --primary-glow: rgba(204, 0, 0, 0.2);

  --success: #10B981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #EF4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.1);

  --bg: #FFFFFF;
  --bg-alt: #FFFFFF;
  --surface: #F3F4F6;
  --surface-hover: #E5E7EB;
  --card: #FFFFFF;
  --card-border: rgba(0, 0, 0, 0.03);
  --card-shadow: 0 15px 35px rgba(0, 0, 0, 0.05), 0 5px 15px rgba(0, 0, 0, 0.02);
  --shadow-3d: 0 20px 50px rgba(0,0,0,0.06), inset 0 1px 2px rgba(255,255,255,1);

  --sidebar-w: 320px;
  --header-h: 72px;
  --radius: 20px;
  --radius-lg: 32px;
  --radius-xl: 40px;
  --radius-sm: 12px;

  --text: #1F2937;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --border: #F1F5F9;

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

/* ===========================  DARK THEME  =========================== */
body:not(.light-theme) {
  --bg: #0F172A;
  --bg-alt: #1E293B;
  --surface: #334155;
  --surface-hover: #475569;
  --card: #1E293B;
  --card-border: rgba(255, 255, 255, 0.03);
  --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --shadow-3d: 0 20px 50px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.05);

  --text: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  --border: rgba(255, 255, 255, 0.06);

  --primary-light: rgba(204, 0, 0, 0.15);
}

/* Smooth transition for theme switch */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}
body.light-theme .sidebar,
body.light-theme .header,
body.light-theme .card,
body.light-theme .stat-card,
body.light-theme .barcode-area,
body.light-theme .modal,
body.light-theme .form-control,
body.light-theme .qty-input,
body.light-theme .qty-btn,
body.light-theme .btn-ghost {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Light theme table tweaks */
body.light-theme thead th {
  background: rgba(0,0,0,0.02);
}
body.light-theme tbody tr:hover {
  background: rgba(0,0,0,0.02);
}
body.light-theme .contagem-item:hover {
  background: rgba(0,0,0,0.02);
}
body.light-theme .login-hints {
  background: rgba(0,0,0,0.03);
}
body.light-theme .badge-gray {
  background: rgba(0,0,0,0.06);
}
body.light-theme .toast-info {
  background: #eff6ff;
  border-color: var(--info);
  color: #1d4ed8;
}
body.light-theme .toast-success {
  background: #f0fdf4;
  border-color: var(--success);
  color: #15803d;
}
body.light-theme .toast-error {
  background: #fef2f2;
  border-color: var(--danger);
  color: #dc2626;
}
body.light-theme .toast-warning {
  background: #fffbeb;
  border-color: var(--warning);
  color: #d97706;
}

/* ===========================  THEME TOGGLE BTN  =========================== */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: rotate(20deg) scale(1.1);
}

/* ===========================  SCROLLBAR PREMIUM  =========================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  border: 1px solid transparent;
  background-clip: content-box;
}
body:not(.light-theme) ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
  background-clip: content-box;
}

/* ===========================  RESET  =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }

.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 32px;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(204, 0, 0, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(204, 0, 0, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(31, 41, 55, 0.05) 0%, transparent 50%),
    var(--bg);
}
.splash-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.splash-icon { font-size: 40px; }
.splash-text {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #FF5555);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===========================  SPINNER  =========================== */
.spinner {
  width: auto;
  height: auto;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================  LAYOUT  =========================== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding: 32px;
  background: var(--surface);
  gap: 32px;
}

/* ===========================  SIDEBAR  =========================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
  z-index: 100;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 10px;
}
.sidebar-logo .logo-full { display: none; }
.sidebar-logo img { width: 45px; height: 45px; object-fit: contain; }
.sidebar-nav {
  flex: 1;
  padding: 16px;
  margin: 10px 16px;
  background: var(--bg); /* Efeito de quadro */
  border-radius: 24px; /* Bordas redondas do board */
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  border-radius: 16px !important; /* Arredondar todas as 4 pontas */
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  max-width: 240px; /* Alargado p/ 1 coluna */
  text-align: center;
  border: none;
  background: transparent;
  margin-bottom: 4px;
}
.nav-label {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: normal; /* Permitir quebra se necessário */
  word-wrap: break-word;
}
.nav-item .nav-icon {
  font-size: 32px; /* Ícone maior em cima */
  margin-bottom: 0;
  transition: transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
}
.nav-item:hover .nav-icon { transform: scale(1.1); }

.nav-item.active {
  background: var(--primary);
  color: #fff !important;
  box-shadow: 0 10px 20px var(--primary-glow);
}
.nav-item.active .nav-icon { color: #fff !important; }
.nav-highlight {
  background: var(--primary-light);
  color: var(--primary);
}
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  cursor: pointer;
  transition: background var(--transition);
  text-align: center;
}
.sidebar-user:hover { background: var(--surface-hover); }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--text-muted);
}
.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  cursor: pointer;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--danger); }

/* ===========================  MAIN  =========================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3d);
  border: 1px solid var(--border);
  position: relative;
}

/* ===========================  HEADER  =========================== */
.header {
  height: var(--header-h);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  padding: 4px;
}

/* ===========================  CONTENT  =========================== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  animation: fadeInUp 0.35s ease;
  /* Removido o excesso de flex para não conflitar com o scroll natural */
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===========================  CARDS  =========================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition);
  position: relative;
  /* Removido overflow: hidden daqui para permitir expansão da lista */
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .icon { font-size: 16px; }

/* Utilitários de Tipografia para Nomes de Lojas */
.unit-name {
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
}
.unit-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===========================  STAT CARDS  =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--card-shadow);
  position: relative;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  box-shadow: var(--shadow-3d);
  border-radius: inherit;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}
.stat-icon {
  width: 52px;
  height: 52px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  transition: all var(--transition);
}


/* ===========================  ICONS & MATERIAL SYMBOLS  =========================== */
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; display: inline-block; vertical-align: middle; line-height: 1; }
.nav-icon .material-symbols-outlined { font-size: 24px; }
.stat-icon .material-symbols-outlined { font-size: 28px; transition: all 0.3s ease; }
.stat-card:hover .stat-icon .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 500; }

.stat-card:hover .stat-icon {
  background: var(--bg);
  border-color: var(--primary-light);
  color: var(--primary);
  transform: rotate(-10deg) scale(1.1);
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ===========================  GRID  =========================== */
.grid {
  display: grid;
  gap: 32px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }

/* ===========================  TABLES  =========================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  width: 100%;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: rgba(255,255,255,0.03);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody td {
  padding: 13px 16px;
  color: var(--text);
  font-size: 13.5px;
  vertical-align: middle;
}
.td-muted { color: var(--text-secondary); font-size: 12px; }

/* ===========================  BADGES  =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-indigo { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-pulse { animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===========================  BUTTONS  =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #FF4444);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #FF4444, var(--primary));
  box-shadow: 0 10px 25px var(--primary-glow);
  transform: translateY(-2px);
}
.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { padding: 8px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===========================  FORMS  =========================== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
.form-control.barcode-input {
  font-size: 18px;
  padding: 14px 18px;
  border: 2px solid var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Fundo branco garantido na tela de login — sobrepõe dark mode */
body.login-page,
body.login-page .login-wrapper {
  background: #FFFFFF !important;
  background-color: #FFFFFF !important;
}
body.login-page {
  overflow: hidden !important;
}
/* Wrapper: cobre a tela, centraliza o grupo */
.login-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  overflow: hidden;
  z-index: 9999;
}
/* Grupo único: card + footer com a mesma largura e centro */
.login-center-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(420px, calc(100vw - 40px));
}
.login-bg { display: none; }
/* Card compacto para caber sem scroll */
.login-card {
  position: relative;
  background: #FFFFFF;
  border: none;
  border-radius: 40px;
  padding: 28px 32px 24px;
  width: 100%;
  box-shadow: 0 40px 100px rgba(0,0,0,0.15);
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  box-sizing: border-box;
}
.login-logo-area { margin-bottom: 12px; display: flex; flex-direction: column; align-items: center; }
.login-brand-name { font-size: 24px; font-weight: 900; color: #1e293b; margin-bottom: 2px; }
.login-brand-sub { font-size: 11px; font-weight: 700; color: #94a3b8; letter-spacing: 0.1em; }
.login-welcome-title { font-size: 20px; font-weight: 800; color: #1e293b; margin-bottom: 4px; margin-top: 12px; }
.login-welcome-sub { font-size: 13px; color: #64748b; margin-bottom: 14px; }
.login-submit-btn {
  background: linear-gradient(to right, #CC0000, #FF3333) !important;
  border-radius: 20px !important;
  height: 50px !important;
  font-weight: 800 !important;
  font-size: 16px !important;
  box-shadow: 0 8px 20px rgba(204, 0, 0, 0.15) !important;
  margin-top: 8px;
  border: none;
}
.login-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(204, 0, 0, 0.2) !important;
}
.login-error {
  background: var(--danger-light);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}
.login-hints {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.login-hints p { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.login-hints code {
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
}
/* Footer fora do card, abaixo, centralizado */
.login-footer {
  width: 100%;
  text-align: center;
  pointer-events: none;
  flex-shrink: 0;
}
.login-footer div {
  pointer-events: auto;
  text-align: center;
  width: 100%;
}

/* ===========================  BIPAGEM PAGE  =========================== */
.barcode-area {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.barcode-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-counter {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}
.scan-counter-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.scan-counter-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.contagem-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.25s ease;
  transition: background var(--transition);
}
.contagem-item:hover { background: rgba(255,255,255,0.02); }
.contagem-item:last-child { border-bottom: none; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.item-produto { flex: 1; min-width: 0; }
.item-produto-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-barcode { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.qty-control {
  display: flex;
  align-items: center;
  gap: 4px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.qty-btn:hover { background: var(--primary); border-color: var(--primary); }
.qty-input {
  width: 52px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  padding: 4px;
}
.qty-input:focus { outline: none; border-color: var(--primary); }

/* ===========================  LOJA STATUS  =========================== */
.loja-row-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-alert { background: var(--danger); box-shadow: 0 0 6px var(--danger); animation: pulse 2s infinite; }

/* ===========================  PROGRESS BAR  =========================== */
.progress-bar {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  transition: width 0.5s ease;
}

/* ===========================  SEARCH BAR  =========================== */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-input-wrap .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}
.search-input-wrap .form-control { padding-left: 36px; }

/* ===========================  PAGE HEADER  =========================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
}
.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===========================  MODAL  =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  padding: 20px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 0; /* Importante: Padding vai para o scroller */
  width: 100%;
  max-width: 480px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.15);
  animation: fadeInUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden; /* Corta TUDO nos cantos arredondados */
}
.modal-scroller {
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  box-shadow: var(--shadow-3d);
  border-radius: inherit;
  pointer-events: none;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal-wide {
  max-width: 780px;
}
.modal-wide .modal-scroller {
  padding: 0 40px; 
}
.modal-scroller::-webkit-scrollbar {
  width: 8px;
}
.modal-scroller::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.18);
  border-radius: 20px;
  border: 2px solid var(--card); /* Respiro lateral */
  background-clip: padding-box;
}
body:not(.light-theme) .modal-scroller::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.15);
}
.modal-scroller::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

.modal-scroller .modal-header {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
  padding: 28px 0 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.modal-scroller .modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--card);
  z-index: 10;
  padding: 16px 0 28px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* Títulos de seção dentro do formulário */
.form-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===========================  TOAST  =========================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slideToast 0.3s ease;
  position: relative;
  overflow: hidden;
}
@keyframes slideToast {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  animation: toastProgress 3s linear forwards;
}
@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}
.toast-success { background: #064e3b; border: 1px solid var(--success); color: #6ee7b7; }
.toast-success::after { background: var(--success); }
.toast-error { background: #450a0a; border: 1px solid var(--danger); color: #fca5a5; }
.toast-error::after { background: var(--danger); }
.toast-info { background: #1e3a5f; border: 1px solid var(--info); color: #93c5fd; }
.toast-info::after { background: var(--info); }
.toast-warning { background: #451a03; border: 1px solid var(--warning); color: #fcd34d; }
.toast-warning::after { background: var(--warning); }
.toast-icon { font-size: 18px; flex-shrink: 0; }

/* ===========================  EMPTY STATE  =========================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ===========================  CHART CONTAINER  =========================== */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

/* ===========================  CONTAGEM FINALIZAR  =========================== */
.finalize-bar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  padding: 20px 0 0;
  margin-top: 16px;
}

/* ===========================  RESPONSIVE  =========================== */

/* --- Tablet: hamburger ativo, sidebar sobre o conteúdo --- */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 32px rgba(0,0,0,0.6);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 199;
    display: none;
  }
  .sidebar-overlay.show { display: block; animation: fadeIn 0.2s ease; }

  .hamburger { display: flex; align-items: center; justify-content: center; }

  .header { padding: 0 16px; }
  .header-title { font-size: 16px; }
  .header-subtitle { font-size: 11px; }

  .content { padding: 16px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header h1 { font-size: 18px; }

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

  .filters-group {
    flex-wrap: wrap !important;
    width: 100%;
    gap: 8px !important;
  }
  .filters-group select { flex: 1; min-width: 120px !important; width: auto !important; }

  .alert-stores-grid { grid-template-columns: 1fr; }
}

/* --- Mobile pequeno --- */
@media (max-width: 640px) {
  .content { padding: 12px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; flex-shrink: 0; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }

  .card { padding: 14px; }

  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  tbody td { padding: 10px 12px; font-size: 12px; }
  thead th { padding: 10px 12px; font-size: 10px; }

  .modal { padding: 20px 16px; }
  .modal-wide { padding: 16px; max-height: 95vh; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  .page-header .btn { width: 100%; justify-content: center; }

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

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

  .qty-control { width: 100%; justify-content: flex-end; }
  .item-produto { min-width: 100%; }

  .search-bar { flex-direction: column; }
  .search-input-wrap { min-width: unset; }

  .filters-group { flex-direction: column !important; }
  .filters-group select { width: 100% !important; }

  #toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* --- Mobile muito pequeno --- */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 18px; }
  .header-title { font-size: 14px; }
}

/* ===========================  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(--text-muted); }

/* ===========================  UTILS  =========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.d-none { display: none !important; }

/* Highlight row */
.row-highlight {
  animation: highlight 1.5s ease;
}
@keyframes highlight {
  0% { background: rgba(99, 102, 241, 0.2); }
  100% { background: transparent; }
}

/* ===========================  ALERT STORE CARDS  =========================== */
.alert-stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.alert-store-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.alert-store-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  box-shadow: var(--shadow-3d);
  border-radius: inherit;
  pointer-events: none;
}
.alert-store-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(204, 0, 0, 0.08);
}
.alert-store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(239, 68, 68, 0.04);
  gap: 10px;
  flex-wrap: wrap;
}
.alert-prod-list {
  padding: 4px 0;
}
.alert-prod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.alert-prod-row:last-child { border-bottom: none; }
.alert-prod-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-prod-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.alert-prod-num {
  font-size: 15px;
  font-weight: 800;
  min-width: 24px;
  text-align: right;
}
.alert-prod-sep {
  font-size: 11px;
  color: var(--text-muted);
}
.alert-prod-min {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 20px;
}
.alert-mini-bar {
  width: 56px;
  height: 5px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
/* ===========================  MONTH TABS  =========================== */
.month-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px;
  margin-bottom: 24px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.month-tabs::-webkit-scrollbar { display: none; }

.month-tab {
  padding: 10px 20px;
  border-radius: 30px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.month-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.month-tab.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 8px 20px var(--primary-glow);
  font-weight: 600;
}

.alert-prod-more {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  border-top: 1px dashed var(--border);
}
/* ===========================  DASHBOARD FATURAMENTO GRID  =========================== */
.fat-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}
.fat-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .fat-tables-row { grid-template-columns: 1fr; }
  .fat-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .alert-stores-grid { grid-template-columns: 1fr; }
  .alert-store-header { gap: 8px; }
}
@media (max-width: 480px) {
  .fat-kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 360px) {
  .fat-kpi-grid { grid-template-columns: 1fr; }
}

/* ===========================  FATURAMENTO CARDS KPI  =========================== */
.fat-stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.fat-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.fat-stat-icon { font-size: 22px; margin-bottom: 2px; }
.fat-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.fat-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.fat-stat-value--sm { font-size: 18px; font-weight: 700; }

/* ===========================  FATURAMENTO CHART CARDS  =========================== */
.fat-chart-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.fat-chart-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  box-shadow: var(--shadow-3d);
  border-radius: inherit;
  z-index: 1;
}
.fat-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.fat-chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.fat-chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.fat-chart-badge {
  background: rgba(139, 30, 47, 0.12);
  color: #8B1E2F;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===========================  FATURAMENTO TABLE & RANK  =========================== */
.fat-value-pos { color: #8B1E2F; font-weight: 600; }
.fat-rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  min-width: 36px;
  justify-content: center;
}
.fat-rank-badge--gold   { background: rgba(245,158,11,0.15); color: #d97706; }
.fat-rank-badge--silver { background: rgba(148,163,184,0.15); color: #64748b; }
.fat-rank-badge--default { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ===========================  FATURAMENTO INSIGHTS  =========================== */
.fat-insights-section { margin-top: 0; }
.fat-insights-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-left: 2px;
}
.fat-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.fat-insight-card {
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.18s ease;
}
.fat-insight-card:hover { transform: translateY(-2px); }
.fat-insight-card--dark {
  background: #8B1E2F;
  color: #fff;
}
.fat-insight-card--dark .fat-insight-icon { font-size: 20px; margin-bottom: 4px; }
.fat-insight-card--dark .fat-insight-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; opacity: 0.75; color: #ffd5d5;
}
.fat-insight-card--dark .fat-insight-title {
  font-size: 20px; font-weight: 800; line-height: 1.1; color: #fff; text-transform: uppercase;
}
.fat-insight-card--dark .fat-insight-desc { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.fat-insight-card--light {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}
.fat-insight-card--light .fat-insight-icon { font-size: 20px; margin-bottom: 4px; }
.fat-insight-card--light .fat-insight-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-muted);
}
.fat-insight-card--light .fat-insight-title {
  font-size: 18px; font-weight: 800; color: #8B1E2F; line-height: 1.1; text-transform: uppercase;
}
.fat-insight-card--light .fat-insight-desc { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

@media (max-width: 900px) {
  .fat-insights-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .fat-insights-grid { grid-template-columns: 1fr; }
  .fat-insight-card--dark .fat-insight-title { font-size: 17px; }
  .fat-insight-card--light .fat-insight-title { font-size: 15px; }
}

.nav-item.active { background: var(--primary) !important; color: #fff !important; }

@media (max-width: 768px) {
  .layout { flex-direction: column !important; padding: 0 !important; gap: 0 !important; overflow-y: auto !important; }
  .sidebar {
    width: 100% !important;
    height: auto !important;
    flex-direction: row !important;
    position: sticky !important;
    top: 0 !important;
    padding: 10px 16px !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: var(--card) !important;
    border-bottom: 1px solid var(--border) !important;
    z-index: 1000 !important;
  }
  .sidebar-logo, .sidebar-footer { display: none !important; }
  .sidebar-nav {
    flex-direction: row !important;
    flex-wrap: nowrap !important; /* Evita quebra de linha */
    overflow-x: auto !important; /* Permite scroll se houver muitos itens */
    padding: 6px !important;
    margin: 0 !important;
    gap: 8px !important;
    justify-content: flex-start !important; /* Permite scroll do início */
    width: 100% !important;
    background: var(--bg) !important;
    border-radius: 50px !important; /* Cápsula perfeita */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 auto !important; /* Não encolhe nem cresce */
    width: 72px !important;
    padding: 8px 4px !important;
    margin-bottom: 0 !important;
    gap: 2px !important;
    border-radius: 40px !important;
  }
  .nav-item .nav-icon { font-size: 22px !important; }
  .nav-label { font-size: 9px !important; white-space: nowrap !important; }
}

/* ===========================  DUAL PERFORMANCE DASHBOARD  =========================== */
.perf-stack {
  display: flex !important;
  flex-direction: column !important;
  gap: 32px !important;
  width: 100% !important;
}

.perf-dual-header {
  display: flex !important;
  flex-direction: column !important;
  gap: 24px !important;
  width: 100% !important;
  margin-bottom: 40px !important;
  align-items: stretch !important;
}

/* Coluna Esquerda: Melhor Vendedor (Horizontal) */
.perf-col-left {
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

/* Coluna Direita: Ranking Lojas (Vertical) */
.perf-col-right {
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

.perf-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.perf-card-header span { color: var(--primary); font-size: 24px; }
.perf-card-header h3 { font-size: 16px; font-weight: 800; margin: 0; text-transform: uppercase; letter-spacing: 0.05em; }

/* Ranking Vendedores Badges */
.top5-badges-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important; /* Permitir quebra de linha */
  gap: 16px !important;
  padding: 8px 4px !important;
  width: 100% !important;
}

.top5-badge-card {
  flex: 1 1 260px !important; /* Flexível, com base de 260px */
  max-width: 400px; /* Evitar largura excessiva em telas grandes */
  background: var(--card);
  padding: 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.top5-badge-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.top5-medal {
  width: 32px; height: 32px; background: var(--primary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; flex-shrink: 0;
}

/* Ranking Lojas Vertical */
.store-ranking-card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.store-rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.store-rank-item:hover { border-color: var(--primary-light); background: var(--surface); }
.store-rank-name { font-weight: 700; font-size: 13px; }
.store-rank-val { font-weight: 800; color: var(--primary); font-size: 13px; }

/* Grid de Unidades */
.perf-grid {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  grid-auto-rows: 1fr !important;
  gap: 16px !important; /* Slightly smaller gap for 5 columns */
  width: 100% !important;
}

.perf-actions {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
  margin-top: 24px !important;
}

/* Podium Performance Cards */
.podium-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--card-shadow);
  position: relative;
}
.podium-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  border-color: var(--primary-light);
}
.podium-header {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}
.podium-top1 {
  padding: 24px 20px;
  background: var(--primary);
  color: #FFFFFF;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.podium-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.podium-icon span { font-size: 24px; color: #fff; }
.podium-name {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.podium-val {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.9;
}
.podium-others {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.podium-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.podium-sub:last-child { border-bottom: none; }
.podium-sub-name { font-size: 12px; font-weight: 600; color: var(--text); }
.podium-sub-val { font-size: 12px; font-weight: 800; color: var(--primary); }

@media (max-width: 1400px) {
  .perf-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

@media (max-width: 1200px) {
  .perf-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 1000px) {
  .perf-dual-header { grid-template-columns: 1fr !important; }
  .perf-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 600px) {
  .perf-grid { grid-template-columns: 1fr !important; }

}

/* ===========================  WEBKIT FOOTER  =========================== */
.footer-webkit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  flex-shrink: 0;
  z-index: 10;
}
.footer-link {
  text-decoration: none;
  font-weight: 700;
  color: inherit;
  transition: all var(--transition);
}
.footer-link:hover {
  color: var(--primary) !important;
  text-decoration: underline;
}
.footer-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* ===========================  BOTTOM NAV (MOBILE)  =========================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.08);
  z-index: 1000;
  padding: 0 2px; /* Reduzido para caber 7 itens */
  backdrop-filter: blur(10px);
}

.bottom-nav-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.bottom-nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 0px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--transition);
  flex: 1;
}

.bottom-nav-item .material-symbols-outlined {
  font-size: 20px; /* Reduzido para caber 7 itens */
}

.bottom-nav-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

/* ===========================  RESPONSIVO PREMIUM  =========================== */
@media (max-width: 1024px) {
  .layout { padding: 0 !important; gap: 0 !important; height: 100vh !important; }
  .sidebar { display: none; }
  .main { border-radius: 0; width: 100%; height: 100vh; display: flex; flex-direction: column; }
  .header { padding: 0 16px; border-top: none; }
  .content { padding: 12px; flex: 1; overflow-y: auto; padding-bottom: 120px; } /* Ajustado para 12px para evitar que fique colado na borda do celular */
  .footer-webkit { display: none; }
  
  .bottom-nav { display: block; }
  .mobile-footer { display: block !important; opacity: 0.8; }
  .hamburger { display: none !important; }
}

@media (max-width: 640px) {
  .header-actions { gap: 8px; }
  .header-title { font-size: 14px; font-weight: 800; }
  .stats-grid { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .podium-card { border-radius: 16px; }
  .podium-top1 { padding: 16px 12px; }
  .form-row { grid-template-columns: 1fr; }
}

/* Toasts Monocromáticos */
.toast {
  background: var(--card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--card-shadow) !important;
  border-left: 4px solid var(--primary) !important;
}
.toast-success { border-left-color: var(--success) !important; }
.toast-error { border-left-color: var(--danger) !important; }
.toast-warning { border-left-color: var(--warning) !important; }
.toast-info { border-left-color: var(--info) !important; }

/* Ajuste específico para Tela de Login Mobile */
@media (max-width: 480px) {
  .login-wrapper { align-items: flex-start !important; }
  .login-card { 
    max-width: 370px !important; 
    padding: 10px 24px !important; 
    margin: 10px !important; 
    border-radius: 32px !important;
    margin-top: 50px !important; /* Sobe o board para o topo */
  }
  .login-submit-btn { height: 48px !important; font-size: 14px !important; }
  .login-welcome-title { font-size: 19px !important; margin-top: 5px !important; }
  .login-logo-area { margin-bottom: 12px !important; }
  .login-welcome-sub { margin-bottom: 15px !important; }
}

