/* ============================================================
   STOCKYA — Estilos principales
   Archivo: css/styles.css
   ============================================================ */

:root {
  --verde:       #00C77B;
  --verde-dark:  #009E62;
  --verde-glow:  rgba(0,199,123,0.18);
  --rojo:        #FF4C4C;
  --amarillo:    #FFB800;
  --azul:        #5B8EFF;
  --bg:          #0D0F14;
  --bg2:         #141720;
  --bg3:         #1C2030;
  --card:        #1E2235;
  --border:      rgba(255,255,255,0.07);
  --text:        #E8EAF0;
  --muted:       #6B7280;
  --font-head:   'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body:   'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius:      14px;
  --shadow:      0 8px 32px rgba(0,0,0,0.45);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 16px 0 16px;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow: hidden; /* el scroll vive en #navScrollWrap, no aquí */
}

/* Scrollbar del área de navegación — fina y discreta */
#navScrollWrap::-webkit-scrollbar { width: 3px; }
#navScrollWrap::-webkit-scrollbar-track { background: transparent; }
#navScrollWrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; }


.logo-block { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; padding: 0 8px; }

.logo-icon {
  width: 36px; height: 36px;
  background: var(--verde);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.logo-text { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--text); letter-spacing: -0.5px; }
.logo-text span { color: var(--verde); }

.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 10px; margin-bottom: 8px; margin-top: 20px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 400; color: var(--muted);
  margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover  { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--verde-glow); color: var(--verde); font-weight: 500; }
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }

.nav-badge {
  margin-left: auto; background: var(--rojo); color: white;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.sidebar-footer { margin-top: auto; padding: 16px 10px; border-top: 1px solid var(--border); padding-bottom: max(16px, env(safe-area-inset-bottom)); }

/* Toggle tema */
.theme-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px; cursor: pointer; border-radius: 10px; transition: all 0.2s;
}
.theme-toggle-row:hover { background: var(--bg3); padding-left: 8px; padding-right: 8px; }
.theme-toggle-label { font-size: 13px; color: var(--muted); user-select: none; }
.theme-toggle-switch {
  width: 40px; height: 22px; background: var(--bg3);
  border-radius: 99px; position: relative; border: 1px solid var(--border);
  transition: background 0.3s; flex-shrink: 0;
}
.theme-toggle-switch.activo { background: var(--verde); border-color: var(--verde); }
.theme-toggle-thumb {
  width: 16px; height: 16px; background: white; border-radius: 50%;
  position: absolute; top: 2px; left: 2px;
  transition: transform 0.3s ease; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.theme-toggle-switch.activo .theme-toggle-thumb { transform: translateX(18px); }

.user-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--verde), #00A8FF);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white; flex-shrink: 0;
}

.user-info  { flex: 1; overflow: hidden; }
.user-name  { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan  { font-size: 11px; color: var(--verde); }

.logout-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; flex-shrink: 0; transition: all 0.2s;
}
.logout-btn:hover { background: rgba(255,76,76,0.12); border-color: var(--rojo); color: var(--rojo); }

/* ============================================================
   CONTENIDO PRINCIPAL
   ============================================================ */
.main-content { margin-left: 240px; flex: 1; padding: 28px 32px; min-height: 100vh; }

/* Las pantallas usan animación — ver sección ANIMACIONES */
.screen { display: none; }
.screen.active { display: block; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; }
.page-title  { font-family: var(--font-head); font-weight: 700; font-size: 26px; letter-spacing: -0.5px; }
.page-subtitle { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ============================================================
   BOTONES
   ============================================================ */
.btn-primary {
  background: var(--verde); color: #0D0F14;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn-primary:hover { background: var(--verde-dark); transform: translateY(-1px); box-shadow: 0 4px 16px var(--verde-glow); }

.btn-secondary {
  background: var(--bg3); color: var(--text);
  font-family: var(--font-body); font-weight: 500; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border);
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  position: relative; overflow: hidden;
}
.btn-secondary:hover { background: var(--card); border-color: rgba(255,255,255,0.15); }

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

.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%; border-radius: 3px 0 0 3px; }
.stat-card.verde::before    { background: var(--verde); }
.stat-card.rojo::before     { background: var(--rojo); }
.stat-card.amarillo::before { background: var(--amarillo); }
.stat-card.azul::before     { background: var(--azul); }

