/* base.css — el sistema: tokens, letra y los componentes de siempre.

   Lenguaje de Apple (Human Interface), adaptado a gente de 50 a 80 años:
   - Fondo gris de Apple (#F5F5F7) con bloques blancos agrupados, como en los
     Ajustes del iPhone. La profundidad sale del blanco contra el gris, no de
     sombras: casi no hay.
   - Letra del sistema en iPhone y Mac (San Francisco); en el resto, Inter
     Tight. Texto de 19 px (Apple usa 17) y grises secundarios más oscuros que
     los de Apple (#515154 en vez de #86868B: 7,9:1 contra 3,6:1).
   - Un solo color de acento: el del negocio, que llega por /config y pisa las
     variables --marca-* (js/marca.js asegura el contraste).
   - Controles del iPhone: selector segmentado, interruptor, contador − +.
   - Todo lo que se toca mide 56 px. */

:root {
  color-scheme: light;

  /* Superficies y tinta (de Apple) */
  --fondo: #f5f5f7;
  --superficie: #ffffff;
  --relleno: #e8e8ed; /* pistas: segmentado, contador, botones grises */
  --relleno-hover: #dedee3;
  --tinta: #1d1d1f;
  --tinta-2: #515154; /* 7,9:1 sobre blanco */
  --tinta-3: #6e6e73; /* flechas y cosas no esenciales: 5:1 */
  --linea: #d2d2d7; /* divisores finos */
  --linea-campo: #86868b; /* borde de los campos: 3,6:1 */

  /* Marca: neutros hasta que llega /config (así no aparece un color ajeno) */
  --marca: #1d1d1f;
  --marca-boton: #1d1d1f;
  --marca-texto: #1d1d1f;
  --marca-suave: #ececf0;
  --marca-borde: #c7c7cc;
  --sobre-marca: #fff; /* las letras sobre el color del negocio */
  --superficie-hover: #fbfbfd;

  /* Estados */
  --prendido: #248a3d; /* el verde de los interruptores de Apple, oscurecido para contraste */
  --ok: #1d6b34;
  --ok-suave: #e6f4ea;
  --alerta: #6b4500;
  --alerta-suave: #fff4d6;
  --error: #b3261e;
  --error-suave: #fdecea;

  --fuente: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  --fuente-titulos: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;

  --toque: 3.5rem; /* 56 px */
  --radio-chico: 12px;
  --radio: 18px;
  --radio-grande: 22px;
  --sombra: 0 1px 2px rgb(0 0 0 / 0.04);
  --material: rgb(245 245 247 / 0.82); /* barras translúcidas */
  --suave: cubic-bezier(0.16, 1, 0.3, 1); /* expo-out: nunca rebota */
  --alto-cabecera: 4rem;
  --ancho: 60rem;
  --ancho-angosto: 36rem;
  --gutter: 1.25rem;
}
/* En el celular las barras fijas son más bajas: cada renglón de pantalla
   cuenta. Nada de lo que se toca baja de 44 px (el mínimo de Apple). */
@media (max-width: 40rem) {
  :root {
    --alto-cabecera: 3.5rem;
    --gutter: 1rem;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--alto-cabecera) + 1.5rem);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fondo);
  color: var(--tinta);
  font-family: var(--fuente);
  font-size: 1.1875rem; /* 19 px */
  line-height: 1.47;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--fuente-titulos);
  line-height: 1.15;
  text-wrap: balance;
  color: var(--tinta);
}

h1 {
  font-size: clamp(2.125rem, 1.85rem + 1.4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.018em;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.012em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--marca-texto);
  text-underline-offset: 0.18em;
}

strong {
  font-weight: 600;
}

.icono {
  flex: none;
}

/* Foco: el anillo de Apple, en el color del negocio, siempre visible */
:focus-visible {
  outline: 3px solid var(--marca-boton);
  outline-offset: 3px;
  border-radius: var(--radio-chico);
}

.solo-lectores {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.saltar {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--superficie);
  color: var(--tinta);
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: var(--radio-chico);
}
.saltar:focus {
  top: 1rem;
}

.contenedor {
  width: 100%;
  max-width: var(--ancho);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

[hidden] {
  display: none !important;
}

/* ---------- Botones ----------
   Por defecto, el botón gris de iOS: relleno gris claro y texto en el color
   del negocio. El principal va lleno del color del negocio. */

.boton {
  --fondo: var(--relleno);
  --color: var(--marca-texto);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--toque);
  min-width: var(--toque);
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: var(--radio-chico);
  background: var(--fondo);
  color: var(--color);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 0.2s var(--suave),
    transform 0.2s var(--suave),
    opacity 0.2s var(--suave);
  -webkit-tap-highlight-color: transparent;
}
.boton:hover:not(:disabled) {
  --fondo: var(--relleno-hover);
}
.boton:active:not(:disabled) {
  transform: scale(0.97);
}
.boton:disabled,
.boton[aria-disabled='true'] {
  cursor: not-allowed;
  --fondo: var(--relleno);
  --color: var(--tinta-3);
}

