:root {
  --verde: #1e6b45; --verde-osc: #12402a; --crema: #f8f3e8; --tinta: #14211a; --tinta-2: #3a4a41; --suave: #5f6d65; --borde: #dfe3d7; --wa: #1fa855;
  --wa-cab: #1f5f43; --wa-fondo: #efe7dc; --wa-out: #d9fdd3; --wa-tilde: #53bdeb;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--crema); color: var(--tinta); font: 15px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }

.escenario { height: 100dvh; display: grid; }
@media (min-width: 900px) {
  .escenario { grid-template-columns: minmax(360px, 420px) minmax(300px, 440px); justify-content: center; align-items: center; gap: 48px; padding: 28px;
    background: radial-gradient(60% 70% at 85% 10%, rgb(31 168 85 / .12), transparent 60%), var(--crema); }
}

/* ---------- teléfono / chat ---------- */
.telefono { display: flex; flex-direction: column; min-height: 0; height: 100dvh; background: var(--wa-fondo); overflow: hidden; }
@media (min-width: 900px) {
  .telefono { height: min(780px, calc(100dvh - 56px)); border-radius: 36px; border: 10px solid #1b1d20;
    box-shadow: 0 2px 4px rgb(0 0 0 / .1), 0 30px 70px -20px rgb(40 30 10 / .45), inset 0 0 0 1px rgb(255 255 255 / .06); }
}
.chat-cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--wa-cab); color: #fff; }
.volver { text-decoration: none; font-size: 20px; padding: 4px 6px; border-radius: 8px; }
.avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; display: grid; place-items: center; background: var(--crema); color: var(--verde-osc); font: 900 15px Archivo, sans-serif; }
.quien { display: grid; line-height: 1.2; }
.quien b { font-size: 16px; }
.quien small { font-size: 12.5px; color: #bfe3cc; }

.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 10px 8px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain;
  background: radial-gradient(circle, rgb(120 100 70 / .1) 1px, transparent 1.5px) 0 0 / 16px 16px, var(--wa-fondo); }
