/* Ayuda de navegación — encima de la barra inferior en móvil */
.ayuda-fab {
  position: fixed;
  right: 0.75rem;
  bottom: calc(var(--nav-h, 96px) + env(safe-area-inset-bottom, 0px) + 0.75rem);
  z-index: 120;
  width: 68px;
  height: 68px;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 6px 18px rgba(0, 61, 120, 0.22);
  opacity: 0.92;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.ayuda-fab:hover,
.ayuda-fab:focus-visible {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 24px rgba(0, 61, 120, 0.32);
  opacity: 1;
  outline: none;
}

.ayuda-fab:active {
  cursor: grabbing;
}

.ayuda-fab.is-dragging {
  cursor: grabbing;
  opacity: 1;
  z-index: 130;
  transition: none;
  transform: scale(1.06);
  box-shadow: 0 12px 28px rgba(0, 61, 120, 0.35);
}

.ayuda-fab.ayuda-fab--moved:hover,
.ayuda-fab.ayuda-fab--moved:focus-visible {
  transform: none;
}

.ayuda-fab.is-dragging:hover,
.ayuda-fab.is-dragging:focus-visible {
  transform: scale(1.06);
}

.ayuda-fab img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  pointer-events: none;
}

/* App pública: un poco más arriba para no tapar Inicio/Pagos/etc. */
body.ayuda-fab--publica .ayuda-fab {
  bottom: calc(var(--nav-h, 96px) + env(safe-area-inset-bottom, 0px) + 0.9rem);
  right: 0.65rem;
}

/* Paneles sin barra inferior */
body.ayuda-fab--admin .ayuda-fab,
body.ayuda-fab--docentes .ayuda-fab,
body.ayuda-fab--bienestar .ayuda-fab,
body.ayuda-fab--personero .ayuda-fab {
  bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  right: 0.85rem;
  width: 72px;
  height: 72px;
}

.modal--ayuda {
  border: none;
  border-radius: 20px;
  padding: 0;
  width: min(480px, calc(100vw - 1.25rem));
  max-height: min(85dvh, 640px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  overflow: hidden;
}

.modal--ayuda:not([open]) {
  display: none;
}

.modal--ayuda::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.modal--ayuda:focus {
  outline: none;
}

.ayuda-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1.25rem 1.2rem 1.15rem;
  max-height: min(85dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ayuda-panel__head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ayuda-panel__head img {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  background: #e8f1fa;
  box-shadow: 0 4px 14px rgba(0, 61, 120, 0.14);
}

.ayuda-panel__head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #003d78;
  font-family: inherit;
}

.ayuda-panel__head p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: #5b6b7c;
}

.ayuda-section h3 {
  margin: 0.85rem 0 0.4rem;
  font-size: 1rem;
  color: #003d78;
}

.ayuda-section h3:first-child {
  margin-top: 0;
}

.ayuda-brand-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ayuda-inline-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: 0 2px 8px rgba(0, 85, 164, 0.18);
}

.ayuda-section p {
  margin: 0 0 0.7rem;
  color: #5b6b7c;
  font-size: 0.9rem;
  line-height: 1.45;
}

.ayuda-section ul,
.ayuda-section ol {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: #0f172a;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ayuda-section li {
  margin-bottom: 0.35rem;
}

.ayuda-section li strong {
  color: #003d78;
}

.ayuda-section code {
  font-size: 0.85em;
  background: #e8f1fa;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.ayuda-panel__actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.15rem;
}

.ayuda-panel__actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 700;
  background: #0055a4;
  color: #fff;
}

.ayuda-panel__actions .btn:hover {
  background: #003d78;
}

@media (min-width: 768px) {
  .ayuda-fab,
  body.ayuda-fab--publica .ayuda-fab {
    bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
    right: 0.85rem;
    width: 72px;
    height: 72px;
  }
}
