/* ============================================================
   STOREOS — PREMIUM DESIGN SYSTEM v2.0
   Aesthetic: Refined Enterprise · Electric Blue · Geometric
   Font: Sora (display) · DM Sans (body)
   ============================================================ */

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

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }
table { border-collapse: collapse; width: 100%; }

/* ===== DESIGN TOKENS ===== */
:root {
  /* Surfaces */
  --bg:           #f8fafc;
  --white:        #ffffff;
  --surface-1:    #ffffff;
  --surface-2:    #f8fafc;
  --surface-3:    #f1f5f9;

  /* Navigation */
  --nav:          #06101f;
  --nav-2:        #0c1a31;
  --nav-border:   rgba(255,255,255,0.07);

  /* Brand — Electric Blue */
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-glow:  rgba(37,99,235,0.25);
  --accent-glow-lg: rgba(37,99,235,0.18);

  /* Text */
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --text-4:       #cbd5e1;

  /* Borders */
  --border:       #e8edf3;
  --border-2:     #d1dae7;

  /* Status */
  --green:        #16a34a;  --green-bg:   #f0fdf4;  --green-border: #bbf7d0;
  --red:          #dc2626;  --red-bg:     #fef2f2;  --red-border:   #fecaca;
  --yellow:       #b45309;  --yellow-bg:  #fffbeb;  --yellow-border:#fde68a;
  --purple:       #6d28d9;  --purple-bg:  #f5f3ff;  --purple-border:#ddd6fe;
  --blue-soft:    #0369a1;  --blue-bg:    #f0f9ff;  --blue-border:  #bae6fd;

  /* Radius */
  --radius:    8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows — Soft & Diffuse */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --shadow:    0 1px 3px rgba(15,23,42,0.07), 0 4px 12px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,0.08), 0 1px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 40px rgba(15,23,42,0.1), 0 4px 12px rgba(15,23,42,0.05);
  --shadow-xl: 0 24px 64px rgba(15,23,42,0.14), 0 8px 24px rgba(15,23,42,0.06);
  --shadow-blue: 0 6px 24px var(--accent-glow);

  /* Typography */
  --font-display: 'Sora', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t: 150ms;
  --t-md: 220ms;
}

/* ===== BASE ===== */
html { overflow-x: hidden; max-width: 100vw; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #060d1c;
  overflow: hidden;
  position: relative;
}

/* Animated background mesh */
#auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(37,99,235,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 60%, rgba(99,102,241,0.12) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 20%, rgba(59,130,246,0.08) 0%, transparent 50%);
  pointer-events: none;
}

/* Floating grid lines */
#auth-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37,99,235,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 80%);
  pointer-events: none;
}

.auth-orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 10s ease-in-out infinite;
}
.auth-orb:nth-child(1) { width: 500px; height: 500px; background: rgba(37,99,235,0.12); top: -120px; left: -80px; }
.auth-orb:nth-child(2) { width: 350px; height: 350px; background: rgba(99,102,241,0.1); bottom: -60px; right: 5%; animation-delay: -4s; }
.auth-orb:nth-child(3) { width: 240px; height: 240px; background: rgba(14,165,233,0.09); top: 40%; right: 15%; animation-delay: -7s; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.06); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.auth-card {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow:
    0 48px 96px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.9);
  animation: cardIn 0.65s var(--ease-bounce) forwards;
  position: relative;
  z-index: 2;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(32px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo { text-align: center; margin-bottom: 36px; }
.auth-logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 60%, #60a5fa 100%);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 28px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  animation: logoPulse 3s ease-in-out infinite;
}
.auth-logo-icon svg { width: 26px; height: 26px; color: white; }
@keyframes logoPulse {
  0%,100% { box-shadow: 0 8px 28px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }
  50%      { box-shadow: 0 12px 40px rgba(37,99,235,0.65), inset 0 1px 0 rgba(255,255,255,0.25); }
}

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 800;
  color: var(--text);
  letter-spacing: -0.8px;
}
.auth-logo p { color: var(--text-2); font-size: 13px; margin-top: 4px; font-weight: 400; }

.auth-field { margin-bottom: 18px; }
.auth-field label {
  display: block;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.auth-field input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: all var(--t-md) var(--ease);
  font-size: 14px; font-weight: 500;
  background: var(--surface-2);
  color: var(--text);
}
.auth-field input:focus {
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1), 0 1px 3px rgba(37,99,235,0.12);
}

.auth-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: white;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14.5px; font-weight: 700;
  margin-top: 14px;
  transition: all var(--t-md) var(--ease);
  position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(37,99,235,0.4);
  letter-spacing: -0.2px;
}
.auth-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent);
  opacity: 0; transition: opacity var(--t) var(--ease);
}
.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(37,99,235,0.55);
}
.auth-btn:hover::before { opacity: 1; }
.auth-btn:active { transform: scale(0.97) translateY(0); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app { display: none; height: 100vh; overflow: hidden; }
.layout { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.topnav {
  background: linear-gradient(180deg, #08122a 0%, #0a1628 100%);
  border-bottom: 1px solid var(--nav-border);
  flex-shrink: 0;
  position: relative;
  z-index: 1000;
}
.topnav::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(37,99,235,0.5) 40%, rgba(99,102,241,0.4) 60%, transparent 100%);
}

.topnav-inner {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 20px;
  gap: 0;
}

/* Brand */
.topnav-brand {
  display: flex; align-items: center; gap: 10px;
  padding-right: 20px; margin-right: 6px;
  border-right: 1px solid var(--nav-border);
  flex-shrink: 0;
}
.topnav-brand-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.2);
}
.topnav-brand-logo svg { width: 17px; height: 17px; color: white; }
.topnav-brand-text h2 {
  font-family: var(--font-display);
  color: white; font-size: 15px; font-weight: 700;
  letter-spacing: -0.5px; line-height: 1.1;
}
.topnav-brand-text span {
  color: rgba(255,255,255,0.28);
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
}

/* Nav Groups */
.nav-groups { display: flex; align-items: center; flex: 1; gap: 1px; padding: 0 6px; }

/* Direct nav buttons */
.nav-dash-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 7px;
  cursor: pointer; color: rgba(255,255,255,0.5);
  font-family: var(--font-body);
  font-size: 12.5px; font-weight: 500;
  transition: all var(--t) var(--ease);
  white-space: nowrap; background: none; border: none;
  position: relative;
}
.nav-dash-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.nav-dash-btn:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.07); }
.nav-dash-btn.active {
  color: white;
  background: rgba(37,99,235,0.12);
}
.nav-dash-btn.active::after {
  content: '';
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2.5px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(59,130,246,0.7);
}

