:root {
  --verde: #00b341;
  --verde-dark: #008a30;
  --verde-light: #e6f9ed;
  --amarillo: #ffd100;
  --rojo: #e03131;
  --rojo-oscuro: #c01e1e;
  --rojo-light: #fff0f0;
  --azul: #1971c2;
  --azul-light: #e8f4fd;
  --gris-bg: #f4f6f9;
  --gris-card: #ffffff;
  --gris-borde: #e2e8f0;
  --gris-texto: #4a5568;
  --gris-suave: #718096;
  --negro: #1a202c;
  --sombra: 0 2px 12px rgba(0, 0, 0, 0.08);
  --sombra-hover: 0 8px 24px rgba(0, 0, 0, 0.14);
  --radio: 12px;
  --radio-sm: 8px;
  --nav-h: 100px;
  --font-titulo: monospace;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'Nunito', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


* {
  -webkit-tap-highlight-color: transparent;
}

/* Mejora la interacción táctil */
button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}

/* Opcional: elimina outlines feos en móviles pero mantiene accesibilidad */
:focus {
  outline: none;
}


html,
body {
  height: 100%;
  font-family: var(--font-body);
  background: #292e42;
  color: var(--negro);
  background: #2c3e50;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gris-borde);
  border-radius: 3px;
}

/* ---- AUTH ---- */
#auth-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #00b341 0%, #008a30 40%, #1a202c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--verde), var(--verde-dark));
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(0, 179, 65, 0.3);
}

.auth-logo h1 {
  font-family: var(--font-titulo);
  font-size: 28px;
  font-weight: 800;
  color: var(--negro);
}

.auth-logo p {
  color: var(--gris-suave);
  font-size: 14px;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background: var(--gris-bg);
  border-radius: var(--radio);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radio-sm);
  cursor: pointer;
  transition: all .2s;
  color: var(--gris-suave);
  border: none;
  background: none;
}

.auth-tab.active {
  background: white;
  color: var(--verde);
  box-shadow: var(--sombra);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gris-texto);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color .2s;
  outline: none;
  color: var(--negro);
}

.form-group input:focus {
  border-color: var(--verde);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--verde), var(--verde-dark));
  color: white;
  border: none;
  border-radius: var(--radio-sm);
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all .2s;
  margin-top: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 179, 65, 0.3);
}

.auth-msg {
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  padding: 10px;
  border-radius: var(--radio-sm);
}

.auth-msg.error {
  background: var(--rojo-light);
  color: var(--rojo);
}

.auth-msg.success {
  background: var(--verde-light);
  color: var(--verde-dark);
}

/* ---- MAIN APP ---- */
#app {
  display: none;
  flex-direction: column;
  height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar {
  height: 68px;
  background: #f4f5f6;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  border-radius: 0px 0px 14px 14px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--verde);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.navbar-brand span {

  color: white;
}

.navbar-brand .negocio-nombre {
  color: var(--verde);
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
}

.navbar h1 {
  font-size: 1.7rem;
  font-family: system-ui;
}

.nav-spacer {
  flex: 1;
}

.nav-datetime {
  color: rgb(74 85 104);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  line-height: 1.4;
}

.nav-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-btn {
  padding: 8px 14px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-btn.active {
  background: #2c3248;
  color: #fc4f62;
  border-radius: 26px;
}

.nav-btn:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: rgb(252 79 98);
}

.nav-btn:hover:not(.active) {
  background: rgb(157 153 153 / 15%);
  color: #fc4f62;
}

.nav-btn.logout {
  background: rgba(224, 49, 49, 0.15);
  color: #ff6b6b;
}

.nav-btn.logout:hover {
  background: rgba(224, 49, 49, 0.3);
}

/* ---- CONTENT ---- */
.content {
  flex: 1;
  overflow: hidden;
  margin: 1rem;
}

/* ---- PAGES ---- */
.page {
  display: none;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

.page.active {
  display: flex;
}

/* ---- CAJA BANNER ---- */
.caja-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--rojo);
  color: white;
  text-align: center;
  padding: 10px;
  font-weight: 700;
  font-size: 14px;
  display: none;
}

