/* ══════════════════════════════════════════════════════════════
   TU NEGOCIO — Design System v14.0 (redesign visual completo)
   Nenhuma lógica de negócio foi alterada. Este arquivo substitui
   as 3 camadas de overrides que existiam antes (variáveis
   duplicadas, !important em cascata) por um sistema único e
   consistente. Todas as classes usadas pelo JS foram preservadas.
   ══════════════════════════════════════════════════════════════ */

/* ── 1. BASE — tokens de design ─────────────────────────────── */
:root {
  /* Paleta nova (nomes do briefing) */
  --primary: #16A34A;
  --primary-dark: #15803D;
  --primary-light: #DCFCE7;

  --success: #16A34A;
  --success-light: #DCFCE7;

  --danger: #DC2626;
  --danger-light: #FEE2E2;

  --warning: #F59E0B;
  --warning-light: #FEF3C7;

  --info: #2563EB;
  --info-light: #DBEAFE;

  --purple: #7C3AED;
  --purple-light: #EDE9FE;

  --background: #F6F8FA;
  --surface: #FFFFFF;
  --surface-secondary: #F8FAFC;

  --border: #E5E7EB;
  --border-light: #EEF2F5;

  --text: #111827;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --text-disabled: #9CA3AF;

  --sidebar: #0F172A;
  --sidebar-secondary: #111827;
  --sidebar-text: #CBD5E1;
  --sidebar-muted: #64748B;

  --white: #FFFFFF;

  --radio-card: 12px;
  --radio-input: 8px;
  --radio-badge: 999px;
  --sombra: 0 1px 3px rgba(15, 23, 42, .06);
  --sombra-md: 0 4px 16px rgba(15, 23, 42, .10);

  /* ── Nomes antigos mantidos como alias: todo o CSS/JS/estilos
     inline existentes (inclusive os 12 arquivos de páginas) usam
     estas variáveis e continuam funcionando sem tocar em uma
     linha de JS ── */
  --verde: var(--primary);
  --verde-claro: var(--primary-light);
  --verde-hover: var(--primary-dark);
  --azul: var(--info);
  --azul-claro: var(--info-light);
  --rojo: var(--danger);
  --rojo-claro: var(--danger-light);
  --naranja: var(--warning);
  --naranja-claro: var(--warning-light);
  --amarillo: var(--warning);
  --amarillo-claro: var(--warning-light);
  --gris-oscuro: var(--sidebar);
  --gris-claro: var(--surface-secondary);
  --gris-borde: var(--border);
  --blanco: var(--surface);
  --fondo: var(--background);
  --texto: var(--text);
  --texto-suave: var(--text-muted);
  --radio: var(--radio-input);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; overflow-x: hidden; max-width: 100vw; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -.2px; }

/* ── Ícones SVG (icons.js) — outline consistente ────────────── */
.ico { width: 17px; height: 17px; vertical-align: -3px; flex-shrink: 0; }
.nav-icon .ico { width: 18px; height: 18px; vertical-align: -4px; }
.btn .ico { margin-right: 2px; }
.btn-sm .ico { width: 15px; height: 15px; vertical-align: -3px; margin-right: 0; }

/* ── 2. LAYOUT ───────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }
#page-content { padding: 24px; flex: 1; }
.conteudo { padding: clamp(10px, 2vw, 24px); }

.page-header { padding: 0 0 18px; }
.page-header h1, .page-header h2,
#page-content > h1, #page-content > h2 { letter-spacing: -.4px; }

/* ── 3. SIDEBAR ──────────────────────────────────────────────── */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .2s, transform .2s;
}
#main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

#sidebar .logo { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); position: relative; }
#sidebar .logo h1 { color: #fff; font-size: 16px; font-weight: 700; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
#sidebar .logo span.logo-sub,
#sidebar .logo span { color: var(--sidebar-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.3px; }

#btn-colapsar-sidebar {
  position: absolute; top: 18px; right: -12px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sombra); z-index: 5; transition: transform .2s, color .15s, border-color .15s;
}
#btn-colapsar-sidebar:hover { color: var(--primary); border-color: var(--primary); }
#btn-menu-movil { display: none; }

