:root { --primary: #ea580c; --primary-dark: #c2410c; --shadow: 0 4px 16px rgba(120, 53, 15, .08); }
body { background: #fbf7f2; }
input:focus, select:focus, textarea:focus { outline-color: rgba(234, 88, 12, .25); }
.c-top {
  position: sticky; top: 0; z-index: 1000; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
}
.c-brand { text-decoration: none; color: var(--text); font-size: 16px; }
.c-main { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; }
.apk-dl { white-space: nowrap; }

/* ----- Inicio: saludo, buscador y categorías ----- */
.c-home { padding: 22px 16px 20px; border-radius: 24px; box-shadow: 0 12px 30px rgba(234, 88, 12, .22); }
.c-home h2 { font-size: 22px; }
.c-search { width: 100%; margin-top: 14px; padding: 13px 16px; border: 0; border-radius: 999px; font-size: 15px; color: var(--text); text-shadow: none; box-shadow: 0 4px 14px rgba(120, 53, 15, .16); }
.c-cats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px 6px; margin-top: 18px; text-shadow: none; }
.c-cat { grid-column: span 2; display: flex; flex-direction: column; align-items: center; color: var(--text); text-decoration: none; transition: transform .15s; }
.c-cat:nth-child(-n+2) { grid-column: span 3; }
.c-cat:hover { transform: translateY(-3px); }
.c-cat-ico { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; font-size: 40px; background: #fff; border-radius: 54% 46% 52% 48% / 48% 54% 46% 52%; box-shadow: 0 0 0 7px rgba(255, 255, 255, .28); }
.c-cat b { position: relative; margin-top: -10px; max-width: 100%; padding: 4px 10px; font-size: 12px; line-height: 1.15; text-align: center; background: #fff; border: 1.5px solid #f59e0b; border-radius: 999px; }
@media (min-width: 620px) {
  .c-cats { grid-template-columns: repeat(5, 1fr); }
  .c-cat, .c-cat:nth-child(-n+2) { grid-column: span 1; }
}
.c-cat-title { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; }
.c-cat-title span { font-size: 30px; }
.searching .c-signup, .searching .pkg-cta, .searching #activeOrder, .searching #topProducts, .searching .c-cats, .searching .menu-cat { display: none; }

/* ----- Barra de abajo (celular) ----- */
.c-tabs { display: none; }
#cartBar:not(.hidden) ~ .wa-help { display: none; }
@media (max-width: 619px) {
  .c-desk { display: none; }
  .c-main { padding-bottom: 150px; }
  .c-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; display: flex; background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .c-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .c-tabs a span { font-size: 20px; line-height: 1.2; filter: grayscale(1); opacity: .7; }
  .c-tabs a.on { color: var(--primary-dark); }
  .c-tabs a.on span { filter: none; opacity: 1; }
  .c-cartbar { bottom: 58px; }
  body.has-ai .ai-fab, .wa-help.fab { bottom: 72px; }
}

.bday-bar { overflow: hidden; margin-bottom: 12px; padding: 8px 0; border-radius: 12px; background: #fff1e6; border: 1px solid #fed7aa; color: #c2410c; font-weight: 700; }
.bday-track { display: inline-flex; gap: 48px; white-space: nowrap; animation: bday-move 12s linear infinite; }
@keyframes bday-move { from { transform: translateX(-100%); } to { transform: translateX(100vw); } }
@media (prefers-reduced-motion: reduce) { .bday-track { animation: none; padding: 0 12px; flex-wrap: wrap; gap: 4px 24px; white-space: normal; } }
.c-hero { background: linear-gradient(120deg, #c2410c, #f97316, #f59e0b, #dc2626); background-size: 300% 100%; animation: c-bg-flow 7s ease-in-out infinite alternate; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .3); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
@keyframes c-bg-flow { to { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) { .c-hero, .c-signup, .pkg-cta { animation: none; } }
.c-hero h2 { margin: 0 0 4px; }
.c-hero p { margin: 0; }
.c-signup { display: block; background: #fff5f5; border: 1px solid #fecaca; border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; color: #c81e1e; text-decoration: none; animation: c-signup-pulse 2.4s ease-in-out infinite; }
.c-signup b { display: block; color: #c81e1e; }
@keyframes c-signup-pulse { 50% { transform: scale(1.015); box-shadow: 0 0 0 5px rgba(200, 30, 30, .14); } }
.c-saved { background: #eef8f1; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.ac-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-weight: 500; }
.ac-check input { width: auto; margin-top: 3px; }
.c-closed { background: #fde4e5; color: #9b1c21; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.chip-btn { flex-shrink: 0; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; cursor: pointer; font-size: 13px; color: var(--text); }
.chip-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

.menu-cat { margin: 22px 0 10px; font-size: 18px; font-weight: 800; }
.p-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .p-list { grid-template-columns: 1fr 1fr; } }
.p-item { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid #f3ece4; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); }
.p-img { width: 64px; height: 64px; border-radius: 12px; background: var(--bg); font-size: 34px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.p-img img { width: 100%; height: 100%; object-fit: cover; }
/* Productos del carrito en el checkout: foto chica o ícono */
.ck-img { width: 36px; height: 36px; border-radius: 8px; background: var(--bg); font-size: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.ck-img img { width: 100%; height: 100%; object-fit: cover; }
/* Observación de cada producto ("sin cebolla"), debajo del nombre */
.ck-line { padding: 6px 0; }
.ck-obs { display: block; width: calc(100% - 44px); margin: 6px 0 0 44px; padding: 7px 10px; font-size: 13px; }
.p-info { flex: 1; min-width: 0; }
.p-info .small { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; }
.qty button.add { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty b { min-width: 16px; text-align: center; }

.c-cartbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px 16px; background: linear-gradient(transparent, #f6f7fb 30%); z-index: 1200; }
.c-cartbar .btn { max-width: 728px; margin: 0 auto; display: flex; border-radius: 14px; }
body.has-ai .c-cartbar { padding-right: 90px; }

.sec { background: #fff; border: 1px solid #f3ece4; border-radius: 18px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.sec h3 { font-size: 15px; }
#checkMap, #trackMap { height: 260px; border-radius: 12px; margin-top: 8px; }
#trackMap { height: 320px; }
.sum-row { display: flex; justify-content: space-between; padding: 4px 0; }
.sum-row.total { font-weight: 800; font-size: 16px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.pay-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-opts label { margin: 0; border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--text); font-size: 14px; }
.pay-opts input { width: auto; }
.geo-results { border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; max-height: 160px; overflow: auto; background: #fff; }
.geo-results div { padding: 8px 10px; cursor: pointer; font-size: 12px; }
.geo-results div:hover { background: var(--bg); }

.steps { display: flex; justify-content: space-between; position: relative; margin: 14px 4px 6px; }
.steps::before { content: ''; position: absolute; top: 15px; left: 16px; right: 16px; height: 3px; background: var(--border); }
.steps .bar { position: absolute; top: 15px; left: 16px; height: 3px; background: var(--success); transition: width .4s; }
.step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 20%; text-align: center; font-size: 11px; color: var(--muted); }
.step .c { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 3px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.step.done .c { border-color: var(--success); background: var(--success); color: #fff; }
.step.now .c { border-color: var(--success); box-shadow: 0 0 0 5px rgba(23, 165, 104, .18); }
.step.done, .step.now { color: var(--text); font-weight: 600; }
.track-status { font-size: 18px; font-weight: 800; }
.driver-box { display: flex; align-items: center; gap: 12px; }
.o-row { display: flex; gap: 10px; align-items: center; cursor: pointer; }

/* ----- Locales ----- */
.s-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .s-list { grid-template-columns: 1fr 1fr; } }
.s-item { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid #f3ece4; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.s-item:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(120, 53, 15, .13); }
.s-item.closed { opacity: .7; filter: grayscale(.5); }
.top-wrap { position: relative; }
.top-car { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 6px; }
.top-car::-webkit-scrollbar { display: none; }
.top-card { flex: 0 0 170px; scroll-snap-align: start; background: #fff; border: 1px solid #f3ece4; border-radius: 18px; overflow: hidden; text-decoration: none; color: inherit; }
.top-card.closed { opacity: .65; }
.top-img { position: relative; height: 130px; background: var(--bg); font-size: 56px; display: flex; align-items: center; justify-content: center; }
.top-img img { width: 100%; height: 100%; object-fit: cover; }
.top-img .badge { position: absolute; top: 8px; left: 8px; }
.top-info { padding: 10px 12px; }
.top-info > b:first-child { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-info .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav { display: none; position: absolute; top: 50%; width: 36px; height: 36px; margin-top: -24px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: #fff; box-shadow: var(--shadow); font-size: 22px; line-height: 1; cursor: pointer; z-index: 1; }
.top-nav.prev { left: -10px; }
.top-nav.next { right: -10px; }
@media (min-width: 620px) { .top-nav { display: block; } }
.s-img { width: 58px; height: 58px; border-radius: 14px; background: var(--bg); font-size: 32px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.s-img.lg { width: 70px; height: 70px; font-size: 40px; }
.s-img img { width: 100%; height: 100%; object-fit: cover; }
.c-store-head { display: flex; gap: 14px; align-items: center; margin: 10px 0 14px; }
.lvl-opts { display: flex; flex-direction: column; gap: 8px; }
.lvl-opt { margin: 0; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--text); font-size: 14px; }
.lvl-opt input { width: auto; }
.lvl-opt.on { border-color: var(--primary); background: #fff1e6; }
.lvl-ico { font-size: 22px; }

/* ----- Envío de paquetes ----- */
.pkg-cta {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(120deg, #14532d, #16a34a, #22c55e, #0f766e); background-size: 300% 100%; animation: c-bg-flow 7s ease-in-out infinite alternate; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .3); text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.pkg-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(21, 128, 61, .25); }
.pkg-cta .small { color: #fff; }
.pkg-ico { width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px; background: rgba(255, 255, 255, .1); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.pkg-hero { background: linear-gradient(135deg, #166534, #16a34a); background-size: auto; animation: none; }
#pkMap { height: 300px; border-radius: 12px; margin-top: 8px; }
.pk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; flex-shrink: 0; }
.pk-dot.from { background: var(--purple); }
.pk-dot.to { background: var(--danger); }
.pk-target { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pk-target button {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left;
}
.pk-target button small { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--muted); }
.pk-target button.on { border-color: var(--primary); background: #fff1e6; }
/* Dirección del envío: escribirla, pegar un link de mapa o usar la ubicación del celular */
.pk-gps { margin-top: 10px; min-height: 52px; font-size: 16px; border-color: #fed7aa; background: #fff1e6; color: var(--primary-dark); font-weight: 700; touch-action: manipulation; }
.pk-gps:hover:not(:disabled) { background: #ffe8d6; }
.pk-gps:disabled { opacity: .7; cursor: progress; }
.pk-msg { margin-top: 6px; color: var(--muted); }
.pk-msg:empty { display: none; }
.pk-msg.ok { color: var(--success); font-weight: 600; }
.pkg-route { display: grid; gap: 10px; margin: 8px 0 12px; }
.pkg-route > div { position: relative; padding-left: 18px; font-size: 13px; }
.pkg-route .pk-dot { position: absolute; left: 0; top: 4px; }
.steps.four .step { width: 25%; }

/* ----- Mandados ----- */
.errand-cta { background: linear-gradient(120deg, #1e3a8a, #2563eb, #3b82f6, #6d28d9); background-size: 300% 100%; }
.errand-cta:hover { box-shadow: 0 10px 30px rgba(37, 99, 235, .25); }
.errand-hero { background: linear-gradient(135deg, #1e3a8a, #2563eb); background-size: auto; animation: none; }
/* Con Mandados son seis accesos: tres por fila en el celular, una sola fila en pantallas anchas */
.c-cats.six .c-cat, .c-cats.six .c-cat:nth-child(-n+2) { grid-column: span 2; }
@media (min-width: 620px) {
  .c-cats.six { grid-template-columns: repeat(6, 1fr); }
  .c-cats.six .c-cat, .c-cats.six .c-cat:nth-child(-n+2) { grid-column: span 1; }
}
.md-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 4px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; font-weight: 800; vertical-align: middle; }
.md-ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.md-ideas button { padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.md-ideas button:hover { border-color: var(--primary); background: #fff1e6; }
#mdText { min-height: 124px; resize: vertical; font-size: 16px; line-height: 1.45; }
.md-tip { margin-top: 8px; padding: 8px 10px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #92400e; }
.md-text { margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; white-space: pre-wrap; overflow-wrap: anywhere; }
#mdPlaceMap.on { border-color: var(--primary); background: #fff1e6; }

/* Tipo de envío: antes de marcar los puntos, la tarifa base y el precio por km extra de cada tipo */
.lvl-price { text-align: right; white-space: nowrap; }
.lvl-price .lvl-km { font-weight: 500; color: var(--danger); }
@media (max-width: 480px) {
  .c-brand { white-space: nowrap; }
  /* En el celular el precio baja a su propia fila: al lado no entra y se sale de la tarjeta */
  .lvl-opt { flex-wrap: wrap; }
  .lvl-price { flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; }
}
/* Mandado: precio a confirmar y chat con el conductor */
.md-price { border: 2px solid var(--success); background: #f0fdf4; }
.md-price.wait { border: 1px dashed #f2a516; background: #fffbeb; }
.md-chat { padding: 0; overflow: hidden; }
.md-chat h3 { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.md-chat-box { height: 380px; }
