/* ============================================================
   TIENDACONTROL PRO - Fase 4 - Diseño Profesional
   Responsive: Móvil + Tablet + Web
   Colores: Azul #1a56db + Verde #16a34a
   ============================================================ */

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

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Colores principales del logo */
  --azul:          #1a56db;
  --azul-oscuro:   #1344b8;
  --azul-claro:    #e8f0fe;
  --verde:         #16a34a;
  --verde-oscuro:  #15803d;
  --verde-claro:   #dcfce7;
  --pro-badge:     #2563eb;

  /* Neutros */
  --blanco:        #ffffff;
  --fondo:         #f0f4f8;
  --fondo-card:    #ffffff;
  --borde:         #e2e8f0;
  --texto:         #0f172a;
  --texto-medio:   #475569;
  --texto-suave:   #94a3b8;

  /* Semáforo */
  --rojo:          #dc2626;
  --rojo-claro:    #fef2f2;
  --amarillo:      #f59e0b;
  --amarillo-claro:#fffbeb;

  /* Sombras */
  --sombra-sm:  0 1px 3px rgba(0,0,0,0.08);
  --sombra:     0 4px 12px rgba(0,0,0,0.08);
  --sombra-lg:  0 8px 30px rgba(0,0,0,0.12);
  --sombra-azul: 0 4px 16px rgba(26,86,219,0.25);
  --sombra-verde: 0 4px 16px rgba(22,163,74,0.25);

  /* Radio */
  --radio-sm:  8px;
  --radio:     12px;
  --radio-lg:  16px;
  --radio-xl:  24px;

  /* Fuentes */
  --fuente-titulo: 'Nunito', sans-serif;
  --fuente-cuerpo: 'Nunito Sans', sans-serif;

  /* Sidebar width */
  --sidebar-w: 240px;
}

html { font-size: 16px; }

body {
  font-family: var(--fuente-cuerpo);
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

/* ============================================================
   PANTALLA DE LOGIN
   ============================================================ */
#pantalla-login {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.login-izquierda {
  display: none;
  flex: 1;
  background: linear-gradient(145deg, var(--azul-oscuro) 0%, var(--azul) 50%, #2563eb 100%);
  padding: 48px;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-izquierda::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  top: -100px; right: -100px;
}

.login-izquierda::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}

.login-izquierda-contenido {
  position: relative; z-index: 1;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  color: white;
}

.login-feature-icono {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radio);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.login-feature h3 { font-family: var(--fuente-titulo); font-size: 15px; font-weight: 700; }
.login-feature p { font-size: 13px; opacity: 0.75; }

.login-derecha {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--blanco);
}

.login-box {
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  width: 220px;
  max-width: 100%;
  margin-bottom: 8px;
}

.login-logo p {
  font-size: 14px;
  color: var(--texto-suave);
}

.login-titulo {
  font-family: var(--fuente-titulo);
  font-size: 22px;
  font-weight: 800;
  color: var(--texto);
  margin-bottom: 6px;
}

.login-subtitulo {
  font-size: 14px;
  color: var(--texto-medio);
  margin-bottom: 28px;
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-grupo {
  margin-bottom: 16px;
}

.form-grupo label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--texto-medio);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-icono {
  position: relative;
}

.input-icono .icono {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
}

.input-icono input {
  padding-left: 44px !important;
}

.form-grupo input,
.form-grupo select,
.form-grupo textarea {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--borde);
  border-radius: var(--radio);
  font-size: 15px;
  font-family: var(--fuente-cuerpo);
  color: var(--texto);
  background: var(--blanco);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-grupo input:focus,
.form-grupo select:focus,
.form-grupo textarea:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.form-grupo textarea {
  resize: vertical;
  min-height: 80px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border: none;
  border-radius: var(--radio);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--fuente-cuerpo);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  min-height: 48px;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-full { width: 100%; }

.btn-azul {
  background: var(--azul);
  color: white;
  box-shadow: var(--sombra-azul);
}
.btn-azul:hover { background: var(--azul-oscuro); }

.btn-verde {
  background: var(--verde);
  color: white;
  box-shadow: var(--sombra-verde);
}
.btn-verde:hover { background: var(--verde-oscuro); }

.btn-rojo { background: var(--rojo); color: white; }
.btn-amarillo { background: var(--amarillo); color: white; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--borde);
  color: var(--texto-medio);
}
.btn-outline:hover { border-color: var(--azul); color: var(--azul); }

