:root {
  --bg:        #f6f6f7;
  --surface:   #ffffff;
  --texto:     #18181b;
  --muted:     #71717a;
  --tenue:     #a1a1aa;
  --borde:     #ececef;
  --borde-2:   #e0e0e4;
  --acento:    #4338ca;
  --acento-suave: #eef2ff;
  --pay:       #047857;
  --pay-osc:   #036249;
  --rojo:      #dc2626;
  --radio:     16px;
  --radio-sm:  12px;
  --sombra:    0 1px 2px rgba(24,24,27,.05);
  --sombra-md: 0 4px 16px rgba(24,24,27,.08);
  --sombra-lg: 0 20px 50px rgba(24,24,27,.18);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--texto);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
svg { display: block; }

.app { display: grid; grid-template-columns: 1fr 400px; height: 100vh; height: 100dvh; }

/* ====================== PANEL PRODUCTOS ====================== */
.panel-productos { display: flex; flex-direction: column; overflow: hidden; }

.barra-superior {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--borde);
}

.marca { display: flex; align-items: center; gap: 12px; }
.marca-logo-img { display: flex; align-items: center; }
.marca-logo-img img { height: 30px; width: auto; display: block; filter: brightness(0); }
.marca-pos { font-size: 12.5px; color: var(--tenue); font-weight: 600; white-space: nowrap; }
.marca-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--texto); color: #fff;
  display: grid; place-items: center;
}
.marca-logo svg { width: 22px; height: 22px; }
.marca-titulo { font-weight: 600; font-size: 16px; line-height: 1.15; letter-spacing: -.01em; }
.marca-sub { font-size: 12px; color: var(--tenue); }

.buscador {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 12px; padding: 0 14px;
  transition: all .15s;
}
.buscador:focus-within { border-color: var(--acento); background: var(--surface); box-shadow: 0 0 0 4px var(--acento-suave); }
.icono-lupa { width: 19px; height: 19px; color: var(--tenue); flex-shrink: 0; }
#buscar { flex: 1; border: none; background: transparent; font-size: 15px; padding: 13px 0; outline: none; color: var(--texto); }
#buscar::placeholder { color: var(--tenue); }

.btn-escanear {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--borde-2); background: var(--surface);
  color: var(--texto); font-size: 14px; font-weight: 600;
  padding: 12px 16px; border-radius: 12px; cursor: pointer;
  white-space: nowrap; transition: all .12s;
}
.btn-escanear svg { width: 18px; height: 18px; color: var(--acento); }
.btn-escanear:hover { border-color: var(--acento); background: var(--acento-suave); }
.btn-escanear:active { transform: scale(.97); }