.caja-banner.visible {
  display: block;
}

/* ===================== POS PAGE ===================== */
#page-pos {
  flex-direction: row;
  padding: 1rem;
  gap: 1rem;
}



.pos-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f4f4f6;
  padding: 10px 14px;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
}

#pos-resizer:hover #pos-resizer-bar,
#pos-resizer.dragging #pos-resizer-bar {
  background: #fc4f62;
}

#pos-resizer.dragging {
  background: rgba(25, 113, 194, 0.08);
  border-radius: 4px;
}

#pos-right {
  width: var(--pos-right-w, 320px) !important;
  min-width: var(--pos-right-w, 320px) !important;
  max-width: var(--pos-right-w, 320px) !important;
  flex-shrink: 0 !important;
}

#pos-resizer {
  width: 8px;
  flex-shrink: 0;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s;
  user-select: none;
  touch-action: none;
}

#pos-resizer-bar {
  width: 5px;
  height: 40px;
  border-radius: 3px;
  background: #c4cbd5;
  transition: background 0.15s;
  position: absolute;
}

.pos-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-family: var(--font-body);
  color: var(--negro);
  background: #ffffff;
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
}

.pos-search-bar select {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--gris-suave);
  background: var(--gris-bg);
  padding: 6px 10px;
  border-radius: var(--radio-sm);
  cursor: pointer;
}

.pos-search-bar .icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radio-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all .2s;
}

.icon-btn.scan-btn {
  background: var(--verde);
  color: white;
  display: none;
}

.icon-btn.grid-btn {
  background: #e2e8f0;
  color: var(--gris-suave);
  filter: grayscale(1);
}

.icon-btn img {
  height: 20px;
}

.icon-btn.grid-btn.active {
  color: white;
  filter: grayscale(0);
}

.pos-productos-area {
  flex: 1;
  background: #e0e6ee;
  border-radius: 16px;
  padding: 1rem;
}

/* Categorías */
.categorias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
}

.cat-card {
  background: white;
  border-radius: var(--radio);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .3s;
  box-shadow: var(--sombra);
  border: 2px solid transparent;
}

.cat-card:hover {
  box-shadow: 0 8px 25px rgb(0 0 0 / 7%);
  border-color: #667eea;
}

.cat-card img {
  /* width: 56px; */
  height: 144px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.cat-card .cat-emoji {
  font-size: 40px;
  margin-bottom: 8px;
  display: block;
}

.cat-card span {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--negro);
  display: block;
}

.cat-card small {
  font-size: 11px;
  color: var(--gris-suave);
}

/* Productos grid */
.productos-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.back-btn {
  background: var(--gris-bg);
  border: none;
  border-radius: var(--radio-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  color: var(--gris-texto);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}

.back-btn:hover {
  background: var(--negro);
  color: white;
}

.productos-grid {
  display: grid;
  gap: 10px;
}

.productos-grid.grande {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.productos-grid.pequena {
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
}

.prod-card {
  background: white;
  border-radius: var(--radio);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--sombra);
  transition: all .2s;
  border: 2px solid transparent;
  position: relative;
  padding: 5px 5px 5px 5px;
}

.prod-card:hover {
  box-shadow: 0 8px 25px rgb(0 0 0 / 7%);
  border-color: #667eea;
}

.product-image {
  width: 100%;
  height: 114px;
  background: #d0d8e800;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #a0aec0;
  padding: 4px;
}

.prod-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.productos-grid.pequena .product-image {
  width: 60px;
  height: 60px;
  margin-bottom: 0;
  font-size: 32px;
}

.prod-card .prod-emoji {
  text-align: center;
  font-size: 36px;
  padding: 12px;
}

.prod-card .prod-info {
  padding: 5px 2px 0px;
  background: #ffffff;
}

.prod-card .prod-nombre {
  font-size: 12px;
  font-weight: 700;
  color: var(--negro);
  line-height: 1.3;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-card .prod-precio {
  font-size: 1rem;
  font-weight: bold;
  color: var(--verde);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  /* color: #38a169; */
  font-weight: bold;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-card .prod-stock {
  font-size: 13px;
  color: var(--gris-suave);
}

.prod-card .sin-stock {
  opacity: 0.5;
}

.prod-card .stock-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--rojo);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

.prod-card .add-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 179, 65, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  opacity: 0;
  transition: opacity .15s;
}

.prod-card:hover .add-overlay {
  opacity: 1;
}

/* ---- POS RIGHT (CARRITO) ---- */
.pos-right {
  width: 414px;
  background: white;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--gris-borde);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  height: calc(100vh - 100px);
}

