:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #eef2ff;
  --ink: #1e1b2e;
  --muted: #6b7280;
  --bg: #f6f6fb;
  --card: #ffffff;
  --danger: #e11d48;
  --success: #16a34a;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: 84px; /* espacio para bottom nav movil */
  -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; }

.app-topbar {
  background: var(--card);
  border-bottom: 1px solid #ececf5;
  padding: .75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-topbar .brand {
  font-weight: 700;
  color: var(--brand);
  font-size: 1.05rem;
}

.app-topbar .negocio-name {
  font-size: .78rem;
  color: var(--muted);
}

.container-app {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
}

.susc-banner {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .55rem 1rem;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.susc-banner-amber {
  background: #fffbeb;
  color: #92400e;
  border-bottom-color: #fde68a;
}
.susc-banner-red {
  background: #fef2f2;
  color: #b91c1c;
  border-bottom-color: #fecaca;
}
.susc-banner-cta {
  margin-left: auto;
  white-space: nowrap;
  text-decoration: underline;
}

.card-app {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #edeef7;
  box-shadow: 0 1px 3px rgba(30,27,46,.04);
  padding: 1rem;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #edeef7;
  padding: 1rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.stat-card .stat-label {
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-brand:hover, .btn-brand:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.form-control, .form-select {
  border-radius: 10px;
  padding: .6rem .8rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}

.input-scan-group .btn-scan {
  border-radius: 10px;
}

.product-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--brand-light);
}

.product-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid #edeef7;
}
.product-row + .product-row { margin-top: .5rem; }

.product-row .info { flex: 1; min-width: 0; }
.product-row .desc {
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-row .meta {
  font-size: .78rem;
  color: var(--muted);
}
.product-row .price {
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}

.stock-badge {
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
}
.stock-badge.low { background: #fee2e2; color: var(--danger); }

/* Bottom nav movil */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid #ececf5;
  display: flex;
  z-index: 1030;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: .55rem 0 .4rem;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
}
.bottom-nav a i {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 2px;
}
.bottom-nav a.active { color: var(--brand); }

@media (min-width: 768px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(160deg, var(--brand) 0%, #7c3aed 100%);
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
}

.cart-fab {
  position: fixed;
  right: 1rem;
  bottom: 90px;
  z-index: 1040;
}
@media (min-width: 768px) {
  .cart-fab { bottom: 24px; }
}

.store-search {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  padding: .5rem 0 .75rem;
}

.store-hero {
  background: linear-gradient(160deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff;
  padding: 2rem 1rem;
  border-radius: 0 0 24px 24px;
  text-align: center;
}

/* Fila de producto del POS: descripcion/stock a la izquierda, precio + stepper a la derecha */
.pos-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .4rem;
  margin-left: auto;
}
.stepper {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.stepper .cantidad {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
}
.product-row.en-carrito {
  background: var(--brand-light);
  border-color: var(--brand);
}

/* Barra fija de venta (total + boton VENDER) */
.venta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 64px;
  z-index: 1035;
  background: var(--card);
  border-top: 1px solid #edeef7;
  box-shadow: 0 -4px 14px rgba(30,27,46,.08);
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.venta-bar-total {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--brand-dark);
}
.venta-bar-cant {
  font-size: .75rem;
  color: var(--muted);
}
body.has-venta-bar {
  padding-bottom: 170px;
}

@media (min-width: 768px) {
  .venta-bar {
    bottom: 0;
    max-width: 760px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 14px 14px 0 0;
  }
  body.has-venta-bar { padding-bottom: 90px; }
}