/* Nav Group Dropdown */
.nav-group { position: relative; }
.nav-group-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 7px;
  cursor: pointer; color: rgba(255,255,255,0.5);
  font-family: var(--font-body);
  font-size: 12.5px; font-weight: 500;
  transition: all var(--t) var(--ease);
  white-space: nowrap; background: none; border: none;
  position: relative;
}
.nav-group-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.nav-group-btn .chev { width: 10px; height: 10px; opacity: 0.35; transition: transform var(--t-md) var(--ease); }
.nav-group-btn:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.07); }
.nav-group.open .nav-group-btn { color: white; background: rgba(255,255,255,0.09); }
.nav-group.open .nav-group-btn .chev { transform: rotate(180deg); opacity: 0.7; }
.nav-group-btn.grp-active { color: white; background: rgba(37,99,235,0.12); }
.nav-group-btn.grp-active::after {
  content: '';
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2.5px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(59,130,246,0.7);
}

/* Dropdown panel */
.nav-dropdown {
  position: absolute; top: calc(100% + 12px); left: 0;
  background: #0c1e38;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 13px; padding: 6px;
  min-width: 210px;
  box-shadow:
    0 28px 56px rgba(0,0,0,0.65),
    0 8px 20px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
  opacity: 0; visibility: hidden;
  transform: translateY(-10px) scale(0.97);
  transition: all var(--t-md) var(--ease);
  z-index: 500;
}

/* Últimos 3 nav-groups: dropdown alinha à direita para não sair da tela */
.nav-group:nth-last-child(-n+3) .nav-dropdown {
  left: auto;
  right: 0;
}
.nav-group.open .nav-dropdown {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
}
.nav-dropdown-section {
  padding: 7px 10px 4px;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: rgba(255,255,255,0.22);
}
.nav-dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 11px; border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.58);
  font-size: 12.5px; font-weight: 500;
  transition: all 0.12s var(--ease);
  white-space: nowrap;
}
.nav-dd-item svg { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.55; transition: opacity 0.12s; }
.nav-dd-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.95); }
.nav-dd-item:hover svg { opacity: 0.9; }
.nav-dd-item.active { background: rgba(37,99,235,0.2); color: #93c5fd; }
.nav-dd-item.active svg { opacity: 1; }

/* Submenu */
.nav-dd-item-sub { position: relative; }
.nav-submenu {
  position: absolute; left: 100%; top: 0;
  background: #0c1e38;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 6px;
  min-width: 210px;
  box-shadow: 0 20px 48px rgba(0,0,0,0.55);
  opacity: 0; visibility: hidden;
  transform: translateX(-6px);
  transition: all var(--t-md) var(--ease);
  z-index: 600;
}
.nav-dd-item-sub:hover .nav-submenu { opacity: 1; visibility: visible; transform: translateX(0); }

/* PDV CTA Button */
.btn-pdv-nav {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 15px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: white; border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all var(--t-md) var(--ease);
  white-space: nowrap; border: none; font-family: inherit;
  margin-left: 8px; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(37,99,235,0.4);
  position: relative; overflow: hidden;
}
.btn-pdv-nav::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity var(--t);
}
.btn-pdv-nav svg { width: 13px; height: 13px; }
.btn-pdv-nav:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 8px 24px rgba(37,99,235,0.55);
}
.btn-pdv-nav:hover::before { opacity: 1; }
.btn-pdv-nav:active { transform: scale(0.97); }
.btn-pdv-nav.active { background: linear-gradient(135deg, #1d4ed8, #2563eb); }

/* User area */
.topnav-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto; padding-left: 16px;
  border-left: 1px solid var(--nav-border); flex-shrink: 0;
}
.topnav-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}
.topnav-avatar span { color: white; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.topnav-uinfo { display: flex; flex-direction: column; gap: 1px; }
.topnav-uname { color: rgba(255,255,255,0.9); font-size: 12px; font-weight: 600; line-height: 1.2; }
.topnav-urole { color: rgba(255,255,255,0.3); font-size: 10px; }
.btn-nav-logout {
  background: none; border: none;
  color: rgba(255,255,255,0.3); padding: 6px;
  border-radius: 6px; cursor: pointer;
  display: flex; transition: all var(--t);
}
.btn-nav-logout:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); }

/* ============================================================
   PAGE HEADER BAR
   ============================================================ */
.pagebar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 44px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.pagebar h1 {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: -0.4px;
  display: flex; align-items: center; gap: 8px;
}
.pagebar-actions { display: flex; gap: 8px; align-items: center; }

/* Back button */
.btn-back-nav {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 8px;
  border-radius: 7px;
  border: 1.5px solid var(--border-2);
  background: white;
  color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--t-md) var(--ease);
  box-shadow: var(--shadow-xs);
  margin-right: 12px;
  flex-shrink: 0;
}
.btn-back-nav svg {
  width: 14px; height: 14px;
  transition: transform var(--t-md) var(--ease);
}
.btn-back-nav:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-back-nav:hover svg { transform: translateX(-2px); }
.btn-back-nav:active { transform: scale(0.96); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 20px; min-height: 0; box-sizing: border-box; scroll-behavior: smooth; background: var(--bg); width: 100%; }
.content.pdv-active { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

/* ============================================================
   UNIVERSAL PAGE WRAPPER — keeps pages scrollable & consistent
   ============================================================ */
.page-body {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.page-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.page-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.page-section:last-child { border-bottom: none; }

/* Page entry animation */
.page-enter { animation: pageIn 0.28s var(--ease) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COMPONENTS — BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  transition: all var(--t) var(--ease);
  cursor: pointer;
  position: relative; overflow: hidden;
  letter-spacing: -0.1px;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Ripple */
.btn .ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: rippleAnim 0.55s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(37,99,235,0.5);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 6px rgba(37,99,235,0.3); }

.btn-secondary {
  background: white; color: var(--text);
  border: 1.5px solid var(--border-2);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--border-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-secondary:active { transform: scale(0.97); }

.btn-danger {
  background: var(--red-bg); color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: #fee2e2; transform: translateY(-1px); }
.btn-danger:active { transform: scale(0.97); }

.btn-success {
  background: var(--green-bg); color: var(--green);
  border: 1px solid var(--green-border);
}
.btn-success:hover { background: #dcfce7; transform: translateY(-1px); }
.btn-success:active { transform: scale(0.97); }

.btn-warning {
  background: var(--yellow-bg); color: var(--yellow);
  border: 1px solid var(--yellow-border);
}
.btn-warning:hover { background: #fef3c7; transform: translateY(-1px); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; }
.btn-icon { padding: 7px; }

/* ============================================================
   COMPONENTS — CARDS
   ============================================================ */
.card {
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-1);
  gap: 12px;
}
.card-header h3 {
  font-family: var(--font-display);
  font-size: 13.5px; font-weight: 700;
  color: var(--text); letter-spacing: -0.2px;
}
.card-body { padding: 20px; }

/* ============================================================
   COMPONENTS — STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all var(--t-md) var(--ease);
  position: relative; overflow: hidden;
  cursor: default;
}
/* Subtle gradient glow on hover */
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgba(37,99,235,0.04) 0%,
    transparent 55%
  );
  opacity: 0; transition: opacity var(--t-md);
  pointer-events: none;
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover {
  border-color: rgba(37,99,235,0.18);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-card .stat-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  color: var(--text); letter-spacing: -1px;
  line-height: 1;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; font-weight: 500; }
.stat-card .stat-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; margin-top: 6px;
}
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ============================================================
   COMPONENTS — TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.data-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-2);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--t);
  animation: rowIn 0.3s var(--ease) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}