.categorias { display: flex; gap: 8px; padding: 16px 24px 6px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.categorias::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--borde-2); background: var(--surface);
  color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  white-space: nowrap; transition: all .12s;
}
.chip:hover { border-color: var(--tenue); }
.chip.activo { background: var(--texto); color: #fff; border-color: var(--texto); }

.grid-productos {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px; padding: 16px 24px 28px; align-content: start;
}

.card {
  background: var(--surface); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 10px;
  cursor: pointer; display: flex; flex-direction: column;
  transition: transform .1s, box-shadow .15s, border-color .15s;
  box-shadow: var(--sombra); user-select: none; position: relative;
}
.card:hover { border-color: var(--borde-2); box-shadow: var(--sombra-md); transform: translateY(-2px); }
.card:active { transform: translateY(0) scale(.98); }
.card-tile {
  height: 96px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 46px; margin-bottom: 10px; line-height: 1;
}
.card-tile img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.card-tile:has(img) { background: #fff; border: 1px solid var(--borde); padding: 6px; }
.card-cuerpo { padding: 0 4px 4px; display: flex; flex-direction: column; flex: 1; }
.card-nombre { font-size: 13.5px; font-weight: 500; line-height: 1.3; color: var(--texto); min-height: 34px; }
.card-sku { font-size: 10.5px; color: var(--tenue); margin-top: 2px; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-fila { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.card-precio { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card-stock { font-size: 11px; color: var(--tenue); background: var(--bg); padding: 2px 7px; border-radius: 6px; font-weight: 500; }
.card.en-carrito { border-color: var(--acento); box-shadow: 0 0 0 1.5px var(--acento); }
.card.agotado .card-tile { opacity: .5; }
.card-stock.sin-stock { color: var(--rojo); background: #fef2f2; }
.card-cantidad { display: flex; align-items: center; gap: 4px; background: var(--acento-suave); border-radius: 9px; padding: 3px; }
.cc-btn { width: 30px; height: 30px; border: none; background: var(--surface); color: var(--acento); border-radius: 7px; font-size: 17px; font-weight: 700; cursor: pointer; display: grid; place-items: center; line-height: 1; box-shadow: var(--sombra); }
.cc-btn:active { transform: scale(.88); }
.cc-num { min-width: 18px; text-align: center; font-weight: 700; font-size: 14px; color: var(--acento); }

/* ====================== PANEL CARRITO ====================== */
.panel-carrito { background: var(--surface); border-left: 1px solid var(--borde); display: flex; flex-direction: column; overflow: hidden; }
.carrito-encabezado { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px 14px; }
.carrito-encabezado h2 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.contador { font-size: 13px; font-weight: 600; background: var(--acento-suave); color: var(--acento); padding: 2px 9px; border-radius: 999px; }
.btn-vaciar { border: none; background: transparent; color: var(--tenue); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 8px; transition: color .12s; }
.btn-vaciar:hover { color: var(--rojo); }

.lista-carrito { flex: 1; overflow-y: auto; padding: 4px 14px; }

.carrito-vacio { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--tenue); text-align: center; gap: 6px; padding-bottom: 30px; }
.carrito-vacio svg { width: 52px; height: 52px; stroke-width: 1.4; opacity: .55; margin-bottom: 4px; }
.carrito-vacio p { font-weight: 600; color: var(--muted); font-size: 15px; }
.carrito-vacio small { font-size: 12.5px; }

.item { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--borde); }
.item:last-child { border-bottom: none; }
.item-tile { font-size: 24px; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 11px; flex-shrink: 0; line-height: 1; overflow: hidden; }
.item-tile img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; margin: auto; }
.item-tile:has(img) { background: #fff; }
.item-info { flex: 1; min-width: 0; }
.item-nombre { font-size: 14px; font-weight: 500; line-height: 1.25; }
.item-sku { font-size: 10.5px; color: var(--tenue); margin-top: 1px; letter-spacing: .02em; }
.item-precio-u { font-size: 12px; color: var(--tenue); margin-top: 1px; }
.item-precio-u s { color: var(--tenue); }
.item-precio-u .precio-desc { color: var(--texto); font-weight: 600; }
.item-derecha { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.item-subtotal { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.item-ahorro { font-size: 11.5px; font-weight: 600; color: var(--pay); margin-top: 2px; white-space: nowrap; }
.item-ahorro:empty { display: none; }

.cantidad { display: flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 9px; padding: 3px; }
.cantidad button { width: 28px; height: 28px; border-radius: 7px; border: none; background: var(--surface); font-size: 17px; font-weight: 600; cursor: pointer; line-height: 1; color: var(--texto); box-shadow: var(--sombra); display: grid; place-items: center; }
.cantidad button:active { transform: scale(.9); }
.cantidad span { min-width: 20px; text-align: center; font-weight: 600; font-size: 14px; }

.resumen { border-top: 1px solid var(--borde); padding: 16px 22px; background: var(--surface);
  padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.linea { display: flex; justify-content: space-between; font-size: 14.5px; margin-bottom: 9px; color: var(--muted); }
.linea.total { font-size: 22px; font-weight: 700; color: var(--texto); margin: 12px 0 16px; letter-spacing: -.02em; }

.btn-cobrar {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: var(--pay); color: #fff;
  font-size: 17px; font-weight: 600; padding: 16px; border-radius: 13px;
  cursor: pointer; transition: background .15s, transform .1s;
}
.btn-cobrar:hover { background: var(--pay-osc); }
.btn-cobrar:active { transform: scale(.985); }
.btn-cobrar:disabled { background: #e4e4e7; color: var(--tenue); cursor: not-allowed; }

/* ====================== MODALES ====================== */
.modal { position: fixed; inset: 0; background: rgba(24,24,27,.5); display: grid; place-items: center; padding: 20px; z-index: 300; backdrop-filter: blur(3px); }
.modal.oculto { display: none; }
.modal-caja { background: var(--surface); border-radius: 22px; width: 100%; max-width: 440px; box-shadow: var(--sombra-lg);
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; overflow-x: hidden;
  animation: aparecer .2s cubic-bezier(.16,1,.3,1); }
@keyframes aparecer { from { transform: translateY(18px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-titulo { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; font-size: 17px; font-weight: 600; }
.cerrar { border: none; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; color: var(--muted); transition: background .12s; }
.cerrar:hover { background: var(--borde-2); }

.lector-camara { width: 100%; min-height: 280px; background: #000; position: relative; }
.lector-camara::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 10;
  border: 6px solid transparent; transition: border-color .1s, background .1s;
}
.lector-camara.error::after { border-color: var(--rojo); background: rgba(220, 38, 38, .2); }
.lector-camara.ok::after { border-color: var(--pay); background: rgba(4, 120, 87, .16); }
.ayuda-camara { padding: 16px 22px 22px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

.total-pago { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 22px 26px; }
.total-pago span { color: var(--muted); font-size: 13.5px; }
.total-pago strong { font-size: 42px; font-weight: 700; letter-spacing: -.025em; }

.resumen-cobro { margin: 0 22px 18px; border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; }
.rc-lineas { padding: 6px 14px; }
.rc-linea { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px solid var(--borde); }
.rc-linea:last-child { border-bottom: none; }
.rc-img { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; background: #fff; border: 1px solid var(--borde); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.rc-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rc-nom { color: var(--texto); flex: 1; min-width: 0; }
.rc-precio { white-space: nowrap; font-weight: 600; }
.rc-desc { color: var(--pay); font-weight: 600; }
.rc-totales { background: var(--bg); padding: 12px 14px; }
.rc-fila { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.rc-fila:last-child { margin-bottom: 0; }
.rc-descuento { color: var(--pay); font-weight: 600; }

.metodos-pago { display: grid; gap: 10px; padding: 0 22px 24px; }
.metodo { display: flex; align-items: center; gap: 14px; border: 1.5px solid var(--borde-2); background: var(--surface); border-radius: 15px; padding: 14px 16px; cursor: pointer; text-align: left; transition: all .12s; }
.metodo:hover { border-color: var(--acento); background: var(--acento-suave); }
.metodo:active { transform: scale(.985); }
.metodo-icono { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.metodo-icono svg { width: 23px; height: 23px; }
.ic-tarjeta { background: #eef2ff; color: #4338ca; }
.ic-yappy { background: #ecfdf5; color: #047857; }
.ic-ach { background: #fff7ed; color: #c2410c; }

/* Pantalla de cobro Yappy (QR) */
.yappy-cobro { text-align: center; }
.yappy-monto { font-size: 16px; margin-bottom: 12px; color: var(--texto); }
.yappy-qr { width: 240px; max-width: 72%; height: auto; border-radius: 14px;
  border: 1px solid var(--borde); padding: 10px; background: #fff; }
.yappy-qr.oculto { display: none; }
.yappy-num { margin-top: 12px; font-size: 15px; color: var(--texto); }
.yappy-tip { margin-top: 12px; font-size: 13px; color: var(--tenue); line-height: 1.5; }

/* Enviar cobro Yappy al número del cliente (push) */
.yappy-push { margin-bottom: 14px; }
.yappy-push-titulo { font-size: 14px; font-weight: 600; color: var(--texto); margin-bottom: 8px; }
.yappy-push-row { display: flex; gap: 8px; }
.yappy-push-row input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px;
  letter-spacing: 1px; border: 1px solid var(--borde); border-radius: 12px; background: var(--fondo); color: var(--texto); }
.yappy-push-row input:focus { outline: none; border-color: #047857; }
.yappy-push-row .btn-cobrar { width: auto; flex-shrink: 0; padding: 12px 20px; }
.yappy-push-estado { margin-top: 10px; font-size: 13.5px; line-height: 1.5; min-height: 0; }
.yappy-push-estado.activo { color: var(--tenue); }
.yappy-push-estado.ok { color: #047857; background: #ecfdf5; padding: 10px 12px; border-radius: 10px; }
.yappy-push-estado.error { color: #b91c1c; }
.yappy-o { margin-top: 14px; font-size: 12.5px; color: var(--tenue); text-transform: uppercase; letter-spacing: .5px; }
.metodo-info { flex: 1; display: flex; flex-direction: column; }
.metodo-nombre { font-size: 16px; font-weight: 600; }
.metodo-nota { font-size: 12.5px; color: var(--tenue); margin-top: 1px; }
.metodo-flecha { font-size: 22px; color: var(--tenue); font-weight: 400; }

.pago-confirmar, .pago-exito { padding: 0 22px 24px; }
.instruccion-pago { background: var(--bg); border-radius: 14px; padding: 18px; margin-bottom: 16px; font-size: 14.5px; line-height: 1.6; color: var(--texto); }
.instruccion-pago strong { color: var(--acento); font-weight: 600; }
.instruccion-pago em { color: var(--muted); font-size: 13px; }
.botones-confirmar { display: flex; gap: 10px; }
/* En el pago, el botón de confirmar queda SIEMPRE visible abajo (no se pierde la venta) */
.pago-confirmar .botones-confirmar { position: sticky; bottom: 0; background: var(--surface);
  padding: 12px 0 4px; margin-top: 4px; box-shadow: 0 -8px 12px -8px rgba(0,0,0,.12); }
.btn-secundario { border: 1.5px solid var(--borde-2); background: var(--surface); color: var(--muted); font-size: 15px; font-weight: 600; padding: 16px 22px; border-radius: 13px; cursor: pointer; flex-shrink: 0; transition: all .12s; }
.btn-secundario:hover { background: var(--bg); }

.pago-exito { text-align: center; padding-top: 10px; }
.exito-check { width: 68px; height: 68px; border-radius: 50%; background: #ecfdf5; color: var(--pay); display: grid; place-items: center; margin: 0 auto 14px; }
.exito-check svg { width: 34px; height: 34px; }
.pago-exito h3 { font-size: 21px; font-weight: 600; margin-bottom: 6px; }
.pago-exito p { color: var(--muted); margin-bottom: 4px; font-size: 14.5px; }
.pago-exito p strong { color: var(--texto); font-weight: 600; }
.pago-exito small { color: var(--tenue); display: block; margin-bottom: 20px; font-size: 12.5px; }
.oculto { display: none !important; }

.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--texto); color: #fff; padding: 13px 22px; border-radius: 999px; font-size: 14.5px; font-weight: 500; z-index: 400; box-shadow: var(--sombra-lg); animation: subir .25s cubic-bezier(.16,1,.3,1); }
@keyframes subir { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ====================== SELECTOR DE CLIENTE ====================== */
.selector-cliente {
  display: flex; align-items: center; gap: 12px;
  margin: 0 22px 6px; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--borde);
  border-radius: 14px; cursor: pointer; text-align: left; width: calc(100% - 44px);
  transition: border-color .12s;
}
.selector-cliente:hover { border-color: var(--borde-2); }
.cliente-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface); color: var(--tenue);
  border: 1px solid var(--borde-2);
  font-size: 14px; font-weight: 600;
}
.cliente-avatar svg { width: 20px; height: 20px; }
.cliente-avatar.con-iniciales { background: var(--acento-suave); color: var(--acento); border-color: transparent; }
.cliente-texto { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cliente-nombre { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cliente-sub { font-size: 12px; color: var(--tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cliente-cambiar { font-size: 13px; font-weight: 600; color: var(--acento); flex-shrink: 0; }

.buscador-cliente { display: flex; align-items: center; gap: 10px; margin: 0 22px 8px; padding: 0 14px; background: var(--bg); border: 1.5px solid var(--borde-2); border-radius: 12px; }
.buscador-cliente .icono-lupa { width: 18px; height: 18px; color: var(--tenue); }
#buscar-cliente { flex: 1; border: none; background: transparent; font-size: 15px; padding: 13px 0; outline: none; color: var(--texto); }

.lista-clientes { max-height: 320px; overflow-y: auto; padding: 0 14px 16px; }
.cliente-opcion { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 8px; border: none; background: transparent; border-radius: 12px; cursor: pointer; text-align: left; transition: background .1s; }
.cliente-opcion:hover { background: var(--bg); }
.cliente-opcion.general { border-bottom: 1px solid var(--borde); border-radius: 0; margin-bottom: 6px; padding-bottom: 14px; }
.sin-clientes { text-align: center; color: var(--tenue); font-size: 14px; padding: 24px 0; }
.clientes-hint { font-size: 12.5px; color: var(--tenue); padding: 2px 8px 8px; }

.btn-nuevo-cliente {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 0 22px 8px; width: calc(100% - 44px);
  border: 1.5px solid var(--borde-2); background: var(--surface);
  color: var(--acento); font-size: 14.5px; font-weight: 600;
  padding: 13px; border-radius: 12px; cursor: pointer; transition: all .12s;
}
.btn-nuevo-cliente svg { width: 18px; height: 18px; }
.btn-nuevo-cliente:hover { border-color: var(--acento); background: var(--acento-suave); }

/* ====================== FORMULARIO NUEVO CLIENTE ====================== */
.form-cliente { padding: 4px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo-label { font-size: 13.5px; font-weight: 600; color: var(--texto); }
.campo-label em { color: var(--rojo); font-style: normal; }
.campo-label em.hint { color: var(--tenue); font-weight: 500; font-size: 12.5px; }
.campo input {
  border: 1.5px solid var(--borde-2); background: var(--surface);
  border-radius: 11px; padding: 13px 14px; font-size: 15px; outline: none;
  color: var(--texto); transition: all .12s; width: 100%;
}
.campo input:focus { border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-suave); }
.campo input::placeholder { color: var(--tenue); }
.form-cliente .botones-confirmar { margin-top: 6px; }
.campo-fila { display: flex; gap: 12px; }
.campo-fila .campo { flex: 1; }
.custom-nota { font-size: 12.5px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 2px 0 0; }
.custom-nota strong { color: var(--texto); font-weight: 600; }

/* ====================== LÍNEA DE DESCUENTO ====================== */
.linea.descuento { color: var(--pay); font-weight: 500; }

/* ====================== FOTO DEL COMPROBANTE ====================== */
.comprobante { margin-bottom: 16px; }
.comprobante-titulo { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--texto); }
.comprobante-titulo svg { width: 18px; height: 18px; color: var(--muted); }
.comprobante-titulo em { color: var(--rojo); font-style: normal; font-weight: 500; font-size: 12.5px; }
.btn-foto {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: 1.5px dashed var(--borde-2); background: var(--bg);
  color: var(--muted); font-size: 15px; font-weight: 600;
  padding: 18px; border-radius: 14px; cursor: pointer; transition: all .12s;
}
.btn-foto svg { width: 22px; height: 22px; }
.btn-foto:hover { border-color: var(--acento); color: var(--acento); background: var(--acento-suave); }
/* Resalta el botón de foto cuando Yappy ya autorizó y falta el comprobante */
.btn-foto.destacar { border-style: solid; border-color: #047857; color: #047857;
  background: #ecfdf5; animation: pulso-foto 1.3s ease-in-out infinite; }
@keyframes pulso-foto {
  0%, 100% { box-shadow: 0 0 0 0 rgba(4, 120, 87, .35); }
  50% { box-shadow: 0 0 0 6px rgba(4, 120, 87, 0); }
}
.comprobante-previa { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--borde-2); }
.comprobante-previa img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.btn-quitar-foto { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(24,24,27,.75); color: #fff; font-size: 15px; cursor: pointer; }

/* ====================== PANTALLA DE PIN ====================== */
.pantalla-pin {
  position: fixed; inset: 0; z-index: 500;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pin-caja { width: 100%; max-width: 320px; text-align: center; }
.pin-logo { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; background: var(--texto); color: #fff; display: grid; place-items: center; }
.pin-logo svg { width: 28px; height: 28px; }
.pin-logo-img { display: inline-flex; margin: 0 auto 20px; }
.pin-logo-img img { height: 50px; width: auto; display: block; filter: brightness(0); }
.pin-caja h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.pin-caja p { color: var(--muted); font-size: 14px; margin: 4px 0 22px; }
.pin-puntos { display: flex; justify-content: center; gap: 14px; margin-bottom: 14px; }
.pin-puntos span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--borde-2); transition: all .12s; }
.pin-puntos span.lleno { background: var(--acento); border-color: var(--acento); }
.pin-error { color: var(--rojo); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pin-teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.pin-tecla { height: 64px; border: none; background: var(--bg); border-radius: 16px; font-size: 24px; font-weight: 600; color: var(--texto); cursor: pointer; transition: transform .08s, background .12s; }
.pin-tecla:active { transform: scale(.94); background: var(--borde-2); }
.pin-borrar { font-size: 22px; color: var(--muted); }
@keyframes sacudir { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
.pin-puntos.mal { animation: sacudir .3s; }
.pin-caja > p { color: var(--muted); font-size: 15px; margin: 4px 0 16px; }

/* Login: lista de usuarios */
.lista-usuarios { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.usuario-opcion { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--borde-2); background: var(--surface); border-radius: 14px; cursor: pointer; text-align: left; transition: all .12s; }
.usuario-opcion:hover { border-color: var(--acento); background: var(--acento-suave); }
.usuario-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--acento-suave); color: var(--acento); font-size: 14px; font-weight: 700; }
.usuario-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.usuario-nombre { font-size: 15px; font-weight: 600; }
.usuario-rol { font-size: 12px; color: var(--tenue); }
.btn-modo-cliente { width: 100%; border: 1.5px dashed var(--borde-2); background: var(--bg); color: var(--muted); font-size: 14.5px; font-weight: 600; padding: 13px; border-radius: 14px; cursor: pointer; }
.btn-modo-cliente:hover { border-color: var(--acento); color: var(--acento); }
.btn-volver-usuarios { margin-top: 14px; border: none; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; }

/* Botón de cuenta en el encabezado */
.btn-cuenta { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--borde-2); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--acento); flex-shrink: 0; }
.btn-cuenta:hover { border-color: var(--acento); background: var(--acento-suave); }
.cuenta-inicial { line-height: 1; }
.pendientes-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

/* Modal de cuenta */
.cuenta-info { display: flex; align-items: center; gap: 14px; padding: 4px 22px 18px; }
.cuenta-avatar-grande { width: 54px; height: 54px; border-radius: 50%; background: var(--acento-suave); color: var(--acento); display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.cuenta-nombre-grande { font-size: 18px; font-weight: 700; }
.cuenta-rol { font-size: 13px; color: var(--tenue); }
.cuenta-acciones { display: grid; gap: 10px; padding: 0 22px 22px; }
.cuenta-grupo { font-size: 11px; font-weight: 700; color: var(--tenue); text-transform: uppercase;
  letter-spacing: .06em; margin: 8px 2px -2px; }

/* Panel admin */
.admin-tabs { display: flex; gap: 8px; padding: 0 22px 14px; }
.admin-tab { flex: 1; border: none; background: var(--bg); color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px; border-radius: 10px; cursor: pointer; }
.admin-tab.activo { background: var(--texto); color: #fff; }
.admin-seccion { padding: 0 22px 22px; }
.lista-usuarios-admin { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.usuario-fila { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 12px; }
.btn-editar-usuario, .btn-borrar-usuario { border: none; background: transparent; cursor: pointer; font-size: 16px; opacity: .7; padding: 4px; }
.btn-editar-usuario:hover, .btn-borrar-usuario:hover { opacity: 1; }
.form-titulo { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.reporte-resultado { margin-top: 14px; }
.reporte-total { background: var(--bg); border-radius: 12px; padding: 14px; font-size: 15px; color: var(--muted); margin-bottom: 12px; }
.reporte-total strong { color: var(--texto); font-size: 18px; }
.reporte-filas { display: flex; flex-direction: column; gap: 6px; }
.reporte-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--borde); border-radius: 10px; font-size: 14.5px; }
.reporte-fila .rf-cant { color: var(--tenue); font-size: 12.5px; margin-left: auto; margin-right: 12px; }
.reporte-fila strong { font-weight: 700; }

.metodo-icono.metodo-emoji { font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }

/* Cierre de caja */
.cierre-sub { font-size: 12px; font-weight: 700; color: var(--tenue); text-transform: uppercase;
  letter-spacing: .05em; margin: 16px 0 8px; }
.cierre-fila { flex-wrap: wrap; }
.cierre-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: 13.5px; }
.cierre-origen { color: var(--tenue); font-size: 12px; }
.cierre-cliente { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cierre-metodo { border: 1px solid var(--borde); border-radius: 8px; padding: 7px 8px; font-size: 13px; background: var(--surface); }
.cierre-metodo.sin-metodo { border-color: #f59e0b; background: #fffbeb; }
.cierre-met-fijo { font-size: 13px; color: var(--muted); }
.cierre-total-fila { min-width: 68px; text-align: right; }
.reporte-fila.no-pagada { opacity: .72; }
.reporte-fila.no-pagada.con-abono { opacity: 1; }
/* Abono de órdenes no pagadas (preventa) */
.cierre-abono { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; padding: 7px 9px; }
.cierre-abono-lbl { font-size: 12px; font-weight: 700; color: #92400e; }
.cierre-abono-monto { width: 92px; border: 1px solid var(--borde); border-radius: 8px;
  padding: 6px 8px; font-size: 14px; background: var(--surface); color: var(--texto); }
.cierre-abono-guardar { border: none; background: var(--texto); color: #fff; border-radius: 8px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.cierre-abono-hint { font-size: 11px; color: #b45309; width: 100%; }
.cierre-abono-val { color: #047857; font-weight: 700; }
.cierre-de-total { display: block; font-size: 11px; color: var(--tenue); font-weight: 400; }
.cierre-total-nocuenta { color: var(--tenue); font-weight: 400; }
.cierre-aviso { background: #fef3c7; color: #92400e; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.cierre-pend { color: #b45309; font-weight: 700; }

/* Arqueo por método (cierre del punto / Yappy / ACH …) */
.cierre-arqueos { display: flex; flex-direction: column; gap: 10px; }
.cp-titulo { font-size: 15px; font-weight: 700; color: var(--texto); }
.cierre-punto { border: 1px solid var(--borde); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px; }
.cp-esperado { font-size: 13.5px; color: var(--muted); }
.cp-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cp-form input[type="number"] { flex: 1; min-width: 150px; border: 1px solid var(--borde);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; background: var(--surface); color: var(--texto); }
.cp-foto-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cp-guardar { width: auto; padding: 10px 18px; }
.cp-estado { font-size: 14px; font-weight: 700; }
.cp-estado.ok { color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 10px; padding: 10px 12px; }
.cp-estado.mal { color: #dc2626; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 12px; }
.cp-foto-img { max-width: 230px; border-radius: 10px; border: 1px solid var(--borde); }
.cp-meta { font-size: 12px; color: var(--tenue); }

/* Pagos por aprobar */
.lista-pendientes { display: flex; flex-direction: column; gap: 8px; padding: 0 22px 22px; }
.pendiente-fila { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--borde-2); border-radius: 14px; background: var(--surface); text-align: left; }
.pendiente-acciones { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pend-aprobar { border: none; background: var(--pay); color: #fff; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.pend-aprobar:active { transform: scale(.96); }
.pend-cancelar { border: 1.5px solid var(--borde-2); background: var(--surface); color: var(--rojo); font-weight: 600; font-size: 14px; padding: 10px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.pend-cancelar:hover { border-color: var(--rojo); background: #fef2f2; }
.espera-icono { background: var(--acento-suave) !important; color: var(--acento) !important; font-size: 30px; }

/* Modo kiosko: oculta artículo personalizado y descuentos al cliente */
body.kiosko #btn-custom,
body.kiosko .item-desc-btn,
body.kiosko #btn-desc-orden,
body.sin-desc-manual .item-desc-btn,
body.sin-desc-manual #btn-desc-orden { display: none; }

/* Descuento por producto en el carrito */
.item-acciones { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.item-desc-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--borde-2); background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 8px; cursor: pointer; }
.item-desc-btn:hover { border-color: var(--acento); color: var(--acento); }
.item-desc-btn.activo { background: #ecfdf5; border-color: var(--pay); color: var(--pay); }

/* Descuento a la orden (resumen) */
.btn-desc-orden { width: 100%; border: 1px dashed var(--borde-2); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 9px; border-radius: 10px; cursor: pointer; margin: 2px 0 10px; }
.btn-desc-orden:hover { border-color: var(--acento); color: var(--acento); }
.btn-desc-orden.activo { border-style: solid; border-color: var(--pay); color: var(--pay); background: #ecfdf5; }

/* Selector de tipo de descuento */
.desc-tipo { display: flex; gap: 8px; margin-bottom: 6px; }
.desc-tipo-btn { flex: 1; border: 1.5px solid var(--borde-2); background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 600; padding: 11px; border-radius: 11px; cursor: pointer; }
.desc-tipo-btn.activo { border-color: var(--acento); background: var(--acento-suave); color: var(--acento); }

/* Mis ventas */
.lista-mis-ordenes { display: flex; flex-direction: column; gap: 8px; padding: 0 22px 22px; max-height: 60vh; overflow-y: auto; }
.orden-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--borde); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; }
.orden-fila:hover { border-color: var(--acento); background: var(--acento-suave); }
.orden-total { font-weight: 700; font-size: 15px; white-space: nowrap; }
.detalle-contenido { padding: 0 22px 22px; }
.detalle-meta { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.detalle-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--borde); margin-top: 8px; padding-top: 12px; }
.detalle-total strong { font-size: 20px; font-weight: 700; }
.detalle-comprobante { margin-top: 16px; }
.cot-det-acciones { display: flex; flex-direction: column; gap: 10px; padding: 4px 22px 22px; }
.detalle-comprobante img { width: 100%; border-radius: 12px; border: 1px solid var(--borde); margin-top: 8px; }

/* ====================== BOTÓN FLOTANTE + VOLVER (base oculto) ====================== */
.fab-carrito { display: none; }
.btn-cerrar-carrito { display: none; }

.fab-carrito {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 120;
  align-items: center; gap: 12px;
  background: var(--pay); color: #fff; border: none;
  border-radius: 15px; padding: 15px 18px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: var(--sombra-lg);
}
.fab-izq { display: flex; align-items: center; gap: 8px; }
.fab-izq svg { width: 22px; height: 22px; }
.fab-count { background: rgba(255,255,255,.25); min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; padding: 0 6px; }
.fab-label { flex: 1; text-align: left; }
.fab-total { font-weight: 700; }
.fab-carrito.vacio { background: var(--texto); opacity: .92; }
body.carrito-abierto .fab-carrito { display: none; }

/* ====================== RESPONSIVE ====================== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr 360px; }
}

@media (max-width: 760px) {
  /* Productos a pantalla completa */
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr; height: 100vh; height: 100dvh; }

  /* Encabezado compacto */
  .barra-superior { flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; }
  .marca { flex: 1; min-width: 0; }
  .marca-sub, .marca-pos { display: none; }
  .marca-logo-img img { height: 22px; }
  .marca-logo { width: 38px; height: 38px; }
  .marca-titulo { font-size: 15px; }
  .btn-escanear { margin-left: auto; padding: 11px 13px; }
  .btn-escanear span { display: none; }
  .buscador { order: 3; flex-basis: 100%; }

  .categorias { padding: 12px 16px 4px; }
  .grid-productos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 14px 16px 100px; }

  /* Botón flotante visible */
  .fab-carrito { display: flex; }

  /* Carrito como panel deslizable a pantalla completa */
  .panel-carrito {
    position: fixed; inset: 0; z-index: 150;
    border: none; max-height: none; height: 100%;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.16, 1, .3, 1);
  }
  body.carrito-abierto { overflow: hidden; }
  body.carrito-abierto .panel-carrito { transform: none; }

  .btn-cerrar-carrito {
    display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 10px;
    border: none; background: var(--bg); color: var(--texto); cursor: pointer; flex-shrink: 0;
  }
  .btn-cerrar-carrito svg { width: 20px; height: 20px; }
  .carrito-encabezado { gap: 10px; }
  .carrito-encabezado h2 { flex: 1; }
}

/* ===================== Cotización (documento PDF) ===================== */
.btn-cotizar-doc { width: 100%; margin-top: 8px; padding: 13px; border-radius: 13px;
  border: 1.5px solid var(--borde-2); background: var(--surface); color: var(--texto);
  font-size: 14.5px; font-weight: 600; cursor: pointer; transition: all .12s; }
.btn-cotizar-doc:hover:not(:disabled) { border-color: var(--acento); color: var(--acento); background: var(--acento-suave); }
.btn-cotizar-doc:disabled { opacity: .45; cursor: default; }

.cotizacion-vista { position: fixed; inset: 0; z-index: 400; background: #eef2f6; overflow-y: auto; }
.cotizacion-vista.oculto { display: none; }
.cot-barra { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--borde); }
.cot-barra > button { width: auto; flex: 0 0 auto; padding: 12px 22px; }

.cot-doc { background: #fff; max-width: 800px; margin: 22px auto; padding: 0;
  box-shadow: 0 10px 40px rgba(0,0,0,.12); color: #1e293b; font-size: 13px; line-height: 1.5; }
/* El cuerpo y los términos llevan su propio padding para poder renderizarse por
   separado en el PDF (términos en hoja aparte cuando la cotización es larga). */
.cot-cuerpo { padding: 46px 50px 14px; }
/* Miniatura del producto en la fila de la cotización */
.cot-prod { display: flex; align-items: flex-start; gap: 10px; }
.cot-prod-img { width: 46px; height: 46px; flex: 0 0 auto; object-fit: contain;
  border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; }
.cot-prod-nom { min-width: 0; }
.cot-logo { text-align: center; margin-bottom: 10px; }
.cot-logo img { height: 110px; width: auto; max-width: 80%; object-fit: contain; }
.cot-empresa { font-size: 11.5px; color: #334155; line-height: 1.5; margin: 14px 0 22px; }
.cot-tachado { text-decoration: line-through; color: #94a3b8; font-size: 11px; margin-right: 5px; }
.cot-desc-linea { color: #047857; font-size: 11px; font-weight: 600; margin-top: 3px; }
.cot-h1 { font-size: 30px; font-weight: 800; margin: 6px 0 2px; }
.cot-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: #475569; margin-bottom: 16px; }
.cot-cliente { font-weight: 600; font-size: 14px; margin-bottom: 16px; }
.cot-cliente-ruc { font-weight: 500; font-size: 12px; color: #475569; margin-top: 2px; }
.cot-tabla { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cot-tabla th { background: #f1f5f9; text-align: left; padding: 9px 11px; border: 1px solid #e2e8f0; font-weight: 700; }
.cot-tabla td { padding: 9px 11px; border: 1px solid #e2e8f0; vertical-align: top; }
.cot-tabla .num { text-align: right; white-space: nowrap; }
.cot-esp { color: #b45309; font-size: 11px; font-style: italic; }
.cot-sku { color: #64748b; font-size: 10px; margin-top: 2px; letter-spacing: .02em; }
.cot-totales { width: 250px; margin: 16px 0 0 auto; font-size: 13px; }
.cot-fila { display: flex; justify-content: space-between; padding: 6px 12px; }
.cot-fila span:last-child { font-weight: 600; }
.cot-total { background: #111827; color: #fff; border-radius: 5px; margin-top: 5px; padding: 9px 12px; font-size: 15px; }
.cot-total span { font-weight: 800 !important; }
.cot-terminos { padding: 30px 50px 46px; font-size: 9.5px; color: #475569; line-height: 1.5; }
.cot-terminos h3 { font-size: 12px; color: #111827; margin: 0 0 7px; }
.cot-terminos p { margin: 0 0 5px; }
.cot-terminos strong { color: #111827; }

@media print {
  html, body { overflow: visible !important; height: auto !important; }
  .app, #fab-carrito, #toast, #pantalla-pin, .modal, .cot-barra { display: none !important; }
  .cotizacion-vista { position: static; background: #fff; overflow: visible; }
  .cot-doc { box-shadow: none; margin: 0; max-width: 100%; padding: 0; }
  @page { size: letter; margin: 14mm; }
}

/* Conciliación bancaria (dashboard admin) */
.concil-vista { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto; }
.concil-barra { display: flex; align-items: center; gap: 12px; padding: 12px 18px; position: sticky;
  top: 0; background: var(--bg); border-bottom: 1px solid var(--borde); z-index: 2; }
.concil-generado { flex: 1; font-size: 12.5px; color: var(--tenue); }
.concil-barra .btn-cobrar { width: auto; padding: 10px 16px; }
.concil-cuerpo { max-width: 880px; margin: 0 auto; padding: 16px 18px 70px; }
.concil-cuentas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.concil-cuenta { background: var(--surface); border: 1px solid var(--borde); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 7px; }
.cc-banco { font-weight: 700; font-size: 15px; }
.cc-linea { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.cc-entrar { color: #047857; }
.cc-proy { border-top: 1px dashed var(--borde); padding-top: 7px; }
.cc-proy strong { font-size: 17px; }
.cc-manual { display: flex; gap: 6px; margin-top: 4px; }
.cc-manual input { flex: 1; min-width: 0; border: 1px solid var(--borde); border-radius: 8px;
  padding: 7px 9px; font-size: 13px; background: var(--bg); color: var(--texto); }
.concil-saldo-guardar, .concil-gasto-guardar { border: none; background: var(--texto); color: #fff;
  border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.concil-fila { align-items: flex-start; }
.concil-detalle { font-size: 12px; color: var(--tenue); }
.concil-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.concil-chip { font-size: 11.5px; background: var(--bg); border: 1px solid var(--borde);
  border-radius: 999px; padding: 2px 9px; }
.concil-ok { color: #047857; }
.concil-rev { color: #b45309; font-weight: 700; }
.concil-atrasada { border-color: #fecaca; background: #fef2f2; }
.concil-gasto-monto { color: #dc2626; font-weight: 700; }
.concil-gasto-edit { display: flex; gap: 6px; margin-top: 6px; width: 100%; }
.concil-gasto-inp { flex: 1; min-width: 0; border: 1px solid var(--borde); border-radius: 8px;
  padding: 7px 9px; font-size: 13px; background: var(--bg); color: var(--texto); }

/* ===================== Shopify: pedidos y borradores ===================== */
.shop-tab { flex: 1; border: none; background: var(--bg); color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px; border-radius: 10px; cursor: pointer; }
.shop-tab.activo { background: var(--texto); color: #fff; }
.lista-shopify { display: flex; flex-direction: column; gap: 8px; padding: 0 22px 22px; max-height: 62vh; overflow-y: auto; }
.shop-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.shop-ok { background: #dcfce7; color: #166534; }
.shop-warn { background: #fef9c3; color: #854d0e; }
.shop-muted { background: #e5e7eb; color: #4b5563; }
.shop-draft { background: #e0e7ff; color: #3730a3; }
#shop-det-contenido { padding: 0 22px; }
#modal-shopify-detalle .cuenta-acciones { padding: 14px 22px 22px; }

/* ===================== Conciliación: vista por orden ===================== */
.concil-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.concil-kpis .ck { flex: 1; min-width: 140px; background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 10px 14px; }
.concil-kpis .ck-n { font-size: 12px; color: var(--muted); font-weight: 600; }
.concil-kpis .ck strong { display: block; font-size: 20px; margin-top: 2px; }
.concil-kpis .ck-ok strong { color: #166534; }
.concil-kpis .ck-pen strong { color: #854d0e; }
.concil-filtros { display: flex; gap: 8px; margin-bottom: 12px; }
.concil-filtro { border: 1px solid var(--borde); background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 600; padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.concil-filtro.activo { background: var(--texto); color: #fff; border-color: var(--texto); }
.co-estado { text-align: right; white-space: nowrap; }
.co-fecha { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.co-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.co-entro { background: #dcfce7; color: #166534; }
.co-camino { background: #fef9c3; color: #854d0e; }
.co-atras { background: #fee2e2; color: #991b1b; }
.co-espera { background: #e5e7eb; color: #4b5563; }
.co-nopago { background: #ffedd5; color: #9a3412; }
.concil-filtros { flex-wrap: wrap; }
.co-falta { color: #9a3412; }

/* ============== Conciliación: detalle de liquidación por orden ============== */
.co-clicable { cursor: pointer; }
.co-clicable:active { background: var(--bg); }
.co-ver { display: block; font-size: 11px; color: #166534; font-weight: 700; margin-top: 2px; }
.liq-det-contenido { padding: 0 22px 22px; max-height: 70vh; overflow-y: auto; }
.liq-orden-actual { background: #ecfdf5; border-radius: 8px; }
.liq-orden-actual .rc-nom { font-weight: 800; }
.liq-sin-designar { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: #fee2e2; color: #991b1b; font-size: 13px; }
.liq-todo-ok { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: #dcfce7; color: #166534; font-size: 13px; font-weight: 600; }

/* ============== Conciliación: ajuste de orden (recibido / lote) ============== */
.aj-label { display: block; font-size: 13px; font-weight: 700; color: var(--texto); margin: 12px 0 0; }
.aj-label input { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid var(--borde); border-radius: 10px; font-size: 15px; background: var(--bg); }
.aj-ayuda { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.co-ajustar { color: var(--muted); }
.liq-forzada { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #e0e7ff; color: #3730a3; vertical-align: middle; }

/* ===================== Login del personal (usuario + contraseña) ===================== */
#form-login { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.login-input { width: 100%; box-sizing: border-box; padding: 13px 14px; font-size: 16px; border: 1px solid var(--borde); border-radius: 12px; background: var(--bg); }
.login-input:focus { outline: none; border-color: var(--texto); }
.login-entrar { width: 100%; margin-top: 2px; }

/* ============== Cierre: ajuste de "recibido real" (pagó distinto) ============== */
.cierre-recibido-wrap { margin-top: 5px; }
.cierre-ajustar-lnk { border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.cierre-ajustar-lnk:hover { color: var(--texto); }
.cierre-recibido { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cierre-recibido.oculto { display: none; }
.cierre-recibido-monto { width: 110px; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 9px; font-size: 14px; background: var(--bg); }
.cierre-recibido-guardar { border: none; background: var(--texto); color: #fff; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }

/* ============== Cierre: pago dividido (2 métodos) ============== */
.cierre-split-wrap { margin-top: 5px; }
.cierre-split-lnk { border: none; background: transparent; color: #3730a3; font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 0; text-align: left; }
.cierre-split { margin-top: 6px; padding: 10px; border: 1px solid var(--borde); border-radius: 10px; background: var(--bg); }
.cierre-split.oculto { display: none; }
.cierre-split-row { display: flex; gap: 8px; margin-bottom: 6px; }
.cierre-split-met { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 9px; font-size: 13px; background: #fff; }
.cierre-split-monto { width: 92px; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 9px; font-size: 13px; background: #fff; }
.cierre-split-acc { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.cierre-split-mitad { border: 1px solid var(--borde); background: #fff; color: var(--texto); font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 9px; cursor: pointer; }
.cierre-split-guardar { border: none; background: var(--texto); color: #fff; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.cierre-split-quitar { border: none; background: transparent; color: #b91c1c; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: auto; }

/* Pago dividido — modal amplio (dropdowns full-width, fáciles de tocar) */
#modal-cierre-split { z-index: 350; }
#modal-deposito, #modal-abonar { z-index: 360; }   /* por encima del cierre (modal-admin) */
#modal-cierre-split .liq-det-contenido { padding: 0 22px 22px; }
.csp-fila { display: flex; gap: 10px; margin-bottom: 10px; }
.csp-sel { flex: 1; min-width: 0; padding: 13px 12px; font-size: 15px; border: 1px solid var(--borde); border-radius: 11px; background: var(--bg); }
.csp-inp { width: 120px; padding: 13px 12px; font-size: 15px; border: 1px solid var(--borde); border-radius: 11px; background: var(--bg); text-align: right; }
.csp-suma { font-size: 13px; color: var(--muted); margin: 6px 2px 14px; }
.csp-dif { color: #b91c1c; font-weight: 700; }
.csp-ok { color: #166534; font-weight: 700; }
.csp-mitad { width: 100%; margin-bottom: 14px; }
#csp-quitar { color: #b91c1c; }

/* ===================== Inventario en tienda ===================== */
.campo-check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 4px; cursor: pointer; }
.campo-check input { width: 18px; height: 18px; }
.inv-fila { align-items: center; }
.inv-conteo { width: 96px; padding: 10px; border: 1px solid var(--borde); border-radius: 10px; font-size: 15px; background: var(--bg); text-align: right; }
#inv-volver-col { margin-bottom: 12px; }
.inv-config-lista { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; }
.inv-config-item { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--borde); font-size: 14px; cursor: pointer; }
.inv-config-item input { width: 18px; height: 18px; }
.inv-config-count { color: var(--muted); font-size: 12px; }
.inv-det-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.inv-dif-pos { color: #166534; font-weight: 700; }
.inv-dif-neg { color: #b91c1c; font-weight: 700; }
.inv-det-acc { padding: 14px 22px 22px; flex-wrap: wrap; }
.inv-rechazar { color: #b91c1c; }

/* Miniaturas de inventario */
.inv-fila { gap: 10px; }
.inv-fila .cierre-col { flex: 1; min-width: 0; }
.inv-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--bg); border: 1px solid var(--borde); flex-shrink: 0; }
.inv-thumb-vacia { display: grid; place-items: center; font-size: 22px; }
.inv-det-linea { display: flex; align-items: center; gap: 10px; }
.inv-thumb-sm { width: 36px; height: 36px; border-radius: 7px; object-fit: cover; background: var(--bg); border: 1px solid var(--borde); flex-shrink: 0; }

/* Artículo sin stock en el carrito (solo cotización) */
.item-sin-stock { font-size: 11px; font-weight: 700; color: #b45309; margin-top: 1px; }

/* Actividad del equipo (auditoría) */
.aud-filtros { display: flex; gap: 8px; padding: 0 22px 10px; }
.aud-buscar { flex: 1; width: auto; text-align: left; }
#modal-auditoria .detalle-meta { padding-bottom: 8px; }
.aud-fila .cierre-col span:first-child { font-size: 13.5px; }

/* Visor de foto ampliada (arqueos del cierre) */
.cp-foto-img { cursor: zoom-in; }
.visor-foto { position: fixed; inset: 0; z-index: 600; background: rgba(10,10,12,.88);
  display: grid; place-items: center; padding: 18px; cursor: zoom-out; backdrop-filter: blur(2px); }
.visor-foto.oculto { display: none; }
.visor-foto img { max-width: 96vw; max-height: 94vh; border-radius: 10px; box-shadow: 0 12px 50px rgba(0,0,0,.5); }

/* Fecha del abono (puede ser distinta al día del cierre) */
.cierre-abono-fecha { padding: 8px 8px; border: 1px solid var(--borde); border-radius: 9px; font-size: 13px; background: var(--bg); }

/* Botón para quitar un abono de otra fecha */
.cierre-abono-quitar { border: none; background: #fee2e2; color: #b91c1c; font-size: 11px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer; padding: 0; vertical-align: middle; }

/* Abonar una orden (búsqueda) */
.abonar-orden-btn { margin-bottom: 12px; }
#modal-abonar .aud-buscar { text-align: left; }
#ab-detalle .detalle-meta { line-height: 1.6; padding-bottom: 10px; }

/* Lista de abonos con borrado (buscador de abonos) */
.ab-lista { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ab-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg);
  border: 1px solid var(--borde); border-radius: 999px; padding: 5px 10px; font-size: 13px; }
.ab-quitar { border: none; background: #fee2e2; color: #b91c1c; font-size: 11px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer; padding: 0; }

/* Caja de efectivo en el cierre */
.caja-box { background: var(--bg); border: 1px solid var(--borde); border-radius: 12px; padding: 14px; margin-bottom: 8px; }
.caja-fila { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.caja-fila.caja-saldo { border-top: 1px dashed var(--borde); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.caja-fila.caja-saldo strong { color: #047857; }
.caja-depositar { margin-top: 10px; width: 100%; }
.caja-deps { margin-top: 10px; border-top: 1px solid var(--borde); padding-top: 8px; }
.caja-dep-quitar { border: none; background: #fee2e2; color: #b91c1c; font-size: 11px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer; padding: 0; margin-left: 8px; }
.co-pill.co-efectivo { background: #ecfdf5; color: #047857; }

/* Ajustar efectivo real en caja */
.caja-real { display: flex; gap: 8px; margin-top: 10px; }
.caja-real-inp { flex: 1; padding: 10px; border: 1px solid var(--borde); border-radius: 9px; font-size: 14px; background: var(--bg); }
.caja-real-guardar { padding: 10px 14px; border: 1px solid var(--borde); border-radius: 9px; background: var(--panel); font-weight: 600; cursor: pointer; white-space: nowrap; }

/* Foto del comprobante del depósito */
.dep-foto-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.dep-foto-previa { max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 8px; display: block; cursor: zoom-in; }
.caja-dep-foto { border: none; background: #eef2ff; color: #3730a3; font-size: 13px; width: 24px; height: 22px; border-radius: 7px; cursor: pointer; padding: 0; margin-left: 6px; }

/* Arqueo parcial (Yappy llegando por partes) */
.liq-parcial { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 9px; padding: 8px 11px; font-size: 13px; margin-top: 8px; }

/* Aviso: orden ya pagada en Shopify (registrar pago final) */
.ab-pagada { color: #047857; font-size: 12.5px; font-weight: 600; }

/* Etiqueta de abono/pago final en la conciliación */
.co-abono-tag { display: inline-block; background: #ecfdf5; color: #047857; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }

/* Asignar órdenes a un depósito */
.asig-resumen { background: var(--bg); border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.asig-ok { color: #047857; font-weight: 700; }
.asig-falta { color: #b45309; font-weight: 700; }
.asig-sobra { color: #b91c1c; font-weight: 700; }
.liq-asignar-btn { margin-top: 12px; width: 100%; }
.asig-fila { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--borde); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.asig-fila.asig-on { border-color: #34d399; background: #ecfdf5; }
.asig-fila input { width: 20px; height: 20px; flex-shrink: 0; }

/* Orden completa por abonos (aunque Shopify la marque sin pagar) */
.cierre-completa { color: #047857; font-weight: 700; }

/* Subir estado de cuenta */
.sub-archivo-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
#modal-subir, #modal-asignar { z-index: 360; }

/* Autoservicio: pantalla de espera de aprobación */
.login-espera { text-align: center; padding: 10px 4px; }
.espera-spinner { font-size: 42px; animation: pulso 1.4s ease-in-out infinite; }
@keyframes pulso { 0%,100% { opacity: .5; transform: scale(.95);} 50% { opacity: 1; transform: scale(1.08);} }
.espera-titulo { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.espera-texto { color: var(--texto-suave); font-size: 14px; margin-bottom: 12px; }
.espera-codigo { font-size: 15px; margin-bottom: 8px; }
.espera-codigo strong { letter-spacing: 4px; font-size: 22px; }
.pendiente-kiosko { background: #ecfdf5; border-radius: 10px; }

/* Aviso fijo de aprobaciones pendientes (imposible de perderse) */
.aviso-pendientes {
  position: fixed; top: 0; left: 0; right: 0; z-index: 250;
  background: #b45309; color: #fff; border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; padding: 11px 16px; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: bajarAviso .3s ease;
}
.aviso-pendientes.oculto { display: none; }
@keyframes bajarAviso { from { transform: translateY(-100%);} to { transform: translateY(0);} }
