:root {
  --bg-1: #333333;
  --bg-2: rgba(255, 255, 255, 0.04);
  --primary: #0a84ff;
  --purple: #bf5af2;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --mint: #63e6e2;
  --text: #ffffff;
  --text-40: rgba(255, 255, 255, 0.4);
  --text-20: rgba(255, 255, 255, 0.2);
  --text-10: rgba(255, 255, 255, 0.15);
  --white-10: rgba(255, 255, 255, 0.1);
  --radius-16: 16px;
  --radius-24: 24px;
  --sidebar: 220px;
  --font: "Inter", system-ui, sans-serif;
  /* Alto fijo calugas Entregas/Retiros (caben 3 ritmos) */
  --ops-kpi-h: 128px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: #1c1c1e;
  color: var(--text);
  font-family: var(--font);
  font-feature-settings: "ss01" 1, "cv01" 1;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 18% 8%, rgba(46, 157, 184, 0.22), transparent 58%),
    radial-gradient(720px 420px at 92% 88%, rgba(232, 90, 90, 0.12), transparent 55%),
    #121214;
}
.auth-gate[hidden] { display: none !important; }
.auth-card {
  width: min(100%, 400px);
  display: grid;
  gap: 14px;
  padding: 32px 28px 26px;
  background: rgba(51, 51, 51, 0.92);
  border-radius: var(--radius-24);
  border: 1px solid var(--white-10);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  animation: auth-card-in 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.auth-brand {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-bottom: 2px;
}
.auth-mark {
  width: 72px;
  height: 72px;
}
.auth-mark-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.auth-ring {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: auth-ring-draw 900ms cubic-bezier(0.4, 0, 0.2, 1) 120ms forwards;
}
.auth-pin {
  transform-origin: 32px 50px;
  opacity: 0;
  transform: translateY(-14px) scale(0.86);
  animation: auth-pin-drop 640ms cubic-bezier(0.34, 1.4, 0.64, 1) 420ms forwards;
}
.auth-bar {
  transform-box: fill-box;
  transform-origin: bottom center;
  transform: scaleY(0);
  animation: auth-bar-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-bar-1 { animation-delay: 780ms; }
.auth-bar-2 { animation-delay: 880ms; }
.auth-bar-3 { animation-delay: 980ms; }
.auth-wordmark {
  display: block;
  width: min(220px, 72%);
  height: auto;
  opacity: 0;
  transform: translateY(8px);
  animation: auth-fade-up 480ms ease 700ms forwards;
  /* PNG viene con fondo negro: recorta el marco y se funde en la card */
  mix-blend-mode: lighten;
}
.auth-tag {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(46, 157, 184, 0.95);
  opacity: 0;
  animation: auth-fade-up 420ms ease 820ms forwards;
}
.auth-sub {
  margin: -4px 0 4px;
  text-align: center;
  color: var(--text-40);
  font-size: 14px;
  opacity: 0;
  animation: auth-fade-up 420ms ease 900ms forwards;
}
.auth-card label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-40);
  opacity: 0;
  animation: auth-fade-up 420ms ease 980ms forwards;
}
.auth-card label + label {
  animation-delay: 1060ms;
}
.auth-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--white-10);
  background: #1c1c1e;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.auth-card input:focus {
  outline: none;
  border-color: rgba(46, 157, 184, 0.75);
  box-shadow: 0 0 0 3px rgba(46, 157, 184, 0.22);
}
.auth-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
}
.auth-error[hidden] { display: none !important; }
.auth-submit {
  width: 100%;
  margin-top: 4px;
  justify-content: center;
  padding: 12px 16px;
  font-size: 15px;
  opacity: 0;
  animation: auth-fade-up 420ms ease 1140ms forwards;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(46, 157, 184, 0.25);
}
.auth-submit:active {
  transform: translateY(0);
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes auth-ring-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes auth-pin-drop {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes auth-bar-rise {
  to { transform: scaleY(1); }
}
@keyframes auth-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-ring,
  .auth-pin,
  .auth-bar,
  .auth-wordmark,
  .auth-tag,
  .auth-sub,
  .auth-card label,
  .auth-submit {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}

.shell {
  position: relative;
  display: flex;
  height: calc(100vh - 24px);
  margin: 12px;
  background: var(--bg-1);
  border-radius: var(--radius-24);
  overflow: hidden;
}
.shell[hidden] { display: none !important; }

.menu-hit {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  align-self: stretch;
  width: 48px;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 180ms ease;
}
.menu-hit span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
}
.menu-hit:hover,
.shell.sidebar-open .menu-hit {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #2a2a2c;
  border-right: 1px solid rgba(255,255,255,.06);
  z-index: 35;
  transform: translateX(-105%);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}
.shell.sidebar-open .sidebar {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  padding: 12px 8px;
}
.brand-word {
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  mix-blend-mode: lighten;
}
.brand-name { font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  display: block;
  padding: 12px;
  border-radius: var(--radius-16);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.nav-item.active, .nav-item:hover { background: var(--white-10); }
.nav-item.muted { color: var(--text-40); pointer-events: none; }

.sidebar-user {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-user-meta {
  flex: 1;
  min-width: 0;
}
.sidebar-user strong { display: block; font-weight: 400; font-size: 14px; }
.sidebar-user p { margin: 0; color: var(--text-40); font-size: 12px; }
.logout-btn {
  appearance: none;
  flex-shrink: 0;
  border: 1px solid rgba(255, 69, 58, 0.35);
  background: rgba(255, 69, 58, 0.12);
  color: #ff8a84;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.logout-btn:hover {
  background: rgba(255, 69, 58, 0.22);
  border-color: rgba(255, 69, 58, 0.55);
  color: #fff;
}
.logout-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.logout-btn:focus-visible {
  outline: 2px solid rgba(255, 69, 58, 0.7);
  outline-offset: 2px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 80px;
  object-fit: cover;
  background: var(--white-10);
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  flex-shrink: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-24);
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
    #2a2a2c;
  border: 1px solid rgba(255,255,255,.08);
}

.view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page[hidden] {
  display: none !important;
}

.topbar-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.top-metric {
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.22);
  min-width: 0;
  transition: background 220ms ease;
}
.top-metric.is-flash {
  background: rgba(10, 132, 255, 0.16);
}

.ops-label {
  margin: 0;
  color: var(--text-40);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ops-value {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.ops-sub {
  margin: 4px 0 0;
  color: var(--text-40);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-metric[data-ops="growth"] .ops-value.up { color: var(--green); }
.top-metric[data-ops="growth"] .ops-value.down { color: var(--red); }
.top-metric[data-ops="received"] .ops-value { color: var(--mint); }
.top-metric[data-ops="delivered"] .ops-value { color: var(--green); }
.top-metric[data-ops="failed"] .ops-value { color: var(--red); }

@media (max-width: 1100px) {
  .topbar-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.clock {
  flex-shrink: 0;
  min-width: 168px;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.22);
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.clock strong {
  display: block;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.clock p {
  margin: 4px 0 0;
  color: var(--text-40);
  font-size: 11px;
}

.login-banner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-radius: var(--radius-24);
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.28)),
    var(--red);
  color: #fff;
}
.login-banner[hidden] { display: none !important; }
.login-banner strong { display: block; font-size: 16px; }
.login-banner p { margin: 6px 0 0; opacity: 0.95; }
.login-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.login-steps code {
  color: #fff;
  background: rgba(0,0,0,.18);
  padding: 1px 6px;
  border-radius: 6px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status[hidden] { display: none !important; }

.block {
  background: var(--bg-2);
  border-radius: var(--radius-24);
  padding: 20px 24px;
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.block-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--purple);
}

.filters-compact {
  padding: 12px 16px;
}
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
}
.page-title {
  margin: 0;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #fff;
  white-space: nowrap;
}
.page-title::after {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2e9db8, #7c5cff);
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.filters-grid[hidden] {
  display: none !important;
}
.filters-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-40);
}
.filters-grid input {
  border: 0;
  border-radius: 12px;
  background: var(--white-10);
  color: var(--text);
  padding: 10px 12px;
  font: 500 14px/1.2 var(--font);
  color-scheme: dark;
}
.filters-grid-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filters-grid-date {
  grid-template-columns: repeat(2, max-content);
  align-items: end;
}
@media (max-width: 720px) {
  .filters-grid-date {
    grid-template-columns: max-content;
  }
}
.filters-date-field {
  width: max-content;
  max-width: 100%;
}
.filters-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filters-date-row input[type="date"] {
  flex: 0 1 auto;
  min-width: 10.5rem;
}
.filters-date-row .btn {
  flex-shrink: 0;
  align-self: stretch;
}

/* Fechas inline en la misma fila que Hoy / Día anterior / Rango */
.filters-inline-dates {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin: 0;
  min-width: 0;
}
.filters-inline-dates[hidden] {
  display: none !important;
}
.filters-inline-field {
  display: flex;
  margin: 0;
  min-width: 0;
}
.filters-inline-dates input[type="date"] {
  border: 0;
  border-radius: 12px;
  background: var(--white-10);
  color: var(--text);
  padding: 8px 10px;
  font: 500 13px/1.2 var(--font);
  color-scheme: dark;
  min-width: 9.5rem;
  width: auto;
}
.filters-date-sep {
  color: var(--text-40);
  font-size: 13px;
  flex-shrink: 0;
}
.filters-inline-dates .btn {
  flex-shrink: 0;
  padding: 8px 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 720px) {
  .filters-inline-dates {
    flex-wrap: wrap;
    width: 100%;
  }
}

.filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  flex: 1 1 320px;
  min-width: 0;
}
.filter-date-label {
  margin-left: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(46, 157, 184, 0.16);
  color: #8fd4e4;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.filter-date-label:empty {
  display: none;
}
.filters-actions + .hint,
.filters-grid + .hint {
  margin-top: 10px;
}
.hint {
  margin: 0;
  color: var(--text-40);
  font-size: 13px;
}
.hint[hidden] { display: none !important; }
.stores-cell {
  max-width: 420px;
  white-space: normal;
  font-size: 12px;
  color: var(--text-40);
}
.gps-link {
  color: #7eb6ff;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.gps-link:hover { text-decoration: underline; }
.gps-link.muted { color: var(--text-40); font-weight: 400; }
.gps-link.gps-icon {
  font-size: 16px;
  text-decoration: none;
  line-height: 1;
  filter: none;
}
.gps-link.gps-icon.gps-on {
  filter: none;
  opacity: 1;
}
.gps-link.gps-icon.gps-off {
  filter: grayscale(1) brightness(0.75);
  opacity: 0.45;
}
.gps-link.gps-icon:hover {
  text-decoration: none;
  transform: scale(1.08);
}
.gps-link.gps-icon.gps-off:hover {
  opacity: 0.7;
}
.muted { color: var(--text-40); }
.destino-cell {
  max-width: 160px;
  white-space: normal;
  font-size: 12px;
}
.cumple-cell { white-space: nowrap; overflow: visible; }
.cumple-marks {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
}
#page-retiros .table-wrap-pane {
  overflow-x: hidden;
  overflow-y: auto;
}
#page-retiros .cumple-cell {
  overflow: visible;
}
.mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  user-select: none;
}
.mark.has-pop {
  cursor: pointer;
}
.mark.has-pop:hover {
  transform: none;
  filter: brightness(1.15);
}
.mark-ok { background: rgba(52, 199, 89, 0.2); color: #34c759; }
.mark-late { background: rgba(255, 159, 10, 0.2); color: #ff9f0a; }
.mark-wait { background: rgba(255, 255, 255, 0.08); color: var(--text-40); }
.mark-missed { background: rgba(255, 69, 58, 0.2); color: #ff453a; }

/* Popup fuera de la tabla (body) — no lo recorta overflow/transform */
.mark-pop-float {
  position: fixed;
  z-index: 10000;
  min-width: 148px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1c1c1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  color: var(--text);
  pointer-events: auto;
}
.mark-pop-float[hidden] {
  display: none !important;
}

.mark-pop {
  display: none;
}
.mark-pop-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}
.mark-pop-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-40);
}
.mark-pop-row strong {
  color: var(--text);
  font-weight: 600;
}
.mark-pop-row strong.bad { color: #ff453a; }
.mark-pop-row strong.muted { color: var(--text-40); font-weight: 500; }
.mark-pop-status {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
}
.mark-pop-status.ok { color: #34c759; }
.mark-pop-status.late { color: #ff9f0a; }
.mark-pop-status.missed { color: #ff453a; }
.mark-pop-status.wait { color: var(--text-40); }

.btn {
  border: 0;
  border-radius: 16px;
  background: var(--white-10);
  color: var(--text);
  padding: 8px 14px;
  font: 400 14px/20px var(--font);
  cursor: pointer;
}
.btn.primary { background: var(--primary); }
.btn.active {
  background: var(--primary);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.btn.ghost { background: transparent; color: var(--text-40); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.retiros-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}
#page-entregas .retiros-kpis,
#page-retiros .retiros-kpis {
  flex-shrink: 0;
  gap: 12px;
  align-items: stretch;
}
#page-entregas .kpi,
#page-retiros .kpi {
  height: var(--ops-kpi-h);
  min-height: var(--ops-kpi-h);
  max-height: var(--ops-kpi-h);
  padding: 12px 16px;
  box-sizing: border-box;
  overflow: hidden;
}
#page-entregas .kpi-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-entregas .kpi-sin-conf {
  display: inline;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.55);
  vertical-align: middle;
  margin: 0 2px;
  white-space: nowrap;
}
.pend-track-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pend-track-btn:hover {
  color: #ff9f0a;
}
.pend-pop-float {
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1c1c1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  color: var(--text);
}
.pend-pop-float[hidden] {
  display: none !important;
}
.pend-pop-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}
.pend-pop-note {
  font-size: 11px;
  color: #ff9f0a;
  margin-bottom: 8px;
}
.pend-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  margin-top: 6px;
}
.pend-pop-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
}
.pend-copy {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-40);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.pend-copy:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
}
.sin-conf-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border-radius: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.sin-conf-link:hover {
  opacity: 0.85;
  background: transparent;
  color: inherit;
}
.ent-kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  margin-right: 8px;
  white-space: nowrap;
}
.ent-kpi-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.ent-kpi-ok .ent-kpi-ico {
  background: rgba(48, 209, 88, 0.95);
  color: #0b1f1a;
}
.ent-kpi-fail .ent-kpi-ico {
  background: rgba(255, 69, 58, 0.95);
  color: #fff;
}
.sin-conf-pop {
  min-width: min(420px, calc(100vw - 24px));
  max-width: min(560px, calc(100vw - 24px));
  max-height: min(420px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  box-sizing: border-box;
}
.pend-pop-float.sin-conf-pop {
  max-width: min(560px, calc(100vw - 24px));
}
.sin-conf-pop .pend-pop-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.sin-conf-table-wrap {
  overflow: auto;
  max-height: 320px;
  max-width: 100%;
  min-width: 0;
}
.sin-conf-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}
.sin-conf-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-40);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  background: rgba(20, 24, 32, 0.96);
}
.sin-conf-table th:nth-child(1),
.sin-conf-table td.sin-conf-num {
  width: 28px;
}
.sin-conf-table th:nth-child(4),
.sin-conf-table td.sin-conf-hora {
  width: 52px;
}
.sin-conf-table td {
  padding: 5px 6px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sin-conf-num {
  width: 28px;
  color: var(--text-40);
  font-variant-numeric: tabular-nums;
}
.sin-conf-tracking,
.sin-conf-orden {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  word-break: break-all;
  min-width: 0;
}
.sin-conf-admin {
  color: var(--mint);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.sin-conf-admin:hover {
  opacity: 0.85;
}
.sin-conf-simpli {
  color: #7ec8ff;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.sin-conf-simpli:hover {
  opacity: 0.85;
}
#page-entregas a.driver-simpli-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(126, 200, 255, 0.4);
  cursor: pointer;
}
#page-entregas a.driver-simpli-link:hover {
  color: #7ec8ff;
  border-bottom-color: #7ec8ff;
}
.sin-conf-hora {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-70, rgba(255, 255, 255, 0.72));
}
.pend-cell-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.2;
}
.sin-conf-link-sm {
  font-size: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fail-pop-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border-radius: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fail-pop-btn:hover {
  opacity: 0.85;
}
.sin-conf-num-btn {
  color: #ff9f0a !important;
  background: transparent !important;
  border: 0 !important;
}
#page-entregas .kpi-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ent-ico {
  display: inline-block;
  width: 0;
  height: 0;
  flex-shrink: 0;
  opacity: 0.85;
  margin-top: 3px;
}
.ent-ico-up {
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 5px solid rgba(52, 199, 89, 0.95);
}
.ent-ico-down {
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 5px solid rgba(255, 69, 58, 0.95);
}
.ent-ritmo {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
  min-width: 0;
  width: 100%;
  margin-top: 2px;
}
.ent-plat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ent-plat-empty {
  color: var(--text-40);
  font-size: 11px;
  text-align: left;
}
.ent-plat-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}
.ent-plat-table th,
.ent-plat-table td {
  padding: 1px 2px;
  line-height: 1.15;
  font-size: 11px;
  vertical-align: middle;
}
.ent-plat-table thead th {
  color: var(--text-40);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.ent-plat-table thead .ent-plat-title {
  width: 38%;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ent-plat-table .ent-plat-name {
  width: 38%;
  color: var(--text-40);
  font-weight: 500;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.ent-plat-table .ent-plat-n,
.ent-plat-table .ent-plat-pct,
.ent-plat-table .ent-plat-done,
.ent-plat-table .ent-plat-ok {
  width: 15.5%;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}
.ent-plat-table thead .ent-plat-n,
.ent-plat-table thead .ent-plat-pct,
.ent-plat-table thead .ent-plat-done,
.ent-plat-table thead .ent-plat-ok {
  color: var(--text-40);
  font-weight: 600;
}
.ent-plat-item {
  display: none;
}
#page-entregas .kpi.kpi-plat,
#page-entregas .kpi:has(.ent-plat-list) {
  justify-content: stretch;
  gap: 0;
  padding: 10px 12px 8px;
  overflow: hidden;
}
.ent-ritmo-col {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  flex: 1 1 0;
}
.ent-ritmo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ent-ritmo-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  line-height: 1.25;
}
.ent-ritmo-name {
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}
.ent-ritmo-rate {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--mint);
  white-space: nowrap;
}
#page-entregas .kpi:has(.ent-ritmo) {
  justify-content: flex-start;
}
#page-entregas .kpi:has(.ent-ritmo) .kpi-top {
  margin-bottom: 4px;
}
.ent-tabs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ent-tabs .btn {
  min-width: 96px;
}
.retiros-unified[hidden],
[data-ent-pane][hidden],
[data-ret-pane][hidden] {
  display: none !important;
}
#page-entregas {
  flex: 1;
  min-height: 0;
  gap: 8px;
  height: 100%;
  overflow: hidden;
}
#page-entregas .ent-tabs {
  flex-shrink: 0;
}
#page-entregas .retiros-unified {
  flex: 1 1 auto;
  min-height: 180px;
}
#page-entregas .table-wrap-pane {
  flex: 1;
  min-height: 160px;
  overflow: auto;
}
#page-entregas .block {
  padding: 8px 10px;
}
#page-entregas .block-head {
  margin-bottom: 4px;
  flex-shrink: 0;
}
#page-entregas .block-head h2 {
  font-size: 13px;
}
#page-entregas table {
  font-size: 12px;
}
#page-entregas th,
#page-entregas td {
  padding: 4px 6px;
  vertical-align: middle;
}
#page-entregas #ent-pane-choferes .table-wrap-pane {
  overflow-x: hidden;
  padding-right: 6px;
}
#page-entregas #ent-drivers-table {
  table-layout: fixed;
  width: 100%;
}
#page-entregas #ent-drivers-table th,
#page-entregas #ent-drivers-table td {
  padding: 3px 4px;
  font-size: 11px;
}
#page-entregas #ent-drivers-table th {
  white-space: nowrap;
}
/* Chofer + nums (12 cols); x h con aire al borde */
#page-entregas #ent-drivers-table th:nth-child(1),
#page-entregas #ent-drivers-table td:nth-child(1) {
  width: 14%;
}
#page-entregas #ent-drivers-table th:nth-child(2),
#page-entregas #ent-drivers-table td:nth-child(2),
#page-entregas #ent-drivers-table th:nth-child(3),
#page-entregas #ent-drivers-table td:nth-child(3),
#page-entregas #ent-drivers-table th:nth-child(4),
#page-entregas #ent-drivers-table td:nth-child(4),
#page-entregas #ent-drivers-table th:nth-child(5),
#page-entregas #ent-drivers-table td:nth-child(5),
#page-entregas #ent-drivers-table th:nth-child(6),
#page-entregas #ent-drivers-table td:nth-child(6) {
  width: 5%;
  padding-left: 2px;
  padding-right: 2px;
  text-align: right;
}
#page-entregas #ent-drivers-table th:nth-child(7),
#page-entregas #ent-drivers-table td:nth-child(7),
#page-entregas #ent-drivers-table th:nth-child(8),
#page-entregas #ent-drivers-table td:nth-child(8),
#page-entregas #ent-drivers-table th:nth-child(9),
#page-entregas #ent-drivers-table td:nth-child(9),
#page-entregas #ent-drivers-table th:nth-child(10),
#page-entregas #ent-drivers-table td:nth-child(10),
#page-entregas #ent-drivers-table th:nth-child(11),
#page-entregas #ent-drivers-table td:nth-child(11) {
  width: 7.2%;
  padding-left: 2px;
  padding-right: 2px;
  text-align: right;
  white-space: nowrap;
}
#page-entregas #ent-drivers-table th:nth-child(12),
#page-entregas #ent-drivers-table td:nth-child(12) {
  width: 5.5%;
  padding-left: 4px;
  padding-right: 10px;
  text-align: right;
}
#page-entregas #ent-drivers-table .cell-primary {
  max-width: none;
}
#page-entregas #ent-drivers-table .cell-sub {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#page-entregas #ent-drivers-table .route-active-badge,
#page-entregas #ent-drivers-table .route-inactive-badge,
#page-entregas #ent-drivers-table .route-closed-badge,
#page-entregas #ent-drivers-table .route-done-badge,
#page-entregas #ent-drivers-table .stale-badge {
  padding: 0 4px;
  font-size: 9px;
}
#page-entregas .filters.block {
  padding: 10px 14px;
  flex-shrink: 0;
}
#page-entregas .footer {
  display: none;
}
.view:has(#page-entregas:not([hidden])) {
  overflow: hidden;
  gap: 8px;
}
.recepcion-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0 16px;
}
.recepcion-block .hint {
  margin: 0 0 8px;
}
.chip-mock {
  background: rgba(255, 159, 10, 0.18);
  color: #ff9f0a;
}