.btn-ghost {
  background: var(--fondo);
  color: var(--texto-medio);
  border: none;
}
.btn-ghost:hover { background: var(--borde); }

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 28px;
  border-radius: var(--radio-sm);
}

.btn-icono {
  width: 40px; height: 40px;
  padding: 0;
  border-radius: 50%;
  min-height: unset;
}

/* ============================================================
   LAYOUT PRINCIPAL - RESPONSIVE
   ============================================================ */
#app {
  display: none;
  min-height: 100vh;
}

/* --- MÓVIL: layout vertical con nav inferior --- */
.app-mobile {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
}

/* Header móvil */
.app-header {
  background: linear-gradient(135deg, var(--azul-oscuro), var(--azul));
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sombra);
  min-height: 60px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo img {
  height: 32px;
  filter: none;
}

.header-logo-texto {
  font-family: var(--fuente-titulo);
  font-weight: 800;
  font-size: 17px;
  color: white;
}

.header-logo-texto span {
  background: rgba(255,255,255,0.25);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

.header-usuario {
  font-size: 11px;
  opacity: 0.85;
  line-height: 1.3;
  text-align: right;
}

.btn-salir {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--fuente-cuerpo);
  transition: background 0.2s;
}
.btn-salir:hover { background: rgba(255,255,255,0.3); }

/* Contenido */
.app-contenido {
  flex: 1;
  padding: 16px;
  padding-bottom: 76px;
  overflow-y: auto;
}

/* Nav inferior móvil */
.nav-inferior {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--borde);
  display: flex;
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 10px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--fuente-cuerpo);
  color: var(--texto-suave);
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.2s;
  min-height: 58px;
  gap: 4px;
  position: relative;
}

.nav-icono { font-size: 22px; line-height: 1; }

.nav-btn.activo { color: var(--azul); }
.nav-btn.activo .nav-icono { transform: scale(1.1); }

.nav-btn.activo::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--azul);
  border-radius: 3px 3px 0 0;
}

.badge-carrito {
  position: absolute;
  top: 6px;
  right: calc(50% - 20px);
  background: var(--rojo);
  color: white;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  display: none;
}

/* ============================================================
   LAYOUT WEB - Sidebar
   ============================================================ */
@media (min-width: 768px) {
  #pantalla-login { flex-direction: row; }

  .login-izquierda {
    display: flex;
    flex: 1;
  }

  .login-derecha {
    flex: 0 0 460px;
    padding: 48px 40px;
  }

  #app {
    display: flex !important;
    flex-direction: row;
  }

  .app-mobile { display: none; }
  .nav-inferior { display: none; }

  /* SIDEBAR */
  .sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--azul-oscuro) 0%, var(--azul) 100%);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 300;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }

  .sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }

  .sidebar-logo img {
    width: 160px;
    filter: none;
display: block;
    margin: 0 auto 4px;
  }

  .sidebar-logo p {
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
  }

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

  .sidebar-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: none;
    color: rgba(255,255,255,0.75);
    border-radius: var(--radio);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--fuente-cuerpo);
    cursor: pointer;
    transition: all 0.18s;
    text-align: left;
    width: 100%;
    position: relative;
  }

  .sidebar-btn:hover {
    background: rgba(255,255,255,0.12);
    color: white;
  }

  .sidebar-btn.activo {
    background: rgba(255,255,255,0.2);
    color: white;
    box-shadow: inset 3px 0 0 rgba(255,255,255,0.8);
  }

  .sidebar-btn .sb-icono { font-size: 20px; width: 24px; text-align: center; }

  .sidebar-badge {
    margin-left: auto;
    background: var(--rojo);
    color: white;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 7px;
    display: none;
  }

  .sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }

  .sidebar-usuario {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
  }

  .sidebar-avatar {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .sidebar-usuario-info { flex: 1; min-width: 0; }
  .sidebar-usuario-nombre {
    font-size: 13px; font-weight: 700; color: white;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sidebar-usuario-rol { font-size: 11px; color: rgba(255,255,255,0.6); }

  .btn-salir-sidebar {
    width: 100%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: rgba(255,255,255,0.85);
    padding: 9px;
    border-radius: var(--radio-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--fuente-cuerpo);
    transition: background 0.2s;
  }
  .btn-salir-sidebar:hover { background: rgba(255,255,255,0.25); }

  /* CONTENIDO PRINCIPAL WEB */
  .web-contenido {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .web-topbar {
    background: white;
    border-bottom: 1px solid var(--borde);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--sombra-sm);
  }

  .web-topbar-titulo {
    font-family: var(--fuente-titulo);
    font-size: 20px;
    font-weight: 800;
    color: var(--texto);
  }

  .web-pagina-contenido {
    padding: 28px;
    flex: 1;
  }
}

/* ============================================================
   PÁGINAS
   ============================================================ */
.pagina { display: none; }
.pagina.activa { display: block; }

/* ============================================================
   CARDS / TARJETAS
   ============================================================ */
.card {
  background: white;
  border-radius: var(--radio-lg);
  padding: 20px;
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--borde);
  margin-bottom: 12px;
}