.data-table tbody tr:hover td { background: #f8fafc; }
.data-table .actions { display: flex; gap: 5px; align-items: center; }

/* ============================================================
   COMPONENTS — BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1px;
}
.badge-green  { background: var(--green-bg);  color: var(--green);    border: 1px solid var(--green-border); }
.badge-red    { background: var(--red-bg);    color: var(--red);      border: 1px solid var(--red-border); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow);   border: 1px solid var(--yellow-border); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-soft);border: 1px solid var(--blue-border); }
.badge-purple { background: var(--purple-bg); color: var(--purple);   border: 1px solid var(--purple-border); }
.badge-gray   { background: var(--surface-3); color: var(--text-2);   border: 1px solid var(--border); }

/* ============================================================
   COMPONENTS — FORMS
   ============================================================ */
.form-grid { display: grid; gap: 18px; }
.form-row   { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 13px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  transition: all var(--t-md) var(--ease);
  background: white; color: var(--text);
  font-size: 13.5px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.09);
  outline: none;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions {
  display: flex; gap: 8px; padding-top: 10px;
  border-top: 1px solid var(--border); margin-top: 4px;
}

/* ============================================================
   COMPONENTS — MODAL
   ============================================================ */
#modal-overlay, #size-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(6,13,28,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000; align-items: center; justify-content: center;
  padding: 20px;
}
#modal-overlay.open, #size-modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-height: 90vh;
  overflow-y: auto; display: flex; flex-direction: column;
  animation: modalIn 0.28s var(--ease-bounce) both;
  border: 1px solid var(--border);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-sm { max-width: 440px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 840px; }
.modal-xl { max-width: 1020px; }

.modal-header {
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  background: white;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: -0.3px;
}
.modal-close {
  background: none; color: var(--text-3);
  display: flex; padding: 5px; border-radius: 6px;
  transition: all var(--t);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 26px; flex: 1; }
.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0; background: var(--bg);
}

/* ============================================================
   COMPONENTS — FILTERS BAR
   ============================================================ */
.filters {
  display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap;
  padding: 14px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.filter-input, .filter-select {
  padding: 8px 13px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13px; background: white;
  transition: border-color var(--t);
}
.filter-input { min-width: 180px; }
.filter-input:focus, .filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.09);
}

/* ============================================================
   COMPONENTS — TABS
   ============================================================ */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  background: white;
  padding: 0 4px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  padding: 13px 18px;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  border-bottom: 2.5px solid transparent;
  transition: all var(--t-md) var(--ease);
  white-space: nowrap;
  position: relative; bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   COMPONENTS — EMPTY STATE & LOADING
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 48px;
  color: var(--text-3);
}
.empty-state i, .empty-state svg { width: 40px; height: 40px; opacity: 0.35; }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty-state p { font-size: 13px; color: var(--text-3); }

/* Skeleton loading */
.loading { padding: 40px; }
.sk {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   COMPONENTS — PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 8px; background: var(--surface-3);
  border-radius: 99px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 100%);
  transition: width 0.8s var(--ease);
  position: relative; overflow: hidden;
}
/* Shimmer effect on progress bar */
.progress-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.45) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: barShimmer 2s ease-in-out infinite;
}
@keyframes barShimmer {
  0%   { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ============================================================
   COMPONENTS — TOAST
   ============================================================ */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: 12px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--ease-bounce) both,
             toastOut 0.3s var(--ease) 3.2s both;
  min-width: 220px; max-width: 340px;
  border: 1px solid;
}
@keyframes toastIn  { from { opacity: 0; transform: translateY(16px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-8px) scale(0.95); } }
.toast-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.toast-error   { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.toast-info    { background: #eff6ff; color: #2563eb; border-color: #93c5fd; }

/* ============================================================
   COMPONENTS — INFO LIST
   ============================================================ */
.info-list { display: flex; flex-direction: column; gap: 0; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row .label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; }
.info-row .value { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* ============================================================
   PDV — POINT OF SALE
   ============================================================ */
.pdv-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  height: calc(100vh - 112px);
}
.pdv-left  { display: flex; flex-direction: column; gap: 12px; overflow: hidden; min-height: 0; }
.pdv-right { display: flex; flex-direction: column; gap: 12px; overflow: hidden; min-height: 0; }

.pdv-search {
  display: flex; gap: 8px; align-items: center;
}
.pdv-search input {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13.5px; background: var(--bg);
  transition: all var(--t-md);
}
.pdv-search input:focus {
  background: white; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.09);
}

/* Products grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; padding: 2px;
}
.product-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all var(--t-md) var(--ease);
  display: flex; flex-direction: column; gap: 5px;
}
.product-card h4 {
  font-size: 12.5px; font-weight: 600;
  color: var(--text); line-height: 1.3;
}
.product-card .price {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--accent);
}
.product-card .stock { font-size: 11px; color: var(--text-3); }
.product-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(37,99,235,0.18);
  transform: translateY(-2px) scale(1.01);
}
.product-card:active { transform: scale(0.97); }

/* Cart */
.cart {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  flex: 1; overflow: hidden;
  box-shadow: var(--shadow);
}
.cart-items { flex: 1; overflow-y: auto; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.cart-item:hover { background: var(--bg); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info h4 { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-info span { font-size: 11px; color: var(--text-2); }
.cart-qty {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 6px; padding: 3px;
}
.cart-qty button {
  width: 22px; height: 22px;
  background: white; border: 1px solid var(--border);
  border-radius: 5px; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: all var(--t);
}
.cart-qty button:hover { background: var(--accent); color: white; border-color: var(--accent); }
.cart-qty span { font-size: 13px; font-weight: 700; min-width: 20px; text-align: center; }
.cart-item-price { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--text); }

.cart-totals { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--bg); }
.cart-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px; color: var(--text-2);
}
.cart-total-row.grand {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; color: var(--text);
  padding-top: 10px; margin-top: 4px;
  border-top: 1.5px solid var(--border-2);
}

/* Payment buttons */
.pay-btns {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.pay-btn {
  padding: 7px 6px; text-align: center;
  border: 1.5px solid var(--border-2); border-radius: 8px;
  font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: all var(--t) var(--ease); color: var(--text-2);
  background: white;
}
.pay-btn:hover { border-color: var(--accent); color: var(--accent); }
.pay-btn.selected {
  background: rgba(37,99,235,0.08);
  border-color: var(--accent);
  color: var(--accent);
}

/* Size selector */
.sizes-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.size-btn {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border-2); border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-md) var(--ease);
  background: white;
}
.size-btn:hover {
  border-color: var(--accent);
  background: rgba(37,99,235,0.08);
  color: var(--accent);
  transform: scale(1.05);
}