.retiros-flow-label {
  margin: 0;
  flex-shrink: 0;
}
.retiros-extra {
  margin: 0;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
}
.retiros-extra strong {
  color: var(--text);
  font-weight: 600;
}
.retiros-extra em {
  font-style: normal;
  opacity: 0.8;
}
/* Una sola tabla por chofer (calle + bodega) — llena el viewport */
.retiros-unified {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.retiros-unified .retiros-pane {
  flex: 1;
}
.retiros-unified-table {
  width: 100%;
}
.retiros-unified-table th,
.retiros-unified-table td {
  white-space: nowrap;
}
.entregas-table tfoot .ent-total-row td {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  padding-top: 10px;
  padding-bottom: 10px;
}
.entregas-table tfoot .ent-total-row .cell-primary {
  font-weight: 700;
}
/* Separador visual calle → bodega (col. Bultos) solo en Retiros choferes */
#page-retiros #ret-pane-choferes .retiros-unified-table th:nth-child(7),
#page-retiros #ret-pane-choferes .retiros-unified-table td:nth-child(7) {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 10px;
}
.retiros-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.retiros-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.table-wrap-pane {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
#page-retiros {
  flex: 1;
  min-height: 0;
  gap: 8px;
  height: 100%;
  overflow: hidden;
}
#page-retiros .ent-tabs {
  flex-shrink: 0;
}
#page-retiros .block {
  padding: 8px 10px;
}
#page-retiros .block-head {
  margin-bottom: 4px;
  flex-shrink: 0;
}
#page-retiros .block-head h2 {
  font-size: 13px;
}
#page-retiros .retiros-unified {
  flex: 1 1 auto;
  min-height: 180px;
}
#page-retiros .table-wrap-pane {
  flex: 1;
  min-height: 160px;
  overflow: auto;
}
#page-retiros table,
#page-retiros .retiros-unified-table {
  font-size: 12px;
}
#page-retiros th,
#page-retiros td {
  padding: 4px 6px;
  vertical-align: middle;
}
#page-retiros .filters.block {
  padding: 10px 14px;
  flex-shrink: 0;
}
#page-retiros .footer {
  display: none;
}
#page-retiros .kpi-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-retiros .kpi-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#page-retiros .th-sort,
#page-entregas .th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
#page-retiros .th-sort::after,
#page-entregas .th-sort::after {
  content: " ⇅";
  font-size: 10px;
  font-weight: 500;
  opacity: 0.5;
  margin-left: 3px;
  vertical-align: middle;
}
#page-retiros.is-loading .table-wrap-pane,
#page-retiros.is-loading .retiros-kpis {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 160ms ease;
}
#page-retiros .ret-loading-row td {
  text-align: center;
  color: var(--muted, #9aa3b2);
  font-style: italic;
  letter-spacing: 0.02em;
  animation: ret-pulse 1.1s ease-in-out infinite;
}
@keyframes ret-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
#page-retiros .th-sort:hover,
#page-entregas .th-sort:hover {
  color: #fff;
}
#page-retiros .th-sort:hover::after,
#page-entregas .th-sort:hover::after {
  opacity: 0.55;
}
#page-retiros .th-sort.sort-asc::after,
#page-entregas .th-sort.sort-asc::after {
  content: " ▲";
  font-size: 9px;
  opacity: 0.95;
  color: var(--mint);
}
#page-retiros .th-sort.sort-desc::after,
#page-entregas .th-sort.sort-desc::after {
  content: " ▼";
  font-size: 9px;
  opacity: 0.95;
  color: var(--mint);
}
.cell-stack {
  line-height: 1.15;
}
.cell-primary {
  display: inline;
  font-weight: 500;
}
.cell-primary-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.cell-primary-row .cell-primary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-sub {
  display: block;
  font-size: 10px;
  color: var(--text-40);
}
.destino-with-pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 130px;
}
.destino-with-pin .gps-icon {
  flex: 0 0 auto;
  font-size: 13px;
}
#page-retiros .destino-cell {
  max-width: 130px;
  font-size: 11px;
}
#page-retiros .num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#page-retiros .cumple-marks {
  gap: 5px;
}
#page-retiros .mark {
  width: 17px;
  height: 17px;
}
/* Cuando Retiros está activo, el view no scrollea: scrollean las grillas */
.view:has(#page-retiros:not([hidden])) {
  overflow: hidden;
  gap: 8px;
}
@media (max-width: 1200px) {
  .retiros-split {
    grid-template-columns: 1fr;
  }
  .retiros-unified-table {
    font-size: 11px;
  }
  .view:has(#page-retiros:not([hidden])) {
    overflow: auto;
  }
  #page-retiros {
    overflow: auto;
    height: auto;
  }
  .table-wrap-pane {
    max-height: 55vh;
  }
}

