:root {
    --font-display: 'Fraunces', serif;
    --font-body: 'Work Sans', sans-serif;
    --paper: #F5F2EA;
    --paper-2: #ECE5D5;
    --ink: #1E2A38;
    --ink-soft: #5C6A78;
    --accent: #065A82;
    --success: #02C39A;
    --danger: #A6362C;
    --line: #D8D0BE;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    min-height: 100%;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
  }

  body {
    display: flex;
    justify-content: center;
    padding: 32px 16px 64px;
    background-image:
      radial-gradient(circle, rgba(30,42,56,0.06) 1px, transparent 1px);
    background-size: 18px 18px;
  }

  .ticket {
    width: 100%;
    max-width: 440px;
    background: #FFFFFF;
    border-radius: 18px 18px 4px 4px;
    box-shadow: 0 1px 0 rgba(30,42,56,0.04);
    border: 1px solid var(--line);
    overflow: hidden;
  }

  .ticket-header {
    padding: 28px 28px 20px;
    border-bottom: 1px dashed var(--line);
  }

  .comercio-nombre {
    font-size: 13px;
    color: var(--ink-soft);
    margin: 0 0 6px;
    min-height: 16px;
  }

  .comercio-direccion {
    font-size: 12px;
    color: var(--ink-soft);
    margin: -4px 0 6px;
  }

  .titulo {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 28px;
    margin: 0;
    line-height: 1.15;
  }

  .progress-wrap {
    padding: 16px 28px 0;
  }

  .progress-track {
    height: 3px;
    border-radius: 2px;
    background: repeating-linear-gradient(
      to right, var(--line) 0 6px, transparent 6px 10px
    );
    position: relative;
    overflow: hidden;
  }

  .progress-fill {
    height: 100%;
    background: var(--accent);
    width: 20%;
    transition: width 0.35s ease;
  }

  .paso-label {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 500;
  }

  .panel { padding: 20px 28px 28px; }
  .hidden { display: none !important; }
  .panel.hidden { display: none; }

  .lista {
    display: flex;
    flex-direction: column;
    margin: 4px 0 24px;
    border-top: 1px dashed var(--line);
  }

  .opcion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 14px 4px;
    border: none;
    border-bottom: 1px dashed var(--line);
    background: none;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    cursor: pointer;
  }

  .opcion:hover { background: color-mix(in srgb, var(--accent) 6%, white); }

  .opcion.seleccionada {
    background: color-mix(in srgb, var(--accent) 10%, white);
  }

  .opcion .meta {
    font-size: 13px;
    color: var(--ink-soft);
  }

  .horarios-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 4px 0 24px;
  }

  .hora-btn {
    padding: 10px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    color: var(--ink);
  }

  .hora-btn:hover { border-color: var(--accent); }

  .hora-btn.seleccionada {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .calendario { margin: 4px 0 4px; }
  .calendario-encabezado, .calendario-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
  }
  .calendario-encabezado span {
    text-align: center;
    font-size: 11px;
    color: var(--ink-soft);
    font-weight: 600;
    padding-bottom: 4px;
  }
  .calendario-grid { margin-top: 4px; }

  .dia-chip {
    aspect-ratio: 1;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink);
  }
  .dia-chip.vacio { visibility: hidden; cursor: default; border: none; }
  .dia-chip:hover:not(.deshabilitado) { border-color: var(--accent); }
  .dia-chip.seleccionado { background: var(--accent); border-color: var(--accent); color: #fff; }
  .dia-chip.deshabilitado { opacity: 0.3; cursor: not-allowed; background: var(--fondo, #F4F5F7); }

  label {
    display: block;
    font-size: 13px;
    color: var(--ink-soft);
    margin: 16px 0 6px;
  }

  label:first-of-type { margin-top: 0; }

  input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="time"] {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    background: #fff;
  }

  input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
  }

  .explicacion {
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 14px 0 0;
    padding: 12px 14px;
    background: var(--paper);
    border-radius: 8px;
  }

  .btn-primario {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }

  .btn-primario:disabled {
    background: var(--line);
    color: var(--ink-soft);
    cursor: not-allowed;
  }

  .btn-secundario {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
  }

  .mensaje-error {
    font-size: 13px;
    color: var(--danger);
    margin-top: 10px;
    min-height: 16px;
  }

  .stub {
    border-top: 2px dashed var(--line);
    margin-top: 8px;
    padding-top: 20px;
  }

  .resumen-cita {
    background: var(--paper);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
  }

  .resumen-cita .servicio {
    font-family: var(--font-display);
    font-size: 20px;
    margin: 0 0 4px;
  }

  .resumen-cita .fecha-hora {
    font-size: 14px;
    color: var(--ink-soft);
    margin: 0;
  }

  .confirmacion-icono {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
  }

  .nota-gestion {
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.5;
    margin-top: 18px;
  }

  .estado-carga, .estado-vacio {
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    padding: 40px 20px;
  }

input { max-width: 100%; }

/* ---------- Campos de texto en celulares y tabletas ---------- */

/* iPhone y iPad hacen zoom automático al tocar un campo con letra menor a
   16px, y luego no regresan solos a su tamaño. En pantallas táctiles todos
   los campos usan 16px. Lleva !important porque varios <textarea> traen el
   tamaño escrito directo en el HTML. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* Safari de iPhone/iPad trata los campos de fecha y hora como un componente
   propio: ignora el ancho que se le pide (se salía de su tarjeta) y centra el
   texto. Aquí se les obliga a portarse como cualquier otro campo. */
@supports (-webkit-touch-callout: none) {
  input[type="date"], input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    text-align: left;
  }
  input[type="date"]::-webkit-date-and-time-value,
  input[type="time"]::-webkit-date-and-time-value { text-align: left; }
}
