/* ============================================================
   PORTADA · Puntos de estado (DEMO v1.0 → PRODUCTO v10)
   ============================================================ */

/* --- Punto sobre cada tarjeta --- */
.card-mini {
  --stage-color: #64748b;
  --stage-glow: rgba(100, 116, 139, 0.22);
  --stage-ink: #0b0b14;
}

.stage-dot {
  position: relative;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--stage-color);
  color: var(--stage-ink);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 0 4px var(--stage-glow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  margin-left: 2px;
}

.stage-dot:hover,
.stage-dot:focus-visible {
  transform: scale(1.14);
  outline: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 0 0 5px var(--stage-glow), 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* El nivel superior (PRODUCTO v10) lleva anillo dorado */
.stage-dot[data-stage="10"] {
  box-shadow: 0 0 0 2px rgba(253, 203, 110, 0.8), 0 0 0 5px var(--stage-glow);
}

.stage-dot[data-stage="10"]:hover,
.stage-dot[data-stage="10"]:focus-visible {
  box-shadow: 0 0 0 2px rgba(253, 203, 110, 0.95), 0 0 0 6px var(--stage-glow), 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* Tooltip del punto */
.stage-dot::after {
  content: attr(data-tip);
  position: absolute;
  right: -2px;
  bottom: calc(100% + 9px);
  padding: 6px 10px;
  border-radius: 8px;
  background: #0d0d18;
  color: #e8e8f0;
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 40;
}

.stage-dot:hover::after,
.stage-dot:focus-visible::after {
  opacity: 1;
  transform: translateY(0) scale(1);
}

html.light .stage-dot {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 0 4px var(--stage-glow);
}

html.light .stage-dot::after {
  background: #fff;
  color: #1a1a2e;
  border-color: #d0d0e0;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
}

/* --- Leyenda de estados (portada) --- */
.stage-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px;
}

.stage-legend-title {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text3);
  margin-right: 6px;
}

.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text2);
  cursor: default;
  transition: border-color 0.2s, color 0.2s;
}

.stage-chip:hover {
  border-color: var(--stage-color);
  color: var(--text);
}

.stage-chip i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 8px;
  font-weight: 800;
  background: var(--stage-color);
  color: var(--stage-ink);
  font-variant-numeric: tabular-nums;
}

.stage-chip em {
  font-style: normal;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text3);
}

.stage-legend button.stage-chip {
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.stage-legend button.stage-chip:focus-visible {
  outline: 2px solid var(--stage-color);
  outline-offset: 2px;
}

.stage-chip.is-active {
  border-color: var(--stage-color);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 1px var(--stage-color) inset;
}

.stage-chip-all {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stage-chip-all.is-active {
  border-color: var(--primary);
  color: #fff;
  background: rgba(108, 92, 231, 0.35);
  box-shadow: none;
}

html.light .stage-chip.is-active {
  background: #f2f0ff;
}

/* Tarjetas ocultas por el filtro de estado */
.card-mini.stage-hidden {
  display: none !important;
}

.stage-chip.is-empty {
  opacity: 0.45;
}

.stage-legend-note {
  flex: 1 1 100%;
  font-size: 0.64rem;
  color: var(--text3);
  margin-top: 2px;
}

html.light .stage-chip {
  background: #fff;
}

/* --- Versión y barra de madurez en la ficha del proyecto --- */
.pm-stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--stage-color);
  color: var(--stage-color);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  vertical-align: middle;
}

.pm-stage-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--stage-color);
  display: inline-block;
}

.pm-stage-bar {
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.pm-stage-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.pm-stage-bar-head b {
  color: var(--text);
  font-weight: 800;
}

.pm-stage-track {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.pm-stage-track i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

html.light .pm-stage-track i {
  background: rgba(0, 0, 0, 0.09);
}

/* --- Punto compacto (packs) --- */
.stage-dot.stage-dot--sm {
  width: 14px;
  height: 14px;
  font-size: 0;
  margin-left: 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 0 3px var(--stage-glow);
}

.stage-dot.stage-dot--sm::after {
  bottom: calc(100% + 7px);
  font-size: 0.62rem;
  padding: 5px 9px;
}

.pack-card .pack-projects span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Marco de la leyenda en páginas sin .container */
.stage-legend-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.stage-legend-wrap .stage-legend {
  margin-bottom: 24px;
}

/* --- Ficha abierta: bloquea el scroll de fondo --- */
body.sheet-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .stage-dot {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }
  .stage-dot.stage-dot--sm {
    width: 14px;
    height: 14px;
    font-size: 0;
  }
  .stage-legend {
    gap: 5px;
  }
  .stage-legend-note {
    font-size: 0.62rem;
  }
}