#sidebar nav { flex: 1; padding: 10px; overflow-y: auto; }

.nav-section {
  padding: 14px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  user-select: none;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(22,163,74,.14);
  color: #22C55E;
  border-left-color: #22C55E;
}
.nav-item .nav-icon { width: 18px; text-align: center; display: inline-flex; opacity: .95; }
.nav-item.active .nav-icon { opacity: 1; }

#sidebar .sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.10);
  font-size: 12px;
  color: rgba(255,255,255,.5);
}
#sidebar .sidebar-footer .user-info { font-size: 13px; color: #fff; font-weight: 600; }
.sidebar-footer .user-chip { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.user-avatar {
  width: 32px; height: 32px; min-width: 32px; border-radius: 50%;
  background: rgba(34,197,94,.18); color: #4ADE80;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-chip-info { display: flex; flex-direction: column; overflow: hidden; }
.user-chip-info .user-info { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-rol { font-size: 11px; color: var(--sidebar-muted); }
.btn-peligro-sutil { background: var(--danger-light); color: #B91C1C; border: 1px solid #FCA5A5; }
.btn-peligro-sutil:hover { background: #FECACA; }

/* ── Sidebar recolhida (persistente) ── */
#app.sidebar-colapsada #sidebar { width: 64px; min-width: 64px; }
#app.sidebar-colapsada #main { margin-left: 64px; }
#app.sidebar-colapsada .logo { padding: 16px 0; text-align: center; }
#app.sidebar-colapsada .logo h1 { justify-content: center; font-size: 20px; }
#app.sidebar-colapsada .logo-texto,
#app.sidebar-colapsada .logo-sub,
#app.sidebar-colapsada .nav-label,
#app.sidebar-colapsada .nav-section,
#app.sidebar-colapsada .btn-texto,
#app.sidebar-colapsada .user-chip-info { display: none; }
#app.sidebar-colapsada .nav-item { justify-content: center; padding: 0; }
#app.sidebar-colapsada .sidebar-footer { display: flex; flex-direction: column; align-items: center; }
#app.sidebar-colapsada .sidebar-footer .btn { width: 34px !important; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; }
#app.sidebar-colapsada #btn-colapsar-sidebar { transform: rotate(180deg); }

/* ── 4. TOPBAR ───────────────────────────────────────────────── */
#topbar {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
#topbar h2 { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.topbar-titulo-wrap { display: flex; align-items: center; gap: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions .btn, .topbar-actions a.btn { min-height: 32px; }

.btn-campana {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-campana:hover { background: var(--surface-secondary); color: var(--text); border-color: #CFD7E2; }
.btn-campana .ico { width: 18px; height: 18px; vertical-align: middle; margin: 0; }
.dot-alerta {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--surface);
}

#btn-ayuda-ctx {
  background: var(--info); color: #fff; width: 28px; height: 28px;
  border-radius: 50%; padding: 0; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
}
.btn-soporte { background: #25D366; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.topbar-fecha { color: var(--text-muted); font-size: 13px; padding-left: 10px; border-left: 1px solid var(--border); margin-left: 2px; }
/* v13.9.54: cotização na barra superior */
.topbar-cot { font-size: 13px; color: var(--text); padding-left: 10px; border-left: 1px solid var(--border); margin-left: 2px; white-space: nowrap; cursor: help; }
.topbar-cot b { color: var(--text-muted); font-weight: 700; font-size: 11px; margin-right: 2px; }
.topbar-cot .tc-sep { color: var(--text-muted); margin: 0 7px; }
.topbar-cot .tc-tag { font-size: 10px; font-weight: 700; color: var(--warning); margin-left: 6px; text-transform: uppercase; }
.topbar-cot.antiga { color: var(--warning); }
@media (max-width: 1024px) { .topbar-cot { display: none !important; } }
.topbar-user-chip {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: default;
}

/* ── 5. CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radio-card);
  box-shadow: var(--sombra);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.card-body { padding: 20px; }

/* ── KPI / stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radio-card);
  padding: 20px;
  box-shadow: var(--sombra);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; min-width: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-icon .ico { width: 22px; height: 22px; }
.stat-icon.verde    { background: var(--primary-light); color: var(--primary); }
.stat-icon.azul     { background: var(--info-light); color: var(--info); }
.stat-icon.rojo     { background: var(--danger-light); color: var(--danger); }
.stat-icon.naranja  { background: var(--warning-light); color: var(--warning); }
.stat-icon.amarillo { background: var(--warning-light); color: var(--warning); }

.stat-info .stat-valor { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -.4px; }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ── Indicadores secundários do dashboard ── */
.dash-indicadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dash-indicador {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.dash-indicador:hover { box-shadow: var(--sombra-md); transform: translateY(-1px); }
.dash-indicador .di-icon { font-size: 18px; width: 30px; text-align: center; }
.dash-indicador .di-valor { font-size: 16px; font-weight: 750; line-height: 1.2; }
.dash-indicador .di-label { font-size: 11px; color: var(--text-muted); }
.dash-indicador.di-alerta .di-valor { color: var(--danger); }
.dash-indicador.di-ok .di-valor { color: var(--primary); }

/* ── 6. TABLES ───────────────────────────────────────────────── */
.tabla-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; table-layout: auto; }
thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--surface-secondary); }
tbody tr:hover { background: var(--primary-light); }
td.gs, th.gs, .text-right { font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .col-ocultar-md { display: none !important; } }
@media (max-width: 800px)  { .col-ocultar-sm { display: none !important; } }

/* ── 7. BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radio-input);
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
  max-width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; font-weight: 700; }

.btn-verde   { background: var(--primary); color: #fff; }
.btn-verde:hover { background: var(--primary-dark); }
.btn-azul    { background: var(--info); color: #fff; }
.btn-azul:hover { background: #1d4ed8; }
.btn-rojo    { background: var(--danger); color: #fff; }
.btn-rojo:hover { background: #b91c1c; }
.btn-naranja { background: var(--warning); color: #fff; }
.btn-naranja:hover { background: #d97706; }
.btn-gris    { background: var(--surface-secondary); color: var(--text); }
.btn-gris:hover { background: #E9EDF2; }
.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-secondary); border-color: #CFD7E2; }

/* ── 8. FORMS ────────────────────────────────────────────────── */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }

input[type=text], input[type=number], input[type=date], input[type=password],
input[type=email], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radio-input);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
input[readonly] { background: var(--surface-secondary); color: var(--text-muted); }
input::placeholder, textarea::placeholder { color: var(--text-disabled); }

.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: clamp(140px, 30%, 300px); }

/* ── 9. BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--radio-badge);
  font-size: 11px;
  font-weight: 700;
}
.badge-verde    { background: var(--primary-light); color: var(--primary-dark); }
.badge-rojo     { background: var(--danger-light); color: var(--danger); }
.badge-naranja  { background: var(--warning-light); color: #9a5b00; }
.badge-amarillo { background: var(--warning-light); color: #9a5b00; }
.badge-azul     { background: var(--info-light); color: var(--info); }
.badge-gris     { background: var(--surface-secondary); color: var(--text-muted); }

/* ── 10. ALERTS ──────────────────────────────────────────────── */
.alerta {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.alerta-rojo     { background: var(--danger-light); border: 1px solid #F5C6CB; color: #7B1A13; }
.alerta-naranja  { background: var(--warning-light); border: 1px solid #FCD3B0; color: #7A2E00; }
.alerta-amarillo { background: var(--warning-light); border: 1px solid #FDE8A0; color: #7A5000; }
.alerta-verde    { background: var(--primary-light); border: 1px solid #B2DFCC; color: #0D4E2B; }
.alerta-badge { background: var(--danger); color: #fff; border-radius: var(--radio-badge); padding: 2px 7px; font-size: 11px; font-weight: 700; margin-left: 4px; }

/* ── 10b. NOTIFICATION DRAWER (Inventario) ──────────────────── */
.btn-notif { position: relative; }
.btn-notif .dot-alerta { position: absolute; top: 3px; right: 3px; }

.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.42);
  z-index: 1000;
  display: flex; justify-content: flex-end;
}
.drawer-panel {
  width: min(380px, 92vw);
  height: 100%;
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(15,23,42,.18);
  display: flex; flex-direction: column;
  animation: drawerIn .18s ease;
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.drawer-body { padding: 14px 16px; overflow-y: auto; flex: 1; }

/* ── Cliente: nombre clicável en la tabla + pestañas del drawer (v14) ── */
.cli-nombre-link { font-weight: 600; cursor: pointer; }
.cli-nombre-link:hover { color: var(--primary); text-decoration: underline; }
.cli-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.cli-tab-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px 4px; margin-right: 14px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.cli-tab-btn:hover { color: var(--text); }
.cli-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── 11. MODALS ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border-light);
  width: clamp(300px, 90vw, 560px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 70px rgba(15,23,42,.20);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border-radius: 8px; border: none;
  background: var(--surface-secondary); color: var(--text-muted);
  font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface-secondary);
}

/* ── 12. TOASTS ──────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(15,23,42,.16);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast-verde   { background: var(--primary); }
.toast-rojo    { background: var(--danger); }
.toast-naranja { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── 13. LOGIN ───────────────────────────────────────────────── */
#login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(22,163,74,.10), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(37,99,235,.08), transparent 28%),
    var(--sidebar);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 36px;
  width: min(380px, calc(100vw - 32px));
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 60px rgba(15,23,42,.18);
}
.login-box .login-logo { text-align: center; margin-bottom: 26px; }
.login-box .login-logo .icon {
  width: 58px; height: 58px;
  background: var(--primary-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
  color: var(--primary);
}
.login-box .login-logo h2 { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.login-box .login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.login-error {
  background: var(--danger-light);
  border: 1px solid #F5C6CB;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radio-input);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ── 14. PDV ─────────────────────────────────────────────────── */
.pdv-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 60px - 48px);
  overflow: hidden;
}
.pdv-produtos, .pdv-productos {
  flex: 1; min-width: 0; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-card);
  padding: 10px;
}
.pdv-caixa, .pdv-carrito {
  width: clamp(300px, 28vw, 400px);
  min-width: 300px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-card);
  display: flex; flex-direction: column; overflow: hidden;
}

/* v13.9.49: lista vertical compacta (sin cards, sin imágenes) en vez de grid de cards */
.pdv-grid { display: flex; flex-direction: column; }
.producto-btn {
  display: grid;
  grid-template-columns: 90px 1fr 110px 60px 30px;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border-light);
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  transition: background .12s;
}
.producto-btn:last-child { border-bottom: none; }
.producto-btn:hover { background: var(--primary-light); }
.pb-codigo { font-family: monospace; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-nombre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-badge { color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 5px; }
.pb-precio { text-align: right; font-weight: 700; color: var(--primary); white-space: nowrap; }
.pb-stock { text-align: right; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.pb-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.pb-add {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-weight: 800; font-size: 15px; line-height: 1;
}
.producto-btn:hover .pb-add { background: var(--primary); color: #fff; }

/* v13.9.54: divisor arrastável entre produtos e carrinho */
.pdv-divisor {
  cursor: col-resize; background: var(--border-light); touch-action: none;
  position: relative; transition: background .12s;
}
.pdv-divisor::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 2px; height: 36px; border-radius: 2px; background: var(--text-muted); opacity: .45;
}
.pdv-divisor:hover, .pdv-divisor.arrastando { background: var(--primary-light); }
.pdv-divisor.arrastando::after { background: var(--primary); opacity: 1; }

/* v13.9.54: controles Lista / Cuadros — só símbolos, na linha do cabeçalho */
/* à direita de STOCK, sobre o espaço da coluna do botão + (cresce para a esquerda no modo quadros) */
.pdv-vista { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: inline-flex; gap: 2px; align-items: center; text-transform: none; letter-spacing: 0; }
.pdv-vbtn {
  width: 21px; height: 21px; padding: 0; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-muted); font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.pdv-vbtn:hover { border-color: var(--primary); color: var(--primary); }
.pdv-vbtn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pdv-vsep { width: 1px; height: 14px; background: var(--border); margin: 0 3px; }
.pdv-sq { display: inline-block; border-radius: 2px; background: currentColor; }
.pdv-sq.sq-s { width: 6px; height: 6px; } .pdv-sq.sq-m { width: 9px; height: 9px; } .pdv-sq.sq-l { width: 12px; height: 12px; }
#pdv-col-header.modo-cuadros .lbl { visibility: hidden; }

/* v13.9.54: modo quadros — mesma ação da lista (pdvAgregar) */
.pdv-grid.modo-cuadros {
  display: grid; gap: 10px; padding: 12px;
  grid-template-columns: repeat(auto-fill, minmax(var(--pc-min, 170px), 1fr));
  align-content: start;
}
.pdv-grid.modo-cuadros.tam-s { --pc-min: 130px; --pc-alto: 104px; --pc-fonte: 12px; --pc-preco: 14px; }
.pdv-grid.modo-cuadros.tam-m { --pc-min: 170px; --pc-alto: 124px; --pc-fonte: 13px; --pc-preco: 16px; }
.pdv-grid.modo-cuadros.tam-l { --pc-min: 220px; --pc-alto: 150px; --pc-fonte: 15px; --pc-preco: 19px; }
.producto-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  min-height: var(--pc-alto, 124px); padding: 10px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; color: var(--text); font-size: var(--pc-fonte, 13px);
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.producto-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.producto-card:active { transform: scale(.98); }
.pc-nombre {
  font-weight: 700; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.pc-badges:empty { display: none; }
.pc-precio { margin-top: auto; font-weight: 800; color: var(--primary); font-size: var(--pc-preco, 16px); }
.pc-unit { display: block; font-size: 10px; font-weight: 600; color: #be185d; }
.pc-pie { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pc-codigo { font-family: monospace; font-size: 10px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pdv-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 13px; font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, border-color .12s;
}
.pdv-chip:hover { border-color: var(--primary); }
.pdv-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pdv-chip-filtros.active { background: var(--warning); border-color: var(--warning); color: #fff; }

.carrito-items { flex: 1; overflow-y: auto; }
.carrito-item {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.carrito-item .item-nombre { flex: 1; font-weight: 600; }
.carrito-item .item-qty { display: flex; align-items: center; gap: 3px; }
.qty-btn {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-secondary);
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.qty-btn:hover { background: var(--border); }
.carrito-item .item-subtotal { font-weight: 700; min-width: 90px; text-align: right; color: var(--primary); font-size: 13px; }

.carrito-total { padding: 15px 16px; border-top: 1px solid var(--border); background: var(--surface-secondary); }
.carrito-total .total-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-muted); margin-bottom: 4px; }
.carrito-total .total-final {
  display: flex; justify-content: space-between;
  font-size: 32px; font-weight: 800; letter-spacing: -.6px;
  color: var(--primary); margin-top: 8px;
}
.btn-cobrar-wrap { position: sticky; bottom: 0; background: var(--surface); padding: 12px; border-top: 1px solid var(--border); }
.btn-cobrar-wrap .btn { width: 100%; height: 50px; font-size: 15px; font-weight: 700; }

/* ── PDV tela cheia (F10) / fonte grande (A+) / ferramentas ── */
body.pdv-full #sidebar { display: none; }
body.pdv-full #topbar  { display: none; }
body.pdv-full #main    { margin-left: 0; }
body.pdv-full #page-content { padding: 8px !important; }
body.pdv-full #pdv-root { height: calc(100vh - 16px) !important; }
body.pdv-fg #pdv-root { font-size: 115%; }
body.pdv-fg #pdv-root .gs { font-size: 1.08em; }

.pdv-tools {
  position: fixed; bottom: 14px; left: 254px; z-index: 60;
  display: none; gap: 6px;
}
body.pagina-pdv .pdv-tools { display: flex; }
body.pdv-full .pdv-tools { left: 14px; }
.pdv-tools button {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--text);
  box-shadow: 0 5px 14px rgba(15,23,42,.08); display: inline-flex; align-items: center; gap: 5px;
}
.pdv-tools button:hover { background: var(--surface-secondary); }
.pdv-tools kbd { font-size: 10px; background: var(--surface-secondary); padding: 1px 4px; border-radius: 4px; }

/* ── 15. INVENTORY ───────────────────────────────────────────── */
.inv-busca-filtro-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; border-left: 1px solid var(--border);
  padding: 6px 10px 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); border-radius: 0;
}
.inv-busca-filtro-btn:hover { color: var(--primary); }
.inv-filtros-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--sombra-md); padding: 12px; min-width: 220px;
  display: flex; flex-direction: column; gap: 4px;
}
.inv-filtros-pop label { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-top: 6px; }
.inv-filtros-pop label:first-child { margin-top: 0; }
.inv-filtros-pop select { width: 100%; }
.inv-side-card { background: var(--surface); border-radius: var(--radio-card); border: 1px solid var(--border); box-shadow: var(--sombra); overflow: hidden; }
.inv-side-card-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); background: var(--surface-secondary);
}
.inv-side-card-body { padding: 8px 14px; }
.inv-alerta-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.inv-alerta-row:last-child { border-bottom: none; }
.inv-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.inv-dot.rojo    { background: var(--danger); }
.inv-dot.naranja { background: var(--warning); }
.inv-dot.amarillo{ background: var(--warning); }
.inv-dot.verde   { background: var(--primary); }
.compra-row { padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.compra-row:last-child { border-bottom: none; }
.compra-row strong { display: block; color: var(--text); font-size: 13px; }
.compra-row span { color: var(--text-muted); font-size: 11px; }
.inv-filtros { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
/* v13.9.54: chips de categoria + stock no Inventario (mesmo estilo do PDV) */
.inv-cats { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 4px; }
.inv-stock-grupo { display: inline-flex; gap: 6px; margin-left: auto; padding-left: 12px; flex-shrink: 0; }
.inv-chip-cero.active { background: var(--danger, #dc2626); border-color: var(--danger, #dc2626); color: #fff; }
.inv-filtros input { flex: 1; min-width: 150px; }
.inv-filtros select { min-width: 140px; }
.unidad-tag { display: inline-block; background: var(--info-light); color: #0369A1; border-radius: 12px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.stock-ok   { color: var(--primary); font-weight: 600; }
.stock-bajo { color: var(--warning); font-weight: 600; }
.stock-cero { color: var(--danger); font-weight: 700; }

/* ── 16. HELP TOOLTIP ────────────────────────────────────────── */
.help-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--info); color: #fff;
  font-size: 10px; font-weight: 700; cursor: pointer;
  position: relative; margin-left: 5px; vertical-align: middle;
  user-select: none; flex-shrink: 0;
}
.help-tip__bubble {
  display: none;
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--sidebar); color: #F1F5F9;
  font-size: 12px; font-weight: 400;
  padding: 8px 12px; border-radius: 8px; width: 230px; line-height: 1.5;
  z-index: 9999; pointer-events: none; white-space: normal;
  box-shadow: 0 4px 15px rgba(0,0,0,.3);
  text-transform: none; letter-spacing: 0;
}
.help-tip__bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--sidebar);
}
.help-tip:hover .help-tip__bubble, .help-tip--open .help-tip__bubble { display: block; }

