/* Clínica Dental Santa Librada — ronda 6: agenda de citas (demo). Se carga al final, en la web y en el panel.
   Sin animación ligada al scroll; lo poco que se mueve va dentro de prefers-reduced-motion: no-preference. */

/* ---------- Aviso de demostración (visible, discreto) ---------- */
.demo-nota { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; font-weight: 600; line-height: 1.35; color: #5A4310; background: #FFF6E3; border: 1px solid #F3D9A8; border-radius: 10px; padding: 8px 12px; }
.demo-nota svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.demo-nota-osc { color: #fff; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); margin-top: 14px; }

/* =====================================================================
   WEB — agenda del paciente
   ===================================================================== */
.r-form { display: grid; gap: 26px; }
.r-form[hidden], .r-listo[hidden], .par[hidden], .hoja-fondo[hidden], .tostada[hidden] { display: none; }
.opc .opc-dur { font-size: .76rem; font-weight: 600; opacity: .72; }
.paso .ayuda:empty { display: none; }

/* calendario mensual */
.cal { margin-inline: -6px; }
.cal-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-mes { font-family: var(--titulo); font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; }
.cal-mes::first-letter { text-transform: uppercase; }
.cal-nav { width: 46px; height: 46px; flex: none; display: grid; place-items: center; background: #fff; color: var(--marino); border: 1px solid var(--linea); border-radius: 12px; }
.cal-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-sem, .cal-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-sem span { text-align: center; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #52628A; padding: 4px 0 6px; }
.cal-d { min-height: 48px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1; color: var(--tinta); background: transparent; border: 1px solid transparent; border-radius: 12px; transition: background-color .15s, color .15s, border-color .15s; }
.cal-d b { font-size: 1.02rem; font-weight: 600; }
.cal-d small { font-size: .58rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.cal-d:disabled { cursor: default; }
.cal-d[data-e="libre"] { background: #fff; border-color: #9DB7DA; box-shadow: 0 2px 6px rgba(20, 38, 74, .08); }
.cal-d[data-e="libre"] b { font-weight: 800; }
.cal-d[data-e="libre"]:hover { background: var(--hielo2); }
.cal-d[data-e="lleno"] { background: #FFF4DF; border-color: #F3D9A8; color: #7A5310; }
.cal-d[data-e="lleno"] b { text-decoration: line-through; }
.cal-d[data-e="cerrado"], .cal-d[data-e="bloqueado"] { background: #EDF1F6; color: #7F8BA3; }
.cal-d[data-e="pasado"], .cal-d[data-e="fuera"] { color: #A3ADC0; }
.cal-d.cal-hoy { outline: 2px solid var(--naranja); outline-offset: -2px; }
.cal-d[aria-pressed="true"] { background: var(--marino); border-color: var(--marino); color: #fff; box-shadow: none; }
.cal-ley { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 6px 0; padding: 0; font-size: .84rem; font-weight: 600; color: #33446A; }
.cal-ley li { display: flex; align-items: center; gap: 6px; }
.cal-ley i { width: 18px; height: 18px; border-radius: 6px; border: 1px solid; }
.ley-libre { background: #fff; border-color: #9DB7DA !important; }
.ley-lleno { background: #FFF4DF; border-color: #F3D9A8 !important; }
.ley-cerrado { background: #EDF1F6; border-color: #EDF1F6 !important; }

/* horas */
.horas-tit { font-weight: 700; font-size: .98rem; margin-bottom: 4px; }
.horas-tit::first-letter { text-transform: uppercase; }
.horas:empty { display: none; }
.hora { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.1; padding: 4px 2px; }
.hora small { font-size: .62rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.hora.hora-no, .hora.hora-no:hover { background: #EDF1F6; border-color: #EDF1F6; color: #6F7C96; cursor: default; translate: none; }

/* datos y privacidad */
.campos { display: grid; gap: 14px; }
@media (min-width: 560px) { .campos { grid-template-columns: 1fr 1fr; } }
.privacidad { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: .88rem; line-height: 1.4; color: #44557A; }
.privacidad svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn-naranja { background: var(--naranja); color: var(--marino); }
.resumen .btn-naranja { box-shadow: none; }

/* confirmación */
.r-listo { display: grid; gap: 14px; outline: none; }
.listo-chk { width: 56px; height: 56px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.listo-chk circle { fill: #0F7B5F; }
.listo-chk path { stroke: #fff; stroke-width: 5; }
.r-listo h3 { font-size: 1.55rem; line-height: 1.15; }
.listo-sub { color: #33446A; }
.listo-datos { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; padding: 14px 16px; background: var(--hielo); border: 1px solid var(--linea); border-radius: 14px; }
.listo-datos dt { font-size: .76rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #52628A; align-self: center; }
.listo-datos dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.listo-datos dd::first-letter { text-transform: uppercase; }
#r-otra { justify-self: center; }
.listo-demo { text-align: center; font-size: .88rem; border-top: 1px dashed var(--linea); padding-top: 6px; }
.listo-demo a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: #52628A; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .r-listo:not([hidden]) { animation: listo-entra .4s ease both; }
  @keyframes listo-entra { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
}

/* =====================================================================
   PANEL — agenda de la clínica
   ===================================================================== */
body.pan { background: #F3F6FB; }
body.con-hoja { overflow: hidden; }
.pan .pag { padding-top: 16px; padding-bottom: 96px; }
.pan-cab { background: linear-gradient(160deg, #14264A, #1D3B73); color: #fff; border-radius: 20px; padding: 22px 18px 18px; --foco: var(--naranja); }
.pan-cab .antet { color: #fff; }
.pan .pag h1 { font-size: clamp(1.7rem, 7.4vw, 2.4rem); margin: 6px 0 8px; }
.pan-cab .bajada { color: #DCE6F5; font-size: 1rem; }
.pan-cab .bajada::first-letter { text-transform: uppercase; }

.pan .cifras { margin-top: 12px; gap: 8px; }
.pan .cifra { appearance: none; font: inherit; font-weight: 700; font-size: .84rem; line-height: 1.2; color: var(--tinta); cursor: pointer; min-height: 76px; padding: 10px 6px; border-radius: 16px; box-shadow: none; background: #fff; }
.pan .cifra b { font-size: 2rem; margin-bottom: 2px; }
.pan .cifra:first-child b { color: #B56A00; }

.pan-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pan-acc .btn { min-height: 50px; padding: 8px 10px; font-size: .98rem; gap: 6px; }

.tabs { position: sticky; top: 64px; z-index: 40; display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 4px; margin: 14px -4px 0; padding: 4px; background: #E1E8F2; border-radius: 14px; box-shadow: 0 0 0 6px #F3F6FB; }
.tab { min-height: 46px; padding: 4px 6px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; font-size: .98rem; color: #33446A; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tab[aria-pressed="true"] { background: #fff; color: var(--marino); box-shadow: 0 2px 8px rgba(20, 38, 74, .14); }
.tab-n { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--naranja); color: var(--marino); font-size: .8rem; font-weight: 800; display: inline-grid; place-items: center; }
.tab-n[hidden] { display: none; }

.vista { margin-top: 18px; }
.vista[hidden] { display: none; }
.vista h2 { font-size: 1.3rem; line-height: 1.2; letter-spacing: -.02em; }
.vista h2::first-letter { text-transform: uppercase; }
.vista-sub { font-size: .94rem; color: #44557A; margin: 4px 0 12px; }
.nav-dia { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-dia h2 { flex: 1; text-align: center; font-size: 1.12rem; outline: none; }
.nav-dia + .vista-sub { text-align: center; }
.sub-tit { font-size: 1rem; margin-top: 10px; color: #33446A; }
.pan .fichas, .linea-dia { display: grid; gap: 10px; }
.pan .vacio { border: 1px dashed #9DB7DA; border-radius: 14px; font-size: .95rem; font-weight: 600; color: #33446A; background: #fff; }

.cita { display: grid; gap: 5px; padding: 14px; background: #fff; border: 1px solid var(--linea); border-radius: 16px; box-shadow: 0 4px 14px rgba(20, 38, 74, .06); }
.cita-nueva { border-left: 4px solid var(--naranja); background: #FFFCF5; }
.cita.resaltada { outline: 3px solid var(--naranja); outline-offset: 2px; }
.cita-llego { width: fit-content; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--naranja); color: var(--marino); border-radius: 999px; padding: 3px 10px; margin-bottom: 2px; }
.cita-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cita-hora { font-family: var(--titulo); font-weight: 800; font-size: 1.04rem; letter-spacing: -.01em; margin-right: 2px; }
.cita-fecha { font-weight: 700; color: var(--azul-f); }
.cita-fecha::first-letter { text-transform: uppercase; }
.cita-quien { font-size: 1.08rem; font-weight: 700; overflow-wrap: anywhere; }
.cita-det { font-size: .92rem; color: #44557A; }
.cita-falta { font-size: .86rem; font-weight: 700; color: #8A5A00; }
.cita-acc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.cita-acc .btn { min-height: 46px; padding: 8px 10px; font-size: .95rem; box-shadow: none; }
.cita-acc > .btn-tinta, .cita-acc > .btn-wa { grid-column: 1 / -1; }
.cita-acc > .btn:only-child { grid-column: 1 / -1; }
.pan .et { white-space: nowrap; }
.pan .et-ok { background: #DFF3EA; border-color: #A9D9C2; color: #0B5A44; }
.pan .et-ej { background: #EDF1F6; color: #44557A; }
.et-rep { background: #E6EFFB; }
.btn.btn-cancela { color: #A32020; border-color: #E3B5B5; }
.btn.btn-peligro { background: #A32020; color: #fff; }
.btn.btn-mini { min-height: 44px; padding: 6px 14px; font-size: .9rem; flex: none; }

.fila-libre { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px dashed #9DB7DA; border-radius: 12px; font-size: .92rem; font-weight: 700; color: #52628A; }
.fila-libre time { font-weight: 600; }
.fila-bloq { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--linea); border-radius: 14px; background: repeating-linear-gradient(135deg, #EDF1F6 0 10px, #E3E9F1 10px 20px); }
.fila-bloq strong { margin-right: 8px; }
.fila-bloq small { display: block; font-size: .86rem; color: #44557A; margin-top: 2px; }
#p-dia-hoy { display: block; margin: 8px auto 0; }
#p-dia-hoy[hidden] { display: none; }

.semana { display: grid; gap: 8px; }
.sem-dia { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; min-height: 66px; padding: 8px 14px; text-align: left; background: #fff; border: 1px solid var(--linea); border-radius: 14px; }
.sem-dia.sem-hoy { border: 2px solid var(--naranja); }
.sem-dia.sem-paso { opacity: .5; cursor: default; }
.sem-f { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.sem-f small { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #52628A; }
.sem-f b { font-family: var(--titulo); font-size: 1.5rem; font-weight: 800; }
.sem-t strong { display: block; font-size: .98rem; }
.sem-t small { display: block; font-size: .86rem; color: #44557A; }
.sem-ir { font-size: 1.6rem; color: #7F8BA3; line-height: 1; }

.mas { margin-top: 26px; background: #fff; border: 1px solid var(--linea); border-radius: 16px; padding: 0 14px; }
.mas summary { min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 700; cursor: pointer; padding: 8px 0; }
.mas > p { font-size: .92rem; color: #44557A; margin-bottom: 12px; }
.mas .fichas { padding-bottom: 14px; }
.pan-pie { margin-top: 26px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.pan-pie-nota { font-size: .86rem; color: #52628A; }

/* hoja inferior */
.hoja-fondo { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 30, 61, .55); }
.hoja { width: min(560px, 100%); max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: #fff; color: var(--tinta); border-radius: 20px 20px 0 0; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(15, 30, 61, .3); }
@media (min-width: 640px) { .hoja-fondo { align-items: center; } .hoja { border-radius: 20px; } }
.hoja-cab { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; padding: 14px 0 10px; }
.hoja-cab h2 { font-size: 1.25rem; line-height: 1.2; outline: none; }
.hoja-x { width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: var(--hielo); font-size: 1.6rem; line-height: 1; color: var(--marino); }
.hoja-cuerpo { display: grid; gap: 12px; }
.hoja-res { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.hoja-nota { font-size: .92rem; line-height: 1.4; color: #44557A; }
.hoja-nota::first-letter { text-transform: uppercase; }
.hoja-error { font-weight: 700; color: #A32020; }
.hoja-acc { display: grid; gap: 8px; margin-top: 6px; }
.hoja-acc .btn { box-shadow: none; }
.hoja .horas { margin-top: 0; }
.hoja .campo input, .hoja .campo select { height: 52px; padding: 0 12px; border: 1px solid var(--linea); border-radius: 12px; background: #fff; color: var(--tinta); font: inherit; font-size: 1rem; font-weight: 600; width: 100%; min-width: 0; }
.hoja .campo input[type="date"] { -webkit-appearance: none; appearance: none; display: block; }
.par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--marino); }
.burbuja { background: #E7F6EC; border: 1px solid #BFE3CC; border-radius: 4px 16px 16px 16px; padding: 12px 14px; font-size: .98rem; line-height: 1.45; overflow-wrap: anywhere; }

.tostada { position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 500; max-width: 520px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--marino); color: #fff; border-radius: 14px; padding: 6px 8px 6px 16px; min-height: 52px; font-weight: 600; font-size: .95rem; box-shadow: 0 12px 30px rgba(15, 30, 61, .35); }
.tostada-btn { flex: none; min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--naranja); font-weight: 800; text-decoration: underline; }

@media (prefers-reduced-motion: no-preference) {
  .hoja-fondo:not([hidden]) { animation: hoja-fondo .2s ease both; }
  .hoja-fondo:not([hidden]) .hoja { animation: hoja-sube .28s cubic-bezier(.2, .8, .2, 1) both; }
  .tostada:not([hidden]) { animation: hoja-sube .25s ease both; }
  .cita.resaltada { animation: llego 1.4s ease-in-out 3; }
  @keyframes hoja-fondo { from { opacity: 0; } to { opacity: 1; } }
  @keyframes hoja-sube { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
  @keyframes llego { 50% { box-shadow: 0 0 0 8px rgba(245, 158, 27, .28); } }
}
