:root {
  --color-emphasis-1: #946aa3;
  --color-emphasis-2: #e7ecf5;
  --color-bg: #fafbfc;
  --color-header-footer: #181925;
  --color-ui-dark: #484860;
  --color-border: #e6e8ee;
  --color-accent-hover: #644099;
  --color-anulado: #bbb;
  --font-main: 'Ubuntu', Arial, sans-serif;
  --max-main-width: 1285px;
}
html, body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-header-footer);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  letter-spacing: 0.01em;
}
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(110deg, #fafbfc 80%, #ededfa 100%);
}
header {
  width: 100vw;
  min-height: 58px;
  background: var(--color-header-footer);
  color: #fff;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 18px #19192c13;
  font-family: var(--font-main);
  padding: 0;
  border-bottom: 2.5px solid var(--color-emphasis-1);
}
.header-content {
  width: 100%;
  max-width: var(--max-main-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2vw;
  margin: 0 auto;
  box-sizing: border-box;
}
.brand-logo {
  font-weight: 700;
  font-size: 1.17em;
  color: var(--color-emphasis-1);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo img {
  height: 31px; min-width: 31px; margin-right: 8px; background: #fff; border-radius: 7px;
  box-shadow: 0 1px 7px #e8d0fc50;
}
.panel-title-desc {
  font-size:1.13em;
  color:#dde6eb;
  font-weight:400;
  letter-spacing:0.02em;
  opacity:.74;
  text-align: right;
  max-width: 300px;
}
main {
  width: 100vw;
  margin: 0;
  padding: 0;
  min-height: 94vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 80px;
  padding-bottom: 44px;
}
.main-contenedor {
  width: 100%;
  max-width: var(--max-main-width);
  margin: 0 auto;
  padding-left: 2vw;
  padding-right: 2vw;
  box-sizing: border-box;
}
h2 {
  font-size: 1.31em;
  font-weight: 600;
  margin: 0 0 25px 0;
  padding-left: 0;
  letter-spacing: 0.01em;
  color: var(--color-header-footer);
  border-left: 3.9px solid var(--color-emphasis-1);
  background: none;
  padding-bottom: 9px;
  max-width: 99vw;
  box-sizing: border-box;
}
.grid-pedidos {
  display: flex;
  flex-direction: column;
  gap: 1.1em;
  margin-bottom: 1.7em;
  width: 100%;
  box-sizing: border-box;
  max-width: var(--max-main-width);
  margin-right: auto;
  margin-left: auto;
}
.seccion-pedidos {
  margin-bottom: 2em;
}
.seccion-pedidos-titulo {
  font-size: 1.15em;
  font-weight: 700;
  color: #fff;
  padding: 0.6em 1.2em;
  border-radius: 10px;
  margin-bottom: 1em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.seccion-pedidos-titulo:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(0,0,0,0.15);
}
.seccion-pedidos-titulo .flecha-colapso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  transition: transform 0.25s ease;
  margin-left: 6px;
}
.seccion-pedidos-titulo.colapsado .flecha-colapso {
  transform: rotate(-90deg);
}
.seccion-pedidos-contenido {
  overflow: visible;
  opacity: 1;
}
.seccion-pedidos-contenido.oculto {
  display: none;
}
.seccion-stock-critico .seccion-pedidos-titulo {
  background: linear-gradient(90deg, #c62828 0%, #e53935 100%);
  box-shadow: 0 3px 12px #c6282833;
}
.seccion-stock-critico .pedido-bloque {
  border-left: 4px solid #c62828;
}
.seccion-pedidos-normal .seccion-pedidos-titulo {
  background: linear-gradient(90deg, #1b5e20 0%, #43a047 100%);
  box-shadow: 0 3px 12px #1b5e2033;
}
.seccion-pedidos-contador {
  background: rgba(255,255,255,0.25);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: 600;
}
.pedido-bloque {
  background: #fff;
  padding: 1.07em 1.8em 1em 1.8em;
  border-radius: 17px;
  border: 1.3px solid var(--color-border);
  box-shadow: 0 3px 23px #ab8dd811;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em 2em;
  min-height: auto;
  transition: box-shadow 0.26s, border 0.17s;
  will-change: box-shadow, border;
  width: 100%;
  box-sizing: border-box;
}
.pedido-bloque .id-encabezado {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 320px;
  order: 1;
}
.pedido-bloque .pedido-meta {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  order: 3;
  margin: 2px 0 4px 0;
}
.pedido-bloque .items-lista {
  flex: 1 1 400px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  order: 4;
}
.pedido-bloque .procesar-btn {
  flex: 0 0 auto;
  align-self: center;
  margin-top: 0;
  order: 2;
}
@media (max-width: 900px) {
  .pedido-bloque {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7em;
  }
  .pedido-bloque .id-encabezado,
  .pedido-bloque .pedido-meta,
  .pedido-bloque .items-lista {
    max-width: 100%;
    min-width: 0;
    flex-basis: auto;
    width: 100%;
  }
  .pedido-bloque .procesar-btn {
    align-self: flex-start;
    margin-top: 0.5em;
    order: 4;
  }
}
.pedido-bloque:hover {
  border: 1.7px solid var(--color-emphasis-1);
  box-shadow: 0 8px 28px #8a50c02e;
}
.id-encabezado {
  font-weight: 500;
  font-size: 0.99em;
  letter-spacing: 0.013em;
  font-family: var(--font-main);
  color: var(--color-ui-dark);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0.33em;
  gap: 2px;
  min-height: 33px;
}
.id-encabezado-header {
  display: flex;
  align-items: center;
  gap: 9px;
}
.id-encabezado img {
  margin-right: 6px;
  border-radius: 8px;
  height: 27px;
  width: 27px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #ece7f4;
  box-shadow: 0 2px 8px #b69fd833;
}
.cliente-nombre {
  font-size: .88em;
  font-weight: 600;
  color: var(--color-emphasis-1);
  margin-left: 10px;
  opacity: .93;
  letter-spacing: 0.017em;
}
.order-id-link {
  color: #1565c0;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 1px 4px;
  border-radius: 4px;
}
.order-id-link:hover {
  color: #0d47a1;
  background: #e3f2fd;
  text-decoration: underline;
}
.order-id-link:active {
  color: #0a3d91;
}
.order-id-nolink {
  color: var(--color-ui-dark);
}
.fecha-pedido {
  font-size: 0.8em;
  color: #777;
  margin-left: 36px;
}
.items-lista {
  margin: .09em 0 1em 0.13em;
  padding-left: 0;
  list-style: none;
  font-size: .9em;
  color: var(--color-header-footer);
  width: 100%;
  max-width: 99%;
}
.items-lista li {
  margin-bottom: 0.3em;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
  background: none;
  width: 100%;
  font-size: 0.95em;
  padding: 4px 6px;
  border-radius: 6px;
}
.item-info-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.item-linea-1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.item-linea-2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.88em;
  color: #555;
}
.item-sku {
  font-weight: 600;
  max-width: 100%;
  word-break: break-all;
}
.item-cantidad {
  font-weight: 600;
  color: #333;
}
.item-contador {
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.86em;
}
.item-contador-pend {
  color: #c62828;
  background: #ffebee;
}
.pack-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7b1fa2 0%, #9c27b0 100%);
  color: #fff;
  font-size: 0.7em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  margin-right: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(123, 31, 162, 0.3);
}
.pack-original-info {
  font-size: 0.78em;
  color: #7b1fa2;
  background: #f3e5f5;
  padding: 2px 8px;
  border-radius: 6px;
  margin: 2px 0 4px 0;
  display: inline-block;
}
.pack-error-banner {
  background: #ffebee;
  border: 1px solid #ef9a9a;
  color: #c62828;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 0.9em;
}
.pack-group-proc {
  border: 1px solid rgba(120, 90, 160, 0.25);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  background: rgba(120, 90, 160, 0.03);
}
.pack-proc-title {
  font-weight: 600;
  margin-bottom: 6px;
}
.pack-proc-original {
  font-size: 1.05em;
}
.pack-proc-subtitle {
  font-size: 0.95em;
  opacity: 0.9;
  margin-bottom: 8px;
}
.pack-components-list {
  margin: 0;
  padding-left: 0;
}
.pack-components-list > li {
  margin: 8px 0;
}
.pack-error-banner b {
  display: block;
  margin-bottom: 4px;
}
.item-contador-ok {
  color: #1b5e20;
  background: #e8f5e9;
}
.item-cb {
  max-width: 100%;
  word-break: break-all;
}
.item-stock {
  color: #7e368e;
  font-weight: 700;
  font-size: .9em;
  background: #f6f3fa;
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.01em;
}
.item-no-asignado {
  color: #d12d39;
  font-weight: 700;
  background: #ffedf0;
  border-radius: 5px;
  padding: 1px 6px;
  font-size:0.9em;
}
.items-img-wrapper {
  flex-shrink: 0;
}
.items-img-wrapper img {
  height: 52px;
  max-width: 78px;
  border-radius: 7px;
  box-shadow:0 1.5px 8px #a775a425;
  object-fit: cover;
  cursor: pointer;
}
.procesar-btn {
  background: var(--color-emphasis-1);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 0.48em 1.39em;
  margin-top: .49em;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1.0em;
  box-shadow: 0 5px 20px #946aa325;
  transition: background 0.18s, color 0.18s, box-shadow 0.14s;
  min-width: 115px;
  align-self: flex-start;
  outline: none;
}
.procesar-btn:hover:not([disabled]) {
  background: var(--color-accent-hover);
  color: #fff;
  box-shadow: 0 9px 26px #946aa429;
}
.procesar-btn[disabled] {
  background: var(--color-anulado);
  color: #e4e2e7;
  cursor: not-allowed;
  box-shadow: none;
}
.paginador {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2em;
  margin-top: 2.1em;
  margin-bottom: 0.7em;
  font-family: var(--font-main);
  width: 100%;
}
.paginador button {
  padding: 0.45em 1.33em;
  border-radius: 28px;
  border: none;
  background: var(--color-ui-dark);
  color: #fff;
  font-weight: 500;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.14s;
  outline: none;
}
.paginador button:disabled {
  background: var(--color-anulado);
  color: #e3e3e3;
  cursor: not-allowed;
}
.page-info {
  color: var(--color-emphasis-1);
  font-weight: 700;
  font-size: 1.11em;
  letter-spacing: 0.043em;
}
.banner-feedback {
  position: fixed;
  top: 2em;
  right: 2em;
  min-width: 230px;
  z-index: 100;
  padding: 1em 1.5em;
  border-radius: 19px;
  color: var(--color-header-footer);
  font-size: 1.07em;
  font-weight: bold;
  display: none;
  font-family: var(--font-main);
  box-shadow: 0 7px 30px #7e368e38;
  text-align: center;
}
.banner-ok {
  background: #e6fff6;
  color: #176b53;
  border: 1.5px solid #91c7b4;
}
.banner-error {
  background: #fff0f1;
  color: #a82a3c;
  border: 1.4px solid #e18595;
}
.banner-info {
  background: #f1f0f9;
  color: #986ab7;
  border: 1.3px solid var(--color-emphasis-1);
}
.addr-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.82em;
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
}
.addr-badge-rojo {
  background: #fff0f1;
  color: #a82a3c;
  border: 1.4px solid #e18595;
}
.addr-badge-amarillo {
  background: #fffbeb;
  color: #7d5c00;
  border: 1.4px solid #ffc107;
}
.addr-badge-info {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #d4d4d4;
  font-style: italic;
}
.proceso-bloque {
  background: #fff;
  margin-top: 2em;
  padding: 1.6em 2.5em 1.3em 2.5em;
  border-radius: 18px;
  border: 1.5px solid var(--color-border);
  box-shadow: 0 5px 24px #ab8dd83a;
  max-width: 710px;
  margin-left: auto;
  margin-right: auto;
  min-height: 310px;
}
.proceso-bloque .id-encabezado { margin-bottom: 0.79em; }
.proceso-bloque .procesar-btn { margin-top: 1.07em; }
.proceso-bloque input[type="text"] { min-width: 185px; padding-right: 10px; }
.volverlistado-btn {
  position: absolute !important;
  top: 22px;
  right: 28px;
  background: var(--color-emphasis-2);
  color: var(--color-header-footer);
  border: 1.7px solid var(--color-emphasis-1);
  border-radius: 100px;
  padding: 7px 22px;
  font-size: 1em;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 2px 12px #946aa41a;
  z-index: 2;
  transition: background 0.22s, border 0.18s;
  outline: none;
}
.volverlistado-btn:hover {
  background: #ececec;
}
.input-qr {
  font-size: 1.02em;
  padding: 0.44em 0.96em;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  color: #2e2545;
  font-family: var(--font-main);
  background: #f7f8fd;
  transition: border-color 0.19s;
  letter-spacing: 0.018em;
}
.input-qr:focus {
  border-color: var(--color-emphasis-1);
  outline: none;
  background: #f3f1fa;
}
@media (max-width: 900px) {
  main { padding-top: 61px; }
  .main-contenedor, .proceso-bloque { padding-left: 2vw; padding-right: 2vw;}
  header { min-height: 54px;}
  .proceso-bloque { padding: 1.16em 2vw 1em 2vw;}
}
.overlay-imagen {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.overlay-imagen-contenido {
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px 14px 14px;
  box-shadow: 0 10px 40px #00000055;
  max-width: 80vw;
  max-height: 80vh;
  position: relative;
}
.overlay-imagen-contenido img {
  max-width: 78vw;
  max-height: 76vh;
  display: block;
  border-radius: 10px;
  cursor: pointer;
}
.overlay-cerrar {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.8em;
  font-weight: 700;
  cursor: pointer;
  color: var(--color-ui-dark);
}
.overlay-cerrar:hover {
  color: var(--color-emphasis-1);
}
.filtros-canal {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 1.1em;
  flex-wrap: wrap;
}
.filtro-canal-btn {
  border: 1.3px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 0.32em 0.9em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: var(--font-main);
  font-size: 0.9em;
  color: var(--color-ui-dark);
  box-shadow: 0 2px 10px #ab8dd81a;
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s, transform 0.08s;
}
.filtro-canal-btn img {
  height: 20px;
  max-width: 60px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.filtro-canal-btn:hover {
  border-color: var(--color-emphasis-1);
  box-shadow: 0 4px 16px #946aa325;
  transform: translateY(-1px);
}
.filtro-canal-activo {
  background: var(--color-emphasis-1);
  color: #fff;
  border-color: var(--color-emphasis-1);
  box-shadow: 0 5px 18px #946aa336;
}
.filtro-canal-activo img {
  background: #fff;
}
.filtros-separador {
  width: 1px;
  height: 28px;
  background: var(--color-border);
  margin: 0 0.5em;
}
.btn-picking {
  background: #ffffff;
  color: var(--color-text);
  border: 2px solid rgba(129, 87, 156, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  box-shadow: 0 6px 18px rgba(129,87,156,0.10);
  user-select: none;
  white-space: nowrap;
}
.btn-picking:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 87, 156, 0.55);
  box-shadow: 0 10px 24px rgba(129,87,156,0.16);
}
.btn-picking:active { transform: translateY(0px); }
.modal-dir-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 22px;
}
.modal-dir-box {
  background: #fff;
  width: min(500px, 96vw);
  border-radius: 18px;
  padding: 24px 24px 20px 24px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
  font-family: var(--font-main);
}
.modal-dir-titulo {
  font-size: 1.1em;
  font-weight: 800;
  color: #a82a3c;
  margin-bottom: 10px;
}
.modal-dir-mensaje {
  font-size: 0.95em;
  color: #333;
  margin-bottom: 8px;
  line-height: 1.5;
}
.modal-dir-instruccion {
  font-size: 0.88em;
  color: #555;
  margin-bottom: 14px;
  line-height: 1.5;
}
.modal-dir-campo {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 0.95em;
  font-family: var(--font-main);
  margin-bottom: 14px;
  color: #333;
}
.modal-dir-campo:focus {
  outline: none;
  border-color: var(--color-emphasis-1);
}
.modal-dir-btn {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
  background: var(--color-emphasis-1);
  color: #fff;
  transition: opacity 0.15s;
}
.modal-dir-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-secondary {
  background: #fff;
  border: 2px solid rgba(0,0,0,0.10);
  color: rgba(0,0,0,0.78);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn-secondary:hover { border-color: rgba(0,0,0,0.20); }
.btn-primary {
  background: var(--color-emphasis-1);
  border: 2px solid rgba(129,87,156,0.35);
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(129,87,156,0.18);
}
.btn-primary:hover { box-shadow: 0 14px 28px rgba(129,87,156,0.22); transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: rgba(129,87,156,0.8);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.filtro-sameday-btn {
  border: 1.5px solid #ff9800;
  background: #fff;
  border-radius: 999px;
  padding: 0.38em 1em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: var(--font-main);
  font-size: 0.9em;
  font-weight: 600;
  color: #e65100;
  box-shadow: 0 2px 10px rgba(255,152,0,0.15);
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s, transform 0.08s;
}
.filtro-sameday-btn:hover {
  background: #fff3e0;
  border-color: #e65100;
  box-shadow: 0 4px 16px rgba(255,152,0,0.25);
  transform: translateY(-1px);
}
.filtro-sameday-btn.activo {
  background: linear-gradient(90deg, #ff9800 0%, #f57c00 100%);
  color: #fff;
  border-color: #e65100;
  box-shadow: 0 5px 18px rgba(255,152,0,0.35);
}

.bloque-paquete-dia {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.3px solid var(--color-border);
  background: #f6f3fa;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  max-width: 100%;
  box-sizing: border-box;
}
.bloque-paquete-dia .label {
  font-weight: 700;
  color: #555;
  letter-spacing: 0.02em;
  font-size: 1.05em;
  white-space: nowrap;
}
.bloque-paquete-dia .valor {
  font-weight: 800;
  color: var(--color-emphasis-1);
  font-size: 1.55em;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}

/* ========== SISTEMA DE VISTAS ========== */
.vista-listado {
  display: block;
}
.vista-listado.oculta {
  display: none;
}
.vista-proceso {
  display: none;
}
.vista-proceso.activa {
  display: block;
}

/* =========================================
   Layout shell + Sidebar
   ========================================= */
.layout-shell {
  width: 100%;
  max-width: var(--max-main-width);
  margin: 0 auto;
  padding-left: 2vw;
  padding-right: 2vw;
  box-sizing: border-box;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.layout-main {
  flex: 1 1 80%;
  min-width: 0;
}
.layout-shell .main-contenedor {
  max-width: none;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}
.sidebar-resumen {
  flex: 0 0 20%;
  min-width: 280px;
  box-sizing: border-box;
  position: sticky;
  top: 92px;
  align-self: flex-start;
}
.sidebar-card {
  width: 100%;
  background: #fff;
  padding: 1.07em 1.25em 1.15em 1.25em;
  border-radius: 17px;
  border: 1.3px solid var(--color-border);
  box-shadow: 0 3px 23px #ab8dd811;
  box-sizing: border-box;
}
.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.sidebar-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--color-ui-dark);
}
.sidebar-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-top: 2px;
}
.sidebar-btn-refresh {
  background: var(--color-emphasis-1);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 0.42em 1.05em;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.92rem;
  box-shadow: 0 5px 20px #946aa325;
  transition: background 0.18s, color 0.18s, box-shadow 0.14s;
  white-space: nowrap;
  outline: none;
}
.sidebar-btn-refresh:hover {
  background: var(--color-accent-hover);
  color: #fff;
  box-shadow: 0 9px 26px #946aa429;
}
.sidebar-body {
  display: grid;
  gap: 10px;
}
.sidebar-loading {
  font-size: 0.95rem;
  color: #666;
}
.resumen-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border: 1.1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 18px #ab8dd80e;
}
.resumen-metric .label {
  opacity: 0.88;
  font-weight: 600;
  font-size: 0.95rem;
}
.resumen-metric .value {
  font-size: 1.25rem;
  font-weight: 800;
  overflow: hidden;
}
.resumen-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.resumen-section {
  border: 1.1px solid var(--color-border);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: 0 3px 18px #ab8dd80e;
}
.resumen-section h3 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 800;
  opacity: 0.95;
}
.resumen-list {
  display: grid;
  gap: 6px;
}
.resumen-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
  color: #333;
}
.resumen-item .k {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 72%;
  min-width: 0;
}
.resumen-item .k-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.resumen-item .k-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.resumen-ico {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  box-shadow: 0 1.5px 8px #a775a425;
  object-fit: contain;
  background: #fff;
  flex: 0 0 auto;
}
.resumen-item .v {
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Spinner resumen ── */
@keyframes resumen-spin {
  to { transform: rotate(360deg); }
}
.resumen-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.12);
  border-top-color: var(--color-emphasis-1, #7B3FA0);
  border-radius: 50%;
  animation: resumen-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 7px;
  flex-shrink: 0;
}

