/* ==========================================================
   ENTREGAS DE MP — vista de Almacén (entregas.js)
   Pensada para el celular: se registra de pie en el almacén, con la
   balanza al lado. Todo lo que se toca mide al menos 48 px y los campos
   usan 16 px para que el navegador no haga zoom al escribir.
   ========================================================== */

.ent-wrap { max-width: 640px; margin: 0 auto; }

/* Resumen del día */
.ent-hoyres {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #e5e1d8; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px;
}
.ent-hoyt { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6f6a62; }
.ent-hoyn { font-size: 15px; color: #2a2722; }
.ent-hoyn .mono { color: #8a5a1c; }
.ent-recarga {
  margin-left: auto; width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid #e5e1d8; background: #faf9f5; font-size: 20px; color: #3d7a4e; cursor: pointer;
}

/* Pestañas */
.ent-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  background: #ebe8e0; border-radius: 12px; padding: 4px; margin-bottom: 12px;
}
.ent-tab {
  min-height: 44px; border: 0; border-radius: 9px; background: transparent;
  font-size: 14px; font-weight: 600; color: #6b665c; cursor: pointer;
}
.ent-tab.on { background: #fff; color: #2a2722; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.ent-cnt {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px;
  background: #3d7a4e; color: #fff; font-size: 11px; margin-left: 2px;
}

.ent-busca {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 16px;
  border: 1px solid #d8d4cc; border-radius: 10px; background: #fff; margin-bottom: 10px;
  box-sizing: border-box;
}
.ent-vacio { text-align: center; color: #6f6a62; font-size: 14px; padding: 28px 12px; }

/* Tarjeta de lote */
.ent-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #fff; border: 1px solid #e5e1d8; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; font: inherit; color: inherit;
}
.ent-card:active { background: #f4f2ec; }
.ent-card-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ent-lote { font-size: 17px; font-weight: 700; color: #2a2722; }
.ent-item { font-size: 13.5px; color: #4a463e; margin: 2px 0 10px; }
.ent-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ent-nums span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6f6a62; }
.ent-nums b { font-size: 14.5px; }
.ent-go { margin-top: 10px; font-size: 13px; font-weight: 700; color: #3d7a4e; text-align: right; }
.ent-ok { color: #2f6d3c; }

.ent-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #f1eee6; color: #6b665c; font-size: 11px; font-weight: 600;
}
.ent-badge.plan { background: #e7f0e8; color: #2f6d3c; }


/* Pedido con su plan */
.ent-ped { background: #fff; border: 1px solid #e5e1d8; border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.ent-ped-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 14px; background: #faf9f5; border-bottom: 1px solid #eeebe3; font-size: 15px;
}
.ent-cli { font-size: 13px; color: #6b665c; }
.ent-fila {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 56px; padding: 10px 14px; text-align: left;
  border: 0; border-bottom: 1px solid #f1eee6; background: #fff; font: inherit; color: inherit; cursor: pointer;
}
.ent-fila:active { background: #f4f2ec; }
.ent-lote-s { font-size: 14.5px; font-weight: 700; }
.ent-item-s { font-size: 12.5px; color: #6b665c; font-weight: 400; }
.ent-fila-d { text-align: right; font-size: 13px; color: #8a5a1c; white-space: nowrap; }
.ent-mini { font-size: 11.5px; color: #6f6a62; }
.ent-fuera { color: #b5772a; }
.ent-otro {
  width: 100%; min-height: 48px; border: 0; background: #fff; color: #3d7a4e;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.ent-sinplan { background: #fff; border: 1px solid #e5e1d8; border-radius: 12px; overflow: hidden; }
.ent-sinplan summary { padding: 14px; font-size: 14px; font-weight: 600; color: #6b665c; cursor: pointer; }

/* Entregas de hoy */
.ent-hoy { background: #fff; border: 1px solid #e5e1d8; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.ent-hoy-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ent-hora { color: #6f6a62; font-size: 13px; }
.ent-kg { margin-left: auto; font-size: 16px; color: #8a5a1c; }
.ent-hoy.anulada { opacity: .6; }
.ent-hoy.anulada .ent-kg, .ent-hoy.anulada .ent-lote-s { text-decoration: line-through; }
.ent-anul { margin-top: 6px; font-size: 12px; font-weight: 700; color: #a03050; }
.ent-anular {
  margin-top: 8px; min-height: 38px; padding: 0 14px; border-radius: 8px;
  border: 1px solid #e5c8cf; background: none; color: #a03050; font-size: 13px; cursor: pointer;
}

/* Hoja de registro: pantalla completa en celular, ventana en escritorio */
body.ent-hoja-on { overflow: hidden; }
.ent-hoja {
  position: fixed; inset: 0; z-index: 60; background: rgba(26, 31, 27, .45);
  display: flex; align-items: center; justify-content: center;
}
.ent-hoja-box {
  display: flex; flex-direction: column; background: #f6f4ef;
  width: min(520px, 100%); max-height: 92vh; border-radius: 14px; overflow: hidden;
}
.ent-hoja-top {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: #1f3a2a; color: #fff; font-size: 16px;
}
.ent-x {
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12);
  color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.ent-hoja-mb { flex: 1; overflow-y: auto; padding: 14px; }
.ent-hoja-mb .fld { margin-bottom: 14px; }
.ent-hoja-mb .fld input { min-height: 48px; font-size: 16px; }
.ent-hoja-mb [data-sacos] input { font-size: 20px; font-weight: 600; text-align: right; }
.ent-hoja-mb [data-sacotot] { font-size: 15px !important; }
.ent-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  background: #fff; border: 1px solid #e5e1d8; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.ent-info span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6f6a62; }
.ent-info b { font-size: 14px; word-break: break-word; }
.ent-hoja-pie { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #e5e1d8; }
.ent-registrar {
  width: 100%; min-height: 54px; border: 0; border-radius: 12px;
  background: #3d7a4e; color: #fff; font-size: 17px; font-weight: 700; cursor: pointer;
}
.ent-registrar:disabled { opacity: .6; }

@media (max-width: 820px) {
  .ent-hoja { align-items: stretch; }
  .ent-hoja-box { width: 100%; max-height: none; height: 100dvh; border-radius: 0; }
  .ent-hoja-top { padding-top: calc(10px + env(safe-area-inset-top)); }
}

/* ---------- Vista de escritorio (entregas.js · entPintarWeb) ---------- */
.entw { max-width: 1280px; margin: 0 auto; }
.entw-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.entw-kpi { background: #fff; border: 1px solid #e5e1d8; border-left: 4px solid var(--c); border-radius: 10px; padding: 12px 16px; }
.entw-kpi-l { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6f6a62; }
.entw-kpi-v { font-size: 24px; font-weight: 700; color: var(--c); margin: 4px 0 2px; }
.entw-kpi-s { font-size: 12px; color: #6f6a62; }
.entw-card { padding: 0; overflow: hidden; }
.entw-bar-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #eeebe3; background: #faf9f5; }
.entw-tabs { display: flex; gap: 4px; background: #ebe8e0; border-radius: 10px; padding: 3px; }
.entw-tab { border: 0; background: transparent; border-radius: 8px; padding: 8px 16px; font-size: 13.5px; font-weight: 600; color: #6b665c; cursor: pointer; }
.entw-tab.on { background: #fff; color: #2a2722; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.entw-n { display: inline-block; min-width: 20px; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #3d7a4e; color: #fff; font-size: 11px; }
.entw-busca { flex: 1; max-width: 420px; padding: 9px 12px; border: 1px solid #d8d4cc; border-radius: 8px; font-size: 14px; background: #fff; margin-left: auto; }
.entw-tw { overflow-x: auto; }
.entw-t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.entw-t th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6f6a62;
  padding: 10px 14px; border-bottom: 1px solid #e5e1d8; background: #fff; position: sticky; top: 0; white-space: nowrap; }
.entw-t td { padding: 10px 14px; border-bottom: 1px solid #f1eee6; vertical-align: middle; }
.entw-t tbody tr:hover td { background: #faf9f5; }
.entw-t .r { text-align: right; }
.entw-mut { color: #6f6a62; font-weight: 400; }
.entw-btn { white-space: nowrap; background: #3d7a4e; }
.entw-bar { height: 8px; border-radius: 999px; background: #ebe8e0; overflow: hidden; }
.entw-bar span { display: block; height: 100%; background: #3d7a4e; border-radius: 999px; }
.entw-pie { padding: 10px 16px; font-size: 12px; color: #6f6a62; }
.entw-vacio { padding: 40px 16px; text-align: center; color: #6f6a62; font-size: 14px; }
.entw-cols { display: flex; gap: 0; padding: 10px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6f6a62; }
.entw-cols span { padding: 0 14px; } .entw-cols span:first-child { padding-left: 0; }
.entw-cols .r { text-align: right; }
.entw-ped { margin: 0 14px 12px; border: 1px solid #e5e1d8; border-radius: 10px; overflow: hidden; }
.entw-ped .entw-t td { border-bottom-color: #f4f2ec; }
.entw-ped .entw-t tr:last-child td { border-bottom: 0; }
.entw-ped-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #faf9f5; border-bottom: 1px solid #eeebe3; font-size: 14px; }
.entw-cli { margin-left: 8px; color: #4a463e; }
.entw-ped-tot { display: flex; align-items: center; gap: 18px; font-size: 12.5px; color: #6b665c; }
.entw-sinplan { margin: 4px 14px 14px; border: 1px solid #e5e1d8; border-radius: 10px; overflow: hidden; }
.entw-sinplan summary { padding: 12px 14px; font-size: 13.5px; font-weight: 600; color: #6b665c; cursor: pointer; background: #faf9f5; }
.entw-anulada td { opacity: .55; }
.entw-anulada td b { text-decoration: line-through; }
@media (max-width: 1100px) { .entw-kpis { grid-template-columns: repeat(2, 1fr); } }
.entw-t td.entw-lote { white-space: nowrap; }
.entw-t td.entw-prod { min-width: 180px; }
.entw-btn { background: #fff !important; color: #3d7a4e !important; border: 1px solid #b7cbb9 !important; font-weight: 700; }
.entw-btn:hover { background: #3d7a4e !important; color: #fff !important; border-color: #3d7a4e !important; }
.entw-t tbody tr:hover .entw-btn { border-color: #3d7a4e !important; }
.entw-t td { padding: 9px 12px; }
.entw-t th { padding: 10px 12px; }
.entw-ped-g { border-top: 10px solid #fff; }
.entw-ped-row td { background: #f6f4ef; border-top: 1px solid #e5e1d8; border-bottom: 1px solid #e5e1d8; font-size: 14px; }
.entw-t tbody tr.entw-ped-row:hover td { background: #f1eee6; }
.entw-t td.entw-sub { padding-left: 28px; }
.ent-hoja [data-sacos] input::placeholder { text-transform: none; }

/* ---------- Ventana de entrega (entHoja) ---------- */
.ent2 { width: min(620px, 100%); }
.ent2 .ent-hoja-top { align-items: center; }
.ent2-tit { display: flex; flex-direction: column; min-width: 0; }
.ent2-tit b { font-size: 16px; }
.ent2-tit span { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ent2-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.ent2-stats > div { background: #fff; border: 1px solid #e5e1d8; border-radius: 10px; padding: 10px 12px; }
.ent2-stats span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6f6a62; }
.ent2-stats b { display: block; font-size: 18px; margin-top: 2px; color: #2a2722; }
.ent2-sec { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6f6a62; margin: 2px 0 6px; }
.ent2-plan { background: #f1ebfd; border: 1px solid #ddd0f5; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.ent2-plan .ent2-sec { color: #6d3fc4; }
.ent2-plan-r { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; font-size: 13.5px; border-top: 1px solid #e6dcf7; }
.ent2-plan-r:first-of-type { border-top: 0; }
.ent2-plan-r .mono { font-weight: 700; color: #4a2a8a; }
.ent2-plan-c { flex: 1; min-width: 0; color: #6b665c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent2-plan-r.yo { font-weight: 700; }
.ent2-plan-r.yo::after { content: 'este pedido'; font-size: 11px; font-weight: 700; color: #6d3fc4; background: #fff; border-radius: 999px; padding: 1px 7px; }
.ent2-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ent2-pick { position: relative; }
.ent2-res { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.ent2-op { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left; width: 100%;
  min-height: 46px; padding: 8px 12px; background: #fff; border: 1px solid #e5e1d8; border-radius: 9px; font: inherit; font-size: 13.5px; cursor: pointer; }
.ent2-op:hover, .ent2-op:focus { border-color: #3d7a4e; background: #f3f8f3; outline: none; }
.ent2-op-i { color: #6b665c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent2-op-k { font-size: 12px; color: #6d3fc4; font-weight: 600; white-space: nowrap; }
.ent2-vacio { padding: 10px 2px; font-size: 13px; color: #6f6a62; }
.ent2-elegido { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 12px;
  padding: 10px 12px; background: #e7f0e8; border: 1px solid #b7cbb9; border-radius: 10px; font-size: 14px; }
.ent2-cambiar { border: 1px solid #b7cbb9; background: #fff; color: #3d7a4e; border-radius: 8px; padding: 6px 12px; font-weight: 600; cursor: pointer; }
.ent2 .ent-hoja-pie { display: flex; align-items: center; gap: 14px; }
.ent2-tot { font-size: 14px; color: #6b665c; white-space: nowrap; }
.ent2-tot .mono { color: #8a5a1c; }
.ent2 .ent-registrar { flex: 1; }
.ent2-planlin { margin-top: 3px; font-size: 11.5px; font-weight: 600; color: #6d3fc4; }
.ent-item .ent2-planlin, .ent-card .ent2-planlin { margin: -6px 0 10px; }
@media (max-width: 820px) {
  .ent2 { width: 100%; }
  .ent2-dos { grid-template-columns: 1fr; gap: 0; }
  .ent2 .ent-hoja-pie { flex-direction: column; align-items: stretch; gap: 8px; }
  .ent2-tot { text-align: center; }
  .ent2-stats b { font-size: 16px; }
}
.ent2-tot { display: none; }
.entw-t .btn { white-space: nowrap; }

/* ---------- Plan por producto del pedido ---------- */
.entw-prod-row td { padding: 7px 12px 5px 28px !important; font-size: 12.5px; color: #6b665c; background: #fff; border-bottom: 1px dashed #ebe8e0 !important; }
.entw-prod-row td b { color: #2a2722; }
.entw-t tbody tr.entw-prod-row:hover td { background: #fff; }
.entw-t td.entw-sub2 { padding-left: 44px; }
.ent-prod { padding: 8px 14px 4px; font-size: 12.5px; color: #6b665c; background: #fff; border-bottom: 1px dashed #ebe8e0; }
.ent-prod b { color: #2a2722; }
.ent2-para { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; background: #fff; border: 1px solid #e5e1d8; border-left: 4px solid #3d7a4e;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.ent2-para span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6f6a62; }
.ent2-para b { font-size: 14px; word-break: break-word; }
.ent-hoja-mb select { width: 100%; min-height: 48px; padding: 10px 12px; font-size: 15px; border: 1px solid #d8d4cc; border-radius: 7px; background: #fff; }
@media (max-width: 820px) { .ent2-para { grid-template-columns: 1fr; } }

/* Quien pide menos movimiento en su sistema: sin animaciones ni transiciones */
@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}

/* Entrega por lote «como factura»: pedido → sacos → agregar línea */
.ent2-rep .ent2-sec { margin-bottom: 8px; }
.ent2-rep-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ent2-rep-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 9px 11px; border-radius: 10px;
  border: 1.5px solid #ddd0f5; background: #fff; cursor: pointer; font: inherit; min-height: 52px; }
.ent2-rep-chip b { color: #4a2a8a; font-size: 13.5px; }
.ent2-rep-chip small { color: #6f6a62; font-size: 11.5px; line-height: 1.3; }
.ent2-rep-chip small[data-repya] { color: #2f6d3c; font-weight: 600; }
.ent2-rep-chip.on { border-color: #6d3fc4; background: #6d3fc4; }
.ent2-rep-chip.on b, .ent2-rep-chip.on small { color: #fff; }
.ent2-rep-chip.sin b { color: #6f6a62; }
.ent2-rep-chip.sin.on { background: #6f6a62; border-color: #6f6a62; }
.ent2-rep-add { width: 100%; margin: 4px 0 12px; padding: 12px; border-radius: 10px; border: 1.5px dashed #6d3fc4; background: #f6f1fe;
  color: #4a2a8a; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.ent2-fac:empty { display: none; }
.ent2-fac { border: 1px solid #e5e1d8; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; background: #fff; }
.ent2-fac-r { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f0ede6; }
.ent2-fac .ent2-sec + .ent2-fac-r { border-top: 0; }
.ent2-fac-r > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ent2-fac-r > div b { font-size: 13.5px; color: #2a2722; }
.ent2-fac-r > div small { font-size: 11.5px; color: #7a746b; }
.ent2-fac-r > b { font-size: 14px; white-space: nowrap; }
.ent2-fac-x { width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid #e8b4bc; background: #fff; color: #a03050; font-size: 17px; cursor: pointer; }
.ent2-fac-t { display: flex; justify-content: space-between; padding-top: 8px; margin-top: 2px; border-top: 2px solid #2a2722; font-size: 14.5px; font-weight: 700; }
.ent-rep { color: #6d3fc4; }