.meli-block .chip-meli {
  background: rgba(255, 230, 0, 0.18);
  color: #ffe600;
}
.meli-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.meli-stat {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.22);
}
.meli-value {
  margin: 6px 0 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
}
.progress-wrap {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffe600, #0a84ff);
  transition: width 400ms ease;
}
.tag-meli {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 230, 0, 0.2);
  color: #ffe600;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.row-meli td {
  background: rgba(255, 230, 0, 0.06);
}

.kpi {
  position: relative;
  min-height: 108px;
  padding: 16px 20px;
  border-radius: var(--radius-24);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: #fff;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.4) 100%);
}
.kpi > * {
  position: relative;
  z-index: 1;
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.kpi-badge {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  padding: 2px 8px;
  border-radius: 80px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.kpi.tone-ok {
  background: linear-gradient(90deg, var(--green), var(--green));
}
.kpi.tone-warn {
  background: linear-gradient(90deg, var(--orange), var(--orange));
}
.kpi.tone-bad {
  background: linear-gradient(90deg, var(--red), var(--red));
}
.kpi.tone-neutral {
  background: linear-gradient(90deg, var(--primary), var(--primary));
}
.kpi.tone-neutral .kpi-badge {
  display: none;
}
.kpi-label { margin: 0; font-size: 16px; line-height: 24px; }
.kpi-value { margin: 8px 0 0; font-size: 24px; font-weight: 600; line-height: 32px; letter-spacing: -0.02em; }
.kpi-delta { margin: 4px 0 0; font-size: 16px; line-height: 24px; }
.kpi-compare { margin: 6px 0 0; font-size: 12px; opacity: 0.85; }

.chip-ok {
  background: rgba(48, 209, 88, 0.2);
  color: #fff;
}
.chip-bad {
  background: rgba(255, 69, 58, 0.2);
  color: #fff;
}

.cell-ok { color: var(--green); font-weight: 500; }
.cell-warn { color: var(--orange); font-weight: 500; }
.cell-bad { color: var(--red); font-weight: 500; }
#page-entregas .pct-inline,
#page-retiros .pct-inline {
  display: inline;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
#page-entregas .pct-bad,
#page-retiros .pct-bad { color: var(--red); font-weight: 600; }
#page-entregas .pct-warn,
#page-retiros .pct-warn { color: var(--orange); font-weight: 600; }
#page-entregas .pct-ok,
#page-retiros .pct-ok { color: var(--green); font-weight: 600; }
.cell-alert {
  color: #ff453a;
  font-weight: 700;
}
#page-entregas tr.row-stale td,
#page-retiros tr.row-stale td {
  background: rgba(255, 69, 58, 0.14);
}
#page-entregas tr.row-stale td:first-child,
#page-retiros tr.row-stale td:first-child {
  box-shadow: inset 3px 0 0 #ff453a;
}
#page-entregas tr.row-warn td,
#page-retiros tr.row-warn td {
  background: rgba(255, 159, 10, 0.08);
}
#page-entregas .stale-badge {
  display: inline-block;
  flex-shrink: 0;
  margin: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #fff;
  background: #ff453a;
  white-space: nowrap;
}
#page-entregas .route-closed-badge {
  display: inline-block;
  flex-shrink: 0;
  margin: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #0b1f1a;
  background: var(--mint);
  white-space: nowrap;
}
#page-entregas .route-done-badge {
  display: inline-block;
  flex-shrink: 0;
  margin: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #0b1f1a;
  background: var(--green);
  white-space: nowrap;
}
#page-entregas .route-active-badge {
  display: inline-block;
  flex-shrink: 0;
  margin: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #fff;
  background: #0a84ff;
  white-space: nowrap;
}
#page-entregas .route-inactive-badge {
  display: inline-block;
  flex-shrink: 0;
  margin: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}
