html, body {
  height: 100%;
  background: var(--color-surface);
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.app-frame {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--color-white);
  position: relative;
  overflow-x: hidden;
  box-shadow: var(--sombra-fuerte);
}

@media (min-width: 900px) {
  body {
    padding: 32px 16px;
  }
  .app-frame {
    min-height: 800px;
    height: 860px;
    border-radius: 32px;
  }
}

/* ---------- Pantalla de bienvenida ---------- */
.welcome {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: radial-gradient(circle at 15% 10%, #ff2f4d 0%, transparent 45%),
              linear-gradient(160deg, var(--color-red-primary) 0%, var(--color-red-deep) 55%, #8f0b21 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 28px;
  overflow: hidden;
  transition: opacity var(--dur-seccion) var(--ease-out), transform var(--dur-seccion) var(--ease-out);
}

.welcome.is-leaving {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.welcome__decor {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

/* Auras de fondo: dan movimiento ambiental al rojo de bienvenida.
   Solo decorativas (no bloquean interacción), por eso usan
   transform/opacity (GPU) y una duración larga y no sincronizada
   entre sí para que no se sientan como un parpadeo mecánico. */
.welcome__aura {
  position: absolute;
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(50px);
  will-change: transform;
}
.welcome__aura--a {
  top: -12%;
  left: -18%;
  width: 68vw;
  height: 68vw;
  max-width: 420px;
  max-height: 420px;
  background: radial-gradient(circle, rgba(255, 122, 26, 0.5) 0%, transparent 70%);
  animation: aura-deriva-a 18s var(--ease-in-out) infinite alternate;
}
.welcome__aura--b {
  bottom: -16%;
  right: -14%;
  width: 58vw;
  height: 58vw;
  max-width: 380px;
  max-height: 380px;
  background: radial-gradient(circle, rgba(70, 110, 255, 0.45) 0%, transparent 70%);
  animation: aura-deriva-b 22s var(--ease-in-out) infinite alternate;
}

.welcome__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- App shell (post-bienvenida) ---------- */
.app-shell {
  display: flex;
  height: 100%;
  min-height: 100vh;
  visibility: hidden;
}

@media (min-width: 900px) {
  .app-shell {
    min-height: 860px;
  }
}

.app-shell.is-active {
  visibility: visible;
}

.sidebar-rail {
  width: 64px;
  flex-shrink: 0;
  background: var(--color-blue-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 16px;
  gap: 18px;
  z-index: 10;
}

.sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: var(--color-white);
  overflow: hidden;
  z-index: 25;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.18);
  transition: width var(--dur-nav) var(--ease-drawer);
}

@media (min-width: 900px) {
  .sidebar-drawer {
    position: absolute;
  }
}

.sidebar-drawer.is-open {
  width: 250px;
}

.sidebar-drawer__inner {
  width: 250px;
  padding: 26px 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 21, 51, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-nav) ease;
  z-index: 20;
}

.sidebar-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  height: 100vh;
  padding: 22px 18px 100px;
  background: linear-gradient(165deg, var(--color-red-primary) 0%, var(--color-red-deep) 100%);
  background-size: 220% 220%;
  animation: fondo-deriva 26s var(--ease-in-out) infinite alternate;
}

.section-title,
.section-subtitle {
  color: #fff;
}
.section-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

@media (min-width: 900px) {
  .main-content {
    height: 860px;
  }
}

.section-panel {
  display: none;
}

.section-panel.is-active {
  display: block;
  animation: seccion-entrada var(--dur-seccion) var(--ease-out);
}
.section-panel.is-active.dir-adelante { animation-name: seccion-entrada-derecha; }
.section-panel.is-active.dir-atras { animation-name: seccion-entrada-izquierda; }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 2px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ---------- Grids ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fund-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 360px) {
  .achievements-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
