html, body{ height:100%; overflow:hidden; }

a{ text-decoration:none; color:inherit; }

.app{ display:flex; flex-direction:column; height:100vh; height:100dvh; }

.topbar{ display:flex; align-items:center; justify-content:space-between; padding:16px clamp(16px, 3vw, 40px); padding-top:calc(16px + env(safe-area-inset-top)); flex-shrink:0; border-bottom:1px solid var(--divider); }

.topbar-btn{ width:40px; height:40px; display:flex; align-items:center; justify-content:center; border-radius:50%; transition:background .2s; }

.topbar-btn:hover{ background:var(--hover); }

.topbar-btn svg{ width:24px; height:24px; }

.logo svg{ height:18px; width:auto; aspect-ratio:1760.32 / 627.54; }

.map-wrapper{ height:40vh; width:100%; flex-shrink:0; background:var(--hover); position:relative; }

#map{ width:100%; height:100%; }

.scroll-content{ flex:1; overflow-y:auto; padding:24px clamp(16px, 3vw, 40px) 60px; }

.scroll-content::-webkit-scrollbar{ width:0; }

.divider{ height:1px; background:var(--divider); margin-block:20px; }

.section-title{ font-size:13px; font-weight:600; margin-bottom:14px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.06em; }

.status-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }

.status-time{ background:var(--hover); padding:6px 12px; border-radius:999px; font-size:13px; font-weight:600; color:var(--text-muted); display:flex; align-items:center; gap:6px; }

.status-time::before{ content:""; width:8px; height:8px; border-radius:50%; background:var(--cimil-1); animation:blink 1.5s infinite; }

@keyframes blink { 0%, 100% { opacity:1; } 50% { opacity:.3; } }

.progress-container{ margin-bottom:20px; }

.progress-bar{ display:flex; gap:6px; }

.progress-segment{ flex:1; height:8px; border-radius:999px; background:var(--hover); transition:background .4s ease; position:relative; overflow:hidden; }

.progress-segment.active{ background:var(--cimil-1); }

.progress-segment.current::after {
content: '';
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
0% { transform: translateX(-100%); }
100% { transform: translateX(100%); }
}

.progress-labels{ display:flex; justify-content:space-between; margin-top:8px; font-size:11px; color:var(--text-muted); text-align:center; }

.company-row{ display:flex; align-items:center; gap:12px; padding:4px 0; }

.company-logo{ width:42px; height:42px; border-radius:12px; background-size:cover; background-position:center; background-color:var(--hover); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-weight:700; color:var(--text); font-size:18px; }

.company-name-sm{ font-size:15px; font-weight:600; line-height:1.2; }

.company-subtitle{ font-size:12px; color:var(--text-muted); margin-top:2px; }

.delivery-card{ background:var(--hover); border-radius:14px; padding:14px; display:flex; align-items:center; gap:12px; }

.delivery-icon{ width:42px; height:42px; border-radius:50%; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }

.delivery-title{ font-size:13px; color:var(--text-muted); margin-bottom:4px; }

.delivery-text{ font-size:15px; font-weight:500; line-height:1.4; }