#page-entregas .cell-late21,
#page-entregas .late21-time {
  color: #ff9f0a;
  font-weight: 700;
}
.ent-stale-alert,
#ent-stale.ent-stale-alert {
  color: #ff453a;
  font-weight: 700;
}
.eta-cell.eta-soon {
  color: #ff9f0a;
  font-weight: 700;
}
.eta-cell.eta-late {
  color: #ff453a;
  font-weight: 700;
}
.row-bad td:first-child { color: rgba(255, 255, 255, 0.92); }
.row-ok td { color: var(--green); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chip {
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--white-10);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-16);
  background: rgba(0,0,0,.12);
}
.table-wrap thead th,
.table-wrap-pane thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #1a1a1c;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--white-10);
  white-space: nowrap;
}
th { color: var(--text-40); font-weight: 500; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-40);
  font-size: 13px;
}
.footer p { margin: 0; }
.debug summary { cursor: pointer; color: rgba(255,255,255,.8); }
.debug pre {
  max-height: 280px;
  overflow: auto;
  background: #1c1c1e;
  border-radius: 16px;
  padding: 14px;
  font-size: 12px;
}
code { color: var(--mint); }

@media (max-width: 1100px) {
  .kpi-row,
  .retiros-kpis,
  .recepcion-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split,
  .filters-grid,
  .meli-card {
    grid-template-columns: 1fr;
  }
  .topbar-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ops-value,
  .clock strong {
    font-size: 22px;
  }
  #page-entregas .kpi,
  #page-retiros .kpi {
    height: auto;
    min-height: 112px;
    max-height: none;
  }
  #page-entregas .kpi-value,
  #page-retiros .kpi-value {
    font-size: 20px;
    line-height: 26px;
  }
  .ent-ritmo { gap: 10px; }
  .ent-ritmo-name,
  .ent-ritmo-rate,
  .ent-plat-table th,
  .ent-plat-table td {
    font-size: 10px;
    line-height: 1.1;
  }
  .ent-plat-table .ent-plat-name {
    font-size: 9px;
  }
  .ent-plat-table thead th {
    font-size: 7px;
  }
  .meli-value {
    font-size: 24px;
  }
}

