:root {
  --fondo: #f6f4ef;
  --superficie: #ffffff;
  --texto: #1d2a2c;
  --tenue: #5f6d6f;
  --linea: #dcd8cf;
  --primario: #0f6b66;
  --primario-oscuro: #0a4f4b;
  --primario-suave: #e3f0ee;
  --acento: #c8693a;
  --ok: #1f7a46;
  --ok-suave: #e5f4ea;
  --error: #b3261e;
  --error-suave: #fbe9e7;
  --info-suave: #eef3fb;
  --wa: #1f9e55;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(20, 40, 40, .06), 0 6px 20px rgba(20, 40, 40, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primario); }
h1, h2 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.2rem); margin: .4em 0 .5em; }
h2 { font-size: 1.2rem; margin: 0 0 .7em; }
.contenedor { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.contenedor { padding-top: 16px; padding-bottom: 48px; min-height: 70vh; }

/* Barra superior */
.barra { background: var(--superficie); border-bottom: 1px solid var(--linea); position: sticky; top: 0; z-index: 5; }
.barra-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--texto); text-decoration: none; }
.marca small { font-weight: 500; color: var(--tenue); }
.marca-icono { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primario); color: #fff; font-size: 18px; }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav a:not(.boton) { text-decoration: none; font-weight: 600; }

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; background: var(--primario); color: #fff;
  padding: 11px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 44px; transition: background .15s;
}
.boton:hover { background: var(--primario-oscuro); }
.boton:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primario) 45%, transparent); outline-offset: 2px;
}
.boton-grande { padding: 14px 26px; font-size: 1.08rem; }
.boton-chico { padding: 6px 12px; min-height: 36px; font-size: .92rem; }
.boton-ancho { width: 100%; }
.boton-secundario { background: var(--primario-suave); color: var(--primario-oscuro); }
.boton-secundario:hover { background: #d2e7e4; }
.boton-peligro { background: var(--error); }
.boton-peligro:hover { background: #8e1d17; }
.boton-wa { background: var(--wa); }
.boton-wa:hover { background: #157c41; }
.enlace { background: none; border: 0; color: var(--primario); font: inherit; font-weight: 600; cursor: pointer; padding: 4px; text-decoration: underline; }
.en-linea { display: inline; }
.botonera { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }

/* Portada */
.portada {
  margin: 8px 0 24px; padding: clamp(28px, 6vw, 64px) clamp(20px, 5vw, 56px);
  border-radius: 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #1b8a83 0%, var(--primario) 45%, var(--primario-oscuro) 100%);
}
.portada h1 { color: #fff; margin-top: .1em; }
.portada .entrada { color: #e6f3f1; max-width: 560px; }
.portada .boton { background: #fff; color: var(--primario-oscuro); }
.portada .boton:hover { background: #f0f7f6; }
.etiqueta { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; opacity: .85; margin: 0; }
.entrada { font-size: 1.08rem; color: var(--tenue); }

.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra); margin-bottom: 16px; overflow-x: auto; }
.tabla-horario { width: 100%; border-collapse: collapse; }
.tabla-horario th, .tabla-horario td { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--linea); vertical-align: top; }
.tabla-horario th { font-weight: 600; width: 38%; }

/* Formularios */
.formulario-caja { max-width: 560px; margin: 0 auto; background: var(--superficie); border: 1px solid var(--linea); border-radius: 16px; padding: clamp(18px, 4vw, 32px); box-shadow: var(--sombra); }
.formulario-caja.estrecha { max-width: 420px; margin-top: 24px; }
.formulario { display: grid; gap: 14px; margin-top: 12px; }
.rejilla { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.ancho-total { grid-column: 1 / -1; }
.campo { display: grid; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.campo label, .campo legend { font-weight: 600; font-size: .95rem; padding: 0; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #c9c4b8; border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
.casilla { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.casilla input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.oculto { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.nota { color: var(--tenue); font-size: .92rem; }
.tenue { color: var(--tenue); }
.separado { margin-top: 18px; }

/* Selector de horas */
.horas { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.horas input { position: absolute; opacity: 0; pointer-events: none; }
.hora-opcion {
  display: block; text-align: center; padding: 10px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid #c9c4b8; background: #fff; font-weight: 600; font-variant-numeric: tabular-nums;
}
.hora-opcion:hover { border-color: var(--primario); }
.horas input:checked + .hora-opcion { background: var(--primario); border-color: var(--primario); color: #fff; }
.horas input:focus-visible + .hora-opcion { outline: 3px solid color-mix(in srgb, var(--primario) 45%, transparent); }
.hora-opcion.ocupada { color: #a39e93; background: #f1efea; text-decoration: line-through; cursor: not-allowed; }
.horas .nota, .horas .aviso { grid-column: 1 / -1; margin: 0; }

/* Avisos */
.aviso { border-radius: 10px; padding: 12px 14px; margin: 12px 0; border: 1px solid transparent; }
.aviso p { margin: .2em 0; }
.aviso ul { margin: .4em 0 .2em; padding-left: 1.2em; }
.aviso-ok { background: var(--ok-suave); border-color: #b9e0c6; }
.aviso-error { background: var(--error-suave); border-color: #f2c4bf; color: #6b1712; }
.aviso-info { background: var(--info-suave); border-color: #cddcf2; }
code.clave { background: #fff; border: 1px dashed var(--tenue); padding: 2px 8px; border-radius: 6px; font-size: 1.05rem; user-select: all; }

/* Detalle de cita */
.detalle { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0 20px; }
.detalle dt { color: var(--tenue); }
.detalle dd { margin: 0; font-weight: 600; }
.estado { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.estado-confirmada { background: var(--primario-suave); color: var(--primario-oscuro); }
.estado-cancelada { background: var(--error-suave); color: var(--error); }
.estado-atendida { background: var(--ok-suave); color: var(--ok); }
.estado-no_asistio { background: #fdf0e6; color: #8a4318; }
.etiqueta-chica { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: #efece5; color: var(--tenue); }

.plegable { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); margin: 12px 0; }
.plegable > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--primario-oscuro); list-style-position: inside; }
.plegable > :not(summary) { margin-left: 16px; margin-right: 16px; }
.plegable[open] { padding-bottom: 12px; }
.plegable-chico { border-style: dashed; margin: 8px 0 0; }
.plegable-chico > summary { padding: 8px 12px; font-size: .92rem; }

/* Agenda */
.semana { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.dia-chip { flex: 1 0 74px; display: grid; justify-items: center; gap: 2px; padding: 8px; border-radius: 10px; border: 1px solid var(--linea); background: var(--superficie); text-decoration: none; color: var(--texto); font-size: .85rem; text-transform: capitalize; }
.dia-chip strong { font-size: 1.1rem; color: var(--primario); }
.dia-chip.activo { background: var(--primario); border-color: var(--primario); color: #fff; }
.dia-chip.activo strong { color: #fff; }
.agenda-cabecera { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.agenda-cabecera h1 { flex: 1 1 220px; margin: 0; font-size: 1.4rem; }
.agenda-cabecera input[type=date] { width: auto; }
.linea-tiempo { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.linea-tiempo .libre { padding: 8px 14px; border: 1px dashed #bfd9d5; border-radius: 10px; color: var(--primario-oscuro); background: #f3f9f8; font-size: .92rem; }
.linea-tiempo .libre .hora { font-weight: 700; margin-right: 6px; }
.cita { display: grid; grid-template-columns: 96px 1fr; gap: 14px; background: var(--superficie); border: 1px solid var(--linea); border-left: 5px solid var(--primario); border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); }
.estado-borde-atendida { border-left-color: var(--ok); }
.estado-borde-no_asistio { border-left-color: var(--acento); }
.cita-hora { display: grid; align-content: start; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cita-hora strong { font-size: 1.05rem; }
.cita-hora span { color: var(--tenue); font-size: .85rem; }
.cita-cuerpo { min-width: 0; }
.cita-titulo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 1.05rem; }
.cita-contacto { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 4px; font-size: .95rem; }
.cita-contacto a { font-weight: 600; text-decoration: none; }
.cita-motivo { margin: 6px 0 0; }
.cita-notas { margin: 6px 0 0; background: #fff8e8; padding: 6px 10px; border-radius: 8px; font-size: .93rem; }
.cita select { width: auto; min-height: 36px; padding: 4px 8px; }
.vacio { color: var(--tenue); text-align: center; padding: 28px; background: var(--superficie); border-radius: var(--radio); border: 1px dashed var(--linea); }

.tabla { width: 100%; border-collapse: collapse; background: var(--superficie); margin: 12px 0; }
.tabla th, .tabla td { padding: 10px 8px; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: top; }
.tabla thead th { font-size: .85rem; color: var(--tenue); }
.tabla-compacta td, .tabla-compacta th { padding: 6px 4px; }
.turno { white-space: nowrap; }
.turno input { width: 7.2em; padding: 6px; min-height: 38px; }
.lista-simple { padding-left: 1.2em; }
.lista-simple li { margin: 6px 0; }
.buscador { display: flex; gap: 8px; max-width: 560px; }

.texto-legal { max-width: 720px; margin: 0 auto; background: var(--superficie); padding: clamp(18px, 4vw, 36px); border-radius: 16px; border: 1px solid var(--linea); }
.texto-legal h2 { margin-top: 1.4em; }

.pie { border-top: 1px solid var(--linea); padding: 20px 0; color: var(--tenue); font-size: .9rem; text-align: center; }
.pie p { margin: 4px 0; }

@media (max-width: 560px) {
  .cita { grid-template-columns: 1fr; gap: 6px; }
  .cita-hora { grid-auto-flow: column; justify-content: start; gap: 8px; align-items: baseline; }
  .nav { gap: 10px; font-size: .95rem; }
  .zona-publica .barra-in { flex-wrap: nowrap; }
  .zona-publica .marca { font-size: .95rem; }
  .zona-publica .nav .boton { white-space: nowrap; }
  .zona-publica .nav { flex-wrap: nowrap; gap: 4px; }
  .zona-publica .nav .boton { padding: 6px 10px; }
  .candado { width: 36px; height: 36px; }
  .detalle { grid-template-columns: 1fr; gap: 2px; }
  .detalle dd { margin-bottom: 8px; }
}

/* Usuarios */
.usuario { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.usuario .plegable { flex: 1 1 100%; }
.usuario-titulo { flex: 1 1 260px; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .2em; }

/* Bitácora */
.filtros { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px; }
.filtros .botonera { margin: 0; grid-column: 1 / -1; }
.tabla-desplazable { overflow-x: auto; border-radius: var(--radio); border: 1px solid var(--linea); }
.tabla-desplazable .tabla { margin: 0; }
.tabla-bitacora { font-size: .92rem; }
.tabla-bitacora td { min-width: 110px; }
.tabla-bitacora .detalle-bit { min-width: 260px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.bit-alerta { background: #fff4f2; }
.bit-usuarios td:nth-child(3), .bit-ajustes td:nth-child(3) { color: var(--acento); font-weight: 600; }
.historial { background: #f7f5f0; border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: .88rem; }
.historial ul { margin: 4px 0 0; padding-left: 1.1em; }

/* Bloqueos */
.horas-bloqueo[hidden] { display: none; }
.linea-tiempo .bloqueado { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 14px; border-radius: 10px; font-size: .92rem;
  border: 1px solid #f0c9b8; color: #7a3413; background: repeating-linear-gradient(-45deg, #fdf3ee, #fdf3ee 8px, #faeae2 8px, #faeae2 16px); }
.linea-tiempo .bloqueado .hora { font-weight: 700; margin-right: 6px; }
.bloqueo-dia { padding: 12px 16px; border-radius: var(--radio); margin: 12px 0; border: 1px solid #f0c9b8; color: #7a3413;
  background: repeating-linear-gradient(-45deg, #fdf3ee, #fdf3ee 8px, #faeae2 8px, #faeae2 16px); }
.lista-bloqueos li { margin: 8px 0; }

/* Candado de acceso del personal */
.candado { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--tenue); text-decoration: none; }
.candado:hover { color: var(--primario); background: var(--primario-suave); }

/* Mapa */
.mapa { border-radius: 10px; overflow: hidden; border: 1px solid var(--linea); margin: 12px 0; aspect-ratio: 16 / 10; background: #eef0ec; }
.mapa iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Íconos de contacto */
.contacto { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.contacto-num { white-space: nowrap; }
.contacto-num { font-variant-numeric: tabular-nums; margin-right: 2px; }
.ico { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; text-decoration: none; }
.ico-tel { color: var(--primario); background: var(--primario-suave); }
.ico-tel:hover { background: #d2e7e4; }
.ico-wa { color: #fff; background: var(--wa); }
.ico-wa:hover { background: #157c41; }
@media (max-width: 560px) {
  .tabla td .contacto-num { flex-basis: 100%; }
  .tabla th, .tabla td { padding: 8px 6px; }
}
/* Tablas que en el celular se muestran como tarjetas apiladas */
@media (max-width: 560px) {
  .tabla-tarjetas thead { display: none; }
  .tabla-tarjetas, .tabla-tarjetas tbody, .tabla-tarjetas tr, .tabla-tarjetas td { display: block; width: 100%; }
  .tabla-tarjetas tr { padding: 12px; border-bottom: 1px solid var(--linea); }
  .tabla-tarjetas td { border: 0; padding: 2px 0; }
  .tabla-tarjetas td .contacto-num { flex-basis: auto; }
}

.ico-correo { color: #fff; background: #3c6e9f; }
.ico-correo:hover { background: #2d5780; }
.ico-sin-dato { background: #e6ebf1; color: #3c6e9f; }
.ico-sin-dato:hover { background: #d4dde8; }
.rejilla > .boton { justify-self: start; white-space: nowrap; }
.rejilla-ancha { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.botonera input[type=email] { width: auto; flex: 1 1 220px; max-width: 320px; }

/* Carrusel de la página principal */
.carrusel { position: relative; margin: 8px 0 20px; border-radius: 20px; overflow: hidden; background: #e9e6df; box-shadow: var(--sombra); }
.carrusel-pista { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.carrusel-pista::-webkit-scrollbar { display: none; }
.carrusel-pista:focus-visible { outline: 3px solid color-mix(in srgb, var(--primario) 45%, transparent); outline-offset: -3px; }
.carrusel-foto { flex: 0 0 100%; margin: 0; position: relative; scroll-snap-align: start; aspect-ratio: 16 / 9; max-height: 460px; width: 100%; }
.carrusel-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carrusel-foto figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 20px 40px; color: #fff; font-weight: 600;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62)); text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.carrusel-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .88); color: var(--texto); font-size: 28px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.carrusel-btn:hover { background: #fff; }
.carrusel-ant { left: 12px; } .carrusel-sig { right: 12px; }
.carrusel-puntos { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 8px; }
.carrusel-puntos button { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.55); cursor: pointer; }
.carrusel-puntos button[aria-current] { background: #fff; transform: scale(1.25); }
@media (max-width: 560px) {
  .carrusel { border-radius: 14px; }
  .carrusel-foto { aspect-ratio: 4 / 3; }
  .carrusel-btn { width: 36px; height: 36px; font-size: 22px; }
  .carrusel-foto figcaption { padding: 28px 14px 34px; font-size: .92rem; }
}

/* Fotos en el panel */
.fotos-admin { list-style: none; padding: 0; display: grid; gap: 14px; }
.foto-admin { display: grid; grid-template-columns: minmax(140px, 260px) 1fr; gap: 16px; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 12px; }
.foto-admin img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #eee; }
@media (max-width: 560px) { .foto-admin { grid-template-columns: 1fr; } }
input[type=file] { padding: 8px; }
.boton[disabled] { opacity: .45; cursor: not-allowed; }