.stat-card {
  background: white;
  border-radius: var(--radio-lg);
  padding: 20px;
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--borde);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icono {
  width: 52px; height: 52px;
  border-radius: var(--radio);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icono.azul { background: var(--azul-claro); }
.stat-icono.verde { background: var(--verde-claro); }
.stat-icono.rojo { background: var(--rojo-claro); }
.stat-icono.amarillo { background: var(--amarillo-claro); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; font-weight: 700; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-valor { font-family: var(--fuente-titulo); font-size: 26px; font-weight: 900; color: var(--texto); line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--texto-suave); margin-top: 2px; }

.grid-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 900px) {
  .grid-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   SECCIÓN TÍTULOS
   ============================================================ */
.seccion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.seccion-titulo {
  font-family: var(--fuente-titulo);
  font-size: 17px;
  font-weight: 800;
  color: var(--texto);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.bienvenida-box {
  background: linear-gradient(135deg, var(--azul-oscuro), var(--azul));
  border-radius: var(--radio-xl);
  padding: 20px;
  margin-bottom: 16px;
  color: white;
  position: relative;
  overflow: hidden;
}

.bienvenida-box::after {
  content: '🏪';
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 56px;
  opacity: 0.2;
}

.bienvenida-box h2 {
  font-family: var(--fuente-titulo);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.bienvenida-box p { font-size: 13px; opacity: 0.85; }

.btn-vender-grande {
  background: linear-gradient(135deg, var(--verde), var(--verde-oscuro));
  color: white;
  border: none;
  border-radius: var(--radio-xl);
  padding: 20px;
  width: 100%;
  font-size: 18px;
  font-weight: 900;
  font-family: var(--fuente-titulo);
  cursor: pointer;
  margin-bottom: 16px;
  box-shadow: var(--sombra-verde);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.btn-vender-grande:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(22,163,74,0.35); }
.btn-vender-grande:active { transform: scale(0.98); }

/* Gráfica de barras simple */
.grafica-barras {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  padding: 8px 0;
}

.barra-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.barra {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--azul-claro);
  transition: height 0.5s ease;
  position: relative;
  min-height: 4px;
}

.barra.activa { background: var(--azul); }
.barra-label { font-size: 9px; color: var(--texto-suave); font-weight: 700; }
.barra-valor { font-size: 9px; color: var(--texto-medio); font-weight: 700; display: none; }

/* ============================================================
   POS - PUNTO DE VENTA
   ============================================================ */
.pos-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 900px) {
  .pos-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .pos-productos { flex: 1; }
  .pos-carrito-panel {
    flex: 0 0 340px;
    position: sticky;
    top: 80px;
  }
}

.buscador-pos {
  position: relative;
  margin-bottom: 12px;
}

.buscador-pos input {
  width: 100%;
  padding: 13px 16px 13px 46px;
  border: 2px solid var(--borde);
  border-radius: var(--radio-lg);
  font-size: 15px;
  font-family: var(--fuente-cuerpo);
  background: white;
  outline: none;
  transition: border-color 0.2s;
}

.buscador-pos input:focus { border-color: var(--azul); }
.buscador-pos .icono-search {
  position: absolute; left: 15px; top: 50%;
  transform: translateY(-50%); font-size: 18px; color: var(--texto-suave);
}

/* Categorías filtro */
.filtro-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.filtro-cats::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--borde);
  background: white;
  font-size: 12px;
  font-weight: 700;
  color: var(--texto-medio);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--fuente-cuerpo);
}

.cat-chip.activo {
  background: var(--azul);
  border-color: var(--azul);
  color: white;
}

/* Grid productos POS */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

@media (min-width: 500px) {
  .productos-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .productos-grid { grid-template-columns: repeat(3, 1fr); max-height: 480px; }
}