/* ============================================================
   ALERT / INFO BOX
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--blue-bg);   color: var(--blue-soft); border-color: var(--blue-border); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow);    border-color: var(--yellow-border); }
.alert-success { background: var(--green-bg);  color: var(--green);     border-color: var(--green-border); }
.alert-danger  { background: var(--red-bg);    color: var(--red);       border-color: var(--red-border); }

/* ============================================================
   IMPORT CSV — DRAG & DROP ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-md) var(--ease);
  background: var(--bg);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(37,99,235,0.04);
}
.drop-zone .drop-icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.drop-zone p  { font-size: 13px; color: var(--text-2); }

/* Import progress bar — animated stripes */
.import-progress {
  height: 10px; background: var(--surface-3);
  border-radius: 99px; overflow: hidden; margin: 12px 0;
}
.import-progress-fill {
  height: 100%; border-radius: 99px;
  background: repeating-linear-gradient(
    -45deg,
    #2563eb 0px,
    #2563eb 10px,
    #3b82f6 10px,
    #3b82f6 20px
  );
  background-size: 28px 100%;
  animation: stripes 0.7s linear infinite;
  transition: width 0.4s var(--ease);
}
@keyframes stripes {
  0%   { background-position: 0 0; }
  100% { background-position: 28px 0; }
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 4px;
}
.dashboard-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; margin-bottom: 16px;
}

/* ============================================================
   PAGE SECTIONS
   ============================================================ */
.section-title {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-2); margin-bottom: 12px;
}
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ============================================================
   RIPPLE EFFECT (Global)
   ============================================================ */
.ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.28);
  transform: scale(0);
  animation: rippleAnim 0.55s linear;
  pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--nav);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 900;
  padding: 0 4px env(safe-area-inset-bottom);
}
.bottom-nav-items {
  display: flex; height: 60px;
  justify-content: space-around; align-items: center;
}
.bottom-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 12px;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: color var(--t);
  border-radius: 10px; flex: 1; max-width: 80px;
  border: none; background: none; font-family: inherit;
}
.bottom-nav-item svg { width: 20px; height: 20px; }
.bottom-nav-item span { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.bottom-nav-item.active { color: #60a5fa; }
.bottom-nav-item.pdv-fab {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(37,99,235,0.5);
  padding: 10px;
  margin-top: -12px;
}
.bottom-nav-item.pdv-fab svg { width: 22px; height: 22px; }

/* Mobile menu overlay */
.mobile-menu-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(6,13,28,0.6); backdrop-filter: blur(4px);
  z-index: 850;
}
.mobile-menu-overlay.open { display: block; }
.mobile-menu {
  position: fixed; bottom: 60px; left: 0; right: 0;
  background: var(--nav-2);
  border-top: 1px solid rgba(255,255,255,0.09);
  border-radius: 20px 20px 0 0;
  padding: 16px;
  z-index: 860;
  max-height: 70vh; overflow-y: auto;
  animation: slideUp 0.3s var(--ease-bounce) both;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.mobile-menu-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.3px; color: rgba(255,255,255,0.25);
  padding: 12px 8px 6px;
}
.mobile-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; border-radius: 10px;
  color: rgba(255,255,255,0.65);
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background var(--t);
  min-height: 48px; /* Touch-friendly */
}
.mobile-menu-item svg { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.mobile-menu-item:hover, .mobile-menu-item:active { background: rgba(255,255,255,0.08); }

/* ============================================================
   MOBILE CARD VIEW (Replaces tables on mobile)
   ============================================================ */
.mobile-cards { display: none; }
.mobile-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  animation: rowIn 0.3s var(--ease) both;
}
.mobile-card-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 10px;
}
.mobile-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.mobile-card-body  { display: flex; flex-direction: column; gap: 6px; }
.mobile-card-row {
  display: flex; justify-content: space-between; align-items: center;
}
.mobile-card-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.mobile-card-value { font-size: 13px; font-weight: 500; color: var(--text); }
.mobile-card-actions {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.mobile-card-actions .btn { flex: 1; justify-content: center; min-height: 44px; }

/* ============================================================
   HAMBURGER (Mobile top bar)
   ============================================================ */
.btn-hamburger {
  display: none;
  background: none; border: none;
  color: rgba(255,255,255,0.7);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--t);
}
.btn-hamburger:hover { background: rgba(255,255,255,0.09); }
.btn-hamburger svg  { width: 20px; height: 20px; }

/* Hide full nav on mobile */
.nav-groups-desktop { display: flex; flex: 1; }

