:root {
  --azul: #12506b;
  --azul-claro: #e6f2f7;
  --azul-medio: #2b7fa3;
  --verde-wa: #1d7d4d;
  --verde-wa-hover: #17663f;
  --texto: #1d2429;
  --texto-suave: #566068;
  --borde: #dbe3e8;
  --fondo: #f4f7f9;
  --blanco: #ffffff;
  --alerta: #b3261e;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(16, 40, 55, .08), 0 4px 16px rgba(16, 40, 55, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.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;
}

:focus-visible {
  outline: 3px solid var(--azul-medio);
  outline-offset: 2px;
}

/* ---------- Encabezado del sitio ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 20px;
  background: var(--blanco); border-bottom: 1px solid var(--borde);
  width: 100%; max-width: 100%; box-sizing: border-box;
}
.txt-nueva-movil { display: none; }
.txt-nueva-desktop { display: inline; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: var(--azul); color: #fff; font-weight: 700;
  display: grid; place-items: center; letter-spacing: .5px;
}
.brand-name { margin: 0; font-weight: 600; }
.brand-tagline { margin: 0; font-size: 13px; color: var(--texto-suave); }
.header-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-cart-header {
  display: none;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-cart-header:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-cart-header .badge {
  font-size: 11px;
  padding: 1px 6px;
  background: #475569;
}

/* ---------- Layout de dos columnas (RF-CHAT-01) ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(320px, 35fr);
  gap: 16px;
  padding: 16px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  height: calc(100vh - 65px);
  box-sizing: border-box;
}

/* ---------- Panel de chat ---------- */
.chat-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--blanco); border: 1px solid var(--borde);
  border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden;
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
}
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--borde); background: var(--azul-claro);
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--blanco);
  display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
}
.chat-title { margin: 0; font-size: 16px; font-weight: 600; }
.chat-status { margin: 0; font-size: 13px; color: var(--texto-suave); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #1a9c5b; display: inline-block; }

.mensajes {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.mensaje { max-width: 78%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.mensaje.bot { align-self: flex-start; background: var(--azul-claro); border-bottom-left-radius: 4px; }
.mensaje.cliente { align-self: flex-end; background: var(--azul); color: #fff; border-bottom-right-radius: 4px; }
.mensaje.error { align-self: flex-start; background: #fdecea; color: var(--alerta); border: 1px solid #f3c2be; }

.escribiendo {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--azul-claro);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.escribiendo span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--azul);
  display: inline-block;
  animation: rebotePuntos 1.3s infinite ease-in-out both;
}
.escribiendo span:nth-child(1) { animation-delay: 0s; }
.escribiendo span:nth-child(2) { animation-delay: 0.18s; }
.escribiendo span:nth-child(3) { animation-delay: 0.36s; }

@keyframes rebotePuntos {
  0%, 80%, 100% {
    transform: translateY(0) scale(0.8);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-8px) scale(1.15);
    opacity: 1;
    background: var(--azul-medio);
  }
}
@media (prefers-reduced-motion: reduce) { .escribiendo span { animation: none; opacity: .7; } }

.cursor-escritura {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background-color: var(--azul);
  margin-left: 3px;
  vertical-align: -2px;
  border-radius: 1px;
  animation: parpadeoCursor 0.6s infinite ease-in-out;
}

@keyframes parpadeoCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---------- Tarjetas de producto (RF-CHAT-03) ---------- */
.tarjetas {
  align-self: flex-start;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tarjeta {
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 10px;
  background: var(--blanco);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(11, 30, 41, 0.05);
}
.tarjeta.tarjeta-aparicion {
  animation: aparicionDifuminada 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity, filter;
}
@keyframes aparicionDifuminada {
  0% {
    opacity: 0;
    filter: blur(12px);
    transform: translateY(14px) scale(0.97);
  }
  50% {
    opacity: 0.8;
    filter: blur(3px);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tarjeta.tarjeta-aparicion {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none;
  }
}
.tarjeta p { margin: 0; }

/* 1. Parte superior: Nombre, presentación, etiquetas */
.tarjeta-cabecera {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tarjeta-nombre {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  color: var(--texto);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}
.tarjeta-meta {
  font-size: 11px;
  color: var(--texto-suave);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.etiqueta {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff3cd;
  color: #7a5b00;
  width: fit-content;
  margin-top: 2px;
}

/* 2. Abajo de esto: Imagen */
.tarjeta-imagen-wrap {
  width: 100%;
  height: 95px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--borde);
  overflow: hidden;
}
.tarjeta-imagen {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 3. Abajo de la imagen: Precio al lado de [- cant +] */
.tarjeta-fila-precio-cantidad {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  margin-top: auto;
}
.tarjeta-precio {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--azul);
  white-space: nowrap;
}
.cantidad-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--borde);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  height: 28px;
}
.cantidad-control button {
  width: 24px;
  height: 28px;
  border: 0;
  background: #f8fafc;
  cursor: pointer;
  font-size: 14px;
  color: var(--azul);
  padding: 0;
  display: grid;
  place-items: center;
}
.cantidad-control button:hover { background: var(--azul-claro); }
.cantidad-control input {
  width: 26px;
  height: 28px;
  border: 0;
  border-left: 1px solid var(--borde);
  border-right: 1px solid var(--borde);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  -moz-appearance: textfield;
}
.cantidad-control input::-webkit-outer-spin-button,
.cantidad-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Sugerencias rápidas ---------- */
.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 8px; }
.sugerencias:empty { display: none; }
.chip {
  border: 1px solid var(--azul-medio); background: var(--blanco); color: var(--azul);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 14px;
}
.chip:hover { background: var(--azul-claro); }

/* ---------- Formulario de chat ---------- */
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--borde); width: 100%; max-width: 100%; box-sizing: border-box; }
.chat-form input {
  flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--borde);
  border-radius: 999px; font-size: 15px; font-family: inherit;
}
.btn-enviar { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex-shrink: 0; }