.prod-card {
  background: white;
  border: 2px solid var(--borde);
  border-radius: var(--radio);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.prod-card:hover, .prod-card:active {
  border-color: var(--azul);
  background: var(--azul-claro);
  transform: translateY(-2px);
  box-shadow: var(--sombra);
}

.prod-card.sin-stock {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(1);
}

.prod-nombre { font-size: 12px; font-weight: 700; color: var(--texto); line-height: 1.3; }
.prod-precio { font-family: var(--fuente-titulo); font-size: 16px; font-weight: 900; color: var(--verde); }
.prod-stock-badge {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--verde-claro);
  color: var(--verde);
}
.prod-stock-badge.bajo { background: var(--rojo-claro); color: var(--rojo); }

/* Panel carrito */
.carrito-panel {
  background: white;
  border-radius: var(--radio-xl);
  border: 2px solid var(--borde);
  overflow: hidden;
  box-shadow: var(--sombra);
}

.carrito-header {
  background: var(--fondo);
  padding: 14px 16px;
  border-bottom: 2px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.carrito-header-titulo {
  font-family: var(--fuente-titulo);
  font-size: 15px;
  font-weight: 800;
  color: var(--texto);
}

.carrito-lista {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
}

.carrito-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: var(--radio);
  transition: background 0.15s;
}

.carrito-item:hover { background: var(--fondo); }

.ci-nombre { flex: 1; font-size: 13px; font-weight: 700; line-height: 1.3; }
.ci-precio { font-size: 11px; color: var(--texto-suave); }

.cantidad-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--fondo);
  border-radius: 999px;
  padding: 3px 8px;
}

.qty-btn {
  width: 24px; height: 24px;
  border: none;
  background: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--azul);
  box-shadow: var(--sombra-sm);
  transition: all 0.15s;
}

.qty-btn:active { transform: scale(0.9); }
.qty-num { font-size: 14px; font-weight: 800; min-width: 20px; text-align: center; }

.ci-subtotal { font-size: 13px; font-weight: 800; color: var(--texto); min-width: 52px; text-align: right; }

.btn-quitar-item {
  background: none; border: none;
  color: var(--texto-suave); font-size: 16px; cursor: pointer;
  padding: 4px; border-radius: 50%;
  transition: all 0.15s;
}
.btn-quitar-item:hover { color: var(--rojo); background: var(--rojo-claro); }

.carrito-footer {
  padding: 14px 16px;
  border-top: 2px solid var(--borde);
  background: var(--fondo);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.total-label { font-size: 13px; font-weight: 700; color: var(--texto-medio); }
.total-monto {
  font-family: var(--fuente-titulo);
  font-size: 28px;
  font-weight: 900;
  color: var(--verde);
}

/* ============================================================
   LISTA DE ITEMS (inventario, compras, ventas)
   ============================================================ */
.lista-item {
  display: flex;
  align-items: center;
  padding: 14px;
  background: white;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  margin-bottom: 8px;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--sombra-sm);
}

.lista-item:hover { border-color: var(--azul); box-shadow: var(--sombra); transform: translateX(2px); }

.li-icono {
  width: 44px; height: 44px;
  border-radius: var(--radio);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: var(--fondo);
}

.li-info { flex: 1; min-width: 0; }
.li-titulo { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12px; color: var(--texto-suave); margin-top: 2px; }

.li-derecha { text-align: right; flex-shrink: 0; }
.li-monto { font-family: var(--fuente-titulo); font-size: 16px; font-weight: 800; color: var(--verde); }
.li-fecha { font-size: 11px; color: var(--texto-suave); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-verde { background: var(--verde-claro); color: var(--verde-oscuro); }
.badge-rojo { background: var(--rojo-claro); color: var(--rojo); }
.badge-amarillo { background: var(--amarillo-claro); color: #92400e; }
.badge-azul { background: var(--azul-claro); color: var(--azul); }

/* ============================================================
   ALERTAS
   ============================================================ */
.alerta {
  padding: 12px 16px;
  border-radius: var(--radio);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alerta-verde { background: var(--verde-claro); color: var(--verde-oscuro); border-left: 4px solid var(--verde); }
.alerta-roja { background: var(--rojo-claro); color: var(--rojo); border-left: 4px solid var(--rojo); }
.alerta-amarilla { background: var(--amarillo-claro); color: #92400e; border-left: 4px solid var(--amarillo); }
.alerta-azul { background: var(--azul-claro); color: var(--azul-oscuro); border-left: 4px solid var(--azul); }

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--sombra-lg);
  font-family: var(--fuente-cuerpo);
}

#toast.visible { opacity: 1; }

@media (min-width: 768px) {
  #toast { bottom: 24px; }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.activo { display: flex; }

.modal-box {
  background: white;
  border-radius: var(--radio-xl) var(--radio-xl) 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease-out;
}

@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal-box {
    border-radius: var(--radio-xl);
    max-height: 85vh;
  }
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--borde);
}

.modal-titulo {
  font-family: var(--fuente-titulo);
  font-size: 18px;
  font-weight: 800;
}

.btn-cerrar-modal {
  width: 36px; height: 36px;
  background: var(--fondo);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--texto-medio);
  transition: background 0.15s;
}
.btn-cerrar-modal:hover { background: var(--borde); }

