/* Panel de Respichat. Tokens del manual de marca (respichat.com, SPEC.md §5): no agregar colores, tamaños ni radios. */

@font-face {
  font-family: "Gabarito";
  src: url("/estaticos/Gabarito-Variable.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --papel: #fffdf8;
  --pluma: #fff3d1;
  --linea: #e9e3d6;
  --borde: #8a879c;
  --noche: #1a1b3a;
  --noche-suave: #55567a;
  --rojo: #ce271d;
  --rojo-suave: #feece9;
  --sobre-rojo: #ffffff;
  --amarillo: #ffc21a;
  --azul: #1b5faa;
  --azul-suave: #e2ecf8;
  --font-marca: "Gabarito", ui-rounded, system-ui, sans-serif;
  --esp-1: 4px;
  --esp-2: 8px;
  --esp-4: 16px;
  --esp-6: 24px;
  --esp-12: 48px;
  --radio-s: 6px;
  --radio-m: 16px;
  --radio-total: 999px;
  --sombra-flotante: 0 8px 24px -6px #1a1b3a33;
  --foco: 0 0 0 2px #fffdf8, 0 0 0 4px #1b5faa;
  --alto-barra: 64px;
}

/* ---------- Base ---------- */

html {
  color-scheme: light;
  font-size: 100%;
  touch-action: manipulation;
  /* Que la barra inferior fija nunca tape el campo enfocado (WCAG 2.2, foco no oculto). */
  scroll-padding-bottom: calc(var(--alto-barra) + var(--esp-6));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--papel);
  color: var(--noche);
  font: 1rem/1.5 var(--font-marca);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
}

a {
  color: var(--azul);
  text-underline-offset: 0.15em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--foco);
  border-radius: var(--radio-s);
}

.nota {
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 500;
  color: var(--noche-suave);
}

.visualmente-oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Estructura ---------- */

main:focus {
  outline: none;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--esp-6);
  display: flex;
  flex-direction: column;
  gap: var(--esp-6);
}

main > * + h2,
main > section {
  margin-top: var(--esp-4);
}

section {
  display: flex;
  flex-direction: column;
  gap: var(--esp-4);
}

.fila {
  display: flex;
  gap: var(--esp-4);
  flex-wrap: wrap;
  align-items: center;
}

.titulo-con-accion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--esp-4);
  flex-wrap: wrap;
}

.dos-columnas,
.tres-columnas {
  display: grid;
  gap: var(--esp-4);
}

@media (min-width: 560px) {
  .dos-columnas {
    grid-template-columns: 1fr 1fr;
  }

  .tres-columnas {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Cabecera y navegación ---------- */

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esp-4);
  padding: var(--esp-4) var(--esp-6);
  border-bottom: 1px solid var(--linea);
}

.marca {
  display: inline-flex;
  width: 124px;
  line-height: 0;
}

.marca svg {
  width: 100%;
  height: auto;
}

.navegacion {
  display: flex;
  align-items: center;
  gap: var(--esp-6);
}

.navegacion ul {
  display: flex;
  gap: var(--esp-6);
  list-style: none;
  padding: 0;
}

.navegacion a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--noche);
  font-weight: 600;
  text-decoration: none;
}

.navegacion a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

.navegacion .solo-celular {
  display: none;
}

/* En el celular: barra inferior fija con lo esencial, al alcance del pulgar. */
@media (max-width: 719px) {
  body.con-menu {
    padding-bottom: calc(var(--alto-barra) + env(safe-area-inset-bottom));
  }

  .navegacion ul {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 10;
    justify-content: space-around;
    gap: 0;
    padding: 0 var(--esp-2) env(safe-area-inset-bottom);
    background: var(--papel);
    border-top: 1px solid var(--linea);
  }

  .navegacion li {
    flex: 1;
  }

  .navegacion ul a {
    justify-content: center;
    width: 100%;
    min-height: var(--alto-barra);
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .navegacion ul a[aria-current="page"] {
    color: var(--rojo);
    text-decoration: none;
    box-shadow: inset 0 3px 0 var(--rojo);
  }

  .navegacion .solo-escritorio {
    display: none;
  }

  .navegacion .solo-celular {
    display: list-item;
  }
}

/* ---------- Botones ---------- */

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--esp-2) var(--esp-6);
  border: 2px solid transparent;
  border-radius: var(--radio-total);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.boton:focus-visible {
  border-radius: var(--radio-total);
}

.principal {
  background: var(--rojo);
  color: var(--sobre-rojo);
}

.secundario {
  background: transparent;
  border-color: var(--noche);
  color: var(--noche);
}

.boton.enlace {
  background: transparent;
  color: var(--rojo);
  padding: var(--esp-2) 0;
}

form.en-linea {
  display: inline-flex;
}

/* ---------- Formularios ---------- */

label {
  display: block;
  font-weight: 600;
  margin: var(--esp-4) 0 var(--esp-1);
}

