/* ═══════════════════════════════════════════
   RETIRO — pantalla propia (ruta #/retiros)
   Reusa las clases .rp-* del diálogo original.
   ═══════════════════════════════════════════ */
.retiro-screen {
  width: 100%;
  padding: 30px clamp(14px, 2vw, 40px) 40px; box-sizing: border-box;
}
.retiro-screen .rp-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  /* Llena el alto disponible (menos los márgenes) para que el total quede abajo
     y no a media pantalla cuando el retiro trae pocas líneas. */
  min-height: calc(100vh / var(--z) - 70px);
}
/* En pantalla scrollea la página, no el cuerpo */
.retiro-screen .rp-body { overflow: visible; flex: 1; }
/* El total y el botón de confirmar acompañan el scroll y descansan dentro de la tarjeta */
.retiro-screen .rp-foot {
  position: sticky; bottom: 0; z-index: 2;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.rp-volver {
  margin-left: auto; flex: none;
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-family: var(--font-body); font-weight: 700; font-size: 12.5px; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.rp-volver:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }

@media (max-width: 700px) {
  .retiro-screen { padding: 16px 12px 24px; }
  /* La hamburguesa empuja el contenido 56px; sin esto sobraría scroll de más */
  .retiro-screen .rp-card { min-height: calc(100vh / var(--z) - 96px); }
}

/* Encabezado */
.rp-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
}
.rp-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--ink); }
.rp-sub { margin: 3px 0 0; font-size: 12px; color: var(--ink-soft); }
/* Cuerpo scrolleable: 2 columnas (formulario | items) */
.rp-body {
  flex: 1; overflow-y: auto;
  padding: 20px 22px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; align-items: start;
}
.rp-col { display: grid; gap: 14px; align-content: start; min-width: 0; }
.rp-col-items {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}

/* Cantidad / peso calculado */
.retiro-qty-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.retiro-calc { align-self: end; padding: 6px 0; }
.retiro-calc span { font-family: var(--font-display); font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; font-size: 1rem; }

.rp-add-btn { width: 100%; justify-content: center; padding: 10px; font-weight: 700; }

/* Presentación */
.pres-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pres-pill {
  padding: 8px 16px; border-radius: var(--pill); cursor: pointer; user-select: none;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 700; font-size: .85rem; color: var(--ink-soft); transition: all .15s;
}
.pres-pill.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.24); }

/* Filtros rápidos del buscador (cliente + tipo) */
.rp-filtros { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.rp-filtros .filter-input { width: 100%; }
.rp-filtros .pres-pick--sm { padding-bottom: 4px; }

/* Buscador de producto: el alto se mide contra la pantalla, no en px fijos,
   para aprovechar el monitor sin desbordarse en laptops chicas. */
.prod-results {
  margin-top: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  max-height: calc(54vh / var(--z)); overflow-y: auto;
}
.prod-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.prod-row:last-child { border-bottom: none; }
.prod-row:hover { background: var(--brand-soft); }
.pr-name { font-weight: 600; font-size: 12.5px; color: var(--ink); }
.pr-meta { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.pr-disp { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.prod-empty { padding: 10px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.prod-selected {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid rgba(37,99,235,.35); background: var(--brand-soft);
}
.ps-name { font-weight: 700; font-size: 12.5px; color: var(--ink); }
.ps-meta { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.prod-selected .pc-icon-btn { margin-left: auto; flex: none; }

/* Items del retiro (columna derecha) */
.retiro-items { }
.retiro-items-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 800; color: var(--ink); font-size: .95rem; }
.retiro-empty { color: var(--ink-soft); padding: 26px 14px; text-align: center; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r); font-size: .88rem; }
.retiro-line {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 8px; background: var(--surface-2);
}
.rl-name { font-weight: 700; color: var(--ink); font-size: .9rem; }
.rl-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.rl-qty { margin-left: auto; text-align: right; font-family: var(--font-display); font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; font-size: .92rem; }
.rl-qty small { display: block; font-family: var(--font-body); font-size: .68rem; color: var(--ink-faint); font-weight: 600; }

/* Línea editable (marquetas + presentación por producto) */
.retiro-line-edit {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 13px; margin-bottom: 8px; background: var(--surface-2);
  transition: border-color .12s, background .12s;
}
.retiro-line-edit.linea-error { border-color: var(--danger); background: var(--danger-soft); }
.rle-top { display: flex; align-items: flex-start; gap: 10px; }
.rle-info { flex: 1; min-width: 0; }
.rle-controls { display: flex; align-items: center; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.pres-pick--sm { gap: 5px; }
.pres-pill--sm { padding: 5px 11px; font-size: .78rem; }
.rle-qty { flex: none; }
.rle-input { width: 78px; text-align: center; padding: 7px 8px; }
.rle-input.input-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.14); }
.rle-calc { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; line-height: 1.25; text-align: right; }
.rle-kg { font-family: var(--font-display); font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; font-size: .95rem; }
.rle-queda { font-size: 10.5px; color: var(--ink-soft); }
.rle-error { margin-top: 7px; font-size: 11px; color: var(--danger-deep); font-weight: 600; }

/* Pie con resumen + confirmar (horizontal) */
.rp-foot {
  border-top: 1px solid var(--line); background: var(--surface-2);
  padding: 14px 22px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.rp-foot-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; flex: 1; min-width: 0; }
.rp-total-row { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.rp-total-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rp-foot-cta { display: flex; align-items: center; gap: 18px; flex: none; }
.rp-total-kg { display: flex; flex-direction: column; align-items: flex-end; }
.rp-total-kg .lbl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.rp-total-kg .val { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--brand); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rp-cta { white-space: nowrap; padding: 11px 22px; }

/* Pantallas de poca altura: compactar para evitar scroll */
@media (max-height: 820px) {
  .rp-head { padding: 12px 20px 10px; }
  .rp-body { padding: 14px 20px; gap: 14px 24px; }
  .rp-foot { padding: 10px 20px 12px; }
  .rp-total-kg .val { font-size: 1.4rem; }
}

/* Responsive: una columna en pantallas medianas/chicas */
@media (max-width: 760px) {
  .rp-body { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .rp-col-items { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .rp-foot { padding: 12px 16px 14px; }
  .rp-foot-cta { width: 100%; justify-content: space-between; }
  .pres-pill { flex: 1; text-align: center; }
  .rp-filtros { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .segmented .seg-btn { flex: 1; }
}
