:root {
  --verde: #0b5a4f;
  --verde2: #035d54;
  --fondo: #efe8dd;
  --bot: #ffffff;
  --yo: #d9f2c4;
  --texto: #1f2a28;
  --gris: #6b7673;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto);
  background: #d9d2c5;
  -webkit-text-size-adjust: 100%;
}
.app {
  max-width: 520px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fondo);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
}
.cab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--verde);
  color: #fff;
}
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; flex: none; }
.titulos { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.titulos strong { font-size: 16px; }
.titulos span { font-size: 12px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acciones { display: flex; gap: 6px; align-items: center; flex: none; }
.acciones a, .acciones button {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  border-radius: 14px;
  padding: 5px 9px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.acciones a.activo { background: #fff; color: var(--verde); font-weight: 700; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Ccircle cx='10' cy='10' r='1.4' fill='%23c9bfae' fill-opacity='.55'/%3E%3Ccircle cx='42' cy='36' r='1.4' fill='%23c9bfae' fill-opacity='.55'/%3E%3Cpath d='M52 8v8M48 12h8' stroke='%23d3c9b8' stroke-width='1.3' stroke-opacity='.6'/%3E%3C/svg%3E");
}
.msg {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  animation: entra 0.18s ease-out;
}
.msg.bot { background: var(--bot); align-self: flex-start; border-top-left-radius: 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); }
.msg.yo { background: var(--yo); align-self: flex-end; border-top-right-radius: 4px; }
.msg.imagen { padding: 5px; max-width: 70%; }
.msg.imagen img { display: block; width: 100%; height: auto; border-radius: 10px; }
.msg.aviso {
  align-self: center;
  max-width: 94%;
  background: #fff7dd;
  border: 1px solid #ecd9a1;
  color: #5b4a17;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  border-radius: 12px;
  margin-bottom: 4px;
}
.msg.nota {
  align-self: center;
  max-width: 94%;
  background: transparent;
  box-shadow: none;
  padding: 2px 8px;
  margin-top: 10px;
  color: var(--gris);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
}
.msg.typing { display: flex; gap: 4px; padding: 12px 14px; }
.msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa5a2; animation: punto 1s infinite; }
.msg.typing span:nth-child(2) { animation-delay: 0.15s; }
.msg.typing span:nth-child(3) { animation-delay: 0.3s; }

.dock {
  padding: 8px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: #f6f1e8;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  min-height: 12px;
}
.dock:empty { padding-top: 0; padding-bottom: 0; border-top: 0; min-height: 0; }
.botones { display: flex; flex-direction: column; gap: 8px; }
.boton {
  background: var(--verde2);
  color: #fff;
  border: 0;
  border-radius: 22px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.boton.secundario { background: transparent; color: var(--verde); border: 1px solid var(--verde); }
.boton:active, .enviar:active { transform: scale(0.98); }
.entrada { display: flex; gap: 8px; align-items: flex-end; }
.entrada input, .entrada textarea {
  flex: 1;
  min-width: 0;
  border: 1px solid #cfc7b8;
  border-radius: 20px;
  padding: 11px 14px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--texto);
  min-height: 44px;
}
.entrada textarea { min-height: 92px; resize: none; border-radius: 16px; }
.entrada input:focus, .entrada textarea:focus { outline: 2px solid var(--verde2); outline-offset: 1px; }
.enviar {
  background: var(--verde2);
  color: #fff;
  border: 0;
  border-radius: 20px;
  padding: 11px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.omitir { margin-top: 8px; background: none; border: 0; color: var(--verde); text-decoration: underline; font-size: 14px; cursor: pointer; width: 100%; font-family: inherit; }
.nota { margin: 8px 2px 0; font-size: 12px; color: var(--gris); line-height: 1.35; }
.nota a { color: var(--verde); }
.error { color: #b3261e; font-size: 13px; margin: 6px 2px 0; }
.error:empty { display: none; }

.ofertas { display: flex; flex-direction: column; gap: 8px; align-self: stretch; margin: 4px 0; }
.oferta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--texto);
  border: 1px solid #d8d0c1;
}
.oferta .precio { font-weight: 700; color: var(--verde); }
.oferta small { color: var(--gris); }
.oferta em { color: var(--verde2); font-style: normal; font-weight: 600; margin-top: 2px; }

@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes punto { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .msg { animation: none; }
  .msg.typing span { animation: none; opacity: 0.7; }
}