/* ============================================================
   RESPONSIVE — TABLET (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .pdv-layout { grid-template-columns: 1fr 340px; }
  .form-row-4 { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: repeat(2, 1fr); }

  /* Collapse some nav items */
  .nav-group-btn .label-txt { display: none; }
  .nav-dash-btn .label-txt  { display: none; }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Hide desktop topnav on mobile */
  .topnav { display: none !important; }

  /* Show bottom nav */
  .bottom-nav { display: block; }

  /* Pad content for bottom nav */
  .content { padding: 12px 12px 76px; overflow-x: auto; }
  .pagebar { padding: 0 16px; }

  /* Stats: 2 col on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 20px; }

  /* PDV: stack vertically */
  .pdv-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .pdv-right { min-height: 0; }

  /* Tables → Mobile Cards */
  .table-wrap    { display: none !important; }
  .mobile-cards  { display: block; }
  .data-table    { display: none; }

  /* Modal: full-screen on mobile */
  #modal-overlay, #size-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: sheetUp 0.32s var(--ease) both;
  }
  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Forms: single column */
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }

  /* Products grid: 2 columns */
  .products-grid { grid-template-columns: repeat(2, 1fr); }

  /* Filters: scroll horizontal */
  .filters { overflow-x: auto; flex-wrap: nowrap; padding: 10px 12px; -webkit-overflow-scrolling: touch; }

  /* Topbar actions */
  .pagebar-actions .btn span { display: none; }
  .pagebar-actions .btn { padding: 8px; }

  /* Dashboard grid: single column */
  .dashboard-grid, .dashboard-grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card .stat-value { font-size: 18px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .pay-btns { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-2); }
.fw-bold     { font-weight: 700; }
.fw-600      { font-weight: 600; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-accent { color: var(--accent); }
.flex        { display: flex; align-items: center; gap: 8px; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-4       { gap: 4px; }
.gap-8       { gap: 8px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.mt-16       { margin-top: 16px; }
.p-0         { padding: 0; }
.hidden      { display: none; }
.w-full      { width: 100%; }

/* ============================================================
   FINANCIAL / SPECIAL COMPONENTS
   ============================================================ */
/* Caixa / Financeiro summary bar */
.summary-bar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.summary-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.summary-item .s-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-2); margin-bottom: 6px; }
.summary-item .s-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text); }
.summary-item.positive .s-value { color: var(--green); }
.summary-item.negative .s-value { color: var(--red); }

/* Crediário specific */
.credi-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 20px;
}

/* Kanban-style columns for bag */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kanban-col { background: var(--bg); border-radius: var(--radius-lg); padding: 12px; }
.kanban-col-header {
  font-size: 12px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 10px; display: flex; justify-content: space-between;
}

/* ============================================================
   PDV LAYOUT v2 — CLEAN & PROFESSIONAL
   ============================================================ */

/* CSS vars specific to PDV */
.pdv-layout-v2 {
  --pdv-bg: #f8fafc;
  --pdv-aside-bg: #1e293b;
  --pdv-aside-border: rgba(255,255,255,.08);
  --pdv-text-2: #64748b;
  --pdv-accent: #2563eb;
  --pdv-radius: 8px;

  display: flex;
  height: 100%;
  background: var(--pdv-bg);
  font-family: var(--font-body);
  overflow: hidden;
}

/* ── ASIDE ── */
.pdv-aside {
  width: 220px;
  flex-shrink: 0;
  background: var(--pdv-aside-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--pdv-aside-border);
}
.pdv-aside-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
  color: rgba(255,255,255,.9);
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--pdv-aside-border);
  flex-shrink: 0;
}
.pdv-aside-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pdv-aside-actions {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--pdv-aside-border);
  flex-shrink: 0;
}