/* ── Flip animaciones resumen ── */
@keyframes resumen-flip-out {
  from { transform: translateY(0);     opacity: 1; }
  to   { transform: translateY(-110%); opacity: 0; }
}
@keyframes resumen-flip-in {
  from { transform: translateY(110%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.resumen-flip-out {
  display: inline-block;
  animation: resumen-flip-out 0.16s ease-in forwards;
}
.resumen-flip-in {
  display: inline-block;
  animation: resumen-flip-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 1024px) {
  .layout-shell {
    flex-direction: column;
  }
  .sidebar-resumen {
    position: relative;
    top: auto;
    width: 100%;
    min-width: 0;
    order: -1;
  }
}
@media (max-width: 520px) {
  .sidebar-card {
    padding: 12px;
  }
  .sidebar-btn-refresh {
    padding: 7px 9px;
    font-size: 0.88rem;
  }
  .resumen-item .k {
    max-width: 66%;
  }
}

/* ===== Ajustes para tarjetas ===== */
.logo-canal-mini {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.id-encabezado-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pedido-meta {
  margin: 10px 0 6px;
  color: #222;
  font-size: 0.95rem;
}

/* ===== Sidebar - Total preparados ===== */
.sidebar-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  background: #fff;
  margin: 10px 0 12px;
}
.sidebar-total .label {
  color: #333;
  font-weight: 700;
}
.sidebar-total .valor {
  font-size: 1.4rem;
  font-weight: 800;
  color: #2b2b2b;
}

/* Badge de secciones */
.seccion-pedidos-titulo .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 800;
  font-size: 0.9em;
}

.btn-modal-cerrar {
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.10);
  color: rgba(0,0,0,0.70);
  width: 34px;
  height: 34px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-modal-cerrar:hover {
  background: rgba(0,0,0,0.08);
}

/* ===== HEADER TABS ===== */
.header-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 2px;
}
.header-tab {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-main);
  font-size: 0.88em;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}