.carrito-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.carrito-header h3 {
  font-family: system-ui;
  font-size: 1.4rem;
  font-weight: bold;
  color: #4a5568;
}

.carrito-count {
  background: var(--verde);
  color: white;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}

.carrito-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.carrito-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gris-suave);
  font-size: 14px;
  gap: 12px;
}

.carrito-empty i {
  font-size: 48px;
  opacity: 0.3;
}

.carrito-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 14px;
  margin-bottom: 6px;
  background: #e2e8f0;
  transition: all .2s;
}

.carrito-item img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 10px;
  background: white;
}

.carrito-item .item-emoji {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.carrito-item .item-info {
  flex: 1;
  min-width: 0;
}

.carrito-item .item-nombre {
  font-size: 1rem;
  font-weight: 700;
  color: var(--negro);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carrito-item .item-precio {
  font-size: 12px;
  color: var(--gris-suave);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.img-producto {
  width: 60px;
  height: 60px;
  margin-bottom: 0;
}

.btns-editar-lib{
      display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.7rem;
}

.carrito-item .item-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.qty-btn.minus {
  background: var(--rojo-light);
  color: var(--rojo);
}

.qty-btn.plus {
  background: var(--verde-light);
  color: var(--verde-dark);
}

.qty-btn:hover {
  opacity: 0.8;
}

.qty-num {
  font-size: 1.4rem;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
  font-family: var(--font-mono);
}

.item-subtotal {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--negro);
}

.item-unidad-cantidad {
    font-size: 1rem;
    color: #ffffff;
background: #28a745;
    border-radius: 4px;
    padding: 0px 6px;
}

.btns-editar-lib{
display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.carrito-footer {
  border-top: 1px solid var(--gris-borde);
  padding: 7px 20px;
}

.totales-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gris-suave);
  margin-bottom: 6px;
}

.totales-row.total {
  color: var(--negro);
  font-size: 18px;
  font-weight: 800;
  margin-top: 8px;
  border-top: 2px solid var(--gris-borde);
  padding-top: 8px;
}

.totales-row span:last-child {
  font-family: var(--font-mono);
}

.btn-facturar {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--verde), var(--verde-dark));
  color: white;
  border: none;
  border-radius: var(--radio);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
}

.btn-facturar:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 179, 65, 0.3);
}

.btn-limpiar {
  width: 100%;
  padding: 8px;
  background: var(--rojo-light);
  color: var(--rojo);
  border: none;
  border-radius: var(--radio-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  font-family: var(--font-body);
}

/* ===================== CAJA PAGE ===================== */
#page-caja {
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  gap: 20px;
  background: #e0e6ee;
  width: 100%;
  align-items: center;
}

.caja-estado-card {
  background: white;
  border-radius: var(--radio);
  padding: 28px;
  box-shadow: var(--sombra);
  text-align: center;
}

.caja-estado-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.caja-estado-card h2 {
  font-family: var(--font-titulo);
  font-size: 22px;
  margin-bottom: 8px;
}

.caja-estado-card p {
  color: var(--gris-suave);
  font-size: 14px;
  margin-bottom: 20px;
}

.caja-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.caja-info-item {
  background: var(--gris-bg);
  border-radius: var(--radio-sm);
  padding: 14px;
  text-align: left;
}

