/* =====================================================================
   Estilos de la app · Sistema de diseño «Glass Mint»
   cream 60 % · green 30 % · mint 10 % · cristal esmerilado sobre manchas
   ===================================================================== */
:root {
  --cream: #FFFBF2; --green: #187D5C; --mint: #6ACFB6;
  --surface: #FFFBF2; --surface-raised: #FFFFFF;
  --ink: #0F3D2E; --ink-muted: #3F6458;
  --on-green: #FFFBF2; --on-mint: #0F3D2E; --accent-text: #187D5C;
  --glass-fill: rgba(255, 251, 242, 0.55);
  --glass-fill-strong: rgba(255, 251, 242, 0.78);
  --glass-tint-green: rgba(24, 125, 92, 0.16);
  --glass-tint-mint: rgba(106, 207, 182, 0.30);
  --glass-border: rgba(255, 255, 255, 0.75);
  --line: rgba(15, 61, 46, 0.14);
  --line-control: rgba(15, 61, 46, 0.38);
  --blob-green: #187D5C; --blob-mint: #6ACFB6;
  --focus-ring: #187D5C; --danger: #B3261E;
  --font-display: Coolvetica, "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-body: Sanseriffic, Quicksand, "Varela Round", system-ui, sans-serif;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  --radius-sm: 10px; --radius-md: 16px; --radius-lg: 24px; --radius-xl: 32px; --radius-pill: 999px;
  --blur-glass: 18px; --blur-glass-strong: 28px; --blur-blob: 60px;
  --shadow-glass: 0 8px 32px rgba(15, 61, 46, 0.12);
  --shadow-glass-lg: 0 20px 60px rgba(15, 61, 46, 0.18);
  --nav-h: 72px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  font-family: var(--font-body); font-weight: 500; font-size: 16px; line-height: 24px;
  background: var(--surface); color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; }
a { color: var(--accent-text); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- Fondo con manchas (obligatorio detrás del cristal) */
.fondo { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--surface); pointer-events: none; }
.fondo::before, .fondo::after { content: ""; position: absolute; border-radius: 50%; filter: blur(var(--blur-blob)); }
.fondo::before { width: 340px; height: 340px; background: var(--blob-green); opacity: .45; top: -140px; left: -110px; }
.fondo::after { width: 320px; height: 320px; background: var(--blob-mint); opacity: .7; bottom: -120px; right: -110px; }

/* ---- Estructura */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding: 0 var(--space-4) calc(var(--nav-h) + var(--space-8) + env(safe-area-inset-bottom)); }
.cabecera {
  display: flex; align-items: center; gap: var(--space-3);
  padding: calc(var(--space-4) + env(safe-area-inset-top)) 0 var(--space-4);
}
.cabecera .marca-img { width: 40px; height: 40px; border-radius: 12px; box-shadow: var(--shadow-glass); }
.cabecera .marca-nombre { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; line-height: 1.1; }
.cabecera .marca-sub { font-size: 13px; color: var(--ink-muted); line-height: 1.2; }
.cabecera .espacio { flex: 1; }
main:focus { outline: none; }
.vista { display: flex; flex-direction: column; gap: var(--space-6); animation: entra .25s ease; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .vista { animation: none; } * { transition: none !important; } }

/* ---- Tipografía */
.t-display { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1.02; letter-spacing: -.03em; margin: 0; }
.t-heading { font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.1; letter-spacing: -.025em; margin: 0; }
.t-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 26px; letter-spacing: -.02em; margin: 0; }
.t-label { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 20px; }
.eyebrow { font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 var(--space-2); }
.texto-suave { color: var(--ink-muted); margin: 0; }
.pequeno { font-size: 14px; line-height: 20px; }
p { margin: 0; }