.btn-wa{ background:var(--cimil-1); color:#fff; width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; flex-shrink:0; }

.btn-wa svg{ width:20px; height:20px; }

.cart-item{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid var(--divider); font-size:14px; }

.cart-item:last-child{ border-bottom:none; }

.cart-item-name{ color:var(--text); flex:1; }

.cart-item-qty{ color:var(--text-muted); font-weight:500; }

.cart-item-price{ font-weight:600; white-space:nowrap; }

.cart-obs{ font-size:12px; color:var(--text-muted); font-style:italic; margin-top:2px; }

.cost-toggle{ display:flex; justify-content:space-between; align-items:center; padding:8px 0; cursor:pointer; user-select:none; }

.cost-toggle-label{ font-size:15px; color:var(--text); font-weight:500; }

.cost-toggle-icon{ width:20px; height:20px; transition:transform .25s ease; color:var(--text-muted); }

.cost-toggle.open .cost-toggle-icon{ transform:rotate(180deg); }

.cost-content{ max-height:0; overflow:hidden; transition:max-height .3s ease; }

.cost-content.open{ max-height:300px; }

.cost-row{ display:flex; justify-content:space-between; font-size:14px; padding:8px 0; color:var(--text-muted); }

.total-row{ display:flex; justify-content:space-between; font-size:20px; font-weight:700; margin-top:8px; padding-top:12px; border-top:1px solid var(--divider); }

.pay-box{ background:var(--hover); border-radius:14px; padding:14px; font-size:14px; line-height:1.5; }

.pay-box.warn{ background:rgba(54,191,177,.10); border:1px solid rgba(54,191,177,.30); color:var(--cimil-1); font-weight:600; }

.pay-box.alert{ background:rgba(255, 215, 0, .15); border:1px solid rgba(255, 215, 0, .4); color:#FFD700; font-weight:700; text-align:center; animation:blink 1.5s infinite; }

/* LLAVE DE PAGO DESTACADA + ✚ BOTÓN COPIAR */
.pay-key-container{ margin-top:12px; background:var(--bg); border:2px solid var(--cimil-1); border-radius:12px; padding:15px; text-align:center; }

.pay-key-label{ font-size:12px; color:var(--text-muted); margin-bottom:8px; text-transform:uppercase; letter-spacing:1px; }

.pay-key-row{ display:flex; align-items:center; justify-content:center; gap:10px; }

.pay-key{ font-size:20px; font-weight:700; color:var(--cimil-1); letter-spacing:2px; user-select:all; word-break:break-all; }

.btn-copy{ width:38px; height:38px; border-radius:10px; background:var(--cimil-1); color:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:transform .15s ease, background .2s; }

.btn-copy:hover{ background:var(--cimil-2); }

.btn-copy:active{ transform:scale(0.92); }

.btn-copy svg{ width:18px; height:18px; }

/* ✚ CHAT CON EL DOMICILIARIO */
.chat-open-btn{ display:inline-flex; align-items:center; gap:6px; margin-top:7px; padding:5px 12px; border-radius:999px; background:rgba(54,191,177,.12); color:var(--cimil-1); font-size:12px; font-weight:600; transition:background .2s; }

.chat-open-btn:hover{ background:rgba(54,191,177,.22); }

.chat-open-btn svg{ width:14px; height:14px; }

.chat-overlay{ position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:1600; display:flex; align-items:flex-end; justify-content:center; }

.chat-panel{ width:100%; max-width:520px; height:82vh; height:82dvh; max-height:640px; background:var(--bg); border-radius:20px 20px 0 0; display:flex; flex-direction:column; overflow:hidden; animation:chatUp .25s ease; }

@keyframes chatUp{ from{ transform:translateY(48px); opacity:.4; } to{ transform:translateY(0); opacity:1; } }

.chat-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px 16px; border-bottom:1px solid var(--divider); flex-shrink:0; }

.chat-head-title{ font-size:15px; font-weight:600; }

.chat-head-sub{ font-size:11px; color:var(--cimil-1); margin-top:2px; }

.chat-close{ width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--hover); flex-shrink:0; }

.chat-close svg{ width:16px; height:16px; }

.chat-messages{ flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:8px; }

.chat-messages::-webkit-scrollbar{ width:0; }

.chat-bubble{ max-width:78%; padding:9px 13px; border-radius:14px; font-size:13.5px; line-height:1.45; background:var(--hover); align-self:flex-start; border-bottom-left-radius:4px; word-break:break-word; }