input,
textarea {
  width: 100%;
  padding: var(--esp-2) 12px;
  border: 1px solid var(--borde);
  border-radius: var(--radio-s);
  font: inherit;
  background: var(--sobre-rojo);
  color: var(--noche);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.en-linea-check {
  display: flex;
  gap: var(--esp-2);
  align-items: center;
}

.en-linea-check input {
  width: 24px;
  height: 24px;
  accent-color: var(--azul);
}

/* ---------- Avisos ---------- */

.aviso,
.info {
  padding: var(--esp-4);
  border-radius: var(--radio-m);
}

.aviso {
  background: var(--rojo-suave);
}

.info {
  background: var(--azul-suave);
}

.aviso ul,
.info ul {
  padding-left: var(--esp-6);
}

/* ---------- Portada: quién te espera ---------- */

.te-esperan {
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
  padding-bottom: var(--esp-6);
  border-bottom: 1px solid var(--linea);
}

.te-esperan .titular {
  font-size: 2.5rem;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.te-esperan .titular.calma {
  color: var(--noche-suave);
}

@media (min-width: 720px) {
  .te-esperan .titular {
    font-size: 3.5rem;
    line-height: 1;
  }
}

.esperando {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.esperando li + li {
  border-top: 1px solid var(--linea);
}

.esperando a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  color: var(--noche);
  text-decoration: none;
}

.esperando strong {
  font-size: 1.25rem;
  line-height: 1.4;
}

/* ---------- Listas (conversaciones, citas pendientes) ---------- */

.lista {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--linea);
}

.lista li {
  border-bottom: 1px solid var(--linea);
}

.lista a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--esp-4);
  padding: 12px 0;
  min-height: 56px;
  color: var(--noche);
  text-decoration: none;
}

.lista .principal-linea {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lista .principal-linea strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etiqueta {
  display: inline-block;
  padding: 2px 12px;
  border-radius: var(--radio-total);
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
  color: var(--noche);
}

.etiqueta-dueno,
.etiqueta.estado-pendiente {
  background: var(--pluma);
}

.etiqueta-loro,
.etiqueta.estado-confirmada {
  background: var(--azul-suave);
}

.etiqueta.estado-rechazada,
.etiqueta.estado-cancelada {
  background: var(--linea);
}

/* ---------- Primeros pasos ---------- */

.pasos {
  list-style: none;
  padding: 0;
}

.pasos li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--linea);
}

.marca-paso {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radio-total);
  border: 2px solid var(--borde);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
}

.hecho .marca-paso {
  background: var(--azul);
  border-color: var(--azul);
  color: var(--sobre-rojo);
}

.hecho .texto-paso {
  color: var(--noche-suave);
}

/* ---------- Mensajes ---------- */

.mensajes {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
}

.mensaje {
  max-width: 85%;
  padding: var(--esp-2) var(--esp-4);
  border-radius: var(--radio-m);
  border: 1px solid var(--linea);
}

.mensaje .nota {
  display: block;
}

.m-cliente {
  align-self: flex-start;
}

.m-loro,
.m-dueno {
  align-self: flex-end;
  background: var(--pluma);
  border-color: var(--pluma);
}

.m-sistema {
  align-self: center;
  max-width: 100%;
  border: none;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--noche-suave);
}

.respuesta {
  padding: var(--esp-4);
  border-radius: var(--radio-m);
  background: var(--pluma);
}

/* ---------- Servicios ---------- */

.tarjetas {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--esp-4);
}

.tarjeta {
  border: 1px solid var(--linea);
  border-radius: var(--radio-m);
  padding: var(--esp-4);
}

.tarjeta-enlace {
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
  height: 100%;
  color: var(--noche);
  text-decoration: none;
}

.tarjeta-enlace:hover {
  border-color: var(--borde);
}

.tarjeta-enlace:focus-visible {
  border-radius: var(--radio-m);
}

.tarjeta-cabecera {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--esp-2);
}

.tarjeta-nombre {
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.precio {
  font-weight: 700;
  font-size: 1.25rem;
  white-space: nowrap;
}

.tarjeta-enlace .etiqueta {
  align-self: flex-start;
}

.no-disponible {
  background: var(--pluma);
}

.no-disponible .tarjeta-nombre,
.no-disponible .precio {
  color: var(--noche-suave);
}

.nueva {
  background: var(--pluma);
  border-color: var(--pluma);
}

/* ---------- Citas ---------- */

.semana-nav {
  display: flex;
  gap: var(--esp-6);
  flex-wrap: wrap;
}

.semana-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.semana {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--esp-2);
}

.dia {
  display: flex;
  flex-direction: column;
  gap: var(--esp-2);
  padding: 12px 0;
  border-top: 1px solid var(--linea);
}

.dia h3 {
  font-size: 0.9375rem;
  line-height: 1.35;
}

.dia.hoy h3 {
  color: var(--rojo);
}

.dia ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* En el celular la agenda muestra solo los días con citas (y hoy). */
@media (max-width: 899px) {
  .dia-vacio:not(.hoy) {
    display: none;
  }
}