/* ---- Cristal */
.glass {
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(140%);
  backdrop-filter: blur(var(--blur-glass)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
}
.glass-fuerte { background: var(--glass-fill-strong); }
.tarjeta { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.tarjeta-compacta { padding: var(--space-4) var(--space-5); }
.bloque-verde { background: var(--green); color: var(--on-green); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-glass); }
.bloque-verde .texto-suave { color: var(--on-green); }
.bloque-verde .eyebrow { color: var(--on-green); }

/* ---- Botones (píldora, ≥ 48 px de alto para el dedo) */
.btn {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: var(--space-3) var(--space-6); border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--green); color: var(--on-green); box-shadow: var(--shadow-glass); }
.btn-accent { background: var(--mint); color: var(--on-mint); }
.btn-glass { background: var(--glass-fill-strong); color: var(--ink); border-color: var(--glass-border);
  -webkit-backdrop-filter: blur(var(--blur-glass)); backdrop-filter: blur(var(--blur-glass)); box-shadow: 0 2px 10px rgba(15,61,46,.06); }
.btn-glass:hover { background: var(--glass-tint-mint); }
.btn-borde { background: transparent; color: var(--accent-text); border-color: var(--line-control); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-texto-peligro { background: transparent; color: var(--danger); border-color: rgba(179,38,30,.35); }
.btn-bloque { width: 100%; }
.btn-grande { min-height: 56px; font-size: 17px; }
.btn-icono { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--glass-border);
  background: var(--glass-fill-strong); color: var(--ink); cursor: pointer; flex: none; }
.btn .ico, .btn-icono .ico { width: 20px; height: 20px; }
.fila-botones { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.fila-botones > .btn { flex: 1 1 140px; }
.acciones-rapidas { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.accion { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-2);
  text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 13px; text-align: center; }
.accion .circulo { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-tint-green); color: var(--green); }
.accion .ico { width: 22px; height: 22px; }

/* ---- Badges / chips */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); font-family: var(--font-display); font-weight: 700;
  font-size: 12px; line-height: 16px; padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border); color: var(--ink); white-space: nowrap; }
.badge-mint { background: var(--glass-tint-mint); }
.badge-green { background: var(--glass-tint-green); }
.badge-solid { background: var(--green); color: var(--on-green); border-color: transparent; }
.badge-gris { background: rgba(15,61,46,.07); color: var(--ink-muted); }
.badge-peligro { background: rgba(179,38,30,.1); color: var(--danger); border-color: rgba(179,38,30,.25); }
.badge .ico { width: 14px; height: 14px; }

.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip { min-height: 44px; padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  background: var(--glass-fill-strong); border: 1px solid var(--line); color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--green); color: var(--on-green); border-color: var(--green); }

/* ---- Navegación inferior de cristal */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  width: min(528px, calc(100% - 2 * var(--space-4))); height: var(--nav-h); z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr); padding: var(--space-2);
  background: var(--glass-fill-strong);
  -webkit-backdrop-filter: blur(var(--blur-glass-strong)) saturate(140%); backdrop-filter: blur(var(--blur-glass-strong)) saturate(140%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-glass-lg);
}
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: var(--ink-muted); font-family: var(--font-display); font-weight: 700; font-size: 12px; border-radius: var(--radius-lg); }
.nav a .ico { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--on-green); background: var(--green); }

/* ---- Formularios */
.campo { display: flex; flex-direction: column; gap: var(--space-1); }
.campo label, .etiqueta { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); }
.campo .opcional { font-family: var(--font-body); font-weight: 500; color: var(--ink-muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; font-size: 16px; color: var(--ink);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
  background: var(--glass-fill-strong); border: 1px solid var(--line-control);
}
textarea.input { min-height: 88px; resize: vertical; }
.input::placeholder { color: var(--ink-muted); opacity: .85; }
.input:focus { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.ayuda { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ayuda-error { font-size: 13px; line-height: 18px; color: var(--danger); font-weight: 600; }
.error-form { color: var(--danger); font-weight: 600; background: rgba(179,38,30,.08); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); margin: 0; }
.check { display: flex; gap: var(--space-3); align-items: flex-start; font-size: 14px; line-height: 20px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); flex: none; margin: 0; }
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.interruptor input { width: 22px; height: 22px; accent-color: var(--green); }

/* ---- Servicios */
.lista { display: flex; flex-direction: column; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.servicio { width: 100%; text-align: left; cursor: pointer; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); }
.servicio .nombre { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 22px; letter-spacing: -.01em; }
.servicio .desc { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.servicio .meta { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-1); flex-wrap: wrap; }
.servicio .precio { margin-left: auto; text-align: right; font-family: var(--font-display); font-weight: 800; font-size: 18px; white-space: nowrap; }
.servicio[aria-pressed="true"] { background: var(--glass-tint-green); border-color: var(--green); }
.servicio .info { flex: 1; min-width: 0; }

/* ---- Pasos de la reserva */
.pasos { display: flex; gap: var(--space-2); }
.pasos span { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--line); }
.pasos span.hecho { background: var(--green); }
.pasos span.actual { background: var(--mint); }
.resumen-sel { display: flex; align-items: center; gap: var(--space-3); }
.resumen-sel .info { flex: 1; }