/* Fields inside aside */
.pdv-field-group { display: flex; flex-direction: column; gap: 5px; }
.pdv-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .8px; }
.pdv-select {
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--pdv-radius);
  color: rgba(255,255,255,.9);
  font-size: 12px; font-weight: 600;
  outline: none; cursor: pointer;
}
.pdv-select option { background: #1e293b; color: #fff; }
.pdv-input {
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--pdv-radius);
  color: rgba(255,255,255,.9);
  font-size: 12px; font-weight: 600;
  outline: none; box-sizing: border-box;
}
.pdv-input::placeholder { color: rgba(255,255,255,.3); }
.pdv-input-sm { padding: 6px 8px; font-size: 12px; }
.pdv-input-addon { display: flex; align-items: center; gap: 0; }
.pdv-input-addon .pdv-addon-text {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.12);
  border-right: none; border-radius: var(--pdv-radius) 0 0 var(--pdv-radius);
  padding: 7px 10px; color: rgba(255,255,255,.5); font-size: 12px;
}
.pdv-input-addon .pdv-input { border-radius: 0 var(--pdv-radius) var(--pdv-radius) 0; }
.pdv-dropdown-list {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 6px;
  max-height: 200px; overflow-y: auto; z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); margin-top: 3px;
}
.pdv-btn-sm {
  padding: 6px 10px; border: none; border-radius: 5px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.pdv-btn-green { background: #16a34a; color: #fff; }

/* Totals card in aside */
.pdv-totals-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--pdv-radius);
  padding: 12px;
}
.pdv-total-row { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.6); padding: 3px 0; }
.pdv-total-divider { border-top: 1px solid rgba(255,255,255,.1); margin: 8px 0; }
.pdv-total-final { display: flex; justify-content: space-between; font-size: 15px; font-weight: 800; color: #fff; }

/* Action buttons */
.pdv-action-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px; border: none; border-radius: var(--pdv-radius);
  font-size: 12px; font-weight: 700; cursor: pointer; width: 100%;
  transition: opacity .15s;
}
.pdv-action-btn:hover { opacity: .88; }
.pdv-action-gray  { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
.pdv-action-green { background: #16a34a; color: #fff; }
.pdv-action-blue  { background: #2563eb; color: #fff; }
.pdv-action-red   { background: #dc2626; color: #fff; }

/* ── MAIN ── */
.pdv-main-v2 {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: 14px;
  gap: 12px;
  background: var(--pdv-bg);
}
.pdv-alert-info {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 7px;
  font-size: 12px; color: #1d4ed8; font-weight: 500; flex-shrink: 0;
}

/* ── TABS ── */
.pdv-tabs-container {
  flex: 1; min-height: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pdv-tabs-header {
  display: flex; gap: 2px;
  padding: 8px 8px 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.pdv-tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border: none; background: transparent;
  font-size: 12px; font-weight: 600;
  color: #94a3b8; cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all .15s;
}
.pdv-tab-btn:hover { color: #475569; background: rgba(0,0,0,.03); }
.pdv-tab-active { background: #fff !important; color: #2563eb !important; box-shadow: 0 1px 0 #fff, 0 -2px 0 #2563eb inset; }

.pdv-tab-panel {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── SEARCH BAR ── */
.pdv-search-bar {
  display: flex; align-items: flex-end; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.pdv-qty-wrap { display: flex; flex-direction: column; gap: 4px; }
.pdv-qty-wrap .pdv-label { color: #64748b; }
.pdv-input-qty {
  width: 70px; padding: 8px 10px; text-align: center;
  background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 7px;
  font-size: 15px; font-weight: 800; color: #1e293b; outline: none;
  box-sizing: border-box;
}
.pdv-input-qty:focus { border-color: #2563eb; background: #fff; }
.pdv-prod-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pdv-prod-wrap .pdv-label { color: #64748b; }
.pdv-input-scan {
  width: 100%; padding: 9px 12px 9px 38px;
  border: 1.5px solid #e2e8f0; border-radius: 7px 0 0 7px;
  font-size: 14px; font-weight: 600; color: #1e293b;
  outline: none; box-sizing: border-box; background: #f8fafc;
  transition: all .15s;
}
.pdv-input-scan:focus { border-color: #2563eb; background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.pdv-scan-btn {
  background: #2563eb; border: none; color: #fff;
  padding: 9px 14px; border-radius: 0 7px 7px 0;
  cursor: pointer; display: flex; align-items: center;
  flex-shrink: 0;
}
.pdv-scan-btn:hover { background: #1d4ed8; }
.pdv-ean-drop {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1.5px solid #2563eb; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 999;
  max-height: 300px; overflow-y: auto; margin-top: 2px;
}

/* ── CART TABLE ── */
.pdv-cart-wrap {
  flex: 1; overflow-y: auto; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pdv-cart-table {
  width: 100%; border-collapse: collapse; min-width: 560px;
  font-size: 12.5px;
}
.pdv-cart-table thead th {
  padding: 9px 12px; text-align: left;
  background: #f8fafc; border-bottom: 1.5px solid #e2e8f0;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: #94a3b8; white-space: nowrap;
}
.pdv-cart-table tbody td {
  padding: 9px 12px; border-bottom: 1px solid #f1f5f9;
  color: #334155; vertical-align: middle;
}
.pdv-cart-table tbody tr:hover td { background: #f8fafc; }
.pdv-cart-table tfoot td {
  padding: 10px 12px; border-top: 2px solid #e2e8f0;
  font-size: 12px; color: #64748b; background: #f8fafc;
}
.pdv-cart-empty {
  text-align: center; padding: 32px 16px;
  color: #94a3b8; font-style: italic; font-size: 13px;
}
.pdv-payments-list { flex: 1; overflow-y: auto; overflow-x: auto; padding: 0 16px; }

/* ── RECEBIMENTO ── */
.pdv-rec-summary {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px; padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9; flex-shrink: 0;
  align-items: stretch;
}
.pdv-rec-adjustments {
  display: flex; gap: 12px; align-items: flex-end;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 14px 16px;
}
.pdv-rec-field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pdv-rec-field .pdv-label, .pdv-pay-field .pdv-label { color: #64748b; }
.pdv-rec-field .pdv-input, .pdv-pay-field .pdv-select, .pdv-pay-field .pdv-input {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 7px;
  color: #1e293b; width: 100%; box-sizing: border-box;
}
.pdv-rec-field .pdv-input:focus, .pdv-pay-field .pdv-input:focus {
  border-color: #2563eb; background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.pdv-rec-totals {
  background: linear-gradient(135deg,#1e293b 0%,#0f172a 100%);
  border-radius: 10px; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.pdv-rec-total-row { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.5); padding: 1px 0; }
.pdv-rec-total-row span:last-child { font-weight: 600; color: rgba(255,255,255,.75); }
.pdv-rec-total-final {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 18px; font-weight: 900; color: #fff;
  padding-top: 10px; margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.pdv-rec-total-final span:first-child { font-size: 12px; font-weight: 500; color: rgba(255,255,255,.6); }
@media (max-width: 700px) {
  .pdv-rec-summary { grid-template-columns: 1fr; }
}

/* Payment form */
.pdv-payment-form {
  display: grid;
  grid-template-columns: 2fr 100px 130px 1fr;
  gap: 10px; align-items: flex-end;
  padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
  background: #fafbfc;
}
@media (max-width: 900px) {
  .pdv-payment-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .pdv-payment-form { grid-template-columns: 1fr; }
}
.pdv-pay-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.pdv-pay-field-sm { flex: 0 0 100px; min-width: 90px; }
.pdv-select-pay { padding: 8px 10px; font-size: 13px; }
.pdv-input-valor {
  padding: 9px 12px; border: 1.5px solid #2563eb; border-radius: 7px 0 0 7px;
  font-size: 15px; font-weight: 800; color: #2563eb;
  background: #eff6ff; outline: none; width: 100%; box-sizing: border-box;
}
.pdv-input-valor:focus { background: #fff; }
.pdv-add-pay-btn {
  background: #2563eb; border: none; color: #fff;
  padding: 9px 14px; border-radius: 0 7px 7px 0;
  cursor: pointer; display: flex; align-items: center;
  flex-shrink: 0;
}
.pdv-add-pay-btn:hover { background: #1d4ed8; }
.pdv-pay-summary {
  padding: 10px 16px;
  display: flex; justify-content: flex-end; gap: 24px;
  flex-shrink: 0;
  border-top: 1px solid #f1f5f9; background: #f8fafc;
}
.pdv-pay-summary-row { display: flex; gap: 10px; font-size: 12px; align-items: center; }

/* ── RESPONSIVE PDV ── */
@media (max-width: 900px) {
  .pdv-aside { width: 180px; }
}
@media (max-width: 700px) {
  .pdv-layout-v2 { flex-direction: column; overflow-y: auto; overflow-x: hidden; height: auto; }
  .pdv-aside { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .pdv-aside-body { flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 8px; }
  .pdv-aside-actions { flex-direction: row; flex-wrap: wrap; }
  .pdv-action-btn { flex: 1; min-width: calc(50% - 6px); }
  .pdv-aside-header { width: 100%; }
  .pdv-totals-card { width: 100%; }
  .pdv-field-group { min-width: calc(50% - 4px); }
  .pdv-tabs-container { min-height: 500px; }
}

/* Dashboard responsive classes */
.dash-kpi-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.dash-main-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px; margin-bottom: 16px; align-items: start;
}
.dash-bottom-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px; margin-bottom: 4px;
}
.dash-cat-cli-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px;
}
.dash-period-wrap {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}

/* ============================================================
   RESPONSIVE — MOBILE EXTENDED (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* ── PDV Mobile ── */
  .pdv-mobile-layout {
    flex-direction: column; height: auto;
    padding: 8px; gap: 10px;
  }
  .pdv-sidebar-actions {
    width: 100%; flex-direction: row; flex-wrap: wrap;
    border-right: none; border-bottom: 1px solid #e1e8ed;
    padding: 0 0 8px 0; gap: 6px; flex-shrink: 0;
  }
  .pdv-sidebar-actions button {
    flex: 1; min-width: calc(50% - 4px); font-size: 12px !important;
    padding: 10px 8px !important;
  }
  .pdv-main-area { padding-right: 0; }
  .pdv-top-section { flex-direction: column; gap: 10px; }
  .pdv-filters-grid { grid-template-columns: 1fr; gap: 10px; }
  .pdv-total-box { width: 100%; }
  .pdv-prod-input-wrap input { max-width: 100% !important; }
  .pdv-qty-prod-row {
    flex-direction: column; gap: 12px;
    padding: 12px; align-items: stretch;
  }
  .pdv-qty-prod-row > div { align-items: stretch !important; }
  .pdv-qty-prod-row input { width: 100% !important; }
  .pdv-rec-top-flex { flex-direction: column; gap: 12px; }
  .pdv-rec-form-row {
    flex-direction: column; gap: 10px; align-items: stretch;
  }
  .pdv-rec-form-item { min-width: 100%; }
  .pdv-fundo-inner { flex-direction: column; gap: 20px; }
  .pdv-fundo-inner input { width: 100% !important; max-width: 280px; }
  .pdv-fundo-screen { padding: 24px 16px; min-height: auto; }

  /* PDV Cart table → horizontal scroll */
  .pdv-cart-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pdv-cart-table-wrap table { min-width: 600px; }

  /* ── Dashboard Mobile ── */
  .dash-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-main-grid { grid-template-columns: 1fr; }
  .dash-bottom-grid { grid-template-columns: 1fr; }
  .dash-cat-cli-grid { grid-template-columns: 1fr; }
  .dash-period-wrap { flex-direction: column; align-items: flex-start; }

  /* ── WhatsApp Widget Mobile ── */
  .wa-window {
    width: 100% !important; left: 0; right: 0;
    bottom: 60px !important; top: 0;
    border-radius: 0 !important;
    max-height: calc(100vh - 60px) !important;
    position: fixed !important;
  }
  #wa-fab {
    bottom: 72px !important; right: 14px !important;
    z-index: 910 !important;
  }

  /* ── Summary / Financial bars ── */
  .summary-bar { grid-template-columns: 1fr !important; gap: 8px; }
  .summary-item .s-value { font-size: 16px; }
  .credi-summary { grid-template-columns: 1fr 1fr !important; gap: 8px; }

  /* ── Kanban ── */
  .kanban { grid-template-columns: 1fr !important; gap: 10px; }

  /* ── Toast above bottom nav ── */
  #toast { bottom: 72px !important; right: 12px !important; left: 12px; }
  .toast-item { min-width: auto; max-width: 100%; }

  /* ── Pagebar compact ── */
  .pagebar h1 { font-size: 13px; }

  /* ── Client search row in PDV ── */
  .pdv-client-row {
    flex-direction: column !important; gap: 6px !important;
    align-items: stretch !important;
  }
  .pdv-client-row input { width: 100% !important; }
  .pdv-client-row button { align-self: flex-start; }

  /* ── General improvements ── */
  .info-list { font-size: 13px; }
  .info-row { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 0; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE EXTENDED (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .dash-kpi-grid { gap: 8px; }
  .pdv-sidebar-actions button { min-width: calc(50% - 4px); font-size: 11px !important; }
  .credi-summary { grid-template-columns: 1fr !important; }
  .pdv-total-box { padding: 12px; }
  .wa-window { top: 0 !important; }
}

/* ============================================================
   PRINT OVERRIDES
   ============================================================ */
@media print {
  .topnav, .pagebar, .bottom-nav, #toast, #modal-overlay { display: none !important; }
  .content { padding: 0; overflow: visible; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================================
   GLOBAL VISUAL NORMALIZER v3 — Overrides old inline styles
   Makes ALL pages consistent with the design system
   ============================================================ */

/* ── Content wrappers: all page containers look the same ── */
.content > div,
.content > .card,
.content > [style*="border-radius"] {
  animation: pageIn .25s var(--ease) both;
}

/* Normalize old flat cards used in JS render functions */
.content [style*="background:white"][style*="border:1px solid"],
.content [style*="background:#fff"][style*="border:1px solid"] {
  border-color: var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}

/* ── Universal input/select normalization ── */
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
select, textarea {
  font-family: var(--font-body);
  transition: border-color var(--t), box-shadow var(--t);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
}

/* ── Table inside any wrapper ── */
.content table:not(.pdv-cart-table):not(.data-table):not([class]) {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.content table:not(.pdv-cart-table):not(.data-table):not([class]) thead th {
  padding: 11px 14px;
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-2); white-space: nowrap;
  text-align: left;
}
.content table:not(.pdv-cart-table):not(.data-table):not([class]) tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.content table:not(.pdv-cart-table):not(.data-table):not([class]) tbody tr:hover td {
  background: #f8fafc;
}

/* ── Old color overrides → design tokens ── */
/* Blue buttons (#3498db) */
button[style*="background:#3498db"],
button[style*="background: #3498db"] {
  background: var(--accent) !important;
  border-radius: var(--radius) !important;
  font-family: var(--font-body) !important;
  transition: all var(--t) !important;
}
button[style*="background:#3498db"]:hover,
button[style*="background: #3498db"]:hover {
  background: var(--accent-hover) !important;
  transform: translateY(-1px);
}
/* Green buttons (#2ecc71, #16a34a, #4caf50) */
button[style*="background:#2ecc71"],
button[style*="background:#16a34a"],
button[style*="background:#4caf50"],
button[style*="background:#5cb85c"] {
  background: var(--green) !important;
  border-radius: var(--radius) !important;
}
/* Red buttons */
button[style*="background:#e74c3c"],
button[style*="background:#dc2626"],
button[style*="background:#c0392b"] {
  background: var(--red) !important;
  border-radius: var(--radius) !important;
}
/* Gray buttons */
button[style*="background:#95a5a6"],
button[style*="background:#bdc3c7"] {
  background: #64748b !important;
  border-radius: var(--radius) !important;
}

/* ── Inline border-radius normalization ── */
[style*="border-radius:4px"] { border-radius: var(--radius) !important; }
[style*="border-radius:6px"] { border-radius: var(--radius) !important; }
[style*="border-radius:8px"] { border-radius: var(--radius) !important; }
[style*="border-radius:12px"] { border-radius: var(--radius-lg) !important; }

/* ── Page section headers used by module pages ── */
.content h2[style], .content h3[style] {
  font-family: var(--font-display) !important;
  letter-spacing: -.3px !important;
  color: var(--text) !important;
}

/* ── Pagebar title ── */
#page-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

/* ── Filter bars used by all listing pages ── */
.filters {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-input, .filter-select {
  border-radius: var(--radius) !important;
  border: 1.5px solid var(--border-2) !important;
  font-size: 13px !important;
  padding: 8px 12px !important;
  background: white !important;
}
.filter-input:focus, .filter-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
}

/* ── Mobile cards ── */
.mobile-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t);
}
.mobile-card:hover { box-shadow: var(--shadow); }

/* ── Empty states ── */
[style*="Nenhum"][style*="text-align:center"],
td[style*="Nenhum"] {
  color: var(--text-3) !important;
  font-size: 13px !important;
}

/* ── Toasts ── */
.toast-item {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font-body) !important;
  font-size: 13px !important;
}

/* ── Modal header gradient ── */
.modal-header {
  background: white;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  color: var(--text);
}

/* ── Pagebar actions: consistent button sizes ── */
#topbar-actions .btn {
  font-family: var(--font-body);
  font-size: 13px;
}

/* ── Status badges used inline ── */
span[style*="background:#"][style*="border-radius"],
div[style*="background:#"][style*="border-radius:10px"],
div[style*="background:#"][style*="border-radius:20px"] {
  font-family: var(--font-body) !important;
  font-weight: 600 !important;
  font-size: 11px !important;
}

/* ── Scrollbar global style ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Loading skeleton ── */
.sk {
  background: linear-gradient(90deg, #f1f5f9 25%, #e8edf3 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease infinite;
  border-radius: 6px; height: 14px;
}
@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Section headers inside pages ── */
.section-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  color: var(--text); letter-spacing: -.4px;
  margin-bottom: 16px;
}
.section-subtitle {
  font-size: 12.5px; color: var(--text-2);
  margin-top: -12px; margin-bottom: 16px;
}

/* ── Forms: make all standalone inputs look consistent ── */
.content input[type="text"]:not(.filter-input):not([class]),
.content input[type="number"]:not([class]),
.content input[type="email"]:not([class]),
.content select:not(.filter-select):not([class]) {
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  background: white;
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
  box-sizing: border-box;
}

/* ── Dashboard specific improvements ── */
.dash-widget-card {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}
.dash-kpi-card {
  border-radius: var(--radius-lg) !important;
}

/* ── Pagebar: make it taller with more breathing room ── */
.pagebar {
  height: 48px !important;
  padding: 0 24px !important;
}

/* ── Alert/info bars ── */
.alert-low-stock {
  border-radius: var(--radius) !important;
  font-size: 13px !important;
}

/* ── Responsive: hide overflowing content on mobile ── */
@media (max-width: 768px) {
  .content table:not(.pdv-cart-table) { font-size: 12px; }
  .content table:not(.pdv-cart-table) th,
  .content table:not(.pdv-cart-table) td { padding: 8px 10px; }
  #page-title { font-size: 14px; }
}

/* ── Remove max-width constraints that leave white space on wide screens ── */
.content > div[style*="max-width"],
.content > div > div[style*="max-width:900"],
.content > div > div[style*="max-width: 900"],
.content > div > div[style*="max-width:860"],
.content > div > div[style*="max-width:1000"],
.content > div > div[style*="max-width:1100"],
.content > div > div[style*="max-width:800"],
.content > div > div[style*="max-width:700"] {
  max-width: none !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Direct first-level containers should always be full width */
.content > .card,
.content > div:first-child:not(.pdv-layout-v2) {
  width: 100% !important;
  max-width: none !important;
}

/* Content area background ensures consistent look */
.content {
  background: var(--bg) !important;
}

/* Page wrapper cards: fill full width */
.content [style*="background:white"][style*="border:1px"],
.content [style*="background:#fff"][style*="border:1px"] {
  width: 100%;
  box-sizing: border-box;
}

/* ============================================================
   ANTI-OVERFLOW GLOBAL FIX — garante que nada saia da tela
   ============================================================ */
*, *::before, *::after {
  max-width: 100%;
  box-sizing: border-box;
}

/* Elementos que podem forçar largura maior que o viewport */
img, video, iframe, canvas, svg { max-width: 100%; }

/* Grids e flexbox sempre respeitam o container */
.content * {
  min-width: 0;
}

/* Tabelas: sempre com scroll horizontal no wrapper, nunca overflow no body */
.table-wrap {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

/* Cards e páginas: nunca ultrapassam o container */
.card, .page-card, .dash-kpi-card, .stat-card {
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  /* Padding menor nas laterais no mobile */
  .content { padding: 10px 10px 76px !important; overflow-x: hidden !important; }

  /* Grids fixos → 1 coluna no mobile */
  .dashboard-grid-3 { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .dash-kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .dash-main-grid,
  .dash-bottom-grid { grid-template-columns: 1fr !important; }

  /* Textos e valores: não deixar overflow */
  .stat-value, .dash-kpi-card .value, .kpi-value {
    font-size: clamp(14px, 4vw, 22px) !important;
    word-break: break-all;
  }

  /* Flex rows que podem transbordar */
  .pagebar-actions { flex-wrap: wrap; gap: 6px; }
  .filter-bar, .filters { overflow-x: auto !important; }
}

@media (max-width: 480px) {
  .content { padding: 8px 8px 76px !important; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
  .stat-card { padding: 10px 12px !important; }
  .stat-card .stat-value { font-size: 16px !important; }
}
