/* pedidos.css — chat y lista de pedidos personalizados (pedido-chat.html, mis-pedidos.html)
   Diseño compacto para móvil: poco "cromo" fijo, más espacio para la conversación. */
:root { --pp-accent: var(--color-primary, #6d28d9); --pp-accent-solid: var(--color-primary-soft, #7c3aed); --pp-accent-soft: rgba(139,92,246,.15); --pp-font: inherit; /* hereda la tipografía del sitio; para usar la del sistema: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif */ }
/* Nada de scroll de página: solo se desplaza la conversación (o la lista). Encabezado y caja de escritura quedan fijos. */
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
.pp-app, .pp-ov, .pp-box, .pp-visor { font-family: var(--pp-font); }
.pp-app[data-vv] { bottom: auto; top: var(--pp-top, 0px); height: var(--pp-h); }
.pp-app button, .pp-app input, .pp-app textarea, .pp-box button, .pp-box input, .pp-box textarea { font-family: inherit; }
/* position:fixed con los 4 bordes en 0 ocupa exactamente el área visible; 100dvh puede medir más que la pantalla (barras del navegador / del sistema)
   y dejaba la caja de escritura fuera de vista. Con teclado abierto el JS (data-vv) lo ajusta al área visible real. */
.pp-app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; font-size: 14px; line-height: 1.35; background: var(--color-bg, #fff); color: var(--color-text-primary, #1e2128); }

/* ---- Encabezado: el mismo .app-header del sitio (styles.css); aquí solo se ajusta para vivir dentro del chat ---- */
.pp-app .app-header { position: static; flex-shrink: 0; gap: 8px; box-sizing: border-box; } /* styles.css no define box-sizing global: sin esto el encabezado (width:100% + padding) se desborda 32px */
.pp-app .header-left { flex: 1; min-width: 0; gap: 10px; }
.pp-app .header-text { min-width: 0; }
.pp-app .app-title, .pp-app .app-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-app .header-right { padding: 0; gap: 8px; flex-shrink: 0; }
.pp-app a.icon-button { text-decoration: none; flex-shrink: 0; }
.pp-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--pp-accent-soft); color: var(--pp-accent); white-space: nowrap; flex-shrink: 0; }
.pp-badge.ok { background: rgba(34,197,94,.14); color: var(--color-success, #16a34a); }
.pp-badge.bad { background: rgba(239,68,68,.14); color: var(--color-error, #dc2626); }
.pp-badge.warn { background: rgba(245,158,11,.18); color: var(--color-warning, #b45309); }

/* ---- Progreso: 6 tramos delgados ---- */
.pp-prog { display: flex; gap: 3px; padding: 0 10px; height: 3px; margin-top: -1px; }
.pp-prog i { flex: 1; border-radius: 3px; background: var(--color-surface-3, #e5e7eb); }
.pp-prog i.on { background: var(--pp-accent-solid); }

/* ---- Resumen colapsable ---- */
.pp-strip { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--color-border-subtle, #e5e7eb); background: var(--color-surface-2, #f9fafb); color: inherit; padding: 7px 12px; font-size: 12.5px; text-align: left; cursor: pointer; }
.pp-strip .t { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-strip .chev { font-size: 12px; font-weight: 700; color: var(--color-accent-solid, #8b5cf6); white-space: nowrap; flex-shrink: 0; }
.pp-recargar { width: 32px; height: 32px; flex-shrink: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 19px; line-height: 1; opacity: .6; cursor: pointer; }
.pp-recargar:active { opacity: 1; }
.pp-detail { padding: 8px 12px 10px; border-bottom: 1px solid var(--color-border-subtle, #e5e7eb); background: var(--color-surface-2, #f9fafb); max-height: 44dvh; overflow-y: auto; font-size: 12.5px; }
.pp-d-ref { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.pp-d-ref img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--color-surface-3, #e5e7eb); flex-shrink: 0; }
.pp-d-ref b { display: block; font-size: 13px; }
.pp-d-ref span { opacity: .7; font-size: 11.5px; }
.pp-d-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.pp-d-dl dt { opacity: .6; }
.pp-d-dl dd { margin: 0; font-weight: 600; word-break: break-word; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-hint { font-size: 12px; margin: 6px 0 4px; opacity: .85; }
.pp-hint.bad { color: var(--color-error, #b91c1c); opacity: 1; }

/* ---- Mensajes ---- */
.pp-msgs { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.pp-more { align-self: center; border: 0; background: var(--color-surface-2, #f3f4f6); color: inherit; padding: 5px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; }
.pp-day { align-self: center; font-size: 10.5px; opacity: .55; margin: 6px 0 2px; }
.pp-day::first-letter { text-transform: uppercase; }
.pp-sys { align-self: center; text-align: center; font-size: 11.5px; opacity: .6; padding: 1px 12px; max-width: 92%; }
.pp-b { max-width: 82%; padding: 6px 10px; border-radius: 14px; font-size: 14px; line-height: 1.3; white-space: pre-wrap; word-break: break-word; background: var(--color-surface-2, #f3f4f6); align-self: flex-start; border-bottom-left-radius: 4px; }
.pp-fila { display: flex; align-items: flex-end; align-self: flex-start; max-width: 88%; min-width: 0; }
.pp-fila .pp-b { max-width: none; min-width: 0; }
.pp-fila .znr-av { margin-bottom: 2px; }
.pp-b.me { align-self: flex-end; background: var(--pp-accent-solid); color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.pp-b time { display: block; font-size: 10px; opacity: .6; margin-top: 2px; text-align: right; }
.pp-b img.pp-foto { display: block; max-width: 100%; max-height: 170px; border-radius: 10px; cursor: zoom-in; margin-bottom: 3px; }

/* Hechos del pedido (aceptar, pagar, empezar, entregar…): burbujas del autor, alineadas a su lado */
.pp-b.ev { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; background: var(--pp-accent-soft); color: inherit; border: 1px solid rgba(168,85,247,.28); }
.pp-b.ev.me { background: var(--pp-accent-soft); color: inherit; }
.pp-b.ev .ico { font-size: 15px; line-height: 1.25; }
.pp-b.ev .tx { flex: 1; min-width: 0; }
.pp-b.ev time { flex-basis: 100%; }
.pp-b.pago { background: var(--color-surface-2, #f3f4f6); color: inherit; border: 1px solid var(--color-border-subtle, #d1d5db); }
.pp-b.pago.me { background: var(--color-surface-2, #f3f4f6); color: inherit; }
.pp-b.pago.ok { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.4); }
.pp-b.pago.bad { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); }
.pp-b.pago .l1 b { font-size: 13px; }
.pp-b.pago .l2 { font-size: 12px; opacity: .8; margin-top: 2px; }
.pp-b.pago .pp-comprobante { display: block; margin-top: 5px; width: 56px; height: 56px; }
.pp-chip { align-self: flex-start; max-width: 92%; display: flex; align-items: center; gap: 8px; border-radius: 12px; padding: 7px 10px; font-size: 12.5px; background: var(--color-surface-2, #f3f4f6); border-left: 3px solid var(--color-border-subtle, #d1d5db); }
.pp-chip.me { align-self: flex-end; }
.pp-chip.cot { display: block; min-width: 72%; border-left-color: var(--pp-accent); }
.pp-chip.cot.vivo { background: var(--pp-accent-soft); }
.pp-chip .l1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 0; }
.pp-chip .l1 b { font-size: 13px; }
.pp-chip .l1 em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; color: var(--pp-accent); padding-left: 8px; }
.pp-chip .l2 { opacity: .75; font-size: 12px; margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.pp-comprobante { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; cursor: zoom-in; flex-shrink: 0; background: var(--color-surface-3, #e5e7eb); }

/* ---- Barra de acción única ---- */
.pp-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 7px 10px; border-top: 1px solid var(--color-border-subtle, #e5e7eb); background: var(--color-surface-2, #f9fafb); }
.pp-bar.bad { background: rgba(239,68,68,.08); }
.pp-bar .info { flex: 1 1 120px; min-width: 0; font-size: 12.5px; font-weight: 600; }
.pp-bar.dos { flex-wrap: wrap; }
.pp-bar.dos .info { flex: 1 1 100%; }
.pp-bar.dos.conthumb .info { flex: 1 1 calc(100% - 44px); }
.pp-bar.dos .pp-btn.sm { flex: 1 1 0; padding: 9px 10px; }
.pp-bar.bad .info { color: var(--color-error, #b91c1c); }
.pp-btn { border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--color-surface-3, #e5e7eb); color: inherit; flex: 1; min-width: 110px; }
.pp-btn.sm { flex: none; min-width: 0; padding: 8px 12px; font-size: 12.5px; border-radius: 10px; }
.pp-btn.primary { background: var(--pp-accent-solid); color: #fff; }
.pp-btn.danger { background: rgba(239,68,68,.14); color: var(--color-error, #dc2626); }
.pp-btn:disabled { opacity: .55; cursor: wait; }

/* Calificación en línea */
.pp-rate { flex: 1; min-width: 0; }
.pp-rate-fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; }
.pp-estrellas { display: flex; gap: 2px; }
.pp-estrellas button { border: 0; background: none; font-size: 28px; line-height: 1; color: #f59e0b; cursor: pointer; padding: 0 2px; }
.pp-rate-extra { display: flex; gap: 6px; margin-top: 6px; }
.pp-rate-extra input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--color-border-subtle, #d1d5db); background: var(--color-surface, #fff); color: inherit; font-size: 13px; box-sizing: border-box; }

/* Respuestas rápidas (se abren con ⚡) y escritura */
.pp-quick { display: flex; gap: 6px; padding: 6px 10px 0; overflow-x: auto; }
.pp-quick button { white-space: nowrap; border: 1px solid var(--color-border-subtle, #d1d5db); background: var(--color-surface, #fff); color: inherit; border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
.pp-comp { display: flex; align-items: flex-end; gap: 6px; padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--color-border-subtle, #e5e7eb); }
.pp-comp textarea { flex: 1; resize: none; max-height: 100px; min-height: 36px; padding: 8px 12px; border-radius: 18px; border: 1px solid var(--color-border-subtle, #d1d5db); background: var(--color-surface, #fff); color: inherit; font-size: 14px; box-sizing: border-box; line-height: 1.25; }
.pp-ico { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--color-surface-2, #f3f4f6); color: inherit; font-size: 16px; cursor: pointer; flex-shrink: 0; }
.pp-send { background: var(--pp-accent-solid); color: #fff; }
.pp-ico:disabled { opacity: .5; }

/* ---- Ventanas (cotizar, motivo, datos de pago, menú) ---- */
.pp-ov { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.pp-box { background: var(--color-surface, #fff); color: var(--color-text-primary, #1e2128); width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); max-height: 92dvh; overflow: auto; }
@media (min-width: 600px) { .pp-ov { align-items: center; padding: 16px; } .pp-box { border-radius: 18px; } }
.pp-box h3 { margin: 0 0 6px; font-size: 16px; }
.pp-box label { display: block; font-size: 12px; font-weight: 600; margin: 9px 0 3px; }
.pp-box input, .pp-box textarea { width: 100%; box-sizing: border-box; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--color-border-subtle, #d1d5db); background: var(--color-surface, #fff); color: inherit; font-size: 14px; }
.pp-box textarea { min-height: 76px; resize: vertical; }
.pp-box .err { color: var(--color-error, #ef4444); font-size: 12px; min-height: 16px; margin-top: 5px; }
.pp-box .row { display: flex; gap: 8px; margin-top: 10px; }
.pp-box .row.col { flex-direction: column; }
.pp-box .row.col .pp-btn { flex: none; }
.pp-datos { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 10px; font-size: 13px; }
.pp-datos dt { opacity: .65; }
.pp-datos dd { margin: 0; font-weight: 600; word-break: break-all; }
.pp-datos dd.clabe { font-family: ui-monospace, Menlo, monospace; font-size: 15px; letter-spacing: .03em; }
.pp-motivos { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.pp-motivos button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--color-border-subtle, #d1d5db); background: var(--color-surface, #fff); color: inherit; font-size: 14px; cursor: pointer; }
.pp-motivos button.on { border-color: var(--pp-accent); background: var(--pp-accent-soft); font-weight: 700; }
.pp-visor { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 1100; display: flex; align-items: center; justify-content: center; }
.pp-visor img { max-width: 96vw; max-height: 92dvh; border-radius: 8px; }
.pp-state { text-align: center; padding: 40px 20px; font-size: 14px; opacity: .8; }
.pp-state a { color: var(--pp-accent); font-weight: 700; }

/* ---- Lista (mis-pedidos) ---- */
.pp-tabs { display: flex; gap: 6px; padding: 8px 10px 0; }
.pp-tabs button, .pp-chips button { border: 1px solid var(--color-border-subtle, #d1d5db); background: var(--color-surface, #fff); color: inherit; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer; }
.pp-tabs button.on, .pp-chips button.on { background: var(--pp-accent-solid); border-color: var(--pp-accent-solid); color: #fff; }
.pp-chips { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; }
.pp-chips button { font-size: 12px; padding: 5px 11px; white-space: nowrap; }
.pp-list { flex: 1; overflow-y: auto; padding: 0 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.pp-card { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--color-border-subtle, #e5e7eb); background: var(--color-surface, #fff); color: inherit; text-decoration: none; position: relative; }
.pp-card img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: var(--color-surface-3, #e5e7eb); flex-shrink: 0; }
.pp-card .info { min-width: 0; flex: 1; }
.pp-card b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-card small { display: block; font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-card .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.pp-card .turno { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; }

/* Renta: contrato (vista previa o firmado) y casilla "Acepto" */
.pp-contrato{white-space:pre-wrap;font:13px/1.5 system-ui,-apple-system,sans-serif;max-height:45vh;overflow:auto;background:var(--color-surface-2,#f3f4f6);padding:10px 12px;border-radius:10px;margin:0 0 8px}
.pp-box label.pp-acepto{display:flex;gap:8px;align-items:center;font-weight:600;margin-top:10px}
.pp-box label.pp-acepto input{width:auto;margin:0}