.caja-info-item label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gris-suave);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.caja-info-item span {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--negro);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.caja-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-caja {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-caja.abrir {
  background: var(--verde);
  color: white;
}

.btn-caja.cerrar {
  background: var(--rojo);
  color: white;
}

.btn-caja.gasto {
  background: var(--amarillo);
  color: var(--negro);
}

.btn-caja.cuadre {
  background: var(--azul);
  color: white;
}

.caja-movimientos {
  background: white;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  overflow: hidden;
}

.section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h3 {
  font-family: var(--font-titulo);
  font-size: 16px;
  font-weight: 800;
}

.tabla-movimientos {
  width: 100%;
  border-collapse: collapse;
}

.tabla-movimientos th {
  background: var(--gris-bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gris-suave);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.tabla-movimientos td {
  padding: 12px 16px;
  border-top: 1px solid var(--gris-borde);
  font-size: 13px;
  color: var(--gris-texto);
}

.tabla-movimientos tr:hover td {
  background: var(--gris-bg);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge.ingreso {
  background: var(--verde-light);
  color: var(--verde-dark);
}

.badge.gasto {
  background: var(--rojo-light);
  color: var(--rojo);
}

.badge.abierta {
  background: var(--verde-light);
  color: var(--verde-dark);
}

.badge.cerrada {
  background: var(--rojo-light);
  color: var(--rojo);
}

.badge.pendiente {
  background: #fff3cd;
  color: #856404;
}

.badge.pagada {
  background: var(--verde-light);
  color: var(--verde-dark);
}

/* ===================== FACTURAS PAGE ===================== */
#page-facturas {
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  gap: 20px;
  background: #e0e6ee;
}

.facturas-filtros {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.facturas-filtros input,
.facturas-filtros select {
  padding: 10px 14px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s;
}

.facturas-filtros input:focus,
.facturas-filtros select:focus {
  border-color: var(--verde);
}

.btn-sm {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radio-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .2s;
  background: var(--rojo);
  color: white;
}

.btn-sm:hover {
  background: var(--rojo-oscuro);
}

.btn-sm.verde {
  background: var(--verde);
  color: white;
  padding: 10px 34px;
  max-width: 190px;
}

.btn-sm.gris {
  background: #d5d5d5;
  color: var(--gris-texto);
  transition: all .2s;
}

.btn-sm.gris:hover {
  background: #adadad;
}

.btn-sm.azul {
  background: var(--azul);
  color: white;
}

/* ===================== INVENTARIO PAGE ===================== */
#page-inventario {
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  gap: 20px;
  background: #e0e6ee;
}

.inv-controles {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.inv-controles input,
.inv-controles select {
  padding: 10px 14px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s;
}

.inv-controles input:focus {
  border-color: var(--verde);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.inv-card {
  background: white;
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
  transition: all .2s;
  cursor: pointer;
}

.inv-card:hover {
  box-shadow: var(--sombra-hover);
  transform: translateY(-2px);
}

.inv-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.inv-card .inv-emoji {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: var(--gris-bg);
}

.inv-card .inv-body {
  padding: 14px;
}

.inv-card .inv-nombre {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.inv-card .inv-codigo {
  font-size: 11px;
  color: var(--gris-suave);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.inv-card .inv-precios {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.inv-card .inv-precio-venta {
  font-size: 16px;
  font-weight: 800;
  color: var(--verde);
  font-family: var(--font-mono);
}

.inv-card .inv-precio-costo {
  font-size: 12px;
  color: var(--gris-suave);
  font-family: var(--font-mono);
}

.inv-card .inv-stock-bar {
  height: 4px;
  background: var(--gris-borde);
  border-radius: 2px;
  margin-bottom: 8px;
}

.inv-card .inv-stock-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--verde);
}

.inv-card .inv-stock-fill.bajo {
  background: var(--rojo);
}

.inv-card .inv-acciones {
  display: flex;
  gap: 6px;
}

/* ===================== ESTADISTICAS PAGE ===================== */
#page-estadisticas {
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  gap: 20px;
  background: #e0e6ee;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radio);
  padding: 20px;
  box-shadow: var(--sombra);
  border-left: 4px solid transparent;
}

.stat-card.verde {
  border-left-color: var(--verde);
}

.stat-card.azul {
  border-left-color: var(--azul);
}

.stat-card.amarillo {
  border-left-color: var(--amarillo);
}

.stat-card.rojo {
  border-left-color: var(--rojo);
}

.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.stat-card .stat-valor {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--gris-suave);
  margin-top: 4px;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--verde);
  margin-top: 4px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-card {
  background: white;
  border-radius: var(--radio);
  padding: 20px;
  box-shadow: var(--sombra);
}

.chart-card h4 {
  font-family: var(--font-titulo);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}

.chart-wrapper {
  position: relative;
  height: 220px;
}

/* CONTABILIDAD */
.contab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.contab-card {
  background: white;
  border-radius: var(--radio);
  padding: 20px;
  box-shadow: var(--sombra);
  text-align: center;
}

.contab-card h4 {
  font-size: 13px;
  color: var(--gris-suave);
  margin-bottom: 10px;
  font-weight: 600;
}

.contab-card .contab-val {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.contab-card.ingreso .contab-val {
  color: var(--verde);
}

.contab-card.egreso .contab-val {
  color: var(--rojo);
}

.contab-card.ganancia .contab-val {
  color: var(--azul);
}

/* ===================== CONFIGURACION PAGE ===================== */
#page-config {
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  gap: 20px;
  background: #e0e6ee;
}

.config-section {
  background: white;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  overflow: hidden;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px;
}

@media (max-width: 700px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

.config-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gris-texto);
  margin-bottom: 6px;
}

.config-field input,
.config-field select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s;
}

.config-field input:focus {
  border-color: var(--verde);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--gris-borde);
}

