/* components.css — botones, tarjetas, badges, banner, formularios, modal, toast, estado vacío, KPI */

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.35rem; border-radius: var(--nh-radio-pill); border: 2px solid transparent;
  font-weight: 800; font-size: var(--nh-fs-md); line-height: 1; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
  min-height: 44px; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--nh-sombra-md); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-cargando { opacity: .6; pointer-events: none; }
.btn--primario { background: var(--nh-verde-600); color: #fff; }
.btn--primario:hover { background: var(--nh-verde-900); color: #fff; }
.btn--secundario { background: var(--nh-blanco); color: var(--nh-verde-900); border-color: var(--nh-verde-600); }
.btn--secundario:hover { background: var(--nh-verde-pastel, #e6f5ec); }
.btn--fantasma { background: transparent; color: var(--nh-verde-900); border-color: var(--nh-borde); }
.btn--fantasma:hover { background: var(--nh-blanco); }
.btn--peligro { background: var(--nh-estado-cancelada-bg); color: var(--nh-estado-cancelada); }
.btn--sm { padding: .45rem .9rem; font-size: var(--nh-fs-sm); min-height: 36px; }
.btn--bloque { width: 100%; }
.btn--wa { background: var(--nh-whatsapp); color: var(--nh-whatsapp-texto); }
.btn--wa:hover { background: #1ebe5b; color: var(--nh-whatsapp-texto); }
.btn--wa-secundario { background: #fff; color: var(--nh-whatsapp-oscuro); border-color: var(--nh-whatsapp); }
.btn--wa-secundario:hover { background: #eafaf0; }
.btn--wa-sm { padding: .45rem .9rem; font-size: var(--nh-fs-sm); min-height: 36px; }
.btn--wa-flotante {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50; padding: .9rem 1.25rem;
  box-shadow: 0 8px 24px rgba(37,211,102,.35); border-radius: var(--nh-radio-pill);
}
@media (max-width: 767px) { .btn--wa-flotante { bottom: 4.75rem; right: 1rem; padding: .85rem; } .btn--wa-flotante span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); } }
.btn .icono { width: 20px; height: 20px; flex: none; }
.btn-icono { background: none; border: 0; padding: .35rem; border-radius: 50%; line-height: 1; color: var(--nh-texto-2); }
.btn-icono:hover { background: var(--nh-borde); color: var(--nh-texto); }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--nh-blanco); border: 1px solid var(--nh-borde); border-radius: var(--nh-radio-md);
  padding: var(--nh-sp-6); box-shadow: var(--nh-sombra-sm);
}
.tarjeta--acento { border-top: 5px solid var(--nh-verde-400); }
.tarjeta--amarillo { border-top-color: var(--nh-amarillo); } .tarjeta--rosa { border-top-color: var(--nh-rosa); }
.tarjeta--azul { border-top-color: var(--nh-azul); } .tarjeta--verde { border-top-color: var(--nh-verde-400); } .tarjeta--morado { border-top-color: var(--nh-morado); }
.tarjeta__titulo { margin-bottom: var(--nh-sp-2); }
.tarjeta--compacta { padding: var(--nh-sp-4); }
.tarjeta--clic { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.tarjeta--clic:hover { transform: translateY(-2px); box-shadow: var(--nh-sombra-md); }
.seccion-titulo { display: flex; align-items: center; justify-content: space-between; gap: var(--nh-sp-3); flex-wrap: wrap; margin-bottom: var(--nh-sp-4); }
.seccion-titulo h2, .seccion-titulo h1 { margin: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: var(--nh-radio-pill);
  font-size: var(--nh-fs-xs); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap;
}
.badge--pendiente { background: var(--nh-estado-pendiente-bg); color: var(--nh-estado-pendiente); }
.badge--confirmada { background: var(--nh-estado-confirmada-bg); color: var(--nh-estado-confirmada); }
.badge--reprogramada { background: var(--nh-estado-reprogramada-bg); color: var(--nh-estado-reprogramada); }
.badge--completada { background: var(--nh-estado-completada-bg); color: var(--nh-estado-completada); }
.badge--cancelada { background: var(--nh-estado-cancelada-bg); color: var(--nh-estado-cancelada); }
.badge__punto { width: 8px; height: 8px; border-radius: 50%; background: var(--nh-rosa); box-shadow: 0 0 0 2px #fff; }
.chip { display: inline-block; padding: .2rem .6rem; border-radius: var(--nh-radio-pill); font-size: var(--nh-fs-xs); font-weight: 600; background: var(--nh-azul-pastel); color: var(--nh-estado-reprogramada); }
.chip--proximamente { background: var(--nh-amarillo-pastel); color: var(--nh-estado-pendiente); }
.chip--verde { background: var(--nh-estado-confirmada-bg); color: var(--nh-verde-900); }
.chip--morado { background: var(--nh-morado-pastel); color: #5b3f9e; }
.chip--amarillo { background: var(--nh-amarillo-pastel); color: var(--nh-estado-pendiente); }
.chip--rosa { background: var(--nh-rosa-pastel, #ffe3e8); color: var(--nh-estado-cancelada, #b3423f); }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; gap: var(--nh-sp-3); padding: var(--nh-sp-3) var(--nh-sp-4);
  border-radius: var(--nh-radio-md); border: 1px solid transparent; margin-bottom: var(--nh-sp-4);
}
.banner--verde { background: #e3f5ea; border-color: #bfe6cd; color: var(--nh-verde-900); }
.banner--amarillo { background: var(--nh-amarillo-pastel); border-color: #f5e3a6; color: #6b4b00; }
.banner--rosa { background: var(--nh-rosa-pastel); border-color: #f6c4d6; color: #8a2c55; }
.banner--azul { background: var(--nh-azul-pastel); border-color: #bcdcf5; color: #114b7d; }
.banner--morado { background: var(--nh-morado-pastel); border-color: #d5c9ef; color: #4a2f8a; }
.banner__icono { font-size: 1.5rem; flex: none; }
.banner__cuerpo { flex: 1; min-width: 0; }
.banner__titulo { display: block; font-size: var(--nh-fs-md); }
.banner__mensaje { margin: 0; font-size: var(--nh-fs-sm); }
.banner__cta { flex: none; background: rgba(255,255,255,.85); color: inherit; border-color: currentColor; }
.banner__cerrar { background: none; border: 0; font-size: 1.4rem; line-height: 1; color: inherit; opacity: .6; padding: .25rem .5rem; border-radius: 50%; }
.banner__cerrar:hover { opacity: 1; background: rgba(255,255,255,.6); }
.banner--compacto { padding: var(--nh-sp-2) var(--nh-sp-3); margin: 0; }
@media (max-width: 640px) { .banner { flex-wrap: wrap; } .banner__cta { width: 100%; } }

/* ---------- Formularios ---------- */
.formulario { display: grid; gap: var(--nh-sp-4); }
.formulario--2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--nh-sp-4); }
@media (max-width: 640px) { .formulario--2col { grid-template-columns: 1fr; } }
.campo { display: flex; flex-direction: column; gap: .35rem; }
.campo--ancho { grid-column: 1 / -1; }
.campo__label { font-weight: 600; font-size: var(--nh-fs-sm); color: var(--nh-texto); }
.req { color: var(--nh-estado-cancelada); margin-left: .15rem; }
.control {
  width: 100%; padding: .7rem .9rem; border: 1.5px solid var(--nh-borde); border-radius: var(--nh-radio-sm);
  background: #fff; min-height: 44px; transition: border-color .12s, box-shadow .12s;
}
.control:focus { border-color: var(--nh-verde-600); box-shadow: 0 0 0 3px rgba(27,138,90,.15); outline: none; }
.control.is-invalid { border-color: var(--nh-estado-cancelada); background: #fff8f8; }
textarea.control { min-height: 96px; resize: vertical; }
.campo__ayuda { color: var(--nh-texto-2); font-size: var(--nh-fs-xs); }
.campo__error { color: var(--nh-estado-cancelada); font-size: var(--nh-fs-xs); font-weight: 600; min-height: 1em; }
.radios { display: flex; gap: var(--nh-sp-2); flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border: 1.5px solid var(--nh-borde); border-radius: var(--nh-radio-sm); background: #fff; cursor: pointer; min-height: 44px; }
.radio:has(input:checked) { border-color: var(--nh-verde-600); background: #e6f5ec; }
.radio input { accent-color: var(--nh-verde-600); width: 18px; height: 18px; }
.formulario__acciones { display: flex; gap: var(--nh-sp-3); flex-wrap: wrap; align-items: center; grid-column: 1 / -1; }
.formulario__error-global { grid-column: 1 / -1; background: var(--nh-estado-cancelada-bg); color: var(--nh-estado-cancelada); padding: var(--nh-sp-3); border-radius: var(--nh-radio-sm); font-weight: 600; }
/* Campo de contraseña con botón para mostrar/ocultar */
.campo-pass { position: relative; }
.campo-pass .control { padding-right: 3rem; }
.campo-pass__ojo { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: 1.15rem; line-height: 1; padding: .4rem .5rem; border-radius: 8px; }
.campo-pass__ojo:hover { background: var(--nh-borde); }
/* ---------- Buscador de paciente (escribe y filtra) ---------- */
.campo-buscar__caja { position: relative; }
.campo-buscar__lupa { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--nh-texto-2); display: inline-flex; pointer-events: none; }
.campo-buscar__input.control { padding-left: 2.5rem; padding-right: 2.6rem; }
.campo-buscar__limpiar { position: absolute; right: .45rem; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--nh-borde); color: var(--nh-texto); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.campo-buscar__limpiar:hover { background: #d9e6dd; }
.campo-buscar__lista {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: .35rem; list-style: none;
  background: #fff; border: 1px solid var(--nh-borde); border-radius: 14px; box-shadow: 0 14px 34px rgba(30, 40, 60, .16);
  max-height: 264px; overflow-y: auto;
}
.campo-buscar__item { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: 10px; cursor: pointer; }
.campo-buscar__item:hover, .campo-buscar__item.is-activo { background: var(--nh-verde-pastel); }
.campo-buscar__item[aria-selected="true"] { background: #e2f0e6; }
.campo-buscar__avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--nh-morado-pastel); color: #6f4fb8; font-weight: 800; font-size: .95rem; }
.campo-buscar__texto { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.campo-buscar__texto strong { font-size: var(--nh-fs-sm); color: var(--nh-texto); }
.campo-buscar__texto small { font-size: var(--nh-fs-xs); color: var(--nh-texto-2); }
.campo-buscar__vacio { padding: .7rem .8rem; font-size: var(--nh-fs-sm); color: var(--nh-texto-2); }

/* Enlace utilitario (¿olvidaste tu contraseña?) */
.login__util { display: flex; justify-content: flex-end; margin: -.4rem 0 .6rem; }
.login__util a { font-size: var(--nh-fs-sm); color: var(--nh-verde-600); text-decoration: none; font-weight: 600; }
.login__util a:hover { text-decoration: underline; }

/* Flujo de recuperación de contraseña */
.rec__titulo { font-size: var(--nh-fs-xl); margin: 0 0 .35rem; color: var(--nh-verde-900); text-align: center; }
.rec__sub { text-align: center; margin: 0 0 var(--nh-sp-4); }
.rec__acciones { flex-direction: column; gap: var(--nh-sp-2); }
.rec__volver { text-align: center; margin: var(--nh-sp-4) 0 0; font-size: var(--nh-fs-sm); }
.rec__volver a { color: var(--nh-texto-2); text-decoration: none; }
.rec__volver a:hover { color: var(--nh-verde-900); }

.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 24px; border-radius: 12px; background: var(--nh-borde); position: relative; transition: background .15s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--nh-verde-600); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- Modal ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(15,42,38,.55); display: grid; place-items: center; padding: 1rem; z-index: 100; animation: aparecer .15s ease; }
.modal { background: #fff; border-radius: var(--nh-radio-lg); width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.modal--sm { max-width: 420px; } .modal--md { max-width: 620px; } .modal--lg { max-width: 860px; }
.modal__cabecera { display: flex; align-items: center; justify-content: space-between; padding: var(--nh-sp-4) var(--nh-sp-6); border-bottom: 1px solid var(--nh-borde); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal__titulo { margin: 0; font-size: var(--nh-fs-lg); }
.modal__cerrar { background: none; border: 0; font-size: 1.75rem; line-height: 1; color: var(--nh-texto-2); padding: .25rem .5rem; border-radius: 50%; }
.modal__cerrar:hover { background: var(--nh-borde); }
.modal__cuerpo { padding: var(--nh-sp-6); }
@media (max-width: 640px) { .modal-fondo { padding: 0; align-items: end; } .modal { border-radius: var(--nh-radio-lg) var(--nh-radio-lg) 0 0; max-height: 95vh; } }

/* Cabecera "ficha": icono en círculo, título, subtítulo, chip con el nombre; pie fijo con las acciones. */
.modal__cabecera--rica { align-items: flex-start; gap: var(--nh-sp-4); padding: 1.25rem var(--nh-sp-6); border-bottom: 1px solid #e3ece7; background: linear-gradient(180deg, #f7fbf8, #fff); z-index: 2; }
.modal__ico { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--nh-verde-pastel); color: var(--nh-verde-600); }
.modal__ico svg { width: 22px; height: 22px; }
.modal__textos { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.modal__cabecera--rica .modal__titulo { font-size: 1.35rem; font-weight: 900; color: var(--nh-verde-900); letter-spacing: -.01em; }
.modal__sub { margin: 0; color: var(--nh-texto-2); font-size: var(--nh-fs-sm); }
.modal__chip { display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start; margin-top: .15rem; padding: .35rem .8rem; border-radius: 999px; background: var(--nh-verde-pastel); color: var(--nh-verde-900); font-weight: 700; font-size: var(--nh-fs-sm); }
.modal__chip svg { color: var(--nh-verde-600); }
.modal__cerrar--caja { flex: none; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border-radius: 12px; background: var(--nh-verde-pastel); color: var(--nh-verde-900); font-size: 1rem; }
.modal__cerrar--caja:hover { background: #d9efe2; }
.modal__pie { position: sticky; bottom: 0; display: flex; gap: var(--nh-sp-3); justify-content: flex-end; flex-wrap: wrap; padding: var(--nh-sp-4) var(--nh-sp-6); border-top: 1px solid #e3ece7; background: #f7fbf8; z-index: 2; }
.modal__pie .btn { border-radius: 14px; }
.modal .modal__pie .btn--primario { background: var(--nh-verde-600); border-color: var(--nh-verde-600); color: #fff; }
.modal .modal__pie .btn--primario:hover { background: var(--nh-verde-900); border-color: var(--nh-verde-900); }
.modal--ficha.modal--md { max-width: 760px; }
.modal--ficha.modal--sm { max-width: 480px; }
.modal__pregunta { margin: 0; font-size: var(--nh-fs-md); line-height: 1.5; color: var(--nh-texto); }
.modal__pie .btn--peligro { border-radius: 14px; }
.modal__pie .btn--fantasma { background: #fff; border-color: #e3ece7; color: var(--nh-verde-900); }
.modal__pie .btn--fantasma:hover { background: var(--nh-verde-pastel); }
/* Formularios con este estilo: etiquetas oscuras y campos color crema. */
.modal--ficha .campo__label { font-weight: 700; color: var(--nh-verde-900); font-size: .95rem; }
.modal--ficha .control { background: #fffdf7; border: 1.5px solid #e5eee8; border-radius: 12px; min-height: 48px; }
.modal--ficha .control:focus { background: #fff; border-color: var(--nh-verde-600); box-shadow: 0 0 0 3px rgba(39,134,91,.15); }
.modal--ficha .control::placeholder { color: #9aa6a0; }
.modal--ficha .modal__cuerpo { padding: var(--nh-sp-6) var(--nh-sp-6) 1.25rem; }
@media (max-width: 640px) { .modal__cabecera--rica { padding: var(--nh-sp-4); } .modal__pie { padding: var(--nh-sp-3) var(--nh-sp-4); } .modal__pie .btn { flex: 1; } }

/* ---------- Aviso de sesión inactiva ("¿Sigues ahí?") ---------- */
.inact { z-index: 150; backdrop-filter: blur(3px); }
.inact__caja { position: relative; overflow: hidden; width: 100%; max-width: 560px; background: #fff; border-radius: 22px; padding: 2.5rem 2rem 2.25rem; text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,.25); display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.inact__caja::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, #3aa57a, #9fd0e6, #a78bd6); }
.inact__chip { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem 1rem; border-radius: 999px; background: var(--nh-verde-pastel); color: var(--nh-verde-900); font-weight: 800; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.inact__punto { width: 10px; height: 10px; border-radius: 50%; background: var(--nh-verde-400); }
.inact__titulo { margin: .5rem 0 0; font-size: clamp(1.9rem, 4vw, 2.5rem); font-weight: 900; color: var(--nh-verde-900); }
.inact__desc { margin: 0; color: var(--nh-texto-2); font-size: var(--nh-fs-md); }
.inact__reloj { position: relative; width: 190px; height: 190px; margin: 1rem 0 .5rem; }
.inact__svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.inact__pista, .inact__anillo { fill: none; stroke-width: 9; }
.inact__pista { stroke: #e9f4ee; }
.inact__anillo { stroke: var(--nh-verde-400); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.inact__centro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.inact__cuenta { font-size: 2.2rem; font-weight: 900; color: var(--nh-verde-900); font-variant-numeric: tabular-nums; }
.inact__unidad { color: var(--nh-texto-2); font-size: var(--nh-fs-sm); }
.inact__pie { margin: 0; color: var(--nh-texto-2); font-size: var(--nh-fs-sm); }
.inact__acciones { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; width: 100%; }
.inact__acciones .btn { border-radius: 16px; min-width: 200px; min-height: 56px; font-size: 1.1rem; }
.modal-fondo .inact__seguir { background: var(--nh-verde-600); border-color: var(--nh-verde-600); color: #fff; }
.modal-fondo .inact__seguir:hover { background: var(--nh-verde-900); border-color: var(--nh-verde-900); }
.modal-fondo .inact__salir { background: #fff; border-color: var(--nh-morado); color: #6a45b0; }
.modal-fondo .inact__salir:hover { background: var(--nh-morado-pastel); }
@media (max-width: 640px) { .inact.modal-fondo { align-items: center; padding: 1rem; } .inact__caja { border-radius: 22px; padding: 2rem 1.25rem; } .inact__acciones .btn { flex: 1; min-width: 0; } }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; max-width: min(380px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: flex-start; background: #fff; border-left: 5px solid var(--nh-verde-600); padding: .85rem 1rem; border-radius: var(--nh-radio-sm); box-shadow: var(--nh-sombra-md); opacity: 0; transform: translateX(20px); transition: opacity .25s, transform .25s; font-size: var(--nh-fs-sm); }
.toast.is-visible { opacity: 1; transform: none; }
.toast--exito { border-left-color: var(--nh-verde-600); } .toast--error { border-left-color: var(--nh-estado-cancelada); } .toast--info { border-left-color: var(--nh-azul); }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: var(--nh-sp-8) var(--nh-sp-4); background: #fff; border: 1.5px dashed var(--nh-borde); border-radius: var(--nh-radio-md); }
.empty__icono { font-size: 2.5rem; margin-bottom: var(--nh-sp-2); }
.empty__titulo { margin-bottom: var(--nh-sp-2); }
.empty__texto { color: var(--nh-texto-2); max-width: 38ch; margin-inline: auto; }

/* ---------- KPI ---------- */
.kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: var(--nh-sp-3); align-items: center; background: #fff; border: 1px solid var(--nh-borde); border-radius: var(--nh-radio-md); padding: var(--nh-sp-4); text-decoration: none; color: inherit; box-shadow: var(--nh-sombra-sm); }
a.kpi:hover { box-shadow: var(--nh-sombra-md); }
.kpi__icono { grid-row: 1 / 3; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; }
.kpi__icono--verde { background: #e3f5ea; } .kpi__icono--amarillo { background: var(--nh-amarillo-pastel); } .kpi__icono--azul { background: var(--nh-azul-pastel); } .kpi__icono--morado { background: var(--nh-morado-pastel); } .kpi__icono--rosa { background: var(--nh-rosa-pastel); }
.kpi__valor { font-size: 1.75rem; font-weight: 800; color: var(--nh-verde-900); line-height: 1.1; }
.kpi__etiqueta { font-size: var(--nh-fs-sm); color: var(--nh-texto-2); }
/* Versión ilustrada: fondo pastel, esquina doblada, número a la izquierda y dibujo a la derecha. */
.kpi.kpi--ilus {
  --kpi-fondo: #e6f6ec; --kpi-borde: #cdebd8; --kpi-esquina: #c6e9d3;
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  background: var(--kpi-fondo); border: 1px solid var(--kpi-borde); border-radius: 18px; padding: .9rem 1rem .9rem 1.15rem; min-height: 84px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi.kpi--ilus::after { content: ''; position: absolute; top: 0; right: 0; width: 34px; height: 34px; background: linear-gradient(225deg, var(--kpi-esquina) 50%, transparent 50%); border-bottom-left-radius: 12px; }
a.kpi.kpi--ilus:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30, 60, 45, .12); }
.kpi--ilus .kpi__texto { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.kpi--ilus .kpi__valor { font-size: 2rem; line-height: 1; color: #1f5b3d; }
.kpi--ilus .kpi__etiqueta { color: var(--nh-texto); font-weight: 600; }
.kpi--ilus .kpi__ilus { flex: none; width: 78px; height: 66px; display: grid; place-items: center; position: relative; z-index: 1; }
.kpi--ilus .kpi__ilus svg { width: 100%; height: 100%; }
.kpi--ilus .kpi__ilus--emoji { width: auto; height: auto; font-size: 2.6rem; line-height: 1; letter-spacing: -.2em; padding-right: .2em; filter: drop-shadow(0 3px 4px rgba(30, 60, 45, .18)); }
.kpi--ilus.kpi--durazno { --kpi-fondo: #fdece3; --kpi-borde: #f8d6c4; --kpi-esquina: #f9d3bf; }
.kpi--ilus.kpi--amarillo { --kpi-fondo: #fff4d6; --kpi-borde: #f6e2a8; --kpi-esquina: #f8e3a6; }
.kpi--ilus.kpi--lila { --kpi-fondo: #efe9fb; --kpi-borde: #ddd2f5; --kpi-esquina: #d9ccf3; }

/* ---------- Listas / tablas ---------- */
.lista { display: grid; gap: var(--nh-sp-3); padding: 0; margin: 0; list-style: none; }
.item-cita { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--nh-sp-4); align-items: center; background: #fff; border: 1px solid var(--nh-borde); border-radius: var(--nh-radio-md); padding: var(--nh-sp-4); }
.item-cita__fecha { text-align: center; background: var(--nh-azul-pastel); border-radius: var(--nh-radio-sm); padding: .5rem .75rem; min-width: 70px; }
.item-cita__dia { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--nh-verde-900); }
.item-cita__mes { display: block; font-size: var(--nh-fs-xs); text-transform: uppercase; font-weight: 700; color: var(--nh-texto-2); }
.item-cita__info strong { display: block; }
.item-cita__acciones { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .item-cita { grid-template-columns: auto 1fr; } .item-cita__acciones { grid-column: 1 / -1; justify-content: flex-start; } }
.tabla-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--nh-borde); border-radius: var(--nh-radio-md); }
.tabla { width: 100%; border-collapse: collapse; font-size: var(--nh-fs-sm); }
.tabla th, .tabla td { padding: .75rem .9rem; text-align: left; border-bottom: 1px solid var(--nh-borde); vertical-align: middle; }
.tabla th { background: #f4f8f6; font-weight: 700; color: var(--nh-verde-900); white-space: nowrap; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #fbfdfb; }
.filtros { display: flex; gap: var(--nh-sp-3); flex-wrap: wrap; align-items: end; margin-bottom: var(--nh-sp-4); }
.filtros .campo { min-width: 160px; flex: 1; }
.progreso { height: 10px; background: var(--nh-borde); border-radius: 5px; overflow: hidden; }
.progreso__barra { height: 100%; background: linear-gradient(90deg, var(--nh-verde-400), var(--nh-verde-600)); border-radius: 5px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--nh-borde); }
.timeline li { position: relative; padding: 0 0 var(--nh-sp-4) var(--nh-sp-6); }
.timeline li::before { content: ''; position: absolute; left: -9px; top: .35rem; width: 15px; height: 15px; border-radius: 50%; background: var(--nh-verde-400); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--nh-verde-400); }
.nota { background: #fff; border: 1px solid var(--nh-borde); border-left: 5px solid var(--nh-morado); border-radius: var(--nh-radio-sm); padding: var(--nh-sp-4); }
.nota__meta { font-size: var(--nh-fs-xs); color: var(--nh-texto-2); margin-bottom: .35rem; }
.aviso { padding: var(--nh-sp-3) var(--nh-sp-4); border-radius: var(--nh-radio-sm); font-size: var(--nh-fs-sm); background: var(--nh-amarillo-pastel); color: #6b4b00; }
.aviso--info { background: var(--nh-azul-pastel); color: #114b7d; }
.acordeon { border: 1px solid var(--nh-borde); border-radius: var(--nh-radio-sm); background: #fff; margin-bottom: var(--nh-sp-2); }
.acordeon summary { cursor: pointer; padding: var(--nh-sp-4); font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.acordeon summary::-webkit-details-marker { display: none; }
.acordeon summary::after { content: '+'; font-size: 1.25rem; color: var(--nh-verde-600); }
.acordeon[open] summary::after { content: '−'; }
.acordeon__cuerpo { padding: 0 var(--nh-sp-4) var(--nh-sp-4); color: var(--nh-texto-2); }

@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

/* ===== Documento clínico profesional (imprimible / PDF) ===== */
.doc-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(30,32,40,.55); overflow: auto; padding: 1.2rem; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.doc-overlay__barra { position: sticky; top: 0; display: flex; gap: .5rem; justify-content: center; }
.doc-hoja { width: 100%; max-width: 820px; background: #fff; color: #1a1a1a; padding: 3rem 3.2rem; box-shadow: 0 10px 40px rgba(0,0,0,.3); font-family: 'Segoe UI', Arial, Helvetica, sans-serif; font-size: 13.5px; line-height: 1.5; }
.doc-hoja__encab { display: flex; align-items: center; gap: 1.5rem; padding-bottom: 1rem; }
.doc-hoja__logo { width: 120px; height: auto; flex: none; }
.doc-hoja__centro p { margin: .1rem 0; }
.doc-hoja__tipo { margin: 0 0 .3rem; font-size: 1.15rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.doc-hoja__seccion { margin: 1.4rem 0 .7rem; font-size: .95rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; text-align: center; border-top: 1.5px solid #222; border-bottom: 1.5px solid #222; padding: .35rem 0; }
.doc-hoja__datos { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem 2rem; }
.doc-hoja__dato span { color: #444; }
.doc-hoja__cuerpo { white-space: normal; text-align: justify; min-height: 4rem; }
.doc-hoja__firma { margin-top: 3rem; }
.doc-hoja__linea { width: 260px; border-top: 1px solid #333; margin: 0 0 .3rem; }
.doc-hoja__firma p { margin: .1rem 0; }
body.con-doc-abierto { overflow: hidden; }

@media (max-width: 640px) { .doc-hoja { padding: 1.6rem 1.2rem; } .doc-hoja__datos { grid-template-columns: 1fr; } .doc-hoja__encab { flex-direction: column; text-align: center; } }

@media print {
  body.con-doc-abierto > *:not(.doc-overlay) { display: none !important; }
  .doc-overlay { position: static; inset: auto; background: none; padding: 0; display: block; overflow: visible; }
  .doc-overlay__barra, .no-print { display: none !important; }
  .doc-hoja { max-width: none; width: 100%; box-shadow: none; padding: 0; }
}
.doc-hoja__pie { margin-top: 2.5rem; font-size: .8rem; color: #555; text-align: center; border-top: 1px solid #ddd; padding-top: .6rem; }

/* ===== Perfil: dos tarjetas centradas y del mismo tamaño (datos de la cuenta + cambio de contraseña) ===== */
.app .portal.perfil { max-width: 1560px; margin-inline: auto; }
.perfil__hoja { max-width: none; margin: 0 auto; padding: 1rem 0 2rem; }
.perfil__cab { display: flex; align-items: center; justify-content: center; text-align: center; gap: 1rem; margin-bottom: 1.75rem; }
.perfil__cab > div { text-align: left; }
.perfil__cab-ico, .perfil__clave-ico { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--nh-verde-pastel); color: var(--nh-verde-600); }
.perfil__cab-ico svg, .perfil__clave-ico svg { width: 22px; height: 22px; }
.perfil__titulo { margin: 0 0 .2rem; font-size: 1.7rem; font-weight: 900; color: var(--nh-verde-900); letter-spacing: -.01em; }
.perfil__sub { margin: 0; color: var(--nh-texto-2); font-size: var(--nh-fs-sm); }
.perfil__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.75rem; align-items: stretch; }
.perfil__tarjeta, .perfil__clave { min-height: 560px; }

/* Tarjeta de datos */
.perfil__tarjeta, .perfil__clave { position: relative; overflow: hidden; background: #fff; border: 1px solid #e3ece7; border-radius: 22px; box-shadow: 0 8px 24px rgba(30, 107, 73, .06); }
.perfil__tarjeta { padding: 2.75rem 2.5rem 2.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.perfil__tarjeta::before { content: ''; position: absolute; width: 150px; height: 150px; right: -50px; top: -60px; border-radius: 50%; background: #fde8dc; }
.perfil__avatar { position: relative; width: 112px; height: 112px; border-radius: 30px; background: var(--nh-verde-600); color: #fff; display: grid; place-items: center; font-size: 2.4rem; font-weight: 900; box-shadow: 0 8px 18px rgba(39,134,91,.3); margin-bottom: 1.2rem; }
.perfil__nombre { position: relative; margin: 0 0 .7rem; font-size: 1.55rem; font-weight: 900; color: var(--nh-verde-900); }
.perfil__rol { position: relative; display: inline-flex; align-items: center; gap: .45rem; padding: .5rem 1.1rem; font-size: 1rem; border-radius: 999px; background: var(--nh-morado-pastel, #ece4f7); color: #5b3f9e; font-weight: 700; font-size: var(--nh-fs-sm); }
.perfil__rol svg { width: 16px; height: 16px; }
.perfil__datos { list-style: none; width: 100%; margin: 1.6rem 0 0; padding: 1.6rem 0 0; border-top: 1px solid #e3ece7; display: grid; gap: 1.2rem; text-align: left; }
.perfil__dato { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.perfil__dato-ico { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--nh-verde-pastel); color: var(--nh-verde-600); }
.perfil__dato-texto { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.perfil__dato-etq { font-size: 1.1rem; color: var(--nh-texto); }
.perfil__dato-val { font-size: .98rem; color: var(--nh-texto-2); font-weight: 600; overflow-wrap: anywhere; }

/* Tarjeta de contraseña */
.perfil__clave-cab { display: flex; align-items: center; gap: 1rem; padding: 1.75rem 2.5rem; border-bottom: 1px solid #e3ece7; background: linear-gradient(180deg, #f7fbf8, #fff); }
.perfil__clave-titulo { margin: 0 0 .2rem; font-size: 1.15rem; font-weight: 900; color: var(--nh-verde-900); }
.perfil__clave { display: flex; flex-direction: column; }
.perfil__form { padding: 2rem 2.5rem 2.5rem; gap: 1.5rem; flex: 1; }
.perfil__clave-titulo { font-size: 1.3rem; }
.perfil__clave-cab .perfil__sub { font-size: var(--nh-fs-md); }
.perfil__form .control { min-height: 60px; font-size: 1.1rem; }
.perfil__form .campo__label { font-size: 1.08rem; }
.perfil .perfil__form .perfil__guardar { min-height: 58px; padding-inline: 1.8rem; font-size: 1.08rem; }
.perfil__form .formulario--2col { grid-template-columns: 1fr; }
.perfil__form .perfil__acciones { margin-top: auto; }
.perfil__form .campo__label { font-weight: 700; color: var(--nh-verde-900); font-size: .95rem; }
.perfil__form .control { background: #fffdf7; border: 1.5px solid #e5eee8; border-radius: 12px; min-height: 48px; }
.perfil__form .control:focus { background: #fff; border-color: var(--nh-verde-600); box-shadow: 0 0 0 3px rgba(39,134,91,.15); }
.perfil__form .campo__error:empty { display: none; }
.perfil__pista { display: flex; align-items: center; gap: .6rem; margin: 0; padding: 1rem 1.1rem; border-radius: 12px; background: var(--nh-verde-pastel); color: var(--nh-verde-900); font-size: var(--nh-fs-md); }
.perfil__pista svg { flex: none; color: var(--nh-verde-600); }
.perfil__acciones { justify-content: flex-end; margin-top: .25rem; }
.perfil .perfil__form .perfil__guardar { background: var(--nh-verde-600); border-color: var(--nh-verde-600); color: #fff; border-radius: 14px; }
.perfil .perfil__form .perfil__guardar:hover { background: var(--nh-verde-900); border-color: var(--nh-verde-900); }
@media (max-width: 767px) {
  .perfil__hoja { padding: .5rem 0 2rem; }
  .perfil__cab { flex-direction: column; gap: .6rem; }
  .perfil__cab > div { text-align: center; }
  .perfil__grid { grid-template-columns: 1fr; }
  .perfil__tarjeta, .perfil__clave { min-height: 0; }
  .perfil__tarjeta { padding: 2rem 1.25rem; }
  .perfil__clave-cab { padding: 1.25rem; }
  .perfil__form { padding: 1.25rem 1.25rem 1.5rem; }
  .perfil__acciones .btn { width: 100%; }
}

/* ============================================================
   Teléfono: banner de aviso compacto y controles más cómodos
   ============================================================ */
@media (max-width: 767px) {
  .banner { position: relative; flex-wrap: wrap; gap: .5rem .7rem; padding: .85rem 2.4rem .85rem .9rem; border-radius: 16px; }
  .banner__icono { font-size: 1.25rem; }
  .banner__cuerpo { flex: 1 1 60%; }
  .banner__titulo { font-size: .98rem; }
  .banner__mensaje { font-size: .86rem; line-height: 1.4; }
  .banner__cta { flex: 1 1 100%; order: 3; justify-content: center; min-height: 42px; }
  .banner__cerrar { position: absolute; top: .35rem; right: .35rem; font-size: 1.25rem; padding: .3rem .5rem; }
  .btn { padding: .7rem 1.1rem; }
  .modal__cuerpo { padding: 1rem; }
}

/* Aviso de cambio de contraseña obligatorio (fase 13) */
.perfil__aviso { margin: 0 0 var(--nh-sp-4); }

/* Consentimiento de datos en el portal de familias (modal bloqueante) */
.consent__intro { margin: 0 0 .8rem; line-height: 1.55; }
.consent__puntos { list-style: none; margin: 0 0 .9rem; padding: 0; display: grid; gap: .45rem; }
.consent__puntos li { display: grid; grid-template-columns: auto 1fr; gap: .55rem; align-items: start; font-size: var(--nh-fs-sm); line-height: 1.45; }
.consent__check { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e3f4ea; color: #1e6b49; font-weight: 900; font-size: .8rem; margin-top: .05rem; }
.consent__enlace { margin: 0 0 .9rem; font-size: var(--nh-fs-sm); }
.consent__enlace a { color: var(--nh-verde-700, #1e6b49); font-weight: 700; }
.consent__casilla { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; padding: .8rem .9rem; border: 1px solid #dfe9e3; border-radius: 14px; background: #f7fbf8; font-size: var(--nh-fs-sm); line-height: 1.45; cursor: pointer; }
.consent__casilla input { width: 20px; height: 20px; margin-top: .1rem; accent-color: var(--nh-verde-600); }
.modal--consent .modal__cuerpo { padding-top: .4rem; }

/* Firma dibujada (fase 24) */
.firma { position: relative; border: 2px dashed #b9cfc2; border-radius: 14px; background: #fff; padding: 0; overflow: hidden; }
.firma__lienzo { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.firma__guia { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #b3bfb8; font-weight: 700; letter-spacing: .04em; pointer-events: none; }
.firma__limpiar { position: absolute; right: .4rem; bottom: .4rem; }

/* Campos de fecha en iPhone/Safari: el selector nativo tiene un ancho mínimo propio y se salía de su recuadro
   (y centraba la fecha). Se ajusta al ancho del campo y se alinea a la izquierda como los demás. */
input[type="date"].control, input[type="time"].control { min-width: 0; max-width: 100%; }
@supports (-webkit-touch-callout: none) { /* solo iOS / iPadOS */
  input[type="date"].control, input[type="time"].control { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-height: 2.75rem; text-align: left; }
  input[type="date"].control::-webkit-date-and-time-value, input[type="time"].control::-webkit-date-and-time-value { text-align: left; margin: 0; }
}

/* Aviso de versión nueva (core/actualizacion.js). */
.aviso-version { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1200; display: flex; align-items: center; gap: .8rem; width: max-content; max-width: calc(100vw - 24px); padding: .65rem .7rem .65rem 1rem; border-radius: 16px; background: #fff; border: 1px solid #cfe6d7; box-shadow: 0 10px 30px rgba(20, 60, 40, .18); font-weight: 700; color: var(--nh-verde-900); animation: aparecer .2s ease; }
@media (max-width: 480px) { .aviso-version { width: calc(100vw - 24px); justify-content: space-between; font-size: .9rem; } }

/* Selector desplegable del tipo de cita (equipo, médico y familias): botón con el punto de color del tipo elegido y,
   al abrirlo, la lista de tipos con su punto de color y la opción elegida resaltada. */
.tipo-sel__caja { position: relative; }
.tipo-sel__ayuda { margin: .1rem 0 .45rem; }
.tipo-sel__btn { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; cursor: pointer; font: inherit; min-height: 48px; }
.tipo-sel__btn[aria-expanded="true"] { border-color: var(--nh-verde-600); box-shadow: 0 0 0 3px rgba(39,134,91,.15); }
.tipo-sel__btn.is-vacio .tipo-sel__nombre { color: var(--nh-texto-2); font-weight: 400; }
.tipo-sel__actual { flex: 1; min-width: 0; display: flex; align-items: center; gap: .65rem; }
.tipo-sel__actual .tipo-sel__nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--nh-verde-900); }
.tipo-sel__caret { color: var(--nh-texto-2); font-size: .9rem; }
.tipo-sel__lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1; margin: 0; padding: .35rem; list-style: none; background: #fff; border: 1px solid #e3ece6; border-radius: 16px; box-shadow: 0 14px 34px rgba(30,107,73,.16); max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; }
.tipo-sel__op { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: 12px; cursor: pointer; transition: background .12s; min-width: 0; }
.tipo-sel__op:hover, .tipo-sel__op:focus { background: #f4f9f6; outline: none; }
.tipo-sel__op[aria-selected="true"] { background: #eef7f1; }
.tipo-sel__op[aria-selected="true"] .tipo-sel__nombre { font-weight: 700; color: var(--nh-verde-900); }
.tipo-sel__punto { width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--tipo); box-shadow: 0 0 0 3px #fff, 0 0 0 4px color-mix(in srgb, var(--tipo) 45%, #fff); }
.tipo-sel__nombre { flex: 1; min-width: 0; color: var(--nh-texto); font-size: .96rem; line-height: 1.25; }
.tipo-sel__chip { font-size: .68rem; font-weight: 700; color: #5b3f9e; background: var(--nh-morado-pastel); padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
