/* Pedir cita en la clínica: tratamiento(s) → especialista → día y hora → datos.
   Va en un <dialog> a pantalla completa en el móvil y como tarjeta en pantallas grandes. Usa los tokens de tema.css. */
dialog.ct{
  border:0; padding:0; margin:0; width:100%; max-width:none; height:100dvh; max-height:none;
  background:var(--bg); color:var(--text); font-family:var(--font-body);
}
dialog.ct[open]{display:flex; flex-direction:column; animation:ct-in .4s cubic-bezier(.16,1,.3,1);}
dialog.ct::backdrop{background:rgba(23,20,18,0.5); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);}
@keyframes ct-in{from{transform:translateY(24px); opacity:0;} to{transform:none; opacity:1;}}
@media (min-width:720px){
  dialog.ct{width:min(560px, calc(100% - 32px)); height:min(860px, calc(100dvh - 32px)); margin:auto; border-radius:30px; box-shadow:0 30px 80px rgba(23,20,18,0.35);}
}
@media (prefers-reduced-motion: reduce){ dialog.ct[open]{animation:none;} }
html.ct-open{overflow:hidden;}

/* cabecera: atrás · paso y título · cerrar */
.ct-head{
  flex-shrink:0; display:grid; grid-template-columns:44px 1fr 44px; align-items:center; gap:8px;
  padding:calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px; border-bottom:1px solid var(--line); background:var(--bg);
}
.ct-head .ct-titles{text-align:center; min-width:0;}
.ct-step{display:block; font-size:11px; font-weight:600; letter-spacing:0.18em; text-transform:uppercase; color:var(--accent);}
.ct-head h2{font-family:var(--font-display); font-weight:500; font-size:22px; line-height:1.1; margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.ct-icon-btn{
  width:44px; height:44px; border:0; border-radius:50%; background:var(--bg-soft); color:var(--text);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.ct-icon-btn svg{width:20px; height:20px;}
.ct-icon-btn[hidden]{visibility:hidden; display:flex;}

/* cuerpo: cada paso pinta aquí */
.ct-body{flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:16px 16px 24px; overscroll-behavior:contain;}
.ct-lead{font-size:14px; line-height:1.5; color:var(--muted); margin-bottom:14px;}

/* paso 1: categorías y servicios */
.ct-cats{display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; margin:0 -16px 12px; padding:2px 16px 6px;}
.ct-cats::-webkit-scrollbar{display:none;}
.ct-cat{
  flex-shrink:0; border:0; font:inherit; font-size:13px; font-weight:600; padding:9px 14px; border-radius:999px;
  background:var(--card); color:var(--muted); cursor:pointer; box-shadow:0 1px 0 var(--line);
}
.ct-cat[aria-pressed="true"]{background:var(--dark); color:#fff;}
.ct-cat .n{margin-left:6px; font-size:11px; padding:1px 6px; border-radius:999px; background:var(--accent); color:#fff;}
.ct-list{display:flex; flex-direction:column; gap:8px;}
.ct-svc{
  display:grid; grid-template-columns:1fr auto 34px; align-items:center; gap:12px; width:100%; text-align:left;
  border:0; font:inherit; color:inherit; padding:14px 14px 14px 16px; border-radius:18px; background:var(--card); cursor:pointer;
  box-shadow:0 1px 0 var(--line); transition:box-shadow .2s, transform .2s;
}
.ct-svc:active{transform:scale(0.99);}
.ct-svc b{display:block; font-size:15px; font-weight:600;}
.ct-svc small{display:block; font-size:13px; color:var(--muted); margin-top:2px; line-height:1.4;}
.ct-svc .meta{display:block; font-size:12px; color:var(--muted); margin-top:5px;}
.ct-svc .price{font-family:var(--font-display); font-size:19px; font-weight:500; white-space:nowrap;}
.ct-svc .price small{display:block; font-family:var(--font-body); font-size:10px; font-weight:600; letter-spacing:0.12em; text-transform:uppercase; color:var(--accent); text-align:right; margin:0;}
.ct-svc .add{
  width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:var(--bg-soft); color:var(--text); transition:background .2s, color .2s;
}
.ct-svc .add svg{width:16px; height:16px;}
.ct-svc[aria-pressed="true"]{box-shadow:0 0 0 2px var(--dark);}
.ct-svc[aria-pressed="true"] .add{background:var(--dark); color:#fff;}
.ct-svc[aria-pressed="true"] .add .plus{display:none;}
.ct-svc:not([aria-pressed="true"]) .add .tick{display:none;}
.ct-note{margin-top:14px; font-size:12px; line-height:1.5; color:var(--muted);}

/* paso 2: profesional */
.ct-pros{display:flex; flex-direction:column; gap:8px;}
.ct-pro{
  display:flex; align-items:center; gap:14px; width:100%; text-align:left; border:0; font:inherit; color:inherit;
  padding:14px 16px; border-radius:18px; background:var(--card); cursor:pointer; box-shadow:0 1px 0 var(--line);
}
.ct-pro[aria-pressed="true"]{box-shadow:0 0 0 2px var(--dark);}
.ct-pro .av{
  flex-shrink:0; width:48px; height:48px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-size:20px; font-weight:500; background:var(--accent-tint); color:var(--accent);
}
.ct-pro .av.any{background:var(--dark); color:#fff;}
.ct-pro .av svg{width:22px; height:22px;}
.ct-pro .av img{width:100%; height:100%; border-radius:50%; object-fit:cover; object-position:50% 25%;}
.ct-pro b{display:block; font-size:15px; font-weight:600;}
.ct-pro small{display:block; font-size:13px; color:var(--muted); margin-top:2px;}
.ct-pro .go{margin-left:auto; color:var(--muted);}
.ct-pro .go svg{width:18px; height:18px;}

/* paso 3: calendario del mes (como en Booksy), horas en fila y la cita tal como queda */
.ct-aviso{margin:0 0 14px;}
.ct-month{display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 2px 12px;}
.ct-month > span:first-child{font-family:var(--font-display); font-size:21px; font-weight:500; line-height:1.1;}
.ct-month-nav{display:flex; gap:8px;}
.ct-nav{
  width:40px; height:40px; border:0; border-radius:50%; background:var(--card); color:var(--text); cursor:pointer;
  display:flex; align-items:center; justify-content:center; box-shadow:0 1px 0 var(--line); transition:opacity .2s, transform .2s;
}
.ct-nav svg{width:18px; height:18px;}
.ct-nav.prev svg{transform:scaleX(-1);}
.ct-nav:active{transform:scale(0.94);}
.ct-nav:disabled{opacity:0.3; cursor:default;}
.ct-dow, .ct-grid{display:grid; grid-template-columns:repeat(7, 1fr); justify-items:center;}
.ct-dow{margin-bottom:8px; font-size:11px; font-weight:600; letter-spacing:0.04em; color:var(--muted);}
.ct-grid{row-gap:6px; touch-action:pan-y;}
.ct-grid.from-right{animation:ct-mes-r .3s cubic-bezier(.16,1,.3,1);}
.ct-grid.from-left{animation:ct-mes-l .3s cubic-bezier(.16,1,.3,1);}
@keyframes ct-mes-r{from{transform:translateX(20px); opacity:0;} to{transform:none; opacity:1;}}
@keyframes ct-mes-l{from{transform:translateX(-20px); opacity:0;} to{transform:none; opacity:1;}}
.ct-grid.loading{animation:ct-pulso 1.2s ease-in-out infinite;}
@keyframes ct-pulso{50%{opacity:0.45;}}
/* día sin hueco: aro apagado · con hueco: relleno y raya verde · pasado: tachado · elegido: oscuro */
.ct-day{
  position:relative; width:100%; max-width:46px; aspect-ratio:1; padding:0; border:0; border-radius:50%; font:inherit; line-height:1;
  display:flex; align-items:center; justify-content:center; background:transparent; color:var(--muted); cursor:pointer;
  box-shadow:inset 0 0 0 1px var(--line); transition:background .2s, color .2s, transform .15s;
}
.ct-day b{font-size:15px; font-weight:500;}
.ct-day:active{transform:scale(0.94);}
.ct-day:disabled{cursor:default; opacity:0.5; transform:none;}
.ct-day.past b{text-decoration:line-through;}
.ct-day.free{background:var(--card); color:var(--text); box-shadow:0 1px 0 var(--line);}
.ct-day.free b{font-weight:600; transform:translateY(-3px);}
.ct-day.free::after{
  content:''; position:absolute; left:50%; bottom:20%; width:14px; height:3px; margin-left:-7px; border-radius:3px; background:var(--ct-free, var(--ok, #2f7a4f));
}
.ct-day.today{box-shadow:inset 0 0 0 1.5px var(--accent-soft);}
.ct-day[aria-pressed="true"]{background:var(--dark); color:#fff; box-shadow:none;}
.ct-day[aria-pressed="true"]::after{background:#7ddba3;}
@media (min-width:720px){ .ct-day{max-width:50px;} .ct-grid{row-gap:8px;} }

.ct-when{margin-top:18px; padding-top:16px; border-top:1px solid var(--line); scroll-margin-bottom:8px;}
.ct-when-head{display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:36px; margin:0 2px 12px;}
.ct-date{font-size:15px; font-weight:600; min-width:0;}
.ct-turnos{flex-shrink:0; display:flex; padding:3px; border-radius:999px; background:var(--bg-soft);}
.ct-turno{border:0; font:inherit; font-size:13px; font-weight:600; padding:7px 14px; border-radius:999px; background:transparent; color:var(--muted); cursor:pointer;}
.ct-turno[aria-pressed="true"]{background:var(--card); color:var(--text); box-shadow:0 1px 2px rgba(0,0,0,0.08);}
.ct-slots{
  position:relative; display:flex; gap:8px; overflow-x:auto; scrollbar-width:none; margin:0 -16px 14px; padding:2px 16px 6px;
  scroll-snap-type:x proximity; scroll-padding:0 16px; overscroll-behavior-x:contain;
}
.ct-slots::-webkit-scrollbar{display:none;}
.ct-slot{
  flex:0 0 auto; min-width:78px; scroll-snap-align:start; border:0; font:inherit; font-size:15px; font-weight:600; padding:13px 0; border-radius:999px;
  background:var(--card); color:var(--text); cursor:pointer; box-shadow:0 1px 0 var(--line); transition:background .2s, color .2s;
}
.ct-slot[aria-pressed="true"]{background:var(--dark); color:#fff;}
/* con ratón no hay dedo que deslice la fila: las horas caen en varias líneas */
@media (hover:hover) and (pointer:fine){ .ct-slots{flex-wrap:wrap; overflow:visible; margin:0 0 14px; padding:0;} }
.ct-cita{margin-bottom:0; padding:6px 16px;}
.ct-cita-row{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 0;}
.ct-cita-row + .ct-cita-row{border-top:1px solid var(--line);}
.ct-cita-row b{display:block; font-size:15px; font-weight:600;}
.ct-cita-row small{display:block; margin-top:3px; font-size:13px; color:var(--muted);}
.ct-cita-row .r{flex-shrink:0; text-align:right; white-space:nowrap;}
.ct-cita-row.pro{align-items:center;}
.ct-cita-row .who{display:flex; align-items:center; gap:10px; min-width:0; font-size:14px; font-weight:600;}
.ct-cita-row .av{
  flex-shrink:0; width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-size:15px; font-weight:500; background:var(--accent-tint); color:var(--accent);
}
.ct-cita-row .av.any{background:var(--dark); color:#fff;}
.ct-cita-row .av svg{width:16px; height:16px;}
.ct-cita-row .av img{width:100%; height:100%; border-radius:50%; object-fit:cover; object-position:50% 25%;}
.ct-mini{flex-shrink:0; border:0; font:inherit; font-size:13px; font-weight:600; padding:8px 14px; border-radius:999px; background:var(--bg-soft); color:var(--text); cursor:pointer;}
.ct-none{padding:26px 18px 22px; border-radius:18px; background:var(--card); text-align:center; box-shadow:0 1px 0 var(--line);}
.ct-none .ico{width:52px; height:52px; margin:0 auto 12px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--accent-tint); color:var(--accent);}
.ct-none .ico svg{width:24px; height:24px;}
.ct-none b{display:block; font-family:var(--font-display); font-size:20px; font-weight:500; line-height:1.15;}
.ct-none p{margin-top:6px; font-size:14px; line-height:1.45; color:var(--muted);}
.ct-none .acts{display:flex; flex-direction:column; gap:8px; margin-top:16px;}
.ct-none .ct-btn{height:44px; padding:0 18px; font-size:14px;}
a.ct-btn{display:inline-flex; align-items:center; justify-content:center; text-decoration:none;}
@media (prefers-reduced-motion: reduce){ .ct-grid.from-right, .ct-grid.from-left, .ct-grid.loading{animation:none;} }
.ct-empty{padding:22px 18px; border-radius:18px; background:var(--card); font-size:14px; line-height:1.5; color:var(--muted); text-align:center;}
.ct-empty a{color:var(--text); font-weight:600;}

/* paso 4: resumen y datos */
.ct-sum{background:var(--card); border-radius:18px; padding:14px 16px; margin-bottom:16px; box-shadow:0 1px 0 var(--line);}
.ct-sum-row{display:flex; justify-content:space-between; gap:12px; font-size:14px; padding:6px 0;}
.ct-sum-row + .ct-sum-row{border-top:1px solid var(--line);}
.ct-sum-row span:last-child{white-space:nowrap; font-weight:600;}
.ct-sum-row.total{font-family:var(--font-display); font-size:18px;}
.ct-sum-row.total span:last-child{font-weight:500;}
.ct-sum-row .muted{color:var(--muted); font-weight:400; font-size:13px;}
.ct-field{margin-bottom:12px;}
.ct-field label{display:block; margin:0 4px 6px; font-size:11px; font-weight:600; letter-spacing:0.12em; text-transform:uppercase; color:var(--muted);}
.ct-field input, .ct-field textarea{
  width:100%; border:0; outline:none; font:inherit; font-size:16px; color:var(--text);
  background:var(--card); border-radius:14px; padding:14px 16px; box-shadow:0 1px 0 var(--line);
}
.ct-field textarea{min-height:80px; resize:vertical;}
.ct-field input:focus, .ct-field textarea:focus{box-shadow:0 0 0 2px var(--dark);}
.ct-field.invalid input{box-shadow:0 0 0 2px #c2452d;}
.ct-err{display:none; margin:6px 4px 0; font-size:12px; color:#c2452d;}
.ct-field.invalid .ct-err{display:block;}
.ct-check{display:flex; align-items:flex-start; gap:10px; margin:4px 2px 12px; font-size:13px; line-height:1.45; color:var(--muted);}
.ct-check input{flex-shrink:0; width:20px; height:20px; margin-top:1px; accent-color:var(--dark);}
.ct-check a{color:var(--text);}
.ct-check.invalid{color:#c2452d;}
.ct-hp{position:absolute; left:-9999px; width:1px; height:1px; opacity:0;}
.ct-error{margin-top:10px; font-size:13px; color:#c2452d; text-align:center;}

/* pie fijo: resumen de lo elegido + botón */
.ct-foot{
  flex-shrink:0; display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px); border-top:1px solid var(--line); background:var(--bg);
}
.ct-foot[hidden]{display:none;}
.ct-foot .info{min-width:0; font-size:13px; color:var(--muted); line-height:1.35;}
.ct-foot .info b{display:block; font-size:15px; color:var(--text); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.ct-btn{
  flex-shrink:0; border:0; font:inherit; font-size:15px; font-weight:600; padding:0 22px; height:50px; border-radius:999px;
  background:var(--dark); color:#fff; cursor:pointer; transition:opacity .2s;
}
.ct-btn:disabled{opacity:0.35; cursor:default;}
.ct-btn.full{width:100%;}
.ct-btn.ghost{background:var(--bg-soft); color:var(--text);}

/* confirmación */
.ct-done{text-align:center; padding:26px 6px 10px;}
.ct-done .tick{
  width:72px; height:72px; margin:0 auto 16px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:var(--accent-tint); color:var(--accent);
}
.ct-done .tick svg{width:34px; height:34px;}
.ct-done h3{font-family:var(--font-display); font-weight:500; font-size:32px; line-height:1.05;}
.ct-done p{margin-top:10px; font-size:15px; line-height:1.5; color:var(--muted);}
.ct-done p b{color:var(--text); font-weight:600;}
.ct-done .ct-sum{text-align:left; margin-top:18px;}
.ct-done .actions{display:flex; flex-direction:column; gap:8px; margin-top:16px;}
.ct-demo{
  display:inline-block; margin-top:14px; font-size:10px; font-weight:700; letter-spacing:0.12em; text-transform:uppercase;
  padding:5px 10px; border-radius:999px; background:var(--accent-tint); color:var(--accent);
}