/* ============================================================
   MÉTODOS DE PAGO
   ============================================================ */
.metodos-pago {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.metodo-btn {
  border: 2px solid var(--borde);
  background: white;
  border-radius: var(--radio);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--fuente-cuerpo);
  transition: all 0.15s;
  color: var(--texto-medio);
}

.metodo-icono { font-size: 26px; display: block; margin-bottom: 5px; }
.metodo-btn.seleccionado { border-color: var(--azul); background: var(--azul-claro); color: var(--azul); }

/* ============================================================
   TICKET
   ============================================================ */
.ticket {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: #fafafa;
  padding: 20px;
  border: 2px dashed var(--borde);
  border-radius: var(--radio);
  line-height: 1.9;
}

.ticket-titulo { text-align: center; font-size: 17px; font-weight: 700; }
.ticket-sep { border: none; border-top: 1px dashed var(--borde); margin: 8px 0; }
.ticket-cambio {
  background: var(--verde-claro);
  padding: 10px;
  border-radius: var(--radio-sm);
  text-align: center;
  font-weight: 700;
  color: var(--verde);
  font-size: 16px;
  margin-top: 8px;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--fondo);
  border-radius: var(--radio);
  padding: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 9px 8px;
  border: none;
  background: none;
  border-radius: var(--radio-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--fuente-cuerpo);
  cursor: pointer;
  color: var(--texto-suave);
  transition: all 0.15s;
}

.tab-btn.activo {
  background: white;
  color: var(--azul);
  box-shadow: var(--sombra-sm);
}

/* ============================================================
   SPINNER / LOADING
   ============================================================ */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }

.cargando-texto {
  text-align: center;
  color: var(--texto-suave);
  padding: 32px;
  font-size: 14px;
}

/* ============================================================
   BUSCADOR SUPERIOR
   ============================================================ */
.buscador-top {
  position: relative;
  margin-bottom: 14px;
}

.buscador-top input {
  width: 100%;
  padding: 12px 16px 12px 46px;
  border: 2px solid var(--borde);
  border-radius: var(--radio-lg);
  font-size: 15px;
  font-family: var(--fuente-cuerpo);
  background: white;
  outline: none;
}

.buscador-top input:focus { border-color: var(--azul); }
.buscador-top .icono-buscar {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); font-size: 18px; color: var(--texto-suave);
}

/* ============================================================
   REPORTES - GRÁFICA
   ============================================================ */
.reporte-card {
  background: white;
  border-radius: var(--radio-lg);
  padding: 20px;
  border: 1px solid var(--borde);
  box-shadow: var(--sombra-sm);
  margin-bottom: 14px;
}