.toggle-row label {
  font-size: 14px;
  font-weight: 600;
  color: var(--negro);
}

.toggle-row small {
  display: block;
  font-size: 12px;
  color: var(--gris-suave);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gris-borde);
  border-radius: 13px;
  transition: .3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.toggle-slider {
  background: var(--verde);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(22px);
}

.empleados-lista {
  padding: 20px;
}

.empleado-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radio-sm);
  margin-bottom: 6px;
  background: var(--gris-bg);
}

.empleado-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--verde);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 700;
}

.empleado-info {
  flex: 1;
}

.empleado-info .emp-nombre {
  font-weight: 700;
  font-size: 14px;
}

.empleado-info .emp-email {
  font-size: 12px;
  color: var(--gris-suave);
}

.emp-rol {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.emp-rol.admin {
  background: #fff3cd;
  color: #856404;
}

.emp-rol.empleado {
  background: var(--azul-light);
  color: var(--azul);
}

/* ===================== MODALES ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from {
    transform: scale(0.95) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-header {
    padding: 10px 54px;
    border-bottom: 1px solid var(--gris-borde);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    min-height: 40px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    min-height: 30px;
}


.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--gris-bg);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gris-suave);
  transition: all .2s;
}

.modal-close:hover {
  background: var(--rojo-light);
  color: var(--rojo);
}

.modal-body {
  padding: 24px;
  background: white;
}

#modal-ticket-body{
  background: rgb(87 119 139 / 49%);
}

#footer-view-factura {
  background: #b6bfc7;
    border-top: none;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 9px 20px;
    border-top: 1.5px solid #e2e8f0;
    flex-shrink: 0;
    background: white;
}

.detalle-tab-btn i {
  color: black;
}

#modal-footer-facturacion{
  background: #b6bfc7;
  border-top: none;
}

/* Factura modal */
.factura-items-lista {
  /*max-height: 220px;*/
  overflow-y: auto;
  margin-bottom: 16px;
}

.du-precio-valor,
.du-resultado-valor {
color: #000000;
    font-weight: 900;
}
.du-resultado-valor {
    font-size: 1.2rem;
}

.factura-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid var(--gris-borde);
  font-size: 13px;
}