.sistema { align-self: center; max-width: 92%; margin: 2px 0 8px; text-align: center; font-size: 12.5px; color: #54470f; background: #fff5c4; border-radius: 8px; padding: 6px 10px; box-shadow: 0 1px 1px rgb(0 0 0 / .06); }
.sistema a { font-weight: 700; color: var(--verde); }

.msj { position: relative; max-width: 84%; padding: 7px 10px 6px; border-radius: 10px; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgb(0 0 0 / .08); animation: entra .25s var(--ease); }
.msj.in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.msj.out { align-self: flex-end; background: var(--wa-out); border-top-right-radius: 3px; }
.msj .meta { float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: #7b8a80; display: inline-flex; gap: 3px; align-items: center; }
.msj.out .meta i { font-style: normal; color: var(--wa-tilde); letter-spacing: -3px; margin-right: 3px; }
.msj.de-persona { border-left: 3px solid #e2a03f; }
.msj .quien-local { display: block; font-size: 12px; font-weight: 700; color: #b3741d; margin-bottom: 2px; }
.msj .link { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f0f7f2; color: var(--verde); font-weight: 700; text-decoration: none; text-align: center; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } }

/* botones de respuesta rápida, como los de WhatsApp Business */
.botones { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; max-width: 92%; margin: 2px 0 4px; animation: entra .3s var(--ease); }
.botones button { border: 0; border-radius: 18px; padding: 8px 14px; background: #fff; color: #0a7d4f; font: 600 14px Inter, sans-serif; cursor: pointer; box-shadow: 0 1px 1px rgb(0 0 0 / .1); }
.botones button:hover { background: #f2fbf5; }
.botones button:disabled { opacity: .45; cursor: default; }

/* audio */
.audio-burbuja { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.audio-burbuja .play { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #4fae7a; color: #fff; font-size: 12px; }
.onda { display: flex; gap: 2px; align-items: center; height: 26px; flex: 1; }
.onda span { width: 3px; border-radius: 2px; background: #6aa585; }

.escribiendo { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: #fff; border-radius: 10px; border-top-left-radius: 3px; box-shadow: 0 1px 1px rgb(0 0 0 / .08); }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: #8aa394; animation: punto 1.2s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .15s; } .escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes punto { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }

.barra { display: flex; gap: 8px; align-items: center; padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #f0ece4; }
.barra input { flex: 1; min-width: 0; border: 0; border-radius: 22px; padding: 12px 16px; font: 16px Inter, sans-serif; background: #fff; outline: none; box-shadow: 0 1px 1px rgb(0 0 0 / .06); }
.barra button { width: 46px; height: 46px; flex: 0 0 46px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.barra svg { width: 22px; height: 22px; fill: currentColor; }
.enviar { background: var(--wa); color: #fff; }
.audio { background: #fff; color: #4a5a50; }

/* ---------- vista del dueño ---------- */
.duenio { display: none; }
@media (min-width: 900px) {
  .duenio { display: flex; flex-direction: column; gap: 14px; max-height: calc(100dvh - 56px); overflow-y: auto; }
}
.marca { display: inline-flex; align-items: center; gap: 8px; font: 900 17px Archivo, sans-serif; }
.marca svg { width: 26px; height: 26px; }
.duenio h1 { font: 900 clamp(1.8rem, 3vw, 2.4rem)/1.05 Archivo, sans-serif; letter-spacing: -.02em; margin: 10px 0 8px; }
.duenio-cab p { margin: 0; color: var(--tinta-2); }
.duenio-titulo { margin: 8px 0 0; font: 800 15px Inter, sans-serif; }
.avisos { display: grid; gap: 10px; }
.vacio { margin: 0; padding: 14px 16px; border: 1px dashed #c9d6cb; border-radius: 14px; color: var(--suave); font-size: 14px; background: rgb(255 255 255 / .5); }
.aviso { background: #fff; border: 1px solid var(--borde); border-radius: 16px; padding: 14px 16px; box-shadow: 0 1px 2px rgb(40 30 10 / .05), 0 12px 24px -12px rgb(40 30 10 / .2); animation: entra .35s var(--ease); }
.aviso small { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--wa); }
.aviso b { display: block; margin: 4px 0 2px; font-size: 15.5px; }
.aviso p { margin: 0; color: var(--tinta-2); font-size: 14px; white-space: pre-line; }
.aviso .acciones { display: flex; gap: 8px; margin-top: 10px; }
.aviso .acciones button { flex: 1; border: 0; border-radius: 10px; padding: 10px; font: 700 14px Inter, sans-serif; cursor: pointer; }
.si { background: var(--wa); color: #fff; }
.no { background: #f3efe8; color: var(--tinta); }
.aviso .resuelto { margin-top: 10px; font-weight: 700; color: var(--verde); }
.contador { margin: 0; font-size: 14px; color: var(--suave); }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; font-weight: 700; color: #fff; border-radius: 14px; padding: 14px 20px;
  background: linear-gradient(180deg, #2bbd66, #1a9a4c); box-shadow: inset 0 1px 0 rgb(255 255 255 / .28), 0 12px 26px -8px rgb(31 168 85 / .6); }
.cta svg { width: 20px; height: 20px; fill: currentColor; }
.aclara { margin: 0; font-size: 12.5px; color: var(--suave); }

/* en el celular, los avisos del dueño bajan desde arriba como una notificación */
.toast { position: fixed; left: 10px; right: 10px; top: max(10px, env(safe-area-inset-top)); z-index: 20; animation: baja .4s var(--ease); }
.toast .aviso { box-shadow: 0 18px 40px -10px rgb(0 0 0 / .45); }
.toast .etiqueta { display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: rgb(20 33 26 / .85); border-radius: 99px; padding: 4px 10px; margin: 0 0 6px; }
@keyframes baja { from { opacity: 0; transform: translateY(-30px); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