.boton-principal {
  --fondo: var(--marca-boton);
  --color: var(--sobre-marca);
}
.boton-principal:hover:not(:disabled) {
  --fondo: color-mix(in srgb, var(--marca-boton) 88%, #000);
}
.boton-principal:disabled {
  --fondo: #c7c7cc;
  --color: #3a3a3c;
}

.boton-suave {
  --fondo: var(--marca-suave);
  --color: var(--marca-texto);
}
.boton-suave:hover:not(:disabled) {
  --fondo: color-mix(in srgb, var(--marca-suave) 88%, var(--marca));
}

.boton-plano {
  --fondo: transparent;
  --color: var(--marca-texto);
  padding-inline: 0.75rem;
}
.boton-plano:hover:not(:disabled) {
  --fondo: color-mix(in srgb, var(--marca-suave) 60%, transparent);
}

.boton-peligro {
  --fondo: var(--relleno);
  --color: var(--error);
}

.boton-ancho {
  width: 100%;
}

.boton-grande {
  min-height: 3.75rem;
  font-size: 1.05em;
  border-radius: 14px;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- Lo que se elige ----------
   Una regla para todo: lo elegido va lleno del color del negocio, con letras
   blancas. Se ve de lejos y no depende de un matiz. */

.opcion {
  --fondo: var(--relleno);
  --color: var(--tinta);
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: var(--toque);
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: var(--radio-chico);
  background: var(--fondo);
  color: var(--color);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 0.2s var(--suave),
    color 0.2s var(--suave),
    transform 0.2s var(--suave);
  -webkit-tap-highlight-color: transparent;
}
.opcion small {
  font-weight: 400;
  font-size: 0.84em;
  color: var(--tinta-2);
}
.opcion:hover:not(:disabled):not([aria-pressed='true']) {
  --fondo: var(--relleno-hover);
}
.opcion:active:not(:disabled) {
  transform: scale(0.97);
}
.opcion[aria-pressed='true'] {
  --fondo: var(--marca-boton);
  --color: var(--sobre-marca);
}
.opcion[aria-pressed='true'] small {
  color: var(--sobre-marca);
}
.opcion:disabled {
  cursor: not-allowed;
  --fondo: transparent;
  --color: var(--tinta-3);
  box-shadow: inset 0 0 0 1px var(--linea);
  text-decoration: line-through;
}
.opcion:disabled small {
  text-decoration: none;
  color: var(--tinta-3);
}

/* Botones que se prenden y se apagan («Sin aceitunas»): cápsulas, con la
   tilde adelante cuando están prendidos. */
.opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.opciones .opcion {
  flex-direction: row;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
}
.opciones .opcion[aria-pressed='true']::before {
  content: '';
  width: 1.05em;
  height: 1.05em;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Grilla de botones iguales: días, horas */
.opciones-grilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.5rem), 1fr));
  gap: 0.5rem;
}

/* El selector segmentado de iOS: una pista gris con los segmentos adentro */
.segmentado {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radio-chico);
  background: var(--relleno);
}
.segmentado .opcion {
  --fondo: transparent;
  min-height: 3.5rem;
  border-radius: 9px;
}
.segmentado .opcion:hover:not(:disabled):not([aria-pressed='true']) {
  --fondo: rgb(255 255 255 / 0.55);
}
.segmentado .opcion[aria-pressed='true'] {
  --fondo: var(--marca-boton);
  box-shadow: 0 3px 8px rgb(0 0 0 / 0.12);
}
.segmentado .opcion:disabled {
  box-shadow: none;
}

/* Opciones grandes, una abajo de la otra, con su explicación: cuándo, cómo pagás, dónde */
.eleccion-grande {
  display: grid;
  gap: 0.5rem;
}
.eleccion-grande .opcion {
  align-items: flex-start;
  text-align: left;
  min-height: 4rem;
  padding: 0.8rem 1.1rem;
}