/* Tira de días */
.dias { display: flex; gap: var(--space-2); overflow-x: auto; scroll-snap-type: x mandatory; padding: var(--space-1) var(--space-1) var(--space-3); margin: 0 calc(-1 * var(--space-1)); scrollbar-width: thin; }
.dia { flex: 0 0 64px; scroll-snap-align: start; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--glass-fill-strong); cursor: pointer; padding: var(--space-2) 0; }
.dia .dsem { font-size: 12px; font-weight: 600; text-transform: capitalize; color: var(--ink-muted); }
.dia .dnum { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; }
.dia .dmes { font-size: 12px; text-transform: lowercase; color: var(--ink-muted); }
.dia[aria-pressed="true"] { background: var(--green); color: var(--on-green); border-color: var(--green); }
.dia[aria-pressed="true"] .dsem, .dia[aria-pressed="true"] .dmes { color: var(--on-green); }
.dia:disabled { opacity: .38; cursor: not-allowed; text-decoration: line-through; }

.horas { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--space-2); }
.hora { min-height: 48px; border-radius: var(--radius-pill); border: 1px solid var(--line-control); background: var(--glass-fill-strong);
  font-family: var(--font-display); font-weight: 700; font-size: 16px; cursor: pointer; color: var(--ink); }
.hora[aria-pressed="true"] { background: var(--green); color: var(--on-green); border-color: var(--green); }
.grupo-horas { display: flex; flex-direction: column; gap: var(--space-2); }

/* Barra fija de acción */
.barra-accion { position: sticky; bottom: calc(var(--nav-h) + var(--space-5) + env(safe-area-inset-bottom)); z-index: 5; padding: var(--space-3);
  border-radius: var(--radius-xl); }

/* ---- Cita */
.ticket { display: flex; flex-direction: column; gap: var(--space-4); }
.codigo { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: .14em; }
.filas-dato { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; }
.fila-dato { display: flex; gap: var(--space-3); align-items: flex-start; }
.fila-dato .ico { width: 22px; height: 22px; color: var(--green); flex: none; margin-top: 1px; }
.fila-dato .dt { font-size: 13px; color: var(--ink-muted); line-height: 18px; }
.fila-dato .dd { margin: 0; font-weight: 600; }
.ok-circulo { width: 64px; height: 64px; border-radius: 50%; background: var(--mint); color: var(--on-mint); display: grid; place-items: center; }
.ok-circulo .ico { width: 34px; height: 34px; stroke-width: 2.25; }

.cita-item { display: flex; gap: var(--space-4); align-items: center; text-decoration: none; color: var(--ink); padding: var(--space-4) var(--space-5); }
.cita-item .fecha-caja { width: 56px; flex: none; text-align: center; border-radius: var(--radius-md); background: var(--glass-tint-green); padding: var(--space-2) 0; }
.cita-item .fecha-caja .n { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; }
.cita-item .fecha-caja .m { font-size: 12px; text-transform: uppercase; font-weight: 700; color: var(--ink-muted); }
.cita-item .info { flex: 1; min-width: 0; }
.cita-item .ico { width: 20px; height: 20px; color: var(--ink-muted); }