/* ── 17. EMPTY STATES / SKELETON ─────────────────────────────── */
.empty-state, .tabla-vacia, .no-data {
  color: var(--text-disabled);
  text-align: center;
  padding: 40px 20px;
}
.empty-state .ico, .tabla-vacia .ico { width: 32px; height: 32px; opacity: .5; margin-bottom: 10px; }

@keyframes skPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.sk-page { padding: 4px 0; }
.sk { background: var(--border); border-radius: 6px; height: 14px; margin-bottom: 10px; animation: skPulse 1.4s ease-in-out infinite; }
.sk.sk-titulo { width: 35%; height: 22px; margin-bottom: 16px; }
.sk.sk-card   { height: 72px; margin-bottom: 14px; border-radius: var(--radio-card); }
.sk.sk-linea  { width: 100%; }
.sk.sk-corta  { width: 60%; }

/* ── 18. UTILITIES ───────────────────────────────────────────── */
.text-verde   { color: var(--primary); }
.text-rojo    { color: var(--danger); }
.text-naranja { color: var(--warning); }
.text-suave   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.font-bold    { font-weight: 700; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.gs { font-family: 'SF Mono', 'Consolas', monospace; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════
   19. RESPONSIVE — testado em 1280×720, 1366×768, 1440×900,
   1600×900, 1920×1080, tablet e mobile
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 1920px) {
  html { font-size: 16px; }
  #page-content { padding-left: 32px; padding-right: 32px; }
  .pdv-caixa, .pdv-carrito { width: 420px; }
}

@media (max-width: 1200px) {
  #page-content { padding: 20px 22px 28px; }
}

@media (max-width: 1100px) {
  #sidebar { width: 200px; min-width: 200px; }
  #main { margin-left: 200px; }
  .nav-item { font-size: 13px; }
  .pdv-tools { left: 214px; }
}

@media (max-width: 1024px) {
  #sidebar { width: 64px; min-width: 64px; overflow: hidden; }
  #main { margin-left: 64px; }
  #sidebar .logo { padding: 16px 0; text-align: center; }
  #sidebar .logo-texto, #sidebar .logo-sub { display: none; }
  #sidebar .logo h1 { justify-content: center; }
  #sidebar nav { padding: 10px 6px; }
  .nav-section { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-label { display: none; }
  #sidebar .sidebar-footer { padding: 10px 6px; display: flex; flex-direction: column; align-items: center; }
  .sidebar-footer .user-chip-info,
  #sidebar .sidebar-footer .btn-texto { display: none; }
  #sidebar .sidebar-footer .btn { width: 34px !important; height: 34px; padding: 0; }
  #btn-colapsar-sidebar { display: none; }
  .pdv-tools { left: 78px; }
}

@media (max-width: 900px) {
  .pdv-layout { flex-direction: column; height: auto; overflow: visible; }
  .pdv-caixa, .pdv-carrito { width: 100%; min-width: 0; }
  .pdv-produtos, .pdv-productos { min-height: 55vh; }
}

@media (max-width: 700px) {
  #btn-colapsar-sidebar { display: none; }
  #btn-menu-movil {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border: none; background: none;
    font-size: 18px; cursor: pointer; color: var(--text);
  }
  #sidebar { transform: translateX(-100%); width: 240px !important; min-width: 240px !important; z-index: 200; }
  #app.sidebar-colapsada #sidebar { transform: translateX(0); width: 240px !important; min-width: 240px !important; }
  #app.sidebar-colapsada #sidebar .nav-label,
  #app.sidebar-colapsada #sidebar .nav-section,
  #app.sidebar-colapsada #sidebar .logo-texto,
  #app.sidebar-colapsada #sidebar .logo-sub,
  #app.sidebar-colapsada #sidebar .btn-texto,
  #app.sidebar-colapsada #sidebar .user-chip-info { display: block; }
  #app.sidebar-colapsada #sidebar .nav-item { justify-content: flex-start; padding: 0 12px; }
  #app.sidebar-colapsada #sidebar .sidebar-footer { align-items: stretch; }
  #app.sidebar-colapsada #sidebar .sidebar-footer .btn { width: 100% !important; height: auto; padding: 8px; }
  #main, #app.sidebar-colapsada #main { margin-left: 0 !important; }
  .topbar-fecha { display: none; }
  #topbar { height: 56px; padding: 0 14px; }
  #topbar h2 { font-size: 15px; }
  #page-content, .conteudo, .page-header { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-info .stat-valor { font-size: 20px; }
  .card-body { padding: 14px; }
  .modal { width: min(520px, 95vw); max-height: 92vh; }
  .pdv-tools { display: none; }
}
