:root {
  --ink: #0b2340;
  --ink-soft: #3a516b;
  --blue-900: #0a2f5c;
  --blue-700: #1256a0;
  --blue-500: #1d7fd6;
  --blue-300: #7eb6ef;
  --blue-100: #e8f2fc;
  --blue-50: #f4f8fd;
  --surface: #ffffff;
  --line: #d5e3f2;
  --ok: #0f7a4c;
  --ok-bg: #edf8f2;
  --warn: #a16207;
  --warn-bg: #fff7ed;
  --ban: #b42318;
  --ban-bg: #fef3f2;
  --shadow: 0 12px 40px rgba(10, 47, 92, 0.1);
  --radius: 18px;
  --sidebar-w: 300px;
  --font: "Manrope", system-ui, sans-serif;
  --panel-max-h: calc(100dvh - 13rem);
  --page-pad-x: clamp(0.75rem, 3vw, 2rem);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(29, 127, 214, 0.12), transparent 35%),
    radial-gradient(circle at 88% 0%, rgba(10, 47, 92, 0.08), transparent 28%),
    linear-gradient(180deg, #f7fbff 0%, #eef4fb 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(18, 86, 160, 0.12) 1px, transparent 0);
  background-size: 28px 28px;
  opacity: 0.35;
  z-index: 0;
}

button {
  font: inherit;
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(86vw, var(--sidebar-w));
  height: 100vh;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--blue-900), #0d3d73 55%, #0a2a52);
  color: #fff;
  padding: 1.25rem 0.9rem 1rem;
  box-shadow: 8px 0 30px rgba(10, 47, 92, 0.18);
  overflow: hidden;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar__brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0.45rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar__badge {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sidebar__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.sidebar__subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  opacity: 0.72;
}

.sidebar__close {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.nav-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.nav-link.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.nav-link__num {
  display: inline-grid;
  place-items: center;
  min-width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-link.is-active .nav-link__num {
  background: #fff;
  color: var(--blue-900);
}

.nav-link__label {
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 600;
}

.nav-group {
  margin-top: 0.65rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-group__title {
  margin: 0 0 0.35rem;
  padding: 0 0.7rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  font-weight: 700;
}

.main-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: calc(0.85rem + var(--safe-top)) var(--page-pad-x) 0.85rem;
  background: rgba(247, 251, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.menu-btn {
  display: inline-grid;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  place-items: center;
  gap: 4px;
  padding: 0;
}

.menu-btn span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--blue-900);
  border-radius: 2px;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.6rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--blue-900);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.home-btn:hover,
.home-btn:focus-visible {
  border-color: var(--blue-700);
  background: var(--blue-100);
  outline: none;
}

.home-btn__icon {
  font-size: 1.05rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .home-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .home-btn {
    width: 2.6rem;
    justify-content: center;
    padding: 0;
  }
}

.topbar__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-700);
}

.topbar__eyebrow--home {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--blue-900);
}

.topbar__meta {
  min-width: 0;
}

.topbar__heading {
  margin: 0.15rem 0 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.topbar__heading:empty {
  display: none;
}

.topbar__progress {
  min-width: 120px;
  text-align: right;
}

#progress-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.progress-bar {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-left: auto;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-700), var(--blue-500));
  transition: width 0.3s ease;
}

.phase-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  min-width: 0;
}

.phase-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.4rem 0.55rem;
  text-align: left;
  color: var(--ink);
  min-width: 7.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.phase-chip:hover,
.phase-chip:focus-visible {
  border-color: var(--blue-300);
  outline: none;
}

.phase-chip.is-active {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(29, 127, 214, 0.15);
}

.phase-chip.is-done .phase-chip__num {
  background: var(--ok);
  color: #fff;
}

.phase-chip__num {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-900);
  font-size: 0.75rem;
  font-weight: 800;
}

.phase-chip.is-active .phase-chip__num {
  background: var(--blue-700);
  color: #fff;
}

.phase-chip__body {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.phase-chip__name {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-chip__bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.phase-chip__bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-700), var(--blue-500));
  transition: width 0.3s ease;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  padding: 0.25rem var(--page-pad-x) 0;
  font-size: 0.72rem;
  font-weight: 700;
}

.legend[hidden],
body.is-role-home .legend {
  display: none;
}

body.is-role-home .topbar__progress {
  display: none;
}

body.is-role-home .home-btn {
  display: none;
}

body.is-role-home .phase-bar {
  display: none;
}

body.is-role-home .topbar {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  padding: 1.15rem 1.35rem;
  gap: 0.85rem 1rem;
}

body.is-role-home .content {
  padding-top: 1rem;
  padding-bottom: 0.75rem;
}

body.is-role-home .topbar__heading {
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
}

.topbar__logo {
  display: block;
  height: 2.5rem;
  width: auto;
  max-width: min(160px, 28vw);
  object-fit: contain;
  object-position: left center;
}

.topbar__logo[hidden] {
  display: none;
}

.home-fullscreen-btn {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--blue-900);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.home-fullscreen-btn:hover,
.home-fullscreen-btn:focus-visible {
  border-color: var(--blue-700);
  background: var(--blue-100);
  outline: none;
}

.home-fullscreen-btn[hidden] {
  display: none;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend__item::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}

.legend__item--ok::before { background: var(--ok); }
.legend__item--warn::before { background: #eab308; }
.legend__item--ban::before { background: var(--ban); }

.content {
  flex: 1;
  padding: 1rem var(--page-pad-x) 0.75rem;
  outline: none;
  min-width: 0;
}

.section-layout {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.section-layout.no-image {
  max-width: 760px;
}

.section-layout.is-role-home {
  max-width: none;
  width: 100%;
  margin: 0;
}

.role-home-layout {
  width: min(100%, 1472px);
  margin-inline: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.role-home-layout .role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem;
  padding: 0.35rem 0.5rem;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 6px 20px rgba(10, 47, 92, 0.07);
  cursor: pointer;
  opacity: 0;
  animation: role-card-in 0.45s ease-out forwards;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.role-home-layout .role-grid .role-card:nth-child(1) {
  animation-delay: 0.05s;
}

.role-home-layout .role-grid .role-card:nth-child(2) {
  animation-delay: 0.16s;
}

@keyframes role-card-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.role-card:hover,
.role-card:focus-visible {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--blue-700);
  box-shadow: 0 16px 36px rgba(18, 86, 160, 0.18);
  outline: none;
  z-index: 1;
}

.role-card:hover .role-card__title,
.role-card:focus-visible .role-card__title {
  background: #0e4f96;
}

.role-card__media {
  display: block;
  position: relative;
  /* +15% ancho sin subir el alto */
  aspect-ratio: 16 / 9.39;
  background:
    linear-gradient(180deg, #f8fbff, #e8f1fb);
  overflow: hidden;
}

.role-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 1;
  filter: none;
  transform: scale(1.02);
  animation: role-photo-ken 10s ease-in-out infinite alternate;
  transition: transform 0.2s ease;
}

.role-card:hover .role-card__media img,
.role-card:focus-visible .role-card__media img {
  animation-play-state: paused;
  transform: scale(1.08);
  opacity: 1;
}

@keyframes role-photo-ken {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.08) translate3d(-1.2%, -0.8%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .role-card {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .role-card__media img {
    animation: none;
    transform: none;
    transition: none;
    opacity: 1;
  }

  .role-card:hover,
  .role-card:focus-visible {
    transform: none;
  }

  .role-card:hover .role-card__media img,
  .role-card:focus-visible .role-card__media img {
    transform: none;
  }
}

.role-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 1.15rem 1.25rem 1.25rem;
}

.role-card__title {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--blue-700);
  color: #fff;
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  font-weight: 700;
  line-height: 1.25;
}

.role-card__meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  width: 100%;
}

.role-card__topics {
  font-size: 0.9rem;
  color: var(--blue-700);
}

.role-card__topics strong {
  font-weight: 800;
  color: var(--blue-900);
}

.role-card__pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-900);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .role-home-layout .role-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
    padding: 0.25rem 0.15rem;
  }

  .role-card__media {
    aspect-ratio: 16 / 8.45;
  }
}

.nav-link--home {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding-bottom: 0.75rem;
}

body.is-role-home .app-footer .pager__btn {
  display: none;
}

body.is-role-home .app-footer {
  grid-template-columns: 1fr;
  justify-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.9rem;
  margin-bottom: 0.65rem;
  min-height: 0;
}

body.is-role-home .app-footer__msg {
  font-size: 0.8rem;
  line-height: 1.2;
  gap: 0.35rem;
}

body.is-role-home .app-footer__icon {
  font-size: 0.85rem;
}

.visual-panel {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.visual-stage {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, #f8fbff, #eef5fc),
    radial-gradient(circle at 1px 1px, rgba(18, 86, 160, 0.08) 1px, transparent 0);
  background-size: auto, 22px 22px;
}

/* Temas: la imagen define la altura; nunca se recorta */
.section-layout.has-image:not(.is-home) .visual-stage {
  width: 100%;
  flex: 0 0 auto;
  aspect-ratio: auto;
  padding: 0.4rem;
}

.visual-panel img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(68vh, 620px);
  margin-inline: auto;
  object-fit: contain;
}

.section-layout.has-image:not(.is-home) .visual-panel img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72dvh, calc(100dvh - 12.5rem));
  object-fit: contain;
  object-position: center;
}

.fullscreen-btn {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(10, 47, 92, 0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(10, 47, 92, 0.28);
}

.fullscreen-btn:hover,
.fullscreen-btn:focus-visible {
  background: var(--blue-700);
  outline: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(6, 18, 34, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #fff;
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: none;
}

body.lightbox-open {
  overflow: hidden;
}

.image-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  padding: 2rem;
  text-align: center;
  color: var(--ink-soft);
  background: linear-gradient(180deg, #f8fbff, #e8f2fc);
}

.image-fallback strong {
  display: block;
  color: var(--blue-900);
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.key-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(10, 47, 92, 0.06);
}

.key-panel__title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--blue-900);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.steps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.2rem 0 0.65rem;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}

.link-btn:hover,
.link-btn:focus-visible {
  color: var(--blue-500);
  outline: none;
}

.objective {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.objective span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  font-weight: 700;
}

.objective__text {
  margin: 0;
}

.objective__links {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.objective__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e8f1ff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.objective__link:hover,
.objective__link:focus-visible {
  color: #fff;
  outline: none;
}

.objective__link:focus-visible {
  text-decoration-thickness: 2px;
}

.key-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.key-list__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  border-left: 3px solid var(--blue-500);
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.key-list__item.is-ok { border-left-color: var(--ok); background: var(--ok-bg); }
.key-list__item.is-warn { border-left-color: #ca8a04; background: var(--warn-bg); }
.key-list__item.is-ban { border-left-color: var(--ban); background: var(--ban-bg); }

.key-list__dot {
  font-size: 0.7rem;
  line-height: 1.4;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-900);
  font-size: 0.75rem;
  font-weight: 700;
}

.flash {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #f3d5b5;
  color: #7a3d0d;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.9rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.check-chip input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--blue-700);
}

.check-chip.is-done {
  background: #edf8f2;
  border-color: #b7e0cb;
  color: var(--ok);
}

.glossary-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding-bottom: 1rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--line);
}

.glossary-head .key-panel__title {
  margin: 0;
}

.glossary-head__lead {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 36rem;
}

.glossary-head__count {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-900);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  margin-top: 1rem;
  width: 100%;
}

.glossary-card {
  position: relative;
  padding: 1rem 1.1rem 1.05rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(10, 47, 92, 0.05);
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.glossary-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  bottom: 0.85rem;
  width: 3px;
  border-radius: 999px;
  background: var(--blue-500);
}

.glossary-card:hover {
  border-color: var(--blue-300);
  box-shadow: 0 8px 22px rgba(18, 86, 160, 0.1);
}

.glossary-card__term {
  margin: 0 0 0.4rem;
  padding-left: 0.35rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--blue-900);
  line-height: 1.3;
  text-wrap: balance;
}

.glossary-card__def {
  margin: 0;
  padding-left: 0.35rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #2f4660;
  font-weight: 500;
  text-wrap: pretty;
}

.key-panel--glossary {
  max-width: none;
  width: 100%;
  position: static;
  max-height: none;
  overflow: visible;
  padding: 1.25rem 1.35rem 1.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-layout.is-glossary {
  max-width: min(100%, 1400px);
  width: 100%;
  margin-inline: auto;
}

@media (min-width: 1200px) {
  .glossary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.widget {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.widget__title {
  margin: 0 0 0.7rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--blue-900);
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.doc-card {
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  text-align: center;
  padding: 0.55rem 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.doc-card.is-ok { border-color: #b7e0cb; background: var(--ok-bg); color: var(--ok); }
.doc-card.is-ban { border-color: #f3c1bc; background: var(--ban-bg); color: var(--ban); }

.doc-card__icon { font-size: 1.25rem; }
.doc-card__tag { font-size: 0.65rem; opacity: 0.85; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.timeline__item {
  border-left: 3px solid var(--blue-300);
  padding-left: 0.15rem;
}

.timeline__item.is-ok { border-left-color: var(--ok); }
.timeline__item.is-warn { border-left-color: #ca8a04; }
.timeline__item.is-focus .timeline__node {
  box-shadow: 0 0 0 2px rgba(29, 127, 214, 0.25);
}

.timeline__node {
  width: 100%;
  display: grid;
  gap: 0.1rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--blue-50);
  padding: 0.55rem 0.7rem;
}

.timeline__label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--blue-900);
}

.timeline__detail {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.timeline__note,
.flow__result,
.form-note {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.flow {
  display: grid;
  gap: 0.45rem;
  justify-items: stretch;
}

.flow__start {
  text-align: center;
  padding: 0.55rem;
  border-radius: 10px;
  background: var(--blue-100);
  color: var(--blue-900);
  font-weight: 800;
  font-size: 0.82rem;
}

.flow__arrow {
  text-align: center;
  color: var(--blue-700);
  font-weight: 800;
}

.flow__branch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.flow__card {
  display: grid;
  gap: 0.25rem;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.7rem;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}

.flow__card strong {
  font-size: 0.9rem;
}

.flow__card.is-warn { background: var(--warn-bg); border-color: #f3d5b5; }
.flow__card.is-ban { background: var(--ban-bg); border-color: #f3c1bc; }
.flow__card.is-selected {
  box-shadow: 0 0 0 2px rgba(29, 127, 214, 0.35);
}

.flip-grid {
  display: grid;
  gap: 0.55rem;
}

.flip {
  border: 0;
  background: transparent;
  padding: 0;
  perspective: 900px;
  min-height: 110px;
}

.flip__inner {
  position: relative;
  display: block;
  width: 100%;
  min-height: 110px;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.flip.is-flipped .flip__inner {
  transform: rotateY(180deg);
}

.flip__face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 0.35rem;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.flip__front {
  background: var(--blue-50);
  color: var(--blue-900);
}

.flip__back {
  background: var(--ban-bg);
  color: var(--ban);
  transform: rotateY(180deg);
}

.flip__badge {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.form-mock {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed var(--line);
}

.form-mock__header {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--blue-900);
  margin-bottom: 0.15rem;
}

.form-zone {
  display: grid;
  gap: 0.2rem;
  text-align: left;
  border-radius: 10px;
  border: 1px solid #f3c1bc;
  background: rgba(254, 243, 242, 0.95);
  color: var(--ban);
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.form-zone span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7f1d1d;
  opacity: 0.85;
}

.form-zone.is-on {
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.35);
}

.app-footer {
  margin: 0 var(--page-pad-x) calc(1rem + var(--safe-bottom));
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: var(--blue-900);
  color: #f5f9ff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem 0.85rem;
  align-items: center;
}

.app-footer__msg {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  color: #f5f9ff;
}

.app-footer__icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.95;
}

.pager__btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease;
}

.pager__btn:hover:not(:disabled),
.pager__btn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.pager__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager__btn--primary {
  background: #fff;
  border-color: transparent;
  color: var(--blue-900);
}

.pager__btn--primary:hover:not(:disabled),
.pager__btn--primary:focus-visible:not(:disabled) {
  background: var(--blue-100);
}

.sidebar-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(8, 24, 42, 0.45);
  z-index: 30;
}

.sidebar-backdrop[hidden] {
  display: none;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  body.is-role-home .topbar {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    padding: calc(0.85rem + var(--safe-top)) var(--page-pad-x) 0.85rem;
  }

  .phase-bar {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .phase-chip {
    flex: 1;
    min-width: 0;
  }

  .section-layout.has-image,
  .section-layout.has-image.is-home,
  .section-layout.has-image:not(.is-home) {
    grid-template-columns: 1fr;
  }

  .visual-panel,
  .key-panel {
    position: static;
    max-height: none;
    height: auto;
  }

  .section-layout.has-image:not(.is-home) .visual-panel img {
    max-height: min(58vh, 480px);
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 0.55rem 0.65rem;
  }

  body.is-role-home .topbar {
    grid-template-columns: auto auto 1fr auto;
  }

  .home-fullscreen-btn {
    grid-column: auto;
    justify-self: end;
  }

  .topbar__progress {
    grid-column: 1 / -1;
    text-align: left;
  }

  .progress-bar {
    margin-left: 0;
    width: 100%;
    max-width: none;
  }

  .phase-bar {
    grid-column: 1 / -1;
    gap: 0.35rem;
  }

  .phase-chip {
    min-width: 0;
    padding: 0.35rem 0.45rem;
  }

  .phase-chip__name {
    font-size: 0.72rem;
  }

  .app-footer {
    border-radius: var(--radius);
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
  }

  .app-footer__msg {
    grid-column: 1 / -1;
    order: -1;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  body.is-role-home .app-footer {
    grid-template-columns: 1fr;
  }

  .flow__branch {
    grid-template-columns: 1fr;
  }

  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .key-panel--glossary {
    padding: 1rem;
  }

  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fullscreen-btn {
    font-size: 0.7rem;
    padding: 0.4rem 0.65rem;
  }
}

@media (max-width: 640px) {
  :root {
    --page-pad-x: 0.75rem;
    --radius: 14px;
    --panel-max-h: calc(100dvh - 11rem);
  }

  body {
    background-attachment: scroll;
  }

  body.is-role-home .topbar {
    grid-template-columns: auto auto 1fr auto;
    gap: 0.45rem;
  }

  .topbar__logo {
    height: 2rem;
    max-width: min(110px, 32vw);
  }

  .topbar__heading {
    font-size: 0.98rem;
  }

  .topbar__eyebrow {
    font-size: 0.65rem;
  }

  .phase-chip__body {
    min-width: 0;
  }

  .phase-chip__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .role-card:hover,
  .role-card:focus-visible {
    transform: none;
  }

  .role-card__body {
    padding: 0.9rem 0.95rem 1rem;
  }

  .role-card__title {
    font-size: 0.95rem;
    padding: 0.4rem 0.7rem;
  }

  .role-card__meta-row {
    gap: 0.35rem;
  }

  .pager__btn {
    width: 100%;
    justify-content: center;
    min-height: 2.6rem;
    padding: 0.55rem 0.75rem;
  }

  .app-footer__msg {
    font-size: 0.74rem;
  }

  .section-layout.has-image:not(.is-home) .visual-panel img {
    max-height: min(48vh, 360px);
  }

  .lightbox {
    padding: 0.75rem;
  }

  .lightbox img {
    max-width: 100%;
    max-height: 88dvh;
  }

  .lightbox__close {
    top: calc(0.65rem + var(--safe-top));
    right: calc(0.65rem + var(--safe-right));
  }

  .doc-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .widget {
    overflow-x: auto;
  }
}

@media (min-width: 1100px) {
  .section-layout.has-image {
    grid-template-columns: minmax(0, 51fr) minmax(280px, 49fr);
    align-items: stretch;
    gap: 1.25rem;
  }

  /* Temas: ancho del contenedor de imagen */
  .section-layout.has-image:not(.is-home) {
    grid-template-columns: minmax(0, 55fr) minmax(240px, 45fr);
  }

  .section-layout.is-home {
    grid-template-columns: minmax(0, 61fr) minmax(280px, 39fr);
  }

  .section-layout.is-home .visual-panel img {
    width: 100%;
    max-width: 100%;
    max-height: min(var(--panel-max-h), 620px);
  }

  .visual-panel {
    position: sticky;
    top: 6.5rem;
    max-height: var(--panel-max-h);
    height: 100%;
  }

  .section-layout.has-image:not(.is-home) .visual-panel {
    height: auto;
    max-height: none;
  }

  .section-layout.has-image:not(.is-home) .visual-stage {
    max-height: none;
  }

  .visual-panel img {
    max-height: min(var(--panel-max-h), 620px);
  }

  .section-layout.has-image:not(.is-home) .visual-panel img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(78dvh, calc(100dvh - 12rem));
  }

  .key-panel {
    position: sticky;
    top: 6.5rem;
    height: 100%;
    max-height: var(--panel-max-h);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .key-panel--glossary {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (hover: none) {
  .role-card:hover {
    transform: none;
    box-shadow: 0 6px 20px rgba(10, 47, 92, 0.07);
  }

  .role-card:hover .role-card__media img {
    animation-play-state: running;
    transform: scale(1.02);
    opacity: 1;
  }
}