/* ---- Horario */
.horario { width: 100%; border-collapse: collapse; }
.horario td { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.horario tr:last-child td { border-bottom: 0; }
.horario td:last-child { text-align: right; font-weight: 600; }
.horario tr.hoy td { color: var(--accent-text); font-weight: 700; }
.estado-abierto { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.estado-abierto::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(106,207,182,.35); }
.estado-abierto.cerrado::before { background: var(--ink-muted); box-shadow: none; opacity: .5; }

.aviso { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4) var(--space-5); background: var(--glass-tint-mint); }
.aviso .ico { width: 22px; height: 22px; flex: none; color: var(--green); }

.vacio { text-align: center; padding: var(--space-8) var(--space-6); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.vacio .ico { width: 40px; height: 40px; color: var(--green); }

/* ---- Cargando */
.cargando { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-8); color: var(--ink-muted); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--glass-tint-green); border-top-color: var(--green); animation: gira 0.8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.esqueleto { height: 72px; border-radius: var(--radius-lg); background: linear-gradient(90deg, rgba(15,61,46,.05), rgba(15,61,46,.1), rgba(15,61,46,.05)); background-size: 200% 100%; animation: brillo 1.2s infinite; }
@keyframes brillo { to { background-position: -200% 0; } }

/* ---- Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--space-8) + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  max-width: min(480px, calc(100% - 32px)); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); z-index: 100;
  background: var(--ink); color: var(--cream); font-weight: 600; box-shadow: var(--shadow-glass-lg); opacity: 0; pointer-events: none; transition: all .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---- Modales */
dialog.modal { border: 0; padding: 0; background: transparent; width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); color: var(--ink); }
dialog.modal::backdrop { background: rgba(15, 61, 46, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-cuerpo { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4);
  box-shadow: var(--shadow-glass-lg); border: 1px solid var(--glass-border); max-height: calc(100dvh - 24px); overflow: auto; }
.modal-cabecera { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.modal-contenido { display: flex; flex-direction: column; gap: var(--space-4); }

/* ---- Gestión */
.pestanas { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-1); }
.pestanas a { flex: none; min-height: 44px; display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill); text-decoration: none; color: var(--ink); background: var(--glass-fill-strong); border: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.pestanas a[aria-current="page"] { background: var(--green); color: var(--on-green); border-color: var(--green); }
.pestanas .ico { width: 18px; height: 18px; }
.nav-fecha { display: flex; align-items: center; gap: var(--space-2); }
.nav-fecha .centro { flex: 1; text-align: center; }
.agenda-item { display: flex; gap: var(--space-4); padding: var(--space-4) var(--space-5); align-items: flex-start; }
.agenda-item .hora-col { font-family: var(--font-display); font-weight: 800; font-size: 18px; min-width: 56px; line-height: 1.2; }
.agenda-item .hora-col small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 13px; color: var(--ink-muted); }
.agenda-item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.agenda-item.inactiva { opacity: .6; }
.agenda-item.bloqueo { background: repeating-linear-gradient(135deg, rgba(15,61,46,.04) 0 10px, transparent 10px 20px), var(--glass-fill); }
.agenda-item .acciones { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.agenda-item .acciones .btn { min-height: 40px; padding: var(--space-2) var(--space-4); font-size: 13px; }
.resumen-dia { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.fila-admin { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.fila-admin .info { flex: 1; min-width: 0; }
.tramo { display: inline-flex; align-items: center; gap: var(--space-1); }
.tramo button { border: 0; background: none; cursor: pointer; color: var(--danger); padding: 4px; min-width: 32px; min-height: 32px; display: grid; place-items: center; }
.tramo .ico { width: 16px; height: 16px; }
.separador { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Accesibilidad: menos transparencia */
@media (prefers-reduced-transparency: reduce) {
  .glass, .btn-glass, .input, .nav, .dia, .hora, .chip { background: var(--surface-raised); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (min-width: 720px) {
  .t-display { font-size: 52px; }
  .app { padding-top: var(--space-4); }
}