.factura-item-row:last-child {
  border-bottom: none;
}

.fi-nombre {
  flex: 1;
  font-weight: 600;
}

.fi-qty {
  width: 40px;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--gris-suave);
}

.fi-precio {
  width: 80px;
  text-align: right;
  font-family: var(--font-mono);
}

.metodo-pago-btns {
  display: flex;
  gap: 8px;
}

.mpago-btn {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
}

.mpago-btn i {
  font-size: 20px;
  color: var(--gris-suave);
}

.mpago-btn.selected {
  border-color: var(--verde);
  background: var(--verde-light);
}

.mpago-btn.selected i {
  color: var(--verde-dark);
}

.efectivo-section {
  display: none;
}

.efectivo-section.visible {
  display: block;
}

.teclado-num {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.tec-btn {
  padding: 12px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  background: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font-mono);
}

.tec-btn:hover {
  background: var(--gris-bg);
}

.tec-btn.verde {
  background: var(--verde);
  color: white;
  border-color: var(--verde);
}

.tec-btn.rojo {
  background: var(--rojo-light);
  color: var(--rojo);
  border-color: transparent;
}

.cambio-display {
  background: var(--verde-light);
  border-radius: var(--radio-sm);
  padding: 12px 16px;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.cambio-display span:last-child {
  font-family: var(--font-mono);
  color: var(--verde-dark);
  font-size: 18px;
}

/* Ticket */
.ticket {
  font-family: var(--font-mono);
  background: white;
  border: 1px dashed var(--gris-borde);
  border-radius: var(--radio-sm);
  padding: 20px;
  font-size: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.ticket-header {
  text-align: center;
  border-bottom: 1px dashed var(--gris-borde);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ticket-total {
  border-top: 1px dashed var(--gris-borde);
  padding-top: 8px;
  margin-top: 8px;
  font-weight: 700;
  font-size: 14px;
}

/* Loader */
.loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radio);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toastIn .3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.toast.success {
  background: var(--verde);
  color: white;
}

.toast.error {
  background: var(--rojo);
  color: white;
}

.toast.info {
  background: var(--azul);
  color: white;
}

@keyframes toastIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Loading screen */
#loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #00b341, #1a202c);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
}

#loading-screen .ls-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

#loading-screen h2 {
  font-family: var(--font-titulo);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

#loading-screen p {
  opacity: 0.7;
  font-size: 14px;
}

.progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin-top: 24px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 2px;
  animation: progressAnim 1.5s ease forwards;
}

@keyframes progressAnim {
  from {
    width: 0%;
  }

  to {
    width: 100%;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .pos-right {
    width: 100%;
    height: 50vh;
  }

  #page-pos {
    flex-direction: column;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* Print styles */
@media print {
  body>*:not(#ticket-print) {
    display: none !important;
  }

  #ticket-print {
    display: block !important;
  }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gris-suave);
}

