:root {
  --bg: #05070f;
  --bg-soft: #0a0e1c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #eef2ff;
  --muted: #98a2c0;
  --c1: #6366f1;
  --c2: #22d3ee;
  --c3: #f472b6;
  --c4: #34d399;
  --c5: #fbbf24;
  --c6: #a78bfa;
  --c7: #fb7185;
  --c8: #38bdf8;
  --radius: 22px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: "Sora", system-ui, sans-serif;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

.shell {
  width: min(1280px, 92vw);
  margin-inline: auto;
}

/* ---------- Fondo animado ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% -10%, #101833 0%, var(--bg) 55%);
}

.aurora__blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  will-change: transform;
}

.aurora__blob--1 {
  background: #4f46e5;
  top: -12vw;
  left: -8vw;
  animation: drift1 24s var(--ease) infinite alternate;
}

.aurora__blob--2 {
  background: #06b6d4;
  top: 22vw;
  right: -14vw;
  animation: drift2 30s var(--ease) infinite alternate;
}

.aurora__blob--3 {
  background: #db2777;
  bottom: -18vw;
  left: 28vw;
  opacity: 0.32;
  animation: drift3 27s var(--ease) infinite alternate;
}

.aurora__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(90% 60% at 50% 0%, #000 0%, transparent 75%);
}

@keyframes drift1 {
  to {
    transform: translate3d(14vw, 10vw, 0) scale(1.25);
  }
}

@keyframes drift2 {
  to {
    transform: translate3d(-16vw, -8vw, 0) scale(1.15);
  }
}

@keyframes drift3 {
  to {
    transform: translate3d(10vw, -12vw, 0) scale(1.3);
  }
}

.cursor-glow {
  position: fixed;
  z-index: -1;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.16) 0%, transparent 65%);
  transform: translate(-50%, -50%);
  transition: opacity 0.4s ease;
  opacity: 0;
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  background: var(--bg);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader__ring {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--c2);
  border-right-color: var(--c1);
  animation: spin 0.9s linear infinite;
}

.loader__text {
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 1;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(90px, 14vh, 160px) 0 60px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  backdrop-filter: blur(14px);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c4);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: ping 2.2s ease-out infinite;
}

@keyframes ping {
  70% {
    box-shadow: 0 0 0 12px rgba(52, 211, 153, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.hero__title {
  margin: 26px auto 0;
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 800;
  max-width: 16ch;
}

.grad {
  display: block;
  background: linear-gradient(100deg, var(--c2), var(--c1) 42%, var(--c3) 78%, var(--c5));
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 9s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: 260% 0;
  }
}

.hero__lead {
  margin: 22px auto 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero__meta {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.hero__meta span {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}

.hero__meta strong {
  color: var(--text);
}

.scroll-hint {
  margin-top: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.scroll-hint:hover {
  color: var(--text);
}

.scroll-hint svg {
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(6px);
  }
}

/* ---------- Superficies ---------- */
.glass {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.35), transparent 40%, transparent 70%, rgba(255, 255, 255, 0.16));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

/* ---------- Filtros ---------- */
.filters {
  padding: 26px 28px 22px;
  margin-bottom: 26px;
}

.filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.filters__head h2 {
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.field select,
.field input {
  appearance: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 24, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s var(--ease);
}

.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2c0' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.75);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
  transform: translateY(-1px);
}

.field option {
  background: #0b1020;
  color: var(--text);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  min-height: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.14);
  font-size: 12.5px;
  animation: chipIn 0.35s var(--ease) both;
}

.chip button {
  border: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  font-size: 13px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chip button:hover {
  background: var(--c7);
  transform: rotate(90deg);
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.9);
  }
}

.btn {
  border: 1px solid var(--border-strong);
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.85), rgba(34, 211, 238, 0.75));
  color: #05070f;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -12px rgba(99, 102, 241, 0.9);
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
}

.btn--ghost:hover {
  color: var(--text);
  box-shadow: none;
  border-color: var(--border-strong);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* ---------- KPIs ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.kpi {
  padding: 22px 22px 20px;
  transition: transform 0.45s var(--ease), border-color 0.45s ease;
}

.kpi:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
}

.kpi::after {
  content: "";
  position: absolute;
  inset: auto -30% -70% -30%;
  height: 120px;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.35), transparent 70%);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.kpi:hover::after {
  opacity: 1;
}

.kpi__icon {
  font-size: 20px;
}