@media (max-width: 860px) {
  .shell {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    height: 100dvh;
  }
  .shell.sidebar-open::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 30;
    pointer-events: auto;
  }
  .sidebar {
    width: min(280px, 86vw);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }
  .brand {
    padding: 12px;
  }
  .main {
    padding: 12px;
    gap: 10px;
  }
  .menu-hit {
    position: relative;
    top: auto;
    left: auto;
    width: 44px;
    min-height: 44px;
    border-radius: 14px;
  }
  .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
    gap: 8px;
  }
  .topbar-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    flex: 1 1 calc(100% - 56px);
  }
  .top-metric {
    padding: 8px 10px;
  }
  .ops-label {
    font-size: 10px;
  }
  .ops-value {
    font-size: 18px;
  }
  .ops-sub {
    font-size: 10px;
  }
  .clock {
    text-align: left;
    min-width: 0;
    width: 100%;
    padding: 8px 12px;
  }
  .clock strong {
    font-size: 20px;
  }
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-title {
    font-size: 22px;
    white-space: normal;
  }
  .filters-actions {
    margin-left: 0;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  .filters-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 8px);
    justify-content: center;
  }
  .login-banner {
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }
  .login-steps {
    padding-left: 16px;
    font-size: 12px;
  }
  #page-meli,
  #page-entregas,
  #page-retiros {
    overflow: auto;
    height: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }
  .view:has(#page-meli:not([hidden])),
  .view:has(#page-entregas:not([hidden])),
  .view:has(#page-retiros:not([hidden])) {
    overflow: auto;
  }
  #page-entregas .retiros-unified,
  #page-retiros .retiros-unified {
    min-height: 240px;
  }
  #page-entregas .kpi-label,
  #page-retiros .kpi-label {
    font-size: 12px;
  }
  #page-entregas .kpi-badge,
  #page-retiros .kpi-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  .ent-tabs {
    display: flex;
    width: 100%;
  }
  .ent-tabs .btn,
  [data-ent-tab],
  [data-ret-tab] {
    min-width: 0;
    flex: 1;
    justify-content: center;
  }
  .table-wrap,
  .table-wrap-pane {
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }
  .block {
    padding: 12px;
    border-radius: 16px;
  }
  .block-head h2 {
    font-size: 14px;
  }
  .auth-gate {
    padding: 16px;
    align-items: flex-start;
    padding-top: max(24px, env(safe-area-inset-top));
  }
  .auth-card {
    width: 100%;
    padding: 22px 18px 20px;
  }
  .pend-pop-float,
  .mark-pop-float {
    left: 12px !important;
    right: 12px;
    max-width: none;
    width: auto;
  }
  .footer {
    font-size: 12px;
  }
}
@media (max-width: 560px) {
  .retiros-kpis,
  .kpi-row,
  .recepcion-kpis {
    grid-template-columns: 1fr;
  }
  .topbar-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .clock {
    display: none;
  }
  .main {
    padding: 10px;
    gap: 8px;
  }
  .menu-hit {
    width: 40px;
    min-height: 40px;
  }
  .ops-value {
    font-size: 17px;
  }
  .ops-label {
    font-size: 9px;
    letter-spacing: 0.02em;
  }
  .top-metric[data-ops="received"] .ops-label {
    font-size: 8px;
  }
  #page-entregas .kpi-value,
  #page-retiros .kpi-value,
  .meli-value {
    font-size: 22px;
    line-height: 28px;
    white-space: normal;
  }
  .ent-ritmo {
    flex-direction: column;
    gap: 8px;
  }
  #page-entregas table,
  #page-retiros table,
  #page-meli table {
    font-size: 11px;
  }
  #page-entregas th,
  #page-entregas td,
  #page-retiros th,
  #page-retiros td,
  #page-meli th,
  #page-meli td {
    padding: 6px 8px;
  }
  .filters-actions .btn {
    min-width: 100%;
  }
  .chip {
    padding: 6px 10px;
    font-size: 12px;
  }
  .sidebar-user p {
    display: none;
  }
}