/* La lista para elegir de a uno, como un menú de iOS: la tilde a la derecha */
.mitades {
  display: grid;
  border-radius: var(--radio-chico);
  overflow: hidden;
  background: var(--superficie);
  box-shadow: inset 0 0 0 1px var(--linea);
}
.mitades .opcion {
  --fondo: transparent;
  flex-direction: row;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.6rem 3rem 0.6rem 1.1rem;
  border-radius: 0;
  text-align: left;
  font-weight: 500;
}
.mitades .opcion + .opcion {
  box-shadow: inset 0 1px 0 var(--linea);
}
.mitades .opcion > span {
  flex: 1;
}
.mitades .opcion small {
  white-space: nowrap;
}
.mitades .opcion[aria-pressed='true'] {
  --fondo: var(--marca-suave);
  --color: var(--marca-texto);
  font-weight: 700;
}
.mitades .opcion[aria-pressed='true'] small {
  color: var(--marca-texto);
}
.mitades .opcion[aria-pressed='true']::after {
  content: '';
  position: absolute;
  right: 1.1rem;
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* El interruptor de iOS, un poco más grande */
.llave {
  position: relative;
  flex: none;
  width: 4rem;
  height: 2.375rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d1d1d6;
  box-shadow: inset 0 0 0 1px var(--linea-campo);
  cursor: pointer;
  transition:
    background-color 0.3s var(--suave),
    box-shadow 0.3s var(--suave);
  -webkit-tap-highlight-color: transparent;
}
.llave-perilla {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 3px 8px rgb(0 0 0 / 0.15),
    0 1px 1px rgb(0 0 0 / 0.16);
  transition: transform 0.3s var(--suave);
}
.llave[aria-checked='true'] {
  background: var(--prendido);
  box-shadow: none;
}
.llave[aria-checked='true'] .llave-perilla {
  transform: translateX(1.625rem);
}
.llave:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.fila-llave {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* El contador − n + de iOS */
.contador {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radio-chico);
  background: var(--relleno);
}
.contador .boton {
  --fondo: transparent;
  --color: var(--tinta);
  min-width: 3.25rem;
  padding: 0;
  border-radius: var(--radio-chico);
}
.contador .boton:hover:not(:disabled) {
  --fondo: var(--relleno-hover);
}
.contador .boton:disabled {
  --fondo: transparent;
  --color: #aeaeb2;
}
.contador output {
  min-width: 2.25ch;
  text-align: center;
  font-size: 1.15em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Campos ---------- */

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
legend {
  float: left;
  width: 100%;
  padding: 0;
}
legend + * {
  clear: both;
}

.campo {
  display: grid;
  gap: 0.4rem;
}
.campo label,
.etiqueta {
  font-weight: 600;
}
.ayuda {
  color: var(--tinta-2);
  font-size: 0.9em;
}
.opcional {
  font-weight: 400;
  color: var(--tinta-2);
}
input[type='text'],
input[type='tel'],
input[type='search'],
input[type='number'],
input:not([type]),
select,
textarea {
  width: 100%;
  min-height: var(--toque);
  padding: 0.75rem 1rem;
  border: 1px solid var(--linea-campo);
  border-radius: var(--radio-chico);
  background: var(--superficie);
  color: var(--tinta);
  font: inherit;
  line-height: 1.35;
  transition:
    border-color 0.2s var(--suave),
    box-shadow 0.2s var(--suave);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--marca-boton);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--marca-boton) 30%, transparent);
}
select {
  appearance: none;
  padding-right: 2.75rem;
  background: var(--superficie)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E")
    right 0.9rem center / 1.25rem no-repeat;
}
textarea {
  min-height: 6rem;
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: var(--tinta-3);
}
[aria-invalid='true'] {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 20%, transparent) !important;
}
.error-campo {
  color: var(--error);
  font-weight: 600;
  font-size: 0.95em;
}
.error-campo:empty {
  display: none;
}

.casilla {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: var(--toque);
  cursor: pointer;
  font-weight: 500;
}
.casilla input {
  width: 1.625rem;
  height: 1.625rem;
  margin: 0;
  accent-color: var(--marca-boton);
  flex: none;
}

/* ---------- Avisos ---------- */

.aviso {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.15rem;
  border-radius: var(--radio);
  background: var(--alerta-suave);
  color: var(--alerta);
}
.aviso p + p {
  margin-top: 0.3rem;
}
.aviso .icono {
  margin-top: 0.15rem;
}
.aviso-error {
  background: var(--error-suave);
  color: var(--error);
}
.aviso-ok {
  background: var(--ok-suave);
  color: var(--ok);
}
.aviso .acciones {
  margin-top: 0.75rem;
}
/* Los botones comunes, blancos sobre el aviso; el principal sigue lleno del
   color del negocio (si no, quedaba blanco con letras blancas). */
.aviso .boton:not(.boton-principal) {
  --fondo: rgb(255 255 255 / 0.75);
}

.etiqueta-chica {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--relleno);
  color: var(--tinta-2);
  font-size: 0.8em;
  font-weight: 600;
}
.etiqueta-verde {
  background: var(--ok-suave);
  color: var(--ok);
}
.etiqueta-no-hay {
  background: var(--error-suave);
  color: var(--error);
}

.tarjeta {
  background: var(--superficie);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
}

.bloque {
  margin-top: 1.5rem;
}

.cargando {
  display: grid;
  place-items: center;
  gap: 1rem;
  padding: 4rem 1rem;
  color: var(--tinta-2);
  text-align: center;
}
.cargando::before {
  content: '';
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 3px solid var(--linea);
  border-top-color: var(--tinta-2);
  animation: girar 0.8s linear infinite;
}
@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