/* ---------- Botones ---------- */
.btn-primary {
  background: var(--azul); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #0d3e54; }
.btn-secundario {
  background: var(--blanco); color: var(--azul); border: 1px solid var(--azul);
  border-radius: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer; font-size: 15px;
}
.btn-secundario:hover { background: var(--azul-claro); }
.btn-ghost { background: transparent; border: 1px solid var(--borde); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--texto); }
.btn-ghost:hover { background: var(--fondo); }
.btn-link { background: none; border: 0; color: var(--azul-medio); text-decoration: underline; cursor: pointer; font-size: 14px; padding: 8px; font-family: inherit; }
.btn-whatsapp {
  display: block; width: 100%; text-align: center; text-decoration: none;
  background: var(--verde-wa); color: #fff; border: 0; border-radius: 8px;
  padding: 13px 16px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-whatsapp:hover:not(:disabled) { background: var(--verde-wa-hover); }
.btn-agregar {
  display: block;
  width: 100%;
  background: var(--azul);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12.5px;
  text-align: center;
  box-sizing: border-box;
  margin-top: 4px;
}
.btn-agregar:hover { background: #0d3e54; }

/* ---------- Panel de carrito (Gris / Slate) ---------- */
.cart-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: #f1f5f9; border: 1px solid #cbd5e1;
  border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden;
}
.cart-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: #e2e8f0; border-bottom: 1px solid #cbd5e1;
}
.cart-head h2 { margin: 0; font-size: 16px; flex: 1; color: #1e293b; font-weight: 700; }
.badge {
  background: #475569; color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: 13px; font-weight: 600;
}
.btn-cerrar-carrito { display: none; background: none; border: 0; font-size: 18px; cursor: pointer; color: #475569; }

.cart-items {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f1f5f9;
}
.cart-vacio { color: #64748b; text-align: center; padding: 32px 12px; }

.cart-item {
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  background: #ffffff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.cart-item p { margin: 0; }
.cart-item.resaltado { animation: destello 1.4s ease-out; }
@keyframes destello { 0% { background: #fff4cc; border-color: #e0b400; } 100% { background: #ffffff; border-color: #cbd5e1; } }
@media (prefers-reduced-motion: reduce) { .cart-item.resaltado { animation: none; border-color: #e0b400; } }
.cart-item-nombre { font-size: 13.5px; font-weight: 600; color: #1e293b; }
.cart-item-meta { font-size: 12px; color: #64748b; }
.cart-item-fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }

.cart-item-precio-borrar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-item-subtotal {
  font-weight: 700;
  font-size: 14.5px;
  color: #1e293b;
}
.btn-eliminar-icono {
  background: transparent;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1;
}
.btn-eliminar-icono:hover {
  color: #dc2626;
  background: #fee2e2;
}

.cart-footer {
  border-top: 1px solid #cbd5e1; padding: 14px 16px;
  background: #e2e8f0;
}
.totales { margin: 0 0 10px; }
.totales > div { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; color: #334155; }
.totales dt, .totales dd { margin: 0; }
.totales .total { font-size: 18px; font-weight: 700; border-top: 1px solid #cbd5e1; margin-top: 6px; padding-top: 8px; color: #0f172a; }
.nota { font-size: 12px; color: #64748b; margin: 0 0 10px; }

.btn-checkout {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  background: #334155;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}
.btn-checkout:hover:not(:disabled) { background: #1e293b; }
.btn-checkout:disabled { background: #94a3b8; cursor: not-allowed; }

.cart-fab { display: none; }

/* ---------- Modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 30, 41, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  background: var(--blanco); border-radius: 16px; width: min(560px, 100%);
  max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal-sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--borde); position: sticky; top: 0; background: var(--blanco); }
.modal-head h2 { margin: 0; font-size: 18px; }
.btn-cerrar { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--texto-suave); padding: 4px 8px; }
.modal-body { padding: 20px; }
.modal-body.centro { text-align: center; }

.resumen-pedido { background: var(--fondo); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; }
.resumen-pedido h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; color: var(--texto-suave); }
.resumen-pedido ul { margin: 0; padding-left: 18px; font-size: 14px; }
.resumen-total { margin: 10px 0 0; text-align: right; font-size: 15px; }

/* ---------- Campos de formulario ---------- */
.campo { margin-bottom: 14px; }
.campo-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--borde);
  border-radius: 8px; font-size: 15px; font-family: inherit; background: var(--blanco); color: var(--texto);
}
.campo input[aria-invalid="true"], .campo select[aria-invalid="true"], .campo textarea[aria-invalid="true"] { border-color: var(--alerta); }
.campo textarea { resize: vertical; }
.error { color: var(--alerta); font-size: 13px; margin: 4px 0 0; min-height: 0; }
.error:empty { display: none; }
.error-general { margin: 10px 0; text-align: center; }

.campo-check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 4px; }
.campo-check input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.campo-check label { font-size: 13px; line-height: 1.45; }

/* ---------- Confirmación ---------- */
.icono-ok { width: 56px; height: 56px; border-radius: 50%; background: #e3f5ea; color: var(--verde-wa); font-size: 30px; display: grid; place-items: center; margin: 0 auto 12px; }
.aviso-enviar { background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.muted { color: var(--texto-suave); font-size: 13px; }
.acciones-confirmacion { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
hr { border: 0; border-top: 1px solid var(--borde); margin: 16px 0; }

/* ---------- Tablet (RF-CHAT-01) ---------- */
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .btn-cart-header { display: flex; }
  .cart-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 88vw);
    z-index: 40; border-radius: 0; transform: translateX(100%);
    transition: transform .22s ease-out;
  }
  .cart-panel.abierto { transform: translateX(0); }
  .btn-cerrar-carrito { display: block; }
  .cart-fab {
    display: none; position: fixed; right: 16px; bottom: 74px; z-index: 30;
    background: #334155; color: #fff; border: 1px solid #475569; border-radius: 999px;
    padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
  }
}
@media (prefers-reduced-motion: reduce) { .cart-panel { transition: none; } }

/* ---------- Móvil (RF-CHAT-01) con soporte iPhone Notch y Safari Safe Areas ---------- */
@media (max-width: 767px) {
  html {
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
  }
  body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
  }
  .site-header {
    flex-shrink: 0;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: 8px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    gap: 8px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    background: var(--blanco);
    border-bottom: 1px solid var(--borde);
    z-index: 20;
    overflow-x: hidden;
  }
  .brand {
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 13px;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .brand-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-tagline { display: none; }
  .header-acciones {
    gap: 6px;
    flex-shrink: 0;
  }
  .btn-cart-header {
    padding: 5px 8px;
    font-size: 12px;
  }
  #btn-nueva-conversacion {
    padding: 5px 8px;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .txt-nueva-desktop { display: none; }
  .txt-nueva-movil { display: inline; }

  .layout {
    flex: 1;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    padding: 0;
    gap: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  .chat-panel {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    box-sizing: border-box;
  }
  .chat-header {
    flex-shrink: 0;
    padding: 10px 12px;
  }
  .mensajes {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 10px 8px;
    gap: 10px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .tarjetas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .tarjeta {
    padding: 8px 6px;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .tarjeta-nombre {
    font-size: 12px;
    line-height: 1.25;
    min-height: 30px;
  }
  .tarjeta-meta {
    font-size: 10.5px;
  }
  .tarjeta-imagen-wrap {
    height: 80px;
    width: 100%;
  }
  .tarjeta-fila-precio-cantidad {
    gap: 2px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .tarjeta-precio {
    font-size: 11.5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cantidad-control {
    height: 24px;
    flex-shrink: 0;
  }
  .cantidad-control button {
    width: 20px;
    height: 24px;
    font-size: 12px;
  }
  .cantidad-control input {
    width: 22px;
    height: 24px;
    font-size: 11px;
  }
  .btn-agregar {
    padding: 6px 3px;
    font-size: 11px;
    margin-top: 2px;
    box-sizing: border-box;
  }
  .mensaje {
    max-width: 88%;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .sugerencias {
    flex-shrink: 0;
    padding: 0 8px 6px;
  }
  .chat-form {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding-top: 8px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: var(--blanco);
    border-top: 1px solid var(--borde);
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    z-index: 10;
  }
  .chat-form input {
    font-size: 16px; /* Evita que Safari en iOS haga zoom automático al tocar el input */
    padding: 9px 14px;
    min-width: 0;
  }
  .btn-enviar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  .cart-panel {
    width: 100%;
    max-width: 100vw;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 82vh;
    height: 82dvh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .cart-panel.abierto {
    transform: translateY(0);
  }
  .cart-fab {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(62px + max(10px, env(safe-area-inset-bottom)));
    background: #334155;
    color: #fff;
    border: 1px solid #475569;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    width: auto;
    max-width: calc(100vw - 24px);
    z-index: 15;
  }
  .campo-fila { grid-template-columns: 1fr; }
}
