:root {
  --tinta: #1d2420;
  --suave: #5b665f;
  --linea: #dfe4e0;
  --fondo: #f6f7f5;
  --blanco: #fff;
  --acento: #0f6b5c;
  --acento-oscuro: #0a4f44;
  --burbuja-yo: #d9f5c9;
  --chat-fondo: #efe9e0;
  --cita: #c9efd9;
  --cita-borde: #2e9d6a;
  --urgente: #b42318;
  --urgente-fondo: #fdecea;
  --radio: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  background: var(--fondo);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: var(--acento); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
[hidden] { display: none !important; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.boton { display: inline-block; background: var(--acento); color: #fff; text-decoration: none; padding: .7rem 1.1rem; border-radius: 999px; font-weight: 600; }
.boton:hover { background: var(--acento-oscuro); }
.boton-claro { background: #fff; color: var(--acento); border: 1px solid var(--linea); padding: .45rem .9rem; font-size: .9rem; }
.boton-claro:hover { background: var(--fondo); }

.barra { display: flex; align-items: center; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 2.5rem); background: #fff; border-bottom: 1px solid var(--linea); }
.marca { font-weight: 800; font-size: 1.2rem; color: var(--tinta); text-decoration: none; letter-spacing: -.02em; }
.barra-texto { margin: 0; color: var(--suave); flex: 1; font-size: .95rem; }

.intro { max-width: 1180px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 1rem; }
.intro h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.02em; }
.intro p { max-width: 62ch; color: var(--suave); margin: .6rem 0 0; }
.aviso { font-size: .88rem; }

.pestanas { display: none; }

.demo { max-width: 1180px; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 2.5rem) 2.5rem; display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 1.5rem; align-items: start; }

/* ---- Teléfono ---- */
.telefono { background: var(--chat-fondo); border-radius: 26px; border: 8px solid #1d2420; overflow: hidden; display: flex; flex-direction: column; height: min(720px, 80vh); position: sticky; top: 1rem; }
.chat-cabecera { display: flex; align-items: center; gap: .7rem; background: var(--acento); color: #fff; padding: .7rem .9rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.2rem; }
.chat-nombre { margin: 0; font-weight: 600; font-size: .95rem; }
.chat-estado { margin: 0; font-size: .78rem; opacity: .85; }
.reiniciar { margin-left: auto; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; cursor: pointer; }
.reiniciar:hover { background: rgba(255,255,255,.12); }

.chat-cuerpo { flex: 1; overflow-y: auto; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .45rem; }
.burbuja { max-width: 85%; padding: .45rem .65rem .3rem; border-radius: 10px; font-size: .93rem; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 0 rgba(0,0,0,.06); animation: entra .18s ease-out; }
.burbuja .hora { display: block; text-align: right; font-size: .68rem; color: var(--suave); margin-top: .1rem; }
.burbuja.yo { align-self: flex-end; background: var(--burbuja-yo); border-top-right-radius: 3px; }
.burbuja.clara { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.burbuja.error { align-self: center; background: #fff7e6; font-size: .85rem; color: #7a4b00; }
.burbuja.sistema { align-self: center; background: rgba(255,255,255,.8); font-size: .8rem; color: var(--suave); text-align: center; }
.escribiendo { align-self: flex-start; background: #fff; border-radius: 10px; padding: .55rem .8rem; display: flex; gap: 4px; }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: #9aa39d; animation: punto 1s infinite ease-in-out; }
.escribiendo i:nth-child(2) { animation-delay: .15s; }
.escribiendo i:nth-child(3) { animation-delay: .3s; }

.sugerencias { display: flex; gap: .4rem; overflow-x: auto; padding: .4rem .6rem; scrollbar-width: none; }
.sugerencias button { flex: none; background: #fff; border: 1px solid var(--linea); border-radius: 999px; padding: .35rem .7rem; font-size: .8rem; color: var(--acento-oscuro); cursor: pointer; }
.sugerencias button:hover { border-color: var(--acento); }

.chat-formulario { display: flex; gap: .5rem; padding: .5rem .6rem; background: #f3efe8; }
.chat-formulario input { flex: 1; border: 0; border-radius: 999px; padding: .65rem .9rem; font: inherit; font-size: .95rem; background: #fff; }
.chat-formulario input:focus { outline: 2px solid var(--acento); }
.enviar { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; font-size: 1rem; cursor: pointer; }
.enviar:disabled { opacity: .5; cursor: default; }
.restantes { margin: 0; text-align: center; font-size: .72rem; color: var(--suave); background: #f3efe8; padding: 0 0 .45rem; }

/* ---- Recepción ---- */
.recepcion h2 { font-size: 1.15rem; margin-bottom: .8rem; }
.tarjeta { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.tarjeta h3 { font-size: .95rem; margin-bottom: .6rem; }
.tarjeta-cabecera { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.leyenda { display: flex; gap: .8rem; font-size: .75rem; color: var(--suave); }
.cuadro { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.cuadro.libre { background: #fff; border: 1px solid var(--linea); }
.cuadro.ocupado { background: #e6e9e7; }
.cuadro.cita { background: var(--cita); border: 1px solid var(--cita-borde); }

.avisos { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.avisos li { border-left: 4px solid var(--acento); background: var(--fondo); padding: .5rem .7rem; border-radius: 6px; font-size: .88rem; }
.avisos li.alta { border-color: var(--urgente); background: var(--urgente-fondo); }
.avisos .etiqueta { font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; margin-right: .4rem; }
.avisos li.alta .etiqueta { color: var(--urgente); }
.avisos .vacio, .vacio { color: var(--suave); border: 0; background: none; padding: 0; font-size: .88rem; }
.nuevo { animation: destello 1.6s ease-out; }

.dias { display: flex; gap: .35rem; overflow-x: auto; margin: .2rem 0 .7rem; }
.dias button { flex: none; border: 1px solid var(--linea); background: #fff; border-radius: 10px; padding: .35rem .65rem; font-size: .8rem; cursor: pointer; position: relative; }
.dias button[aria-selected="true"] { background: var(--acento); color: #fff; border-color: var(--acento); }
.dias button .punto { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--cita-borde); border: 2px solid #fff; }
.tabla-envoltura { overflow-x: auto; }
.agenda { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: .8rem; table-layout: fixed; min-width: 420px; }
.agenda th { font-weight: 600; text-align: left; color: var(--suave); font-size: .75rem; padding: 0 .2rem; }
.agenda th.hora-col { width: 56px; }
.agenda td { border-radius: 6px; padding: .3rem .4rem; height: 34px; vertical-align: middle; }
.agenda td.hora { color: var(--suave); font-variant-numeric: tabular-nums; }
.agenda td.libre { border: 1px solid var(--linea); }
.agenda td.ocupado { background: #e6e9e7; }
.agenda td.cerrado, .agenda td.pasado { background: repeating-linear-gradient(135deg, #f4f5f4 0 6px, #fafbfa 6px 12px); }
.agenda td.urgencia { border: 1px dashed var(--urgente); color: var(--urgente); font-size: .72rem; }
.agenda td.cita { background: var(--cita); border: 1px solid var(--cita-borde); font-size: .74rem; line-height: 1.25; }
.agenda td.cita.previa { background: #eef6f1; border-style: dashed; }
.agenda td.cita b { display: block; }
.costo p { margin: 0; font-size: .9rem; color: var(--suave); }

.cierre { max-width: 1180px; margin: 0 auto 2rem; padding: 2rem clamp(1rem, 4vw, 2.5rem); background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); }
.cierre h2 { font-size: 1.3rem; }
.cierre p { color: var(--suave); max-width: 60ch; }
.pie { text-align: center; font-size: .8rem; color: var(--suave); padding: 0 1rem 2rem; }

@keyframes entra { from { opacity: 0; transform: translateY(4px); } }
@keyframes punto { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@keyframes destello { from { box-shadow: 0 0 0 3px rgba(46,157,106,.55); } to { box-shadow: 0 0 0 3px rgba(46,157,106,0); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---- Celular: pestañas Chat / Recepción ---- */
@media (max-width: 820px) {
  .barra-texto { display: none; }
  .barra .boton-claro { margin-left: auto; }
  .intro { padding-top: 1.2rem; }
  .pestanas { display: flex; gap: .4rem; padding: .5rem 1rem 0; position: sticky; top: 0; z-index: 2; background: var(--fondo); }
  .pestana { flex: 1; border: 1px solid var(--linea); background: #fff; border-radius: 999px; padding: .5rem; font: inherit; font-size: .9rem; cursor: pointer; }
  .pestana.activa { background: var(--acento); color: #fff; border-color: var(--acento); }
  .globo { display: inline-block; min-width: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: var(--urgente); color: #fff; font-size: .72rem; }
  .demo { display: block; padding-top: .8rem; }
  .vista { display: none; }
  .vista.activa { display: block; }
  .telefono.vista.activa { display: flex; height: 70vh; position: static; border-width: 0; border-radius: var(--radio); }
}
