/* =====================================================================
   Sistema de diseño — Yeison David Cardona Wagner, Fisioterapeuta
   Tokens, reset, tipografía y componentes base compartidos por la web y el panel.
   Sin modo oscuro (decisión del cliente).
   ===================================================================== */

:root {
  color-scheme: light;

  /* Paleta medida del logo */
  --azul: #567589;
  --azul-hover: #46616f;
  --azul-claro: #b8c8d5;
  --niebla: #eef2f5;
  --fondo: #f7f7f7;
  --blanco: #ffffff;
  --texto: #2f4250;
  --texto-suave: #56697a;
  --borde: #dde5eb;

  /* Acentos: solo detalles pequeños */
  --rosa: #eda2d2;
  --lila: #c097c1;
  --celeste: #a3dcf0;
  --verde: #b6e9a4;
  --amarillo: #fdec76;
  --durazno: #fdc571;

  /* v2: acentos con decisión y campos de color (pasteles algo más saturados) */
  --lila-fuerte: #7a569a;   /* 5,8:1 sobre blanco: sirve para texto */
  --verde-fuerte: #5fa77a;  /* solo rellenos y decoración (2,9:1) */
  --azul-profundo: #46616f;
  --campo-rosa: #fbe1f0;
  --campo-lila: #efe4f6;
  --campo-celeste: #dcf0f9;
  --campo-verde: #e2f4d9;
  --campo-amarillo: #fff4c2;
  --campo-durazno: #ffe7c4;

  /* Estados legibles (texto) */
  --error: #a34e86;
  --error-fondo: #fbeef6;
  --ok: #3f6f3a;
  --ok-fondo: #ecf8e7;
  --aviso: #7a5a12;
  --aviso-fondo: #fff6dc;

  --fuente-titulo: 'Fraunces', Georgia, 'Times New Roman', serif;
  --fuente: 'Jost', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radio-sm: 12px;
  --radio: 18px;
  --radio-lg: 24px;
  --sombra: 0 1px 2px rgba(47, 66, 80, 0.04), 0 6px 20px rgba(47, 66, 80, 0.06);
  --sombra-alta: 0 10px 40px rgba(47, 66, 80, 0.14);
  --ancho: 1120px;
  --gutter: 16px;
  --toque: 44px;
}

@media (min-width: 768px) {
  :root { --gutter: 32px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 17px;
  line-height: 1.6;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
@media (min-width: 1024px) { body { font-size: 18px; } }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul-hover); text-underline-offset: 3px; }
a:hover { color: var(--texto); }
p { margin: 0 0 1em; }
h1, h2, h3, h4 {
  font-family: var(--fuente-titulo);
  font-weight: 600;
  line-height: 1.15;
  color: var(--azul-hover);
  margin: 0 0 0.5em;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.05rem, 7vw, 3.5rem); }