@media (min-width: 900px) {
  .semana {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .dia {
    min-height: 160px;
    border-top: 2px solid var(--linea);
  }

  .dia.hoy {
    border-top-color: var(--rojo);
  }
}

.cita {
  display: flex;
  flex-direction: column;
  padding: var(--esp-2);
  border-radius: var(--radio-s);
  border-left: 4px solid var(--borde);
  color: var(--noche);
  text-decoration: none;
}

.cita-hora {
  font-weight: 700;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.cita-cliente {
  font-weight: 600;
}

.cita.estado-pendiente {
  border-left-color: var(--amarillo);
  background: var(--pluma);
}

.cita.estado-confirmada {
  border-left-color: var(--azul);
  background: var(--azul-suave);
}

.cita.estado-rechazada,
.cita.estado-cancelada {
  color: var(--noche-suave);
  text-decoration: line-through;
}

.datos-cita {
  display: grid;
  gap: var(--esp-2);
}

.datos-cita div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--esp-2);
}

.datos-cita dt {
  font-weight: 600;
  color: var(--noche-suave);
}

.eliminar-cita {
  display: flex;
  gap: var(--esp-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Ajustes de la pasada de crítica ---------- */

.bloque {
  display: flex;
  flex-direction: column;
  gap: var(--esp-4);
}

.esperando .accion {
  color: var(--azul);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.no-disponible .etiqueta {
  background: var(--papel);
}

/* ---------- Auditoría ui-ux-pro-max ---------- */

.saltar {
  position: absolute;
  left: var(--esp-4);
  top: var(--esp-4);
  z-index: 20;
  padding: var(--esp-2) var(--esp-4);
  background: var(--noche);
  color: var(--sobre-rojo);
  border-radius: var(--radio-total);
  font-weight: 600;
  transform: translateY(-200%);
}

.saltar:focus-visible {
  transform: none;
  border-radius: var(--radio-total);
}

/* Respuesta al tocar: cambia color u opacidad, nunca el tamaño (sin saltos de layout). */
.boton,
.lista a,
.esperando a,
.tarjeta-enlace,
.cita,
.navegacion a {
  transition: background-color 150ms ease-out, border-color 150ms ease-out, opacity 150ms ease-out;
}

.boton:active,
.lista a:active,
.esperando a:active,
.tarjeta-enlace:active,
.cita:active {
  opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Botón mientras se envía el formulario. */
.boton[aria-disabled="true"] {
  opacity: 0.6;
  cursor: progress;
}

/* Blancos pequeños: al menos 44 px de alto. */
.dia > a.nota,
.semana-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Errores junto al campo. */
.error-campo {
  margin-top: var(--esp-1);
  color: var(--rojo);
  font-size: 0.875rem;
  line-height: 1.4;
  font-weight: 600;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border: 2px solid var(--rojo);
}

.resumen-errores:focus {
  outline: 2px solid transparent;
  box-shadow: var(--foco);
}

.resumen-errores a {
  color: var(--noche);
}

/* Formularios largos agrupados por tema. */
fieldset {
  margin: 0;
  padding: 0 0 var(--esp-6);
  border: none;
  border-bottom: 1px solid var(--linea);
}

fieldset + fieldset {
  padding-top: var(--esp-6);
}

legend {
  padding: 0;
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
}

legend + .nota {
  margin-top: var(--esp-1);
}

/* ---------- Demo pública (se incrusta en respichat.com) ---------- */

body.demo {
  background: var(--papel);
}

.demo-grilla {
  max-width: 1040px;
  padding: var(--esp-4);
  display: grid;
  gap: var(--esp-6);
}

@media (min-width: 760px) {
  .demo-grilla {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    padding: var(--esp-6);
  }
}

.demo-negocio {
  gap: var(--esp-2);
}

.demo-negocio details {
  border: 1px solid var(--linea);
  border-radius: var(--radio-m);
  padding: var(--esp-2) var(--esp-4);
}

.demo-negocio summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.demo-datos {
  display: grid;
  gap: 12px;
  padding-bottom: var(--esp-2);
}

.demo-datos dt {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--noche-suave);
}

.demo-datos ul {
  padding-left: var(--esp-4);
}

.demo-conversacion {
  border: 1px solid var(--linea);
  border-radius: var(--radio-m);
  padding: var(--esp-4);
  gap: 12px;
}

.demo-chat {
  min-height: 260px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: var(--esp-1);
}

.demo-sugerencias {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-2);
}

.pastilla {
  min-height: 44px;
  padding: var(--esp-2) var(--esp-4);
  border: none;
  border-radius: var(--radio-total);
  background: var(--pluma);
  color: var(--noche);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.pastilla:active {
  opacity: 0.7;
}

.demo-form {
  display: flex;
  gap: var(--esp-2);
}

.demo-form input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
}

.demo-form .boton[disabled] {
  opacity: 0.6;
  cursor: progress;
}