.kpi__label {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi__value {
  font-family: "Sora", sans-serif;
  font-size: clamp(2rem, 3.4vw, 2.7rem);
  font-weight: 700;
  line-height: 1.1;
  margin-top: 4px;
  background: linear-gradient(120deg, #fff, #9fb2ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.kpi__value--text {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.kpi__foot {
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Grid de tarjetas ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.card {
  padding: 22px 24px 18px;
  transition: transform 0.45s var(--ease), border-color 0.45s ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.card--wide {
  grid-column: 1 / -1;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card__head h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card__head p {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 24, 0.6);
  gap: 4px;
}

.toggle__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.3s ease, background 0.3s var(--ease);
}

.toggle__btn.is-active {
  color: #05070f;
  background: linear-gradient(120deg, var(--c2), var(--c1));
  font-weight: 600;
}

.chart {
  width: 100%;
  min-height: 260px;
}

.chart--donut {
  min-height: 300px;
}

.chart--donut svg {
  max-width: 320px;
  margin-inline: auto;
}

.chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-empty {
  display: grid;
  place-content: center;
  min-height: 220px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---------- Elementos SVG animados ---------- */
.bar {
  transform-origin: bottom;
  transform-box: fill-box;
  animation: growY 0.9s var(--ease) both;
  cursor: pointer;
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.hbar {
  transform-origin: left;
  transform-box: fill-box;
  animation: growX 0.9s var(--ease) both;
  cursor: pointer;
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.bar:hover,
.hbar:hover {
  filter: brightness(1.25) drop-shadow(0 0 12px rgba(99, 102, 241, 0.55));
}

@keyframes growY {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
}

@keyframes growX {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
}

.axis-label,
.value-label,
.legend-text {
  font-family: "Inter", sans-serif;
  fill: var(--muted);
  font-size: 11.5px;
}

.value-label {
  fill: var(--text);
  font-weight: 600;
  font-size: 11.5px;
  animation: fadeIn 0.7s ease both;
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.area-path {
  animation: fadeIn 1.2s ease both;
}

.line-path {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  animation: draw 1.6s var(--ease) forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

.dot {
  cursor: pointer;
  animation: popIn 0.5s var(--ease) both;
  transition: r 0.2s ease;
}

.dot:hover {
  r: 7;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0);
  }
}

.arc {
  cursor: pointer;
  transform-origin: center;
  transform-box: view-box;
  animation: arcIn 0.9s var(--ease) both;
  transition: transform 0.35s var(--ease), filter 0.35s ease;
}

.arc:hover {
  transform: scale(1.045);
  filter: brightness(1.15) drop-shadow(0 0 16px rgba(255, 255, 255, 0.25));
}

@keyframes arcIn {
  from {
    opacity: 0;
    transform: scale(0.6) rotate(-25deg);
  }
}

.donut-center-value {
  font-family: "Sora", sans-serif;
  font-size: 30px;
  font-weight: 700;
  fill: var(--text);
  text-anchor: middle;
}

.donut-center-label {
  font-size: 11px;
  fill: var(--muted);
  text-anchor: middle;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  animation: fadeUp 0.6s var(--ease) both;
}

.legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend__item strong {
  color: var(--text);
}

/* ---------- Heatmap ---------- */
.heat {
  display: grid;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.heat__row {
  display: grid;
  grid-template-columns: 96px repeat(var(--cols), minmax(58px, 1fr));
  gap: 6px;
  align-items: center;
}

.heat__label {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  padding-right: 6px;
}

.heat__cell {
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-content: center;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: default;
  animation: cellIn 0.6s var(--ease) both;
  transition: transform 0.28s var(--ease), box-shadow 0.28s ease;
}

.heat__cell:hover {
  transform: scale(1.09);
  box-shadow: 0 10px 24px -12px rgba(34, 211, 238, 0.8);
  z-index: 2;
}

.heat__head {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.08em;
}

@keyframes cellIn {
  from {
    opacity: 0;
    transform: scale(0.75);
  }
}

/* ---------- Tabla ---------- */
.tabla-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 940px;
}

.tabla th {
  position: sticky;
  top: 0;
  background: rgba(10, 14, 28, 0.96);
  backdrop-filter: blur(8px);
  text-align: left;
  padding: 13px 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.tabla th[data-sort] {
  cursor: pointer;
  user-select: none;
  transition: color 0.25s ease;
}

.tabla th[data-sort]:hover {
  color: var(--text);
}

.tabla th.is-sorted::after {
  content: " ▲";
  font-size: 9px;
}

.tabla th.is-sorted.is-desc::after {
  content: " ▼";
}

.tabla td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
  color: #d5dcf5;
}

.tabla tbody tr {
  animation: fadeUp 0.45s var(--ease) both;
  transition: background 0.25s ease;
}

.tabla tbody tr:hover {
  background: rgba(99, 102, 241, 0.1);
}

.tabla td.desc {
  color: var(--muted);
  min-width: 300px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.paginador {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 28, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px -20px #000;
  font-size: 12.5px;
  max-width: 260px;
  opacity: 0;
  transform: translate(-50%, -118%) scale(0.94);
  transition: opacity 0.18s ease, transform 0.18s var(--ease);
}

.tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -128%) scale(1);
}

.tooltip strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.tooltip span {
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  padding: 60px 0 50px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.footer__small {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.75;
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 720px) {
  .filters {
    padding: 20px;
  }

  .card {
    padding: 18px 16px 14px;
  }

  .heat__row {
    grid-template-columns: 74px repeat(var(--cols), minmax(48px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