.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0.3px; margin-bottom: 8px; }
.stat-value { font-family: var(--font-head); font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-card.verde    .stat-value { color: var(--verde); }
.stat-card.rojo     .stat-value { color: var(--rojo); }
.stat-card.amarillo .stat-value { color: var(--amarillo); }
.stat-card.azul     .stat-value { color: var(--azul); }
.stat-trend { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ============================================================
   CARD GENÉRICA
   ============================================================ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.card-title { font-family: var(--font-head); font-size: 15px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; }

/* ============================================================
   TABLA
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 0 14px 12px; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody td { padding: 14px; vertical-align: middle; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.ok      { background: rgba(0,199,123,0.15); color: var(--verde); }
.badge.alerta  { background: rgba(255,184,0,0.15);  color: var(--amarillo); }
.badge.critico { background: rgba(255,76,76,0.15);  color: var(--rojo); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   BARRA DE STOCK
   ============================================================ */
.stock-bar-wrap { display: flex; align-items: center; gap: 10px; }
.stock-bar-track { flex: 1; height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; min-width: 60px; }
.stock-bar-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.stock-bar-fill.ok      { background: var(--verde); }
.stock-bar-fill.alerta  { background: var(--amarillo); }
.stock-bar-fill.critico { background: var(--rojo); }

/* ============================================================
   BÚSQUEDA Y FILTROS
   ============================================================ */
.search-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: var(--font-body); font-size: 14px; padding: 10px 16px; outline: none; }
.search-input::placeholder { color: var(--muted); }
.filter-select { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: var(--font-body); font-size: 14px; padding: 10px 14px; outline: none; cursor: pointer; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-full  { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.form-input { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: var(--font-body); font-size: 14px; padding: 10px 14px; outline: none; width: 100%; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
/* max-height + overflow: una ventana más alta que la pantalla ahora tiene
   scroll propio (antes el contenido se salía por abajo y no se podía bajar). */
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 18px; padding: 28px; width: 100%; max-width: 480px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Varias ventanas usan class="modal" en vez de "modal-box" (Contactos →
   Nuevo cliente, Sucursal, Asignar colaborador, Integraciones) y esa clase
   NO tenía ningún estilo: salían sin fondo, transparentes sobre la pantalla,
   y no se notaba que tenían scroll. Ahora se ven igual que las demás. */
.modal-overlay > .modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 18px; padding: 28px; width: 100%; max-width: 480px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; -webkit-overflow-scrolling: touch; box-sizing: border-box; }
@media (max-width: 768px) {
  .modal-overlay > .modal { max-width: 100% !important; max-height: 92vh !important; max-height: 92dvh !important; border-radius: 20px 20px 0 0 !important; padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-title { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.modal-close { background: var(--bg3); border: none; color: var(--muted); font-size: 18px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.modal-close:hover { background: var(--card); color: var(--text); }

/* ============================================================
   TOAST
   ============================================================ */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg2); border: 1px solid var(--verde); border-radius: 12px; padding: 14px 20px; font-size: 14px; box-shadow: var(--shadow); z-index: 2000; display: flex; align-items: center; gap: 10px; opacity: 0; pointer-events: none; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
  background-color: #0e1117;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50V17L28 1l28 16v33L28 66zm0 0v34M0 50l28 16M56 50L28 66M0 17l28 16M56 17L28 33M28 1v32' fill='none' stroke='%23ffffff' stroke-width='0.6' stroke-opacity='0.07'/%3E%3C/svg%3E");
}
.login-screen::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(100,160,255,0.06) 0%, transparent 70%); pointer-events: none; }
.tema-claro .login-card { background: #ffffff; border: none; box-shadow: 0 24px 64px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.2); color: #1a1a2e; }
.tema-claro .login-card .login-tagline, .tema-claro .login-card .form-label { color: #555; }
.tema-claro .login-card .form-input { background: #f4f5f7; border-color: #dde1e9; color: #1a1a2e; }
.tema-claro .login-card .form-input:focus { border-color: #00C77B; background: #fff; }
.tema-claro .login-card .auth-divider { color: #999; }
.tema-claro .login-card .auth-divider::before, .tema-claro .login-card .auth-divider::after { background: #dde1e9; }
.login-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; padding: 40px; width: 100%; max-width: 380px; box-shadow: var(--shadow); position: relative; z-index: 1; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { margin: 0 auto 12px; width: 52px; height: 52px; font-size: 26px; }
.login-logo .logo-text { font-size: 28px; }
.login-tagline { text-align: center; font-size: 14px; color: var(--muted); margin-bottom: 28px; line-height: 1.5; }
.divider-text { text-align: center; font-size: 11px; color: var(--muted); margin: 20px 0; position: relative; }
.divider-text::before, .divider-text::after { content: ''; position: absolute; top: 50%; width: calc(50% - 30px); height: 1px; background: var(--border); }
.divider-text::before { left: 0; } .divider-text::after { right: 0; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 48px; padding-top: 8px; }
.mini-bar { flex: 1; background: var(--verde-glow); border-radius: 3px 3px 0 0; transition: background 0.2s; }
.mini-bar:hover     { background: var(--verde); }
.mini-bar.highlight { background: var(--verde); }
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--bg3); border-radius: 10px; border-left: 3px solid transparent; }
.alert-item.rojo     { border-left-color: var(--rojo); }
.alert-item.amarillo { border-left-color: var(--amarillo); }
.alert-emoji  { font-size: 22px; }
.alert-info   { flex: 1; }
.alert-name   { font-size: 14px; font-weight: 500; }
.alert-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.alert-qty    { font-family: var(--font-head); font-size: 18px; font-weight: 800; }
.alert-item.rojo     .alert-qty { color: var(--rojo); }
.alert-item.amarillo .alert-qty { color: var(--amarillo); }

/* ============================================================
   MOVIMIENTOS — TABS
   ============================================================ */
.mov-type-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.mov-tab { padding: 8px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--bg3); color: var(--muted); transition: all 0.2s; }
.mov-tab.active.entrada { background: rgba(91,142,255,0.15); color: var(--azul);  border-color: rgba(91,142,255,0.3); }
.mov-tab.active.salida  { background: rgba(255,76,76,0.12);  color: var(--rojo);  border-color: rgba(255,76,76,0.3); }
.mov-tab.active.all     { background: var(--verde-glow);     color: var(--verde); border-color: rgba(0,199,123,0.3); }
.mov-icon-entrada { color: var(--azul); }
.mov-icon-salida  { color: var(--rojo); }

/* ============================================================
   ALERTAS — LISTA GRANDE
   ============================================================ */
.alert-big-list { display: flex; flex-direction: column; gap: 12px; }
.alert-big-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; align-items: center; gap: 18px; }
.alert-big-item.critico { border-left: 3px solid var(--rojo); }
.alert-big-item.alerta  { border-left: 3px solid var(--amarillo); }
.alert-icon-big { font-size: 28px; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-icon-big.critico { background: rgba(255,76,76,0.12); }
.alert-icon-big.alerta  { background: rgba(255,184,0,0.12); }
.alert-big-info   { flex: 1; }
.alert-big-name   { font-size: 15px; font-weight: 600; }
.alert-big-detail { font-size: 13px; color: var(--muted); margin-top: 3px; }
.alert-big-action { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.alert-stock-num         { font-family: var(--font-head); font-size: 22px; font-weight: 800; }
.alert-stock-num.critico { color: var(--rojo); }
.alert-stock-num.alerta  { color: var(--amarillo); }

/* ============================================================
   REPORTES
   ============================================================ */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-placeholder { height: 180px; background: var(--bg3); border-radius: 10px; display: flex; align-items: flex-end; padding: 16px; gap: 6px; overflow: hidden; }
.chart-bar-v { flex: 1; border-radius: 4px 4px 0 0; min-height: 10px; transition: all 0.3s; cursor: pointer; position: relative; }
.chart-bar-v:hover { filter: brightness(1.2); }
.chart-bar-v span { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; opacity: 0; transition: opacity 0.2s; }
.chart-bar-v:hover span { opacity: 1; }
.top-products { display: flex; flex-direction: column; gap: 12px; }
.top-product-row { display: flex; align-items: center; gap: 12px; }
.top-rank { font-family: var(--font-head); font-weight: 800; font-size: 16px; color: var(--muted); width: 24px; text-align: center; }
.top-rank.gold   { color: #FFB800; }
.top-rank.silver { color: #A0A8B5; }
.top-rank.bronze { color: #CD7F32; }
.top-bar-track { flex: 1; height: 8px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.top-bar-fill  { height: 100%; background: var(--verde); border-radius: 99px; }
.top-qty { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ============================================================
   MÓVIL
   ============================================================ */
.mobile-menu-btn { display: none; position: fixed; top: 16px; left: 16px; z-index: 200; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; width: 40px; height: 40px; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  /* En móvil ocultar scrollbar del nav wrap — el scroll funciona igual con el dedo */
  #navScrollWrap { scrollbar-width: none !important; }
  #navScrollWrap::-webkit-scrollbar { display: none !important; }
  .sidebar-backdrop.open { display: block; }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; padding: 20px 16px; padding-top: 68px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section { margin-bottom: 28px; }
.settings-section-title { font-family: var(--font-head); font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.settings-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.settings-divider { height: 1px; background: var(--border); margin: 20px 0; }
.settings-field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; display: block; }
.settings-logo-row { display: flex; align-items: center; gap: 24px; margin-bottom: 4px; }
.settings-logo-preview { width: 88px; height: 88px; background: var(--bg3); border: 2px dashed var(--border); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 22px; font-weight: 800; color: var(--verde); flex-shrink: 0; overflow: hidden; transition: border-color 0.2s; }
.settings-logo-preview:hover { border-color: var(--verde); }
.settings-logo-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.settings-logo-hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.settings-color-row { display: flex; align-items: center; gap: 10px; }
.settings-color-picker { width: 44px; height: 44px; border: none; border-radius: 10px; cursor: pointer; padding: 2px; background: var(--bg3); flex-shrink: 0; }
.settings-pass-row { display: flex; align-items: center; gap: 8px; }
.settings-pass-row .form-input { flex: 1; }
.settings-eye-btn { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; flex-shrink: 0; transition: all 0.2s; }
.settings-eye-btn:hover { background: var(--card); border-color: rgba(255,255,255,0.15); }
.pass-strength-wrap { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pass-strength-bar { flex: 1; height: 4px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.pass-strength-fill { height: 100%; border-radius: 99px; transition: width 0.3s ease, background 0.3s ease; width: 0%; }
.pass-strength-label { font-size: 11px; font-weight: 600; white-space: nowrap; }
@media (max-width: 768px) {
  .settings-logo-row { flex-direction: column; align-items: flex-start; gap: 16px; }
  .settings-color-row { flex-wrap: wrap; }
}

/* ============================================================
   TEMA CLARO
   ============================================================ */
body.tema-claro {
  --bg:     #F0F2F7;
  --bg2:    #FFFFFF;
  --bg3:    #E4E7EF;
  --card:   #FFFFFF;
  --border: rgba(0,0,0,0.08);
  --text:   #111827;
  --muted:  #6B7280;
  --shadow: 0 8px 32px rgba(0,0,0,0.10);
}
body.tema-claro .sidebar { box-shadow: 2px 0 16px rgba(0,0,0,0.06); }
body.tema-claro tbody tr:hover { background: rgba(0,0,0,0.03); }
body.tema-claro .form-input,
body.tema-claro .search-input,
body.tema-claro .filter-select { border-color: rgba(0,0,0,0.15); }


/* ============================================================
   ANIMACIONES — CSS puras, sin JS, sin librerías
   Cero impacto en memoria — solo GPU compositing
   ============================================================ */

/* ── KEYFRAMES ──────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0)    scale(1); }
  to   { opacity: 0; transform: translateY(10px) scale(0.95); }
}
@keyframes ripple {
  from { transform: scale(0); opacity: 0.4; }
  to   { transform: scale(4); opacity: 0; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(0,199,123,0.35); }
  50%       { box-shadow: 0 0 0 8px rgba(0,199,123,0); }
}
@keyframes badgePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position:  400px 0; }
}

/* ── PANTALLAS — fade+slide al cambiar sección ──────────────── */
.screen.active {
  animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── PAGE HEADER — baja desde arriba ────────────────────────── */
.page-header {
  animation: fadeInDown 0.50s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── STAT CARDS — entrada escalonada ────────────────────────── */
.stat-card {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.22s ease;
}
.stat-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}
.stats-grid .stat-card:nth-child(1) { animation: fadeInUp 0.55s 0.06s cubic-bezier(0.22,1,0.36,1) both; }
.stats-grid .stat-card:nth-child(2) { animation: fadeInUp 0.55s 0.13s cubic-bezier(0.22,1,0.36,1) both; }
.stats-grid .stat-card:nth-child(3) { animation: fadeInUp 0.55s 0.20s cubic-bezier(0.22,1,0.36,1) both; }
.stats-grid .stat-card:nth-child(4) { animation: fadeInUp 0.55s 0.27s cubic-bezier(0.22,1,0.36,1) both; }
.stats-grid .stat-card:nth-child(5) { animation: fadeInUp 0.55s 0.34s cubic-bezier(0.22,1,0.36,1) both; }

/* ── MODAL — scale + fade estilo iOS ────────────────────────── */
.modal-overlay.open {
  animation: overlayIn 0.20s ease both;
}
.modal-overlay.open .modal-box {
  animation: modalIn 0.50s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

/* ── TOAST — slide desde abajo + desvanece ──────────────────── */
.toast.show {
  animation: toastIn 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.toast.hide {
  animation: toastOut 0.20s ease both;
}

/* ── BOTONES — ripple effect + micro-bounce ─────────────────── */
.btn-primary,
.btn-secondary {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              background  0.18s ease,
              box-shadow  0.18s ease;
}
.btn-primary:active  { transform: scale(0.95); }
.btn-secondary:active { transform: scale(0.95); }

.btn-primary::after,
.btn-secondary::after {
  content: '';
  position: absolute;
  inset: 50%; width: 8px; height: 8px; margin: -4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0); opacity: 0;
}
.btn-primary:active::after,
.btn-secondary:active::after {
  animation: ripple 0.45s ease-out;
}

/* ── NAV ITEMS — slide sutil ────────────────────────────────── */
.nav-item {
  transition: background 0.18s ease,
              color      0.18s ease,
              transform  0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-item:hover  { transform: translateX(3px); }
.nav-item.active { transform: translateX(3px); }

/* ── FILAS DE TABLA ─────────────────────────────────────────── */
tbody tr {
  transition: background 0.15s ease, transform 0.15s ease;
}
tbody tr:hover { transform: translateX(2px); }

/* ── ALERT ITEMS — entrada escalonada ───────────────────────── */
.alert-item {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.alert-item:hover { transform: translateX(4px); }
.alert-item:nth-child(1) { animation: slideInRight 0.50s 0.06s cubic-bezier(0.22,1,0.36,1) both; }
.alert-item:nth-child(2) { animation: slideInRight 0.50s 0.13s cubic-bezier(0.22,1,0.36,1) both; }
.alert-item:nth-child(3) { animation: slideInRight 0.50s 0.20s cubic-bezier(0.22,1,0.36,1) both; }
.alert-item:nth-child(4) { animation: slideInRight 0.50s 0.27s cubic-bezier(0.22,1,0.36,1) both; }
.alert-item:nth-child(5) { animation: slideInRight 0.50s 0.34s cubic-bezier(0.22,1,0.36,1) both; }

/* ── ALERT BIG ITEMS ────────────────────────────────────────── */
.alert-big-item {
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.18s ease;
}
.alert-big-item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }

/* ── CHIP PRODUCTO (ingreso/venta) ──────────────────────────── */
#ingresoChip,
#productoChip {
  animation: scaleIn 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

/* ── BADGE — pop al actualizarse ────────────────────────────── */
.nav-badge.pop {
  animation: badgePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── LOGO — pulse verde sutil ───────────────────────────────── */
.logo-icon {
  animation: pulse 2.5s ease-in-out infinite;
}

/* ── FORMULARIOS — glow al enfocar ──────────────────────────── */
.form-input {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(0,199,123,0.18);
}

.search-input {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(0,199,123,0.12);
}

/* ── SKELETON LOADER ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg3) 25%,
    rgba(255,255,255,0.06) 50%,
    var(--bg3) 75%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── RESPETO A PREFERENCIAS DE ACCESIBILIDAD ────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:       0.01ms !important;
    animation-iteration-count: 1     !important;
    transition-duration:      0.01ms !important;
  }
}

/* ── ÍCONOS SIDEBAR — animaciones individuales ──────────────── */

/* Cada ícono tiene su propia micro-animación al hover del nav-item */
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  display: inline-block;
  animation: iconBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconBounce {
  0%   { transform: scale(1)    rotate(0deg); }
  30%  { transform: scale(1.35) rotate(-8deg); }
  60%  { transform: scale(0.9)  rotate(4deg); }
  100% { transform: scale(1)    rotate(0deg); }
}

/* Íconos específicos con animaciones únicas */

/* Dashboard 🏠 — late como un corazón */
.nav-item[onclick*="dashboard"]:hover .nav-icon {
  animation: iconPulseHeart 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconPulseHeart {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.4); }
  50%  { transform: scale(1.1); }
  75%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Productos 📦 — rebota como caja */
.nav-item[onclick*="productos"]:hover .nav-icon {
  animation: iconDrop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconDrop {
  0%   { transform: translateY(0)   scale(1); }
  40%  { transform: translateY(-8px) scale(1.2); }
  70%  { transform: translateY(2px)  scale(0.95); }
  100% { transform: translateY(0)   scale(1); }
}

/* Stock 📊 — crece como una barra */
.nav-item[onclick*="stock"]:hover .nav-icon {
  animation: iconGrow 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconGrow {
  0%   { transform: scaleY(0.6) scaleX(1.1); }
  60%  { transform: scaleY(1.2) scaleX(0.95); }
  100% { transform: scaleY(1)   scaleX(1); }
}

/* Movimientos ↕ — oscila arriba/abajo */
.nav-item[onclick*="movimientos"]:hover .nav-icon {
  animation: iconSwing 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconSwing {
  0%   { transform: translateY(0); }
  25%  { transform: translateY(-6px); }
  50%  { transform: translateY(4px); }
  75%  { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* Salidas 🚀 — sale volando */
.nav-item[onclick*="salidas"]:hover .nav-icon {
  animation: iconLaunch 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconLaunch {
  0%   { transform: translate(0, 0)    rotate(0deg); }
  40%  { transform: translate(4px, -6px) rotate(-15deg); }
  70%  { transform: translate(-1px, 2px) rotate(5deg); }
  100% { transform: translate(0, 0)    rotate(0deg); }
}

/* Alertas 🔔 — suena como campana */
.nav-item[onclick*="alertas"]:hover .nav-icon {
  animation: iconRing 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: top center;
}
@keyframes iconRing {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(18deg); }
  30%  { transform: rotate(-16deg); }
  45%  { transform: rotate(12deg); }
  60%  { transform: rotate(-8deg); }
  75%  { transform: rotate(4deg); }
  100% { transform: rotate(0deg); }
}

/* Reportes 📈 — sube como gráfico */
.nav-item[onclick*="reportes"]:hover .nav-icon {
  animation: iconChart 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconChart {
  0%   { transform: translateY(0)    scale(1); }
  50%  { transform: translateY(-7px) scale(1.25); }
  100% { transform: translateY(0)    scale(1); }
}

/* Configuración ⚙️ — gira */
.nav-item[onclick*="config"]:hover .nav-icon,
.nav-item[onclick*="configuracion"]:hover .nav-icon {
  animation: iconSpin 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconSpin {
  0%   { transform: rotate(0deg)   scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Mi Equipo 👥 — rebota */
.nav-item[onclick*="equipo"]:hover .nav-icon,
.nav-item[onclick*="team"]:hover .nav-icon {
  animation: iconTeam 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconTeam {
  0%   { transform: scale(1) translateX(0); }
  30%  { transform: scale(1.3) translateX(-3px); }
  60%  { transform: scale(1.2) translateX(3px); }
  100% { transform: scale(1) translateX(0); }
}

/* Deudores/Fiados 💰 — tiembla como monedas */
.nav-item[onclick*="deudores"]:hover .nav-icon,
.nav-item[onclick*="fiados"]:hover .nav-icon {
  animation: iconShake 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes iconShake {
  0%,100% { transform: rotate(0deg); }
  20%     { transform: rotate(-12deg); }
  40%     { transform: rotate(10deg); }
  60%     { transform: rotate(-8deg); }
  80%     { transform: rotate(6deg); }
}

/* ── SELECTOR DE SONIDO ─────────────────────────────────────── */
.sound-option {
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg3);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  display: block;
}
.sound-option:hover {
  border-color: rgba(0,199,123,0.4);
  background: rgba(0,199,123,0.05);
  transform: translateX(3px);
}
.sound-option.active {
  border-color: var(--verde);
  background: rgba(0,199,123,0.08);
}
.sound-option-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.sound-radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
  position: relative;
}
.sound-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--verde);
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.sound-option.active .sound-radio {
  border-color: var(--verde);
}
.sound-option.active .sound-radio::after {
  transform: scale(1);
}
.sound-info { flex: 1; }
.sound-name { font-size: 14px; font-weight: 600; color: var(--text); }
.sound-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sound-preview-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--verde);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.sound-preview-btn:hover {
  background: var(--verde);
  color: #0D0F14;
  border-color: var(--verde);
}
.sound-preview-btn:active {
  transform: scale(0.92);
}

/* ============================================================
   COMPRAS POR INGRESAR — bandeja de revisión (screen-compras)
   Prefijo ce- para no chocar con clases existentes.
   ============================================================ */
.ce-tab { padding:7px 13px; border-radius:999px; font-size:13px; font-weight:600; cursor:pointer; background:var(--bg2); color:var(--muted); }
.ce-tab.activa { background:var(--verde); color:#0D0F14; }
.ce-card { cursor:pointer; }
.ce-badge { font-size:11.5px; font-weight:700; padding:3px 10px; border-radius:999px; white-space:nowrap; }
.ce-badge.pendiente_revision { background:rgba(255,184,0,0.15); color:var(--amarillo); }
.ce-badge.confirmada { background:rgba(0,199,123,0.15); color:var(--verde); }
.ce-badge.descartada { background:var(--bg2); color:var(--muted); }
.ce-item-row { border:1px solid var(--border); border-radius:10px; padding:12px; margin-bottom:10px; }
.ce-item-top { display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.ce-item-nombre { font-weight:600; font-size:13.5px; color:var(--text); }
.ce-item-meta { font-size:12px; color:var(--muted); margin-top:2px; }
.ce-mapeo-ok { display:flex; align-items:center; gap:8px; margin-top:8px; background:rgba(0,199,123,0.1);
               border-radius:8px; padding:7px 10px; font-size:13px; color:var(--verde); font-weight:600; }
.ce-mapeo-ok button { margin-left:auto; }
.ce-buscador { position:relative; margin-top:8px; }
.ce-buscador input { width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:8px; font-size:13.5px; background:var(--bg2); color:var(--text); }
.ce-resultados { position:absolute; top:100%; left:0; right:0; background:var(--card); border:1px solid var(--border);
                 border-radius:8px; margin-top:4px; max-height:220px; overflow:auto; z-index:20;
                 box-shadow:0 6px 18px rgba(0,0,0,.25); }
.ce-resultado { padding:9px 11px; font-size:13px; cursor:pointer; border-bottom:1px solid var(--border); color:var(--text); }
.ce-resultado:last-child { border-bottom:none; }
.ce-resultado:hover { background:var(--bg2); }
.ce-resultado .ce-rn { font-weight:600; }
.ce-resultado .ce-rs { color:var(--muted); font-size:11.5px; }
.ce-crear-nuevo { padding:9px 11px; font-size:13px; cursor:pointer; color:var(--verde); font-weight:600; border-top:1px solid var(--border); }
.ce-form-nuevo { margin-top:8px; border-top:1px dashed var(--border); padding-top:8px; display:none; }
.ce-form-nuevo.abierto { display:block; }
.ce-form-nuevo input { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:8px; font-size:13px; margin-top:6px; background:var(--bg2); color:var(--text); }
.ce-field-inline { display:flex; gap:8px; }
.ce-field-inline input { flex:1; }
.ce-field-inline label, .ce-form-nuevo label { font-size:12px; color:var(--muted); font-weight:600; display:block; margin-top:6px; }

/* ── Inventario Físico — dashboard de progreso en vivo (antes vivía en
   inventario-fisico.html, ahora es una pantalla más dentro de la app) ── */
.invf-dash-grid { grid-template-columns: 2fr 1fr; }
@media (max-width:980px) { .invf-dash-grid { grid-template-columns: 1fr; } }
@keyframes invfPulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }
.invf-live-dot { display:inline-block; width:7px; height:7px; border-radius:99px; background:#4f46e5; margin-right:5px; animation: invfPulse 1.4s infinite; }