h2 { font-size: clamp(1.7rem, 5vw, 2.5rem); }
h3 { font-size: 1.25rem; }
small, .pequeno { font-size: 0.9375rem; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.saltar {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--azul); color: #fff; padding: 10px 16px; border-radius: 10px;
}
.saltar:focus { top: 8px; color: #fff; }

/* ---------- Layout ---------- */
.contenedor { width: 100%; max-width: var(--ancho); margin-inline: auto; padding-inline: var(--gutter); }
.pila > * + * { margin-top: 1rem; }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.suave { color: var(--texto-suave); }
.centro { text-align: center; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--toque); padding: 10px 22px;
  border: 1.5px solid transparent; border-radius: 999px;
  font-weight: 500; font-size: 1rem; line-height: 1.2; text-decoration: none;
  cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primario { background: var(--azul); color: #fff; }
.btn-primario:hover { background: var(--azul-hover); color: #fff; }
.btn-secundario { background: var(--blanco); color: var(--azul-hover); border-color: var(--azul-claro); }
.btn-secundario:hover { border-color: var(--azul); color: var(--azul-hover); }
.btn-suave { background: var(--niebla); color: var(--azul-hover); }
.btn-suave:hover { background: #e2e9ee; color: var(--azul-hover); }
.btn-whatsapp { background: #e9f7ee; color: #1f5f3a; border-color: #bfe5cc; }
.btn-whatsapp:hover { background: #dcf2e4; color: #1f5f3a; }
.btn-claro { background: var(--blanco); color: var(--azul-profundo); }
.btn-claro:hover { background: var(--campo-amarillo); color: var(--texto); }
.btn-peligro { background: var(--error-fondo); color: var(--error); border-color: #efcfe3; }
.btn-texto { background: none; color: var(--azul); padding-inline: 8px; }
.btn-grande { min-height: 52px; padding: 14px 28px; font-size: 1.0625rem; }
/* En celulares de 320 px un botón con texto largo puede ocupar dos líneas en vez de salirse de la pantalla */
@media (max-width: 359px) { .btn { max-width: 100%; white-space: normal; text-align: center; } .btn-grande { padding: 12px 20px; } }
.btn-bloque { width: 100%; }
.btn-icono { width: var(--toque); min-width: var(--toque); padding: 0; flex: none; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.5; pointer-events: none; }

/* ---------- Tarjetas y chips ---------- */
.tarjeta {
  background: var(--blanco); border-radius: var(--radio); padding: 22px;
  box-shadow: var(--sombra); border: 1px solid rgba(184, 200, 213, 0.35);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-size: 0.9375rem; font-weight: 500;
  background: var(--niebla); color: var(--azul-hover); line-height: 1.5;
}
.punto { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.p-rosa { background: var(--rosa); } .p-lila { background: var(--lila); } .p-celeste { background: var(--celeste); }
.p-verde { background: var(--verde); } .p-amarillo { background: var(--amarillo); } .p-durazno { background: var(--durazno); }

/* Separador de puntos (columna del logo, en horizontal) */
.puntos { display: flex; gap: 8px; align-items: center; }
.puntos span { width: 9px; height: 9px; border-radius: 50%; }
.puntos span:nth-child(1) { background: var(--rosa); }
.puntos span:nth-child(2) { background: var(--lila); }
.puntos span:nth-child(3) { background: var(--celeste); }
.puntos span:nth-child(4) { background: var(--verde); }
.puntos span:nth-child(5) { background: var(--amarillo); }
.puntos span:nth-child(6) { background: var(--durazno); }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .etiqueta, fieldset > legend {
  font-weight: 500; color: var(--texto); font-size: 1rem;
}
.campo .opcional { font-weight: 400; color: var(--texto-suave); font-size: 0.9375rem; }
.ayuda { color: var(--texto-suave); font-size: 0.9375rem; margin: 0; }
input[type='text'], input[type='tel'], input[type='email'], input[type='date'], input[type='time'],
input[type='number'], input[type='password'], input[type='search'], input[type='month'], input[type='url'], input:not([type]), select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1.5px solid var(--borde); border-radius: var(--radio-sm);
  background: var(--blanco); font-size: 1rem; color: var(--texto);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23567589' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
/* Subir archivos (soportes, exámenes): área grande para el dedo */
input[type='file'] {
  width: 100%; min-height: 52px; padding: 8px; font-size: 0.9375rem; color: var(--texto-suave);
  border: 1.5px dashed var(--borde); border-radius: var(--radio-sm); background: var(--blanco); cursor: pointer;
}
input[type='file']::file-selector-button {
  min-height: 36px; margin-right: 10px; padding: 6px 14px; border: 0; border-radius: 999px;
  background: var(--niebla); color: var(--azul-profundo); font: inherit; font-weight: 500; cursor: pointer;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(86, 117, 137, 0.18); }
input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true'] { border-color: var(--error); }
.error-campo {
  display: flex; gap: 6px; align-items: flex-start; color: var(--error);
  font-size: 0.9375rem; font-weight: 500; margin: 0;
}
.error-campo::before { content: '!'; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--error); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }
/* Contraseña con botón para verla */
.clave-caja { position: relative; }
.clave-caja input { padding-right: 52px; }
.ver-clave {
  position: absolute; top: 0; right: 0; width: 48px; height: 100%; min-height: 48px;
  display: grid; place-items: center; border: 0; background: none; color: var(--texto-suave);
  cursor: pointer; border-radius: 0 var(--radio-sm) var(--radio-sm) 0;
}
.ver-clave:hover { color: var(--azul); }
.ver-clave:focus-visible { outline: 2px solid var(--azul); outline-offset: -4px; }
.ver-clave svg { width: 22px; height: 22px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--azul); }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.opcion span {
  display: flex; align-items: center; min-height: var(--toque); padding: 8px 16px;
  border: 1.5px solid var(--borde); border-radius: 999px; background: var(--blanco);
  font-size: 1rem; transition: all 0.15s;
}
.opcion input:checked + span { background: var(--azul); border-color: var(--azul); color: #fff; }
.opcion input:focus-visible + span { outline: 3px solid var(--azul); outline-offset: 2px; }

/* ---------- Avisos ---------- */
.aviso { padding: 14px 16px; border-radius: var(--radio-sm); background: var(--niebla); color: var(--texto); font-size: 0.9375rem; display: flex; gap: 10px; }
.aviso-error { background: var(--error-fondo); color: var(--error); }
.aviso-ok { background: var(--ok-fondo); color: var(--ok); }
.aviso-atencion { background: var(--aviso-fondo); color: var(--aviso); }

/* ---------- Diálogos y toasts ---------- */
.velo {
  position: fixed; inset: 0; z-index: 80; background: rgba(47, 66, 80, 0.35);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  animation: aparecer 0.18s ease-out;
}
.dialogo {
  background: var(--blanco); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh;
  /* Título y botones siempre visibles; solo el contenido se desplaza (en celulares pequeños el botón de guardar
     quedaba escondido abajo) */
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radio-lg) var(--radio-lg) 0 0; padding: 22px var(--gutter) calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--sombra-alta); animation: subir 0.22s ease-out;
}
.dialogo h2 { font-size: 1.4rem; }
.dialogo-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex: none; }
.dialogo-cuerpo { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px 6px; }
.dialogo-pie { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--borde); flex: none; }
@media (min-width: 640px) {
  .velo { align-items: center; padding: 24px; }
  .dialogo { border-radius: var(--radio-lg); padding: 28px; }
}
.toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: 90px; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--texto); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--sombra-alta); font-size: 0.9375rem; animation: subir 0.2s ease-out; }
.toast.error { background: var(--error); }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Aparición suave al hacer scroll (fade + 12px) ---------- */
.revelar { opacity: 0; transform: translateY(12px); transition: opacity 0.6s ease, transform 0.6s ease; }
.revelar.visible { opacity: 1; transform: none; }
.sin-js .revelar { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .revelar { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Íconos lineales */
.ico { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===================== V4 ===================== */
/* Aviso visible en la web pública cuando se abre la demostración (?demo=1) */
.aviso-demo-publico { background: var(--campo-amarillo); color: var(--texto); font-size: 0.9375rem; padding: 8px var(--gutter); text-align: center; position: relative; z-index: 60; }
.aviso-demo-publico a { color: var(--azul-profundo); font-weight: 500; }
.btn-enlace { background: none; border: 0; padding: 4px 2px; min-height: 0; color: var(--lila-fuerte); font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.btn-enlace:hover { color: var(--azul-profundo); }
/* Estrellas (reseñas) */
.estrellas { display: inline-flex; gap: 2px; color: #a8780f; vertical-align: -3px; }
.estrellas .ico { width: 18px; height: 18px; }
.estrellas .ico.llena { fill: #f2c94c; }
.estrellas .ico.vacia { color: #c9d3db; }