.header-tab:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.06);
}
.header-tab-active {
  background: rgba(148,106,163,0.35);
  color: #fff;
  border-color: rgba(148,106,163,0.45);
}
.header-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Ajustes finos tarjetas */
.logo-canal-mini {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 6px;
}
.pedido-identidad-linea {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.pedido-identidad-linea .cliente-nombre {
  white-space: nowrap;
}
.stock-critico-pill {
  background: #ffebee;
  color: #c62828;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Estado indicador de cámara */
.cam-status-indicator {
  font-size: 0.82em;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.cam-status-ok {
  color: #4caf50;
  background: rgba(76,175,80,0.12);
}
.cam-status-off {
  color: #bbb;
  background: rgba(180,180,180,0.10);
}

/* Vista proceso layout */
.proc-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.proc-col-izq {
  flex: 1;
  min-width: 0;
}
.proc-col-der {
  flex: 0 0 42%;
  position: sticky;
  top: 80px;
}
@media (max-width: 1024px) {
  .proc-layout {
    flex-direction: column;
  }
  .proc-col-der {
    position: relative;
    top: auto;
    width: 100%;
    flex: none;
  }
}

/* Proceso bloque campos */
.campo-despacho {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.campo-despacho label {
  font-size: 0.85em;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.03em;
}
.campo-despacho input,
.campo-despacho select,
.campo-despacho textarea {
  font-family: var(--font-main);
  font-size: 0.95em;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--color-header-footer);
  background: #f7f8fd;
  transition: border-color 0.18s;
}
.campo-despacho input:focus,
.campo-despacho select:focus,
.campo-despacho textarea:focus {
  outline: none;
  border-color: var(--color-emphasis-1);
  background: #f3f1fa;
}

/* Footer */
footer {
  background: var(--color-header-footer);
  color: #888;
  text-align: center;
  padding: 14px;
  font-size: 0.88em;
  border-top: 1.5px solid #2a2b38;
}
.footer-content {
  max-width: var(--max-main-width);
  margin: 0 auto;
}

/* Badge transportista en tarjeta */
.badge-transporte {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-emphasis-2);
  border: 1px solid #d4c9e8;
  border-radius: 999px;
  padding: 3px 10px 3px 6px;
  font-size: 0.82em;
  font-weight: 700;
  color: var(--color-emphasis-1);
  margin-top: 4px;
}
.badge-transporte img {
  height: 18px;
  width: 18px;
  object-fit: contain;
  border-radius: 4px;
}

/* Badge tipo envio */
.badge-tipo-envio {
  display: inline-block;
  background: #e8f0fe;
  color: #1a56db;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8em;
  font-weight: 700;
  margin-top: 4px;
  margin-right: 6px;
}
.badge-tipo-envio.sameday {
  background: linear-gradient(90deg, #ff9800 0%, #f57c00 100%);
  color: #fff;
}

/* =====================================================
   PROCESO — ESCANEO DE PRODUCTOS
   ===================================================== */
.scan-panel {
  background: #f8f9ff;
  border: 2px solid var(--color-emphasis-1);
  border-radius: 12px;
  padding: 14px;
}
.scan-panel-nobc {
  border-color: #dde;
  background: #fafafa;
}
.scan-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95em;
}
.scan-input-field {
  width: 100%;
  box-sizing: border-box;
  border: 1.8px solid var(--color-emphasis-1);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: var(--font-main);
  font-size: 0.95em;
  background: #fff;
  transition: box-shadow 0.15s;
}
.scan-input-field:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(148, 106, 163, 0.25);
}
.scan-items-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 230px;
  overflow-y: auto;
}
.scan-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 0.88em;
  transition: background 0.2s, color 0.2s;
  border: 1px solid transparent;
}
.scan-item-pending  { background: #f2f2f2; }
.scan-item-ok       { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }
.scan-item-parcial  { background: #fff8e1; color: #e65100; border-color: #ffe082; }
.scan-item-skip     { background: #fafafa; color: #9e9e9e; }
.scan-item-nobc     { background: #fafafa; color: #aaa; }
.scan-check {
  font-size: 1.1em;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.scan-count { flex-shrink: 0; }

/* Feedback de scan */
.scan-feedback {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.88em;
  font-weight: 600;
}
.scan-ok    { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.scan-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* Contador */
.scan-counter { font-size: 0.85em; font-weight: 600; color: #888; }
.scan-counter-ok   { color: #2e7d32; }
.scan-counter-skip { color: #f57c00; }

/* Botón omitir scan */
.btn-omitir-scan {
  font-size: 0.82em;
  padding: 5px 12px;
  border: 1px dashed #bbb;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: #888;
  transition: color 0.15s, border-color 0.15s;
}
.btn-omitir-scan:hover { color: #555; border-color: #888; }
.btn-omitir-scan:disabled { opacity: 0.5; cursor: default; }

/* Proceso cards */
.proc-card {
  background: #fff;
  border: 1.4px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
}
.proc-card-title {
  font-weight: 700;
  font-size: 0.95em;
  color: #555;
  margin-bottom: 10px;
}

/* Badge transporte en vista proceso */
.badge-transporte {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5f0fa;
  border: 1px solid #d4b8e0;
  color: var(--color-emphasis-1);
  border-radius: 999px;
  padding: 3px 10px 3px 6px;
  font-size: 0.82em;
  font-weight: 700;
  margin-top: 4px;
}
.badge-transporte img { height: 18px; width: auto; object-fit: contain; }

/* Botón secundario */
.btn-secondary {
  background: #f3f3f6;
  color: #555;
  border: 1.4px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 20px;
  font-family: var(--font-main);
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #e8e8f0; }

/* Spinner resumen (ya existía en GAS, mantener) */
.resumen-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(148,106,163,0.25);
  border-top-color: var(--color-emphasis-1);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Flip animation para sidebar resumen */
@keyframes flip-out {
  0%   { transform: translateY(0);    opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}
@keyframes flip-in {
  0%   { transform: translateY(100%); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}
.resumen-flip-out { animation: flip-out 0.15s ease-in  forwards; }
.resumen-flip-in  { animation: flip-in  0.18s ease-out forwards; }

@media (max-width: 1024px) {
  #cam-area { width: 100% !important; position: static !important; }
}