.empty-state i {
  font-size: 48px;
  opacity: 0.3;
  display: block;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

.page-title {
  font-family: var(--font-titulo);
  font-size: 22px;
  font-weight: 800;
}

.page-subtitle {
  color: var(--gris-suave);
  font-size: 14px;
  margin-top: 4px;
}

.inv-tabla {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
}

.inv-tabla th {
  background: var(--gris-bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gris-suave);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.inv-tabla td {
  padding: 12px 16px;
  border-top: 1px solid var(--gris-borde);
  font-size: 13px;
  color: var(--gris-texto);
}

.inv-tabla tr:hover td {
  background: var(--gris-bg);
}

.inv-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.facturas-tabla {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
}

.facturas-tabla th {
  background: var(--gris-bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gris-suave);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.facturas-tabla td {
  padding: 12px 16px;
  border-top: 1px solid var(--gris-borde);
  font-size: 13px;
  color: var(--gris-texto);
}

.facturas-tabla tr:hover td {
  background: var(--gris-bg);
}

.historial-caja-tabla {
  width: 100%;
  border-collapse: collapse;
}

.historial-caja-tabla th {
  background: var(--gris-bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gris-suave);
  text-transform: uppercase;
}

.historial-caja-tabla td {
  padding: 10px 14px;
  border-top: 1px solid var(--gris-borde);
  font-size: 13px;
}

.full-table-wrap {
  overflow-x: auto;
}

.modal.large {
  max-width: 780px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.file-upload-area {
  border: 2px dashed var(--gris-borde);
  border-radius: var(--radio-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gris-bg);
}

.file-upload-area:hover {
  border-color: var(--verde);
  background: var(--verde-light);
}

.file-upload-area img {
  max-height: 100px;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
  border-radius: 6px;
}

.factura-detail-modal .modal {
  max-width: 680px;
}

.ticket-modal-inner {
  font-family: var(--font-mono);
  font-size: 12px;
}

.stats-filtros {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stats-filtros input,
.stats-filtros select {
  padding: 10px 14px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s;
}

#caja-pendiente-banner {
  background: linear-gradient(90deg, var(--rojo), #c92a2a);
  color: white;
  text-align: center;
  padding: 12px;
  font-weight: 700;
  font-size: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: absolute;
}

#caja-pendiente-banner.visible {
  display: flex;
}

#caja-pendiente-banner button {
  background: white;
  color: var(--rojo);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radio-sm);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

















/* ==================== INVENTARIO - CATEGORÍAS ==================== */

.categorias-grid-inv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 8px;
}

.cat-card-inv {
  background: white;
  border-radius: var(--radio, 16px);
  box-shadow: var(--sombra, 0 4px 12px rgba(0, 0, 0, 0.05));
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 2px;
  padding: 0px;
  border: 1px solid var(--gris-borde, #e9ecef);
  flex-direction: column;
  align-items: center;
}

.cat-card-inv:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--verde, #00b341);
}

.cat-card-inv img {
  width: 64px;
  height: 154px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--gris-bg, #f8f9fa);
}

.cat-emoji-inv {
  font-size: 48px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gris-bg, #f8f9fa);
  border-radius: 12px;
}

.cat-info-inv {
    padding: 4px 12px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.cat-nombre-inv {
  font-size: 18px;
  font-weight: 700;
  color: var(--texto-oscuro, #212529);
  margin-bottom: 4px;
}

.cat-stats-inv {
    font-size: 1rem;
    color: #666;
}

.cat-actions-inv {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.icon-btn-sm {
  background: #dddddd;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn-sm:hover {
  background: var(--gris-borde, #e9ecef);
}

/* ==================== INVENTARIO - PRODUCTOS ==================== */

.productos-header-inv {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.productos-header-inv .back-btn {
  background: var(--gris-bg, #f8f9fa);
  border: 1px solid var(--gris-borde, #e9ecef);
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body, 'Nunito', sans-serif);
}

.productos-header-inv .back-btn:hover {
  background: var(--gris-borde, #e9ecef);
}

.productos-header-inv strong {
  font-size: 20px;
  color: var(--texto-oscuro, #212529);
}

.productos-grid-inv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.prod-card-inv {
  background: white;
  border-radius: var(--radio, 16px);
  box-shadow: var(--sombra, 0 4px 12px rgba(0, 0, 0, 0.05));
  overflow: hidden;
  transition: all 0.2s ease;
  border: 1px solid var(--gris-borde, #e9ecef);
  position: relative;
}

.prod-card-inv:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.prod-card-inv.sin-stock {
  opacity: 0.7;
  background: #f8f9fa;
}

.prod-card-inv img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--gris-bg, #f8f9fa);
}

.prod-emoji-inv {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: var(--gris-bg, #f8f9fa);
}

.stock-badge-inv {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  z-index: 1;
}

.stock-badge-inv.warning {
  background: #fff3cd;
  color: #856404;
}

.stock-badge-inv.danger {
  background: #f8d7da;
  color: #721c24;
}

.prod-info-inv {
  padding: 16px;
}

.prod-nombre-inv {
  font-size: 16px;
  font-weight: 700;
  color: var(--texto-oscuro, #212529);
  margin-bottom: 6px;
}

.prod-codigo-inv {
  font-size: 11px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  color: var(--gris-suave, #adb5bd);
  margin-bottom: 10px;
}

.prod-precios-inv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.precio-venta {
  font-size: 20px;
  font-weight: 800;
  color: var(--verde, #00b341);
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

.precio-costo {
  font-size: 12px;
  color: var(--gris-suave, #adb5bd);
  text-decoration: line-through;
}

.prod-stock-inv {
  font-size: 13px;
  color: var(--gris-texto, #495057);
  margin-bottom: 16px;
  padding: 6px 10px;
  background: var(--gris-bg, #f8f9fa);
  border-radius: 8px;
  display: inline-block;
}

.prod-stock-inv.bajo {
  background: #fff3cd;
  color: #856404;
}

.prod-stock-inv.sin {
  background: #f8d7da;
  color: #721c24;
}

.prod-actions-inv {
  display: flex;
  gap: 10px;
}

.prod-actions-inv .btn-sm {
  flex: 1;
  text-align: center;
}

.prod-actions-inv .btn-sm.rojo {
  background: #ffe3e3;
  color: var(--rojo, #e03131);
}

.prod-actions-inv .btn-sm.rojo:hover {
  background: #ffc9c9;
}

/* ==================== CONTROLES DE INVENTARIO ==================== */

.inv-controles {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.inv-controles input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid var(--gris-borde, #e9ecef);
  border-radius: var(--radio-sm, 12px);
  font-family: var(--font-body, 'Nunito', sans-serif);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.inv-controles input:focus {
  border-color: var(--verde, #00b341);
}

#btn-volver-cats {
  display: none;
  white-space: nowrap;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .categorias-grid-inv {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .productos-grid-inv {
    grid-template-columns: 1fr;
  }

  .cat-card-inv {
    padding: 12px;
  }

  .cat-emoji-inv {
    font-size: 36px;
    width: 48px;
    height: 48px;
  }

  .cat-card-inv img {
    width: 48px;
    height: 48px;
  }

  .cat-nombre-inv {
    font-size: 15px;
  }

  .productos-header-inv {
    flex-direction: column;
    align-items: flex-start;
  }

  .productos-header-inv .back-btn {
    order: 1;
  }

  .productos-header-inv strong {
    order: 2;
  }

  .productos-header-inv .btn-sm {
    order: 3;
    margin-left: 0 !important;
  }
}

/* ==================== ANIMACIONES ==================== */

.cat-card-inv,
.prod-card-inv {
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}



/* Estilos para el nuevo inventario - agrega al final de tu CSS */

.inv-controles input:focus {
  border-color: #00b341;
  outline: none;
}

#btn-volver-cats {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .inv-controles {
    flex-direction: column;
  }

  #btn-volver-cats {
    width: 100%;
  }
}



/* Estilos para el área de dibujo dentro del carrito-footer */
.dibujo-container {
  margin-top: 12px;

  border-radius: var(--radio-sm);
  background: white;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.dibujo-container.visible {
  display: flex;
}

.dibujo-canvas-wrapper {
  background: white;
  width: 100%;
  height: 300px;
  position: relative;
}

.dibujo-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: white;
  cursor: crosshair;
  touch-action: none;
}

.dibujo-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--gris-bg);
  border-top: 1px solid var(--gris-borde);
  justify-content: flex-end;
}

.btn-dibujo-sm {
  background: white;
  border: 1px solid var(--gris-borde);
  padding: 4px 12px;
  border-radius: 40px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

.btn-dibujo-sm.verde {
  background: var(--verde);
  color: white;
  border: none;
}

.btn-dibujo-sm.rojo {
  background: var(--rojo);
  color: white;
  border: none;
}

.btn-dibujo-principal {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: #4a5568;
  color: white;
  border: none;
  border-radius: 40px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}