.reporte-card-titulo {
  font-family: var(--fuente-titulo);
  font-size: 14px;
  font-weight: 800;
  color: var(--texto-medio);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabla-reporte {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tabla-reporte th {
  text-align: left;
  padding: 8px 10px;
  background: var(--fondo);
  font-weight: 700;
  color: var(--texto-medio);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tabla-reporte td {
  padding: 10px;
  border-bottom: 1px solid var(--borde);
  color: var(--texto);
}

.tabla-reporte tr:last-child td { border-bottom: none; }
.tabla-reporte tr:hover td { background: var(--fondo); }

/* ============================================================
   TIENDACONTROL PRO - PARCHE RESPONSIVE
   Agregar al FINAL de estilos.css
   ============================================================ */

/* ── Forzar que las páginas se vean bien en desktop ── */
@media (min-width: 768px) {

  /* El contenido web ocupa todo el ancho disponible */
  #web-paginas {
    width: 100%;
  }

  #web-paginas .pagina {
    display: block !important;
  }

  /* Inventario en desktop: tabla más ancha */
  #lista-inventario .lista-item {
    padding: 16px 20px;
  }

  /* Compras en desktop */
  #lista-compras .lista-item {
    padding: 16px 20px;
  }

  /* Modal más ancho en desktop para compras y producto */
  .modal-box {
    max-width: 620px;
  }

  /* Grid de stats en desktop: 4 columnas */
  .grid-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Sección header con más espacio */
  .seccion-header {
    margin-bottom: 20px;
  }

  /* Tabla reporte con scroll horizontal en mobile */
  .tabla-reporte-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Inventario: mostrar columna proveedor solo en desktop */
  .col-solo-desktop {
    display: table-cell !important;
  }

  /* Buscador más ancho en desktop */
  .buscador-top input {
    font-size: 15px;
  }

  /* Cards de stats más compactas */
  .stat-card {
    padding: 16px;
  }

  /* POS en desktop: grid de productos más grande */
  .productos-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: 560px;
  }

  /* Carrito panel fijo en desktop */
  .pos-carrito-panel {
    flex: 0 0 380px;
  }

  /* Form grid en modales: mejor espaciado */
  .form-grid-2 {
    gap: 16px;
  }

  /* Reportes: tabla con más espacio */
  .tabla-reporte th,
  .tabla-reporte td {
    padding: 12px 14px;
  }

  /* Reporte márgenes: scroll horizontal en pantallas pequeñas */
  #reporte-margenes-contenido .reporte-card {
    overflow-x: auto;
  }

  #reporte-margenes-contenido .tabla-reporte {
    min-width: 700px;
  }
}

/* ── Tabla reporte con scroll en móvil ── */
.reporte-card {
  overflow-x: auto;
}

/* ── Inventario: badge de proveedor en lista ── */
.li-info .badge {
  font-size: 10px;
  padding: 2px 8px;
}

/* ── Compras: número de compra destacado ── */
.lista-item .li-titulo {
  font-size: 14px;
}

/* ── Modo desktop: quitar max-width al layout móvil ── */
@media (min-width: 768px) {
  .app-mobile {
    display: none !important;
  }

  /* El layout web debe ser flex row */
  #layout-web {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
  }

  /* Asegurar que web-contenido ocupe el espacio restante */
  .web-contenido {
    flex: 1;
    min-width: 0;
  }

  /* Páginas dentro del panel web */
  .web-pagina-contenido .pagina {
    display: block !important;
    max-width: 1200px;
  }

  /* Inventario desktop: lista con más padding */
  .web-pagina-contenido #lista-inventario,
  .web-pagina-contenido #lista-compras {
    max-width: 100%;
  }

  /* Grid de inventario en desktop: 2 columnas */
  .web-pagina-contenido #lista-inventario {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 10px;
  }

  .web-pagina-contenido #lista-inventario .lista-item {
    margin-bottom: 0;
  }

  /* Compras desktop: lista normal */
  .web-pagina-contenido #lista-compras {
    display: block;
    max-width: 800px;
  }

  /* Dashboard desktop: contenido centrado con max-width */
  .web-pagina-contenido #pagina-dashboard {
    max-width: 1100px;
  }

  /* Reportes desktop */
  .web-pagina-contenido #pagina-reportes {
    max-width: 1100px;
  }

  /* Bienvenida box en desktop */
  .bienvenida-box {
    padding: 28px 32px;
    margin-bottom: 24px;
  }

  .bienvenida-box h2 {
    font-size: 26px;
  }

  .bienvenida-box::after {
    font-size: 80px;
    right: 32px;
  }

  /* Botón vender en desktop: no tan ancho */
  .btn-vender-grande {
    max-width: 400px;
    margin-bottom: 24px;
  }

  /* Gráfica semanal más alta en desktop */
  .grafica-barras {
    height: 140px;
  }

  /* Tabs de reportes en desktop */
  .tabs {
    max-width: 500px;
  }
}

/* ── Ajustes finales mobile ── */
@media (max-width: 767px) {
  /* Tabla de márgenes con scroll horizontal */
  #reporte-margenes-contenido .tabla-reporte {
    min-width: 600px;
  }

  /* Modal compra más alto en móvil */
  #modal-compra .modal-box {
    max-height: 92vh;
  }

  /* Sugerencias de búsqueda en compras */
  #compra-sugerencias {
    max-height: 200px;
  }

  /* Tab de márgenes: texto más corto */
  .tabs .tab-btn:last-child {
    font-size: 11px;
  }
}