:root {
  /* Base oscura índigo, cálida, profunda y moderna */
  --bg: #0b0e1a;
  --bg-soft: #12162a;
  --card: #181d33;
  --card-2: #1e2542;
  --card-hover: #232c4f;
  --line: #2b3355;
  --text: #f2f4fb;
  --muted: #9aa3c4;

  /* Paleta vibrante coherente (estilo ModeladoBD) */
  --em: #2ee6a8;   /* Esmeralda */
  --sky: #38bdf8;  /* Cielo     */
  --fu: #f472d0;   /* Fucsia    */
  --am: #fbbf24;   /* Ámbar     */
  --vi: #a78bfa;   /* Violeta   */
  --co: #fb7185;   /* Coral     */

  --accent: var(--em);
  --accent2: var(--sky);
  --accent3: var(--fu);
  --warn: var(--am);
  --radius: 18px;
  --sbw: 320px;
  --grad: linear-gradient(90deg, var(--em), var(--sky), var(--vi), var(--fu));
  --grad-rev: linear-gradient(90deg, var(--fu), var(--vi), var(--sky), var(--em));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection {
  background: var(--em);
  color: #04140d;
}

code {
  font-family: 'Consolas', 'Courier New', monospace;
  background: rgba(56, 189, 248, .12);
  color: var(--sky);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .88em;
}

/* ========================================================
   FONDO ANIMADO CON BLOBS
   ======================================================== */
#bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

#bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: .32;
  animation: blob 22s ease-in-out infinite;
}

#bg-blobs span:nth-child(1) {
  width: 440px;
  height: 440px;
  background: var(--em);
  top: -80px;
  left: -70px;
}

#bg-blobs span:nth-child(2) {
  width: 400px;
  height: 400px;
  background: var(--fu);
  bottom: -100px;
  right: -50px;
  animation-delay: -7s;
}

#bg-blobs span:nth-child(3) {
  width: 360px;
  height: 360px;
  background: var(--sky);
  top: 40%;
  left: 55%;
  animation-delay: -14s;
}

@keyframes blob {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(45px, -35px) scale(1.15);
  }
  66% {
    transform: translate(-35px, 45px) scale(.88);
  }
}

/* ========================================================
   TOPBAR
   ======================================================== */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 1000;
  background: rgba(11, 14, 26, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
}

#hamburger {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.15rem;
  transition: .2s;
}

#hamburger:hover {
  border-color: var(--em);
  transform: scale(1.05);
}

#topbar .brand {
  font-weight: 800;
  font-size: .98rem;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

#topbar .brand .brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(46, 230, 168, .2), rgba(56, 189, 248, .25));
  border: 1px solid var(--em);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

#topbar .brand span.grad-txt {
  background: var(--grad);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: grad 6s ease infinite;
  font-weight: 900;
}

@keyframes grad {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.stage-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 12px;
}

.stage-link {
  text-decoration: none;
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stage-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .08);
  border-color: var(--sky);
  transform: translateY(-1px);
}

.stage-link.active {
  color: #0b0e1a;
  background: linear-gradient(90deg, var(--em), var(--sky));
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(56, 189, 248, .35);
}

#topbar .stepcount {
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

#topbar-progress {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--grad);
  background-size: 200%;
  box-shadow: 0 0 12px var(--em);
  width: 0%;
  transition: width .45s cubic-bezier(.2, .8, .2, 1);
  animation: grad 4s linear infinite;
}

/* ========================================================
   LAYOUT & SIDEBAR
   ======================================================== */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: 58px;
}

#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 899;
  backdrop-filter: blur(3px);
}

#overlay.show {
  display: block;
}

#sidebar {
  width: var(--sbw);
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: rgba(18, 22, 42, .6);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 18px 0 60px;
}

#sidebar::-webkit-scrollbar {
  width: 7px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

.sidebar-stages-block {
  padding: 12px 14px;
  margin: 0 14px 14px;
  background: rgba(24, 29, 51, .75);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.sidebar-stages-title {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.stage-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  transition: all .2s ease;
  margin-bottom: 4px;
}

.stage-sidebar-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .05);
}

.stage-sidebar-link.active {
  background: rgba(56, 189, 248, .12);
  color: var(--sky);
  border-left: 3px solid var(--sky);
  font-weight: 700;
}

.stage-sidebar-link .s-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--card-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
}

.stage-sidebar-link.active .s-num {
  background: var(--sky);
  color: #0b0e1a;
}

.group-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  padding: 16px 22px 8px;
  font-weight: 800;
}

.group-label:first-of-type {
  padding-top: 4px;
}

.navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--muted);
  padding: 9px 22px;
  font-size: .84rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .22s;
  position: relative;
  font-family: inherit;
}

.navitem:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  padding-left: 26px;
}

.navitem.active {
  color: var(--text);
  border-left-color: var(--em);
  background: linear-gradient(90deg, rgba(46, 230, 168, .14), transparent);
  font-weight: 700;
}

.navitem .bullet {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  color: var(--muted);
  transition: .25s;
}

.navitem.active .bullet {
  border-color: var(--em);
  color: var(--em);
  box-shadow: 0 0 0 4px rgba(46, 230, 168, .15);
  transform: scale(1.1);
}

.navitem.done .bullet {
  background: var(--em);
  border-color: var(--em);
  color: #04140d;
}

.navitem.done .bullet::before {
  content: '✓';
  font-weight: 900;
}

@media (max-width: 980px) {
  .stage-nav {
    display: none;
  }
}

@media (max-width: 860px) {
  #hamburger {
    display: block;
  }

  #sidebar {
    position: fixed;
    left: -340px;
    top: 58px;
    z-index: 900;
    box-shadow: 0 0 40px rgba(0, 0, 0, .6);
    transition: left .3s cubic-bezier(.2, .8, .2, 1);
    background: var(--bg-soft);
  }

  #sidebar.open {
    left: 0;
  }
}

/* ========================================================
   MAIN CONTENT & STEP CONTAINER
   ======================================================== */
main {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 40px 24px 90px;
}

.step-panel {
  max-width: 960px;
  width: 100%;
  position: relative;
}

.step {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
  width: 100%;
  visibility: hidden;
}

.step.active {
  position: relative;
  left: 0;
  top: 0;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Entrada escalonada de los elementos en el paso activo */
.step.active > * {
  animation: fadeUp .5s both cubic-bezier(.2, .8, .2, 1);
}

.step.active > *:nth-child(1) { animation-delay: .02s; }
.step.active > *:nth-child(2) { animation-delay: .07s; }
.step.active > *:nth-child(3) { animation-delay: .12s; }
.step.active > *:nth-child(4) { animation-delay: .17s; }
.step.active > *:nth-child(5) { animation-delay: .22s; }
.step.active > *:nth-child(6) { animation-delay: .27s; }
.step.active > *:nth-child(7) { animation-delay: .32s; }
.step.active > *:nth-child(8) { animation-delay: .37s; }

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================================
   TAGS & BADGES
   ======================================================== */
.tag {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #04140d;
  background: var(--em);
  padding: 5px 14px;
  border-radius: 30px;
  font-weight: 800;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(46, 230, 168, .35);
}

.tag.tag2 {
  background: var(--sky);
  color: #022030;
  box-shadow: 0 4px 16px rgba(56, 189, 248, .35);
}

.tag.tag3 {
  background: var(--fu);
  color: #2b0a24;
  box-shadow: 0 4px 16px rgba(244, 114, 208, .35);
}

.tag.tag4 {
  background: var(--am);
  color: #231600;
  box-shadow: 0 4px 16px rgba(251, 191, 36, .35);
}

.tag.tag5 {
  background: var(--vi);
  color: #160a2e;
  box-shadow: 0 4px 16px rgba(167, 139, 250, .35);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: .72rem;
  margin-right: 6px;
  margin-top: 4px;
  font-weight: 600;
}

.pill.em { background: rgba(46, 230, 168, .2); color: var(--em); border: 1px solid rgba(46, 230, 168, .3); }
.pill.sky { background: rgba(56, 189, 248, .2); color: var(--sky); border: 1px solid rgba(56, 189, 248, .3); }
.pill.fu { background: rgba(244, 114, 208, .2); color: var(--fu); border: 1px solid rgba(244, 114, 208, .3); }
.pill.am { background: rgba(251, 191, 36, .2); color: var(--am); border: 1px solid rgba(251, 191, 36, .3); }
.pill.vi { background: rgba(167, 139, 250, .2); color: var(--vi); border: 1px solid rgba(167, 139, 250, .3); }

/* ========================================================
   TYPOGRAPHY
   ======================================================== */
h1.step-title {
  font-size: clamp(1.5rem, 3.6vw, 2.2rem);
  margin: 0 0 14px;
  font-weight: 900;
  line-height: 1.22;
}

h1.step-title.grad {
  background: var(--grad);
  background-size: 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: grad 6s ease infinite;
}

p.step-text {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 18px;
}

p.step-text b {
  color: var(--text);
}

ul.step-list {
  color: var(--muted);
  font-size: .95rem;
  padding-left: 6px;
  margin: 0 0 18px;
  list-style: none;
}

ul.step-list li {
  margin-bottom: 9px;
  padding-left: 26px;
  position: relative;
}

ul.step-list li::before {
  content: '▹';
  position: absolute;
  left: 4px;
  color: var(--em);
  font-weight: 900;
}

ul.step-list b {
  color: var(--text);
}

/* ========================================================
   BOXES & CALLOUTS
   ======================================================== */
.box {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  transition: transform .25s, border-color .25s;
}

.box:hover {
  border-color: rgba(56, 189, 248, .5);
  transform: translateY(-2px);
}

.box h4 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--sky);
  display: flex;
  align-items: center;
  gap: 8px;
}

.box h4 .icon {
  font-size: 1.2rem;
}

.callout {
  border-left: 4px solid var(--em);
  padding: 14px 18px;
  background: rgba(46, 230, 168, .09);
  border-radius: 0 12px 12px 0;
  font-size: .92rem;
  color: var(--text);
  margin-bottom: 18px;
  line-height: 1.5;
}

.callout.warn {
  border-left-color: var(--am);
  background: rgba(251, 191, 36, .1);
}

.callout.ok {
  border-left-color: var(--em);
  background: rgba(46, 230, 168, .12);
}

.callout.info {
  border-left-color: var(--sky);
  background: rgba(56, 189, 248, .1);
}

.callout.fu {
  border-left-color: var(--fu);
  background: rgba(244, 114, 208, .1);
}

/* ========================================================
   HERO BANNER & IMAGES
   ======================================================== */
.hero-image-wrap {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 22px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .45);
  position: relative;
  background: #000;
}

.hero-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform .4s ease;
}

.hero-image-wrap:hover img {
  transform: scale(1.02);
}

.hero-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 18px;
  background: linear-gradient(180deg, transparent, rgba(11, 14, 26, .92));
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-caption b {
  color: var(--em);
}

/* ========================================================
   PHASE CARDS (TARJETAS INTRODUCTORIAS)
   ======================================================== */
.phase-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 18px 0 20px;
}

.phase-card {
  position: relative;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  cursor: pointer;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.phase-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--em);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}

.phase-card .num {
  font-size: 1.8rem;
  font-weight: 900;
  background: var(--grad);
  background-size: 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.phase-card h3 {
  margin: 8px 0 6px;
  font-size: 1.1rem;
}

.phase-card p {
  color: var(--muted);
  font-size: .86rem;
  margin: 0;
  flex: 1;
}

.phase-card .meta {
  margin-top: 14px;
  font-size: .75rem;
  color: var(--sky);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ========================================================
   LINEA DE TIEMPO HISTORICA INTERACTIVA (1995 -> 2026)
   ======================================================== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 22px 0;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 28px;
  width: 3px;
  background: linear-gradient(180deg, var(--em), var(--sky), var(--vi), var(--fu));
  border-radius: 2px;
}

.timeline-item {
  display: flex;
  gap: 22px;
  position: relative;
  padding-left: 10px;
}

.timeline-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-2);
  border: 2px solid var(--sky);
  color: var(--sky);
  font-size: .8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 2;
  box-shadow: 0 0 14px rgba(56, 189, 248, .3);
}

.timeline-item:nth-child(1) .timeline-badge { border-color: var(--em); color: var(--em); box-shadow: 0 0 14px rgba(46, 230, 168, .3); }
.timeline-item:nth-child(2) .timeline-badge { border-color: var(--sky); color: var(--sky); box-shadow: 0 0 14px rgba(56, 189, 248, .3); }
.timeline-item:nth-child(3) .timeline-badge { border-color: var(--vi); color: var(--vi); box-shadow: 0 0 14px rgba(167, 139, 250, .3); }
.timeline-item:nth-child(4) .timeline-badge { border-color: var(--fu); color: var(--fu); box-shadow: 0 0 14px rgba(244, 114, 208, .3); }

.timeline-content {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  transition: border-color .2s;
}

.timeline-content:hover {
  border-color: var(--sky);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-header h4 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--text);
}

.timeline-body {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ========================================================
   DIAGRAMAS SVG Y MAPAS DE PROCESOS
   ======================================================== */
.diagram-wrap {
  position: relative;
  background: radial-gradient(circle at 50% 30%, rgba(56, 189, 248, .06), transparent 60%), var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  overflow: hidden;
}

.diagram-svg {
  width: 100%;
  height: auto;
  display: block;
}

.conn-flow {
  stroke: var(--sky);
  stroke-width: 2.2;
  stroke-dasharray: 7 7;
  opacity: .75;
  animation: dashFlow 1.1s linear infinite;
}

@keyframes dashFlow {
  to {
    stroke-dashoffset: -28;
  }
}

.stage-node {
  fill: var(--card-2);
  stroke: var(--em);
  stroke-width: 2;
  cursor: pointer;
  transition: all .25s ease;
}

.stage-node:hover {
  stroke-width: 3.5;
  filter: drop-shadow(0 0 12px rgba(46, 230, 168, .6));
  transform: translateY(-2px);
}

.stage-node-label {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.gate-diamond {
  fill: var(--bg-soft);
  stroke: var(--am);
  stroke-width: 2.2;
  cursor: pointer;
  transition: all .25s ease;
}

.gate-diamond:hover {
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, .7));
}

.gate-label {
  fill: var(--am);
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
}

/* ========================================================
   TABLAS Y COMPARATIVOS
   ======================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  text-align: left;
}

table.data-table th {
  background: linear-gradient(90deg, rgba(46, 230, 168, .18), rgba(56, 189, 248, .15));
  color: var(--text);
  font-weight: 800;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(43, 51, 85, .6);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.5;
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, .02);
  color: var(--text);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table td b {
  color: var(--text);
}

/* ========================================================
   FILTROS, BUSCADORES Y TABS
   ======================================================== */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 14px;
}

.search-input {
  flex: 1;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--text);
  font-size: .86rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}

.search-input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 10px rgba(56, 189, 248, .25);
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--sky);
}

.filter-btn.active {
  background: var(--sky);
  color: #022030;
  border-color: var(--sky);
  box-shadow: 0 0 12px rgba(56, 189, 248, .3);
}

/* ========================================================
   TARJETAS EXPANDIBLES DE PROCESOS (ACCORDIONS)
   ======================================================== */
.process-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 18px 0;
}

.process-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .25s, transform .25s;
}

.process-card:hover {
  border-color: var(--sky);
  transform: translateY(-2px);
}

.process-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(90deg, rgba(24, 29, 51, .9), rgba(30, 37, 66, .9));
}

.process-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.process-code {
  font-family: 'Consolas', monospace;
  font-weight: 800;
  font-size: .82rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, .15);
  color: var(--sky);
}

.process-name {
  font-weight: 800;
  font-size: .95rem;
  color: var(--text);
}

.process-expand-icon {
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform .3s ease;
}

.process-card.open .process-expand-icon {
  transform: rotate(180deg);
  color: var(--em);
}

.process-card.open {
  border-color: var(--em);
}

.process-body {
  display: none;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: rgba(18, 22, 42, .5);
  font-size: .88rem;
  line-height: 1.55;
  animation: fadeUp .3s ease;
}

.process-card.open .process-body {
  display: block;
}

.process-section-title {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sky);
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.process-section-title:first-child {
  margin-top: 0;
}

.raci-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: .8rem;
}

.raci-table th, .raci-table td {
  padding: 6px 10px;
  border: 1px solid var(--line);
  text-align: center;
}

.raci-table th {
  background: rgba(255, 255, 255, .04);
  color: var(--sky);
  font-weight: 700;
}

.badge-raci {
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-raci.R { background: var(--co); color: #fff; }
.badge-raci.A { background: var(--am); color: #000; }
.badge-raci.C { background: var(--sky); color: #000; }
.badge-raci.I { background: var(--em); color: #000; }

/* ========================================================
   RADAR DE CALIDAD ISO 25010 & MATRIZ INTERACTIVA
   ======================================================== */
.quality-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.quality-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}

.quality-card:hover {
  transform: translateY(-4px);
  border-color: var(--em);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .3);
}

.quality-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.quality-card-head .q-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(46, 230, 168, .15);
  border: 1px solid var(--em);
}

.quality-card h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.quality-subitems {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.quality-subitems small {
  display: block;
  color: var(--sky);
  font-weight: 700;
  margin-bottom: 4px;
}

.interactive-radar-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin: 20px 0;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: center;
}

@media (max-width: 768px) {
  .interactive-radar-box {
    grid-template-columns: 1fr;
  }
}

.slider-group {
  margin-bottom: 12px;
}

.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--em);
}

/* ========================================================
   CHECKLIST INTERACTIVA DE AUDITORÍA
   ======================================================== */
.checklist-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin: 20px 0;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .02);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .2s;
}

.check-item:hover {
  background: rgba(255, 255, 255, .05);
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--em);
  cursor: pointer;
}

.check-item-info {
  flex: 1;
}

.check-item-title {
  font-weight: 700;
  font-size: .88rem;
  color: var(--text);
}

.check-item-desc {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
}

.audit-meter {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 14px;
}

.audit-meter-bar {
  flex: 1;
  height: 10px;
  background: var(--card-2);
  border-radius: 10px;
  overflow: hidden;
}

.audit-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--grad);
  transition: width .4s ease;
}

.audit-meter-score {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--em);
  min-width: 50px;
}

/* ========================================================
   MOTOR DE ADAPTACIÓN (TAILORING ENGINE)
   ======================================================== */
.tailor-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sky);
}

.form-control {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  outline: none;
  transition: border-color .2s;
}

.form-control:focus {
  border-color: var(--em);
}

.tailor-output {
  margin-top: 20px;
  background: #080a14;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}

.tailor-output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.tailor-badge-count {
  display: flex;
  gap: 8px;
}

/* ========================================================
   QUIZ & EVALUACIÓN INTERACTIVA
   ======================================================== */
.quiz-card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}

.quiz-card p.q {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0 0 14px;
  color: var(--text);
}

.opt {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: .9rem;
  transition: .2s ease;
  font-family: inherit;
}

.opt:hover:not(.disabled) {
  border-color: var(--sky);
  transform: translateX(4px);
  background: rgba(56, 189, 248, .08);
}

.opt.correct {
  background: rgba(46, 230, 168, .2) !important;
  border-color: var(--em) !important;
  color: #fff;
  font-weight: 700;
}

.opt.wrong {
  background: rgba(251, 113, 133, .2) !important;
  border-color: var(--co) !important;
  animation: shake .4s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.quiz-feedback {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .84rem;
  line-height: 1.45;
}

.quiz-feedback.show {
  display: block;
  animation: fadeUp .3s ease;
}

.quiz-score {
  text-align: center;
  color: var(--muted);
  margin-top: 14px;
  font-size: .95rem;
  font-weight: 700;
}

.quiz-celebrate {
  display: none;
  text-align: center;
  margin-top: 20px;
  padding: 26px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(46, 230, 168, .18), rgba(244, 114, 208, .18));
  border: 1px solid var(--em);
  box-shadow: 0 12px 36px rgba(46, 230, 168, .2);
}

.quiz-celebrate.show {
  display: block;
  animation: fadeUp .5s ease;
}

.quiz-celebrate h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

/* ========================================================
   STEP NAVIGATION FOOTER & BUTTONS
   ======================================================== */
.stepnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.navbtn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 800;
  transition: all .2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.navbtn:hover:not(:disabled) {
  border-color: var(--em);
  transform: translateY(-2px);
}

.navbtn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.navbtn.primary {
  background: var(--em);
  color: #04140d;
  border-color: var(--em);
  box-shadow: 0 6px 20px rgba(46, 230, 168, .3);
}

.navbtn.primary:hover:not(:disabled) {
  box-shadow: 0 10px 28px rgba(46, 230, 168, .45);
}

.step-of {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
}

.kbd-hint {
  text-align: center;
  color: var(--muted);
  font-size: .74rem;
  margin-top: 12px;
  opacity: .75;
}

.kbd {
  display: inline-block;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: .72rem;
  background: var(--bg-soft);
  color: var(--sky);
}

.shine {
  position: relative;
  overflow: hidden;
}

.shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-20deg);
  animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
  0% { left: -120%; }
  60%, 100% { left: 160%; }
}

/* ========================================================
   FLOATING ACTION BUTTON (FAB) & VISOR
   ======================================================== */
#fab-visor {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--grad);
  background-size: 200%;
  color: #04140d;
  border: none;
  border-radius: 40px;
  padding: 13px 22px;
  font-size: .92rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 10px 30px rgba(46, 230, 168, .4);
  animation: grad 6s ease infinite, fabIn .5s ease .4s both;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
}

#fab-visor:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 16px 40px rgba(46, 230, 168, .55);
}

#fab-visor .fab-ic {
  font-size: 1.25rem;
  line-height: 1;
}

#fab-visor .fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 40px;
  box-shadow: 0 0 0 0 rgba(46, 230, 168, .5);
  animation: fabPulse 2.4s infinite;
  pointer-events: none;
}

@keyframes fabPulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 230, 168, .45); }
  70% { box-shadow: 0 0 0 16px rgba(46, 230, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 230, 168, 0); }
}

@keyframes fabIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 600px) {
  #fab-visor {
    right: 16px;
    bottom: 16px;
    padding: 12px 18px;
    font-size: .85rem;
  }
  #fab-visor .fab-txt {
    display: none;
  }
}

/* ========================================================
   CONFETTI
   ======================================================== */
.confetti {
  position: fixed;
  top: -12px;
  width: 10px;
  height: 14px;
  z-index: 2000;
  pointer-events: none;
  border-radius: 2px;
}

/* ========================================================
   FOOTER CREDITS
   ======================================================== */
footer.credits {
  text-align: center;
  padding: 32px 20px 44px;
  color: var(--muted);
  font-size: .84rem;
  border-top: 1px solid var(--line);
  background: rgba(11, 14, 26, .9);
}

footer.credits p {
  margin: 4px 0;
}

footer.credits .author {
  color: var(--text);
  font-size: .92rem;
  margin-top: 8px;
}

footer.credits .author b {
  color: var(--em);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
  }
  #bg-blobs span {
    animation: none;
  }
}