.chat-bubble.me{ background:var(--cimil-1); color:#fff; align-self:flex-end; border-bottom-left-radius:14px; border-bottom-right-radius:4px; }

.chat-bubble time{ display:block; font-size:9.5px; opacity:.65; margin-top:3px; text-align:right; }

.chat-empty{ text-align:center; font-size:12.5px; color:var(--text-muted); padding:24px 12px; }

.chat-quick{ display:flex; gap:8px; padding:10px 14px; overflow-x:auto; border-top:1px solid var(--divider); flex-shrink:0; }

.chat-quick::-webkit-scrollbar{ height:0; }

.chat-chip{ flex-shrink:0; padding:7px 13px; border-radius:999px; border:1px solid var(--cimil-1); color:var(--cimil-1); font-size:12px; font-weight:500; background:transparent; transition:background .2s; white-space:nowrap; }

.chat-chip:active{ background:rgba(54,191,177,.15); }

.chat-input-row{ display:flex; gap:10px; padding:10px 14px; padding-bottom:calc(10px + env(safe-area-inset-bottom)); border-top:1px solid var(--divider); flex-shrink:0; }

.chat-input{ flex:1; border:none; outline:none; background:var(--hover); color:var(--text); border-radius:999px; padding:11px 16px; font-size:14px; font-family:inherit; min-width:0; }

.chat-send{ width:42px; height:42px; border-radius:50%; background:var(--cimil-1); color:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:transform .15s; }

.chat-send:active{ transform:scale(.9); }

.chat-send svg{ width:18px; height:18px; }

/* ✚ TRANSFERENCIA CONFIRMADA (chulito verde repetitivo) */
.pay-confirmed{ background:rgba(33,164,93,.12); border:1px solid rgba(33,164,93,.35); border-radius:14px; padding:22px 16px; text-align:center; }

.confirm-badge{ width:52px; height:52px; margin:0 auto 10px; border-radius:50%; background:#21A45D; display:flex; align-items:center; justify-content:center; animation:confirmPop 1.6s ease infinite; }

.confirm-badge svg{ width:26px; height:26px; }

@keyframes confirmPop{ 0%{ transform:scale(.75); box-shadow:0 0 0 0 rgba(33,164,93,.45); } 30%{ transform:scale(1.08); } 55%{ transform:scale(1); box-shadow:0 0 0 6px rgba(33,164,93,.25); } 100%{ transform:scale(1); box-shadow:0 0 0 14px rgba(33,164,93,0); } }

.pay-confirm-text{ font-size:16px; font-weight:700; color:#21A45D; }

.pay-confirm-sub{ font-size:12.5px; color:var(--text-muted); margin-top:4px; }

/* ✚ QR DE PAGO 1:1 */
.pay-qr-img{ display:block; width:150px; height:150px; object-fit:contain; margin:14px auto 0; background:#fff; border-radius:10px; padding:6px; }

.pay-qr-label{ font-size:11.5px; color:var(--text-muted); text-align:center; margin-top:6px; }

/* ✚ AVISO: TRANSFERENCIA PENDIENTE DE CONFIRMACIÓN */
.pay-pending{ display:flex; align-items:flex-start; gap:8px; margin-top:12px; padding:10px 12px; border-radius:10px; background:rgba(255,215,0,.10); border:1px dashed rgba(255,215,0,.45); font-size:12px; line-height:1.45; text-align:left; color:var(--text); }

.pay-pending svg{ flex:0 0 auto; width:15px; height:15px; margin-top:2px; color:#E6A23C; }

.pay-pending b{ font-weight:700; }

/* PANTALLA DE ERROR */
.error-screen{ display:none; flex-direction:column; align-items:center; justify-content:center; height:100vh; height:100dvh; text-align:center; padding:40px; gap:12px; background:var(--bg); }

.error-icon{ width:60px; height:60px; color:var(--danger); margin-bottom:10px; }

.error-title{ font-size:20px; font-weight:700; }

.error-msg{ font-size:15px; color:var(--text-muted); max-width:320px; line-height:1.5; }

.btn-home{ margin-top:20px; padding:12px 30px; background:var(--cimil-1); color:#fff; border-radius:12px; font-weight:600; text-decoration:none; display:inline-block; transition:background .2s; }

.btn-home:hover{ background:var(--cimil-2); }

.toast{ position:fixed; bottom:20px; left:50%; transform:translateX(-50%) translateY(100px); background:var(--text); color:var(--bg); padding:12px 24px; border-radius:999px; font-size:14px; font-weight:600; z-index:2000; opacity:0; transition:transform .3s ease, opacity .3s ease; pointer-events:none; max-width:90%; text-align:center; }

.toast.show{ transform:translateX(-50%) translateY(0); opacity:1; }
