:root {
  --milk: #fff9fa; --petal: #fde8ec; --blush: #fbd6dd; --rose: #ea8bba; --plum: #f34e85; --plum-dark: #c42762; --gold: #a63d74; --ink: #4b2a24;
  --ok: #1f9d55; --danger: #c0392b; --radio: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--milk); font-size: 16px; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.oculto { display: none !important; }

/* Estructura */
.pantalla { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: linear-gradient(135deg, var(--plum), var(--plum-dark)); color: #fff; }
.cab b { letter-spacing: .18em; font-size: 18px; }
.cab small { opacity: .9; display: block; letter-spacing: 0; }
.cuerpo { padding: 14px 14px 90px; display: grid; gap: 12px; align-content: start; max-width: 760px; width: 100%; margin: 0 auto; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--blush); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.nav button { flex: 1; border: 0; background: none; padding: 12px 0; font-size: 11px; font-weight: 600; color: var(--gold); }
.nav button.act { color: var(--plum-dark); box-shadow: inset 0 3px 0 var(--plum); }

/* Controles */
.btn { border: 0; border-radius: var(--radio); padding: 14px 18px; min-height: 48px; font-weight: 700; background: var(--plum); color: #fff; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--petal); color: var(--plum-dark); }
.btn.gran { width: 100%; font-size: 18px; }
.btn:disabled { background: var(--blush); color: var(--rose); }
.campo { width: 100%; min-height: 48px; padding: 12px 14px; border: 2px solid var(--blush); border-radius: var(--radio); background: #fff; outline: none; }
.campo:focus { border-color: var(--plum); }
label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.fila { display: flex; gap: 8px; align-items: center; }
.fila > * { flex: 1; }
.fila > .btn.auto { flex: none; }
.tarjeta { align-content: start; background: #fff; border: 1px solid var(--blush); border-radius: 18px; padding: 14px; box-shadow: 0 4px 16px rgba(196, 39, 98, .07); display: grid; gap: 10px; }
.sub { color: var(--gold); font-size: 14px; }
.error { color: var(--danger); font-weight: 600; min-height: 20px; font-size: 14px; }
.ok { color: var(--ok); font-weight: 600; }
.aviso { padding: 10px 12px; border-radius: 12px; background: #fff3dc; color: #8a5a0a; font-size: 14px; }
.vacio { text-align: center; color: var(--gold); padding: 22px 10px; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--blush), var(--petal) 55%, var(--milk)); }
.login .tarjeta { width: min(420px, 100%); }
.login h1 { font-size: 30px; letter-spacing: .3em; color: var(--plum-dark); text-align: center; }
.persona { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border: 1px solid var(--blush); border-radius: var(--radio); background: #fff; min-height: 56px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--blush); color: var(--plum-dark); font-weight: 800; flex: none; }
.persona small { display: block; color: var(--gold); }
.puntos { display: flex; gap: 10px; justify-content: center; padding: 6px; }
.puntos i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rose); }
.puntos i.on { background: var(--plum); border-color: var(--plum); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.teclado .btn { font-size: 22px; padding: 16px 0; }

/* Listas */
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; background: #fff; border: 1px solid var(--blush); border-radius: var(--radio); min-height: 56px; }
.item small { display: block; color: var(--gold); }
.item b.num { font-size: 20px; }
.bajo { color: var(--danger); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; padding: 10px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--blush); min-width: 130px; }
.chip b { display: block; font-size: 20px; }
.chip small { color: var(--gold); display: block; }
.mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; margin-top: 6px; }
.mini span { background: var(--milk); border-radius: 10px; padding: 4px 8px; font-size: 13px; }
.mini span.cero { color: var(--danger); background: #fdeaea; }
.mini b { display: block; font-size: 17px; }

/* Hoja (modal desde abajo) */
.fondo { position: fixed; inset: 0; background: rgba(75, 42, 36, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.hoja { background: var(--milk); width: min(560px, 100%); max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
@media (min-width: 640px) { .fondo { align-items: center; } .hoja { border-radius: 22px; } }
.hoja h2 { font-size: 20px; }
.cantidad { font-size: 34px; text-align: center; font-weight: 800; }

/* Escáner */
#lector { width: 100%; min-height: 260px; background: #000; border-radius: var(--radio); overflow: hidden; }

/* Etiquetas e impresión */
#impresion { display: none; }
.etiqueta { width: 50mm; height: 30mm; padding: 1.5mm 2mm; display: grid; grid-template-rows: auto 1fr auto; font-family: Arial, sans-serif; color: #000; page-break-inside: avoid; break-inside: avoid; overflow: hidden; }
.etiqueta .n { font-size: 7.5pt; font-weight: 700; line-height: 1.1; max-height: 2.3em; overflow: hidden; }
.etiqueta svg { width: 100%; height: 100%; }
.etiqueta .p { display: flex; justify-content: space-between; font-size: 7pt; }
@media print {
  body > *:not(#impresion) { display: none !important; }
  #impresion { display: flex; flex-wrap: wrap; }
  @page { margin: 4mm; }
}
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 40; max-width: 90vw; text-align: center; }

/* ---------- Paneles de Joan y Alex: un negocio a la vez ---------- */
body.neg-unas { --plum: #2f6fb0; --plum-dark: #1f4f86; --petal: #e8f1fb; --blush: #cfe0f3; --rose: #7fa9d6; --gold: #2c5d91; --milk: #f5f9ff; }
.nav { overflow-x: auto; }
.nav button { flex: 1 0 auto; min-width: 76px; padding-left: 8px; padding-right: 8px; }
.marca-lateral { display: none; }

.conmutador { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.conmutador button { border: 2px solid var(--blush); background: #fff; border-radius: 16px; padding: 12px 14px; text-align: left; font-weight: 800; font-size: 17px; color: var(--ink); cursor: pointer; }
.conmutador button small { display: block; font-weight: 500; font-size: 12px; color: var(--gold); }
.conmutador button.act { background: var(--plum); border-color: var(--plum); color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .15); }
.conmutador button.act small { color: rgba(255, 255, 255, .85); }
.conmutador button:first-child.act { background: #f34e85; border-color: #f34e85; }
.conmutador button:last-child.act { background: #2f6fb0; border-color: #2f6fb0; }

.eleccion { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcion { display: grid; gap: 4px; text-align: left; padding: 16px; border-radius: 18px; border: 3px solid var(--blush); background: #fff; cursor: pointer; }
.opcion b { font-size: 20px; }
.opcion small, .opcion span { color: var(--gold); font-size: 13px; }
.opcion.neg-maquillaje.act { border-color: #f34e85; background: #fde8ec; }
.opcion.neg-unas.act { border-color: #2f6fb0; background: #e8f1fb; }
.opcion.act span { font-weight: 700; color: var(--ok); }
.titulo-negocio { padding: 8px 14px; border-radius: 12px; color: #fff; font-size: 17px; }
.titulo-negocio.neg-maquillaje { background: #f34e85; }
.titulo-negocio.neg-unas { background: #2f6fb0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--blush); border-radius: 16px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.kpi small { color: var(--gold); font-size: 13px; }
.kpi b { font-size: 22px; }
.kpi.fuerte { background: linear-gradient(135deg, var(--plum), var(--plum-dark)); border: 0; color: #fff; }
.kpi.fuerte small { color: rgba(255, 255, 255, .9); }
.dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.estado { font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #f1eef0; color: #6b5a60; white-space: nowrap; }
.estado.amarillo { background: #fff3dc; color: #c27a10; }
.estado.verde { background: #e6f7ec; color: var(--ok); }
.estado.rojo { background: #fdeaea; color: var(--danger); }
.estado.gris { background: #f1eef0; color: #6b5a60; }

/* Computadora: el menú pasa a la izquierda */
@media (min-width: 900px) {
  .pantalla { padding-left: 220px; }
  .nav { top: 0; right: auto; width: 220px; flex-direction: column; border-top: 0; border-right: 1px solid var(--blush); padding: 14px 10px; gap: 2px; overflow-x: hidden; overflow-y: auto; }
  .nav button { flex: none; text-align: left; font-size: 15px; padding: 12px 14px; border-radius: 12px; }
  .nav button.act { box-shadow: none; background: var(--petal); }
  .marca-lateral { display: block; font-weight: 800; letter-spacing: .3em; color: var(--plum-dark); font-size: 20px; padding: 6px 14px 16px; }
  .cuerpo { max-width: 1100px; padding-bottom: 40px; }
  .toast { bottom: 24px; }
}

/* Sin barras de desplazamiento visibles: el scroll sigue funcionando. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

/* ---------- Inicio y levantamiento de inventario (teléfono primero; se adapta a tablet y computadora) ---------- */
.inicio { gap: 14px; }
.opcion { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 18px 16px; min-height: 84px; border: 2px solid var(--blush); border-radius: 18px; background: #fff; cursor: pointer; }
.opcion b { display: block; font-size: 18px; }
.opcion small { display: block; color: var(--gold); font-size: 14px; margin-top: 2px; }
.opcion.rosa { background: linear-gradient(135deg, var(--plum), var(--plum-dark)); border-color: transparent; color: #fff; }
.opcion.rosa small { color: #ffe3ee; }
.opcion:active { transform: scale(.98); }
.opcion-icono { font-size: 30px; flex: none; }
.enlace { border: 0; background: none; color: var(--plum-dark); font-weight: 600; padding: 10px; text-decoration: underline; cursor: pointer; }

.pastilla { border: 1.5px solid var(--blush); background: #fff; border-radius: 999px; padding: 9px 14px; font-weight: 600; min-height: 42px; white-space: nowrap; flex: none; }
.pastilla.activa { background: var(--plum-dark); border-color: var(--plum-dark); color: #fff; }
.etq { flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--petal); color: var(--plum-dark); white-space: nowrap; align-self: start; }
.etq.ok { background: #e2f6ee; color: var(--ok); }
.etq.aviso { background: #fff1d6; color: #9a6208; }
.etq.mal { background: #fde4e8; color: var(--danger); }
.etq.gris { background: #eee8e8; color: #7b6b68; }

.lev-form { gap: 12px; }
.lev-form .campo { font-size: 17px; }
.campo.grande { font-size: 24px; font-weight: 700; text-align: center; min-height: 58px; }
.lev-cantidades { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lev-nota { color: #8a5a0a; font-size: 14px; font-weight: 600; }
.lev-nota:empty { display: none; }
.btn.activo { background: var(--plum-dark); color: #fff; }
.lev-titulo { margin: 6px 2px 0; font-size: 17px; }
.lev-lista { display: grid; gap: 8px; }
.lev-fila { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; background: #fff; border: 1px solid var(--blush); border-left: 5px solid var(--blush); border-radius: 14px; min-height: 64px; }
.lev-fila.pendiente { border-left-color: #e8a317; }
.lev-fila.completo { border-left-color: var(--ok); }
.lev-fila.revision { border-left-color: var(--danger); }
.lev-fila.publicado { border-left-color: #b9aeae; opacity: .75; }
.lev-fila.sin-enviar { border-left-color: #b9aeae; border-style: dashed; }
.lev-info { display: grid; gap: 2px; min-width: 0; word-break: break-word; }
.lev-info b { font-size: 16px; }
.lev-info small { color: var(--gold); font-size: 13px; }
.lev-motivo { color: var(--danger) !important; font-weight: 600; }
.lev-fila.bodega { flex-direction: column; }
.lev-bodega-accion { display: grid; grid-template-columns: 1fr auto; gap: 8px; width: 100%; align-items: center; }
.lev-bodega-accion .campo { min-height: 52px; }

/* Tablet y computadora: la captura y la lista van lado a lado */
@media (min-width: 900px) {
  .cuerpo:has(.lev-form) { max-width: 1100px; grid-template-columns: minmax(340px, 440px) 1fr; align-items: start; column-gap: 20px; }
  .cuerpo:has(.lev-form) .lev-form { grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 14px; }
  .cuerpo:has(.lev-form) .lev-titulo, .cuerpo:has(.lev-form) .lev-lista { grid-column: 2; }
}
@media (max-width: 380px) { .lev-cantidades { grid-template-columns: 1fr; } .opcion b { font-size: 16px; } }