/* Initiative details page styles */
.initiative-detail-page {
  background: transparent;
}

.initiative-detail-shell {
  max-width: min(1280px, calc(100vw - (2 * var(--cp-space-page-inline))));
}

.initiative-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--cp-color-border-subtle);
  background: var(--cp-color-surface);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  position: relative;
}

.initiative-detail__header::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cp-color-accent);
  border-radius: 999px;
}

.initiative-detail__header h1 {
  margin: 0 0 6px;
  color: var(--cp-color-text-primary);
}

.initiative-detail__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.initiative-detail__pill {
  font-size: 0.78rem;
}

.initiative-detail__pill--secondary {
  color: var(--cp-color-text-primary);
}

.initiative-detail__title {
  font-size: 1.6rem;
  font-weight: 700;
}

.initiative-detail__header a {
  text-decoration: none;
}

.initiative-detail__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.initiative-detail__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.initiative-detail__grid .org-card {
  border: 1px solid var(--cp-color-border-subtle);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  background: var(--cp-color-surface);
}

.initiative-detail__span {
  grid-column: span 2;
}

.initiative-detail__field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.initiative-detail__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}

.initiative-detail__row .initiative-detail__field {
  margin-bottom: 0;
}

.initiative-detail__field:last-child {
  margin-bottom: 0;
}

.initiative-detail__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cp-color-text-muted);
  font-weight: 700;
}

.initiative-detail__value {
  color: var(--cp-color-text-primary);
  font-size: 0.95rem;
}

.initiative-detail__value--muted {
  color: var(--cp-color-text-muted);
  font-style: italic;
}

.initiative-detail__people {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.initiative-detail__person {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--cp-color-accent-subtle);
  color: var(--cp-color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
}

.initiative-detail__person::after {
  content: attr(data-name);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.initiative-detail__person:hover::after {
  opacity: 1;
}

.initiative-timeline {
  display: grid;
  gap: 12px;
}

.initiative-timeline__empty {
  border: 1px dashed var(--cp-color-border-subtle);
  border-radius: 12px;
  background: color-mix(in srgb, var(--cp-color-surface-subtle) 65%, white 35%);
  color: var(--cp-color-text-muted);
  font-size: 0.88rem;
  padding: 14px 16px;
}

.initiative-timeline__canvas {
  position: relative;
  min-height: 168px;
  border: 1px solid var(--cp-color-border-subtle);
  border-radius: 14px;
  background: color-mix(in srgb, var(--cp-color-surface) 92%, var(--cp-color-surface-subtle) 8%);
  overflow: auto;
  scrollbar-gutter: stable;
}

.initiative-timeline__scale {
  --timeline-baseline-top: 60px;
  --timeline-marker-row-height: 18px;
  --timeline-marker-row-gap: 4px;
  position: absolute;
  inset: 18px 14px 16px 14px;
}

.initiative-timeline__delta-band {
  position: absolute;
  top: 10px;
  bottom: 8px;
  border-radius: 0;
  z-index: 0;
  pointer-events: none;
}

.initiative-timeline__delta-band--good {
  background-image: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, #16a34a 22%, transparent 78%) 0 6px,
    transparent 6px 12px
  );
}

.initiative-timeline__delta-band--bad {
  background-image: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, #dc2626 22%, transparent 78%) 0 3px,
    transparent 3px 6px
  );
}

.initiative-timeline__baseline {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--timeline-baseline-top);
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cp-color-border-subtle) 68%, #f8fafc 32%);
  z-index: 1;
}

.initiative-timeline__range {
  position: absolute;
  height: 8px;
  border-radius: 999px;
  top: calc(var(--timeline-baseline-top) + 1px);
  z-index: 1;
}

.initiative-timeline__range--planned {
  background: color-mix(in srgb, var(--cp-color-accent) 24%, #ffffff 76%);
}

.initiative-timeline__range--actual {
  background: color-mix(in srgb, #0f766e 45%, #ffffff 55%);
}

.initiative-timeline__range--forecast-delivery {
  background: color-mix(in srgb, #0369a1 42%, #ffffff 58%);
  top: calc(var(--timeline-baseline-top) + 18px);
}

.initiative-timeline__range--measurement {
  background: color-mix(in srgb, #f59e0b 45%, #ffffff 55%);
  top: calc(var(--timeline-baseline-top) + 34px);
}

.initiative-timeline__marker {
  position: absolute;
  top: 0;
  bottom: 0;
}

.initiative-timeline__marker-line {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  top: 10px;
  bottom: 8px;
  width: 2px;
  z-index: 1;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cp-color-text-muted) 40%, #ffffff 60%);
}

.initiative-timeline__marker-line--planned {
  background: color-mix(in srgb, var(--cp-color-accent) 58%, #ffffff 42%);
}

.initiative-timeline__marker-line--target {
  background: color-mix(in srgb, #7c3aed 48%, #ffffff 52%);
}

.initiative-timeline__marker-line--actual {
  background: color-mix(in srgb, #0f766e 66%, #ffffff 34%);
}

.initiative-timeline__marker-line--forecast {
  background: color-mix(in srgb, #0369a1 62%, #ffffff 38%);
}

.initiative-timeline__marker-line--measurement {
  background: color-mix(in srgb, #b45309 64%, #ffffff 36%);
}

.initiative-timeline__marker-line--initiative {
  background: color-mix(in srgb, #1d4ed8 64%, #ffffff 36%);
}

.initiative-timeline__marker-line--today {
  background: transparent;
  width: 0;
  border-left: 3px dashed color-mix(in srgb, #0f172a 76%, #ffffff 24%);
  border-radius: 0;
}

.initiative-timeline__marker-label {
  --timeline-marker-tone: var(--cp-color-border-subtle);
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  z-index: 3;
  white-space: nowrap;
  font-size: 0.7rem;
  color: var(--cp-color-text-secondary);
  background: var(--cp-color-surface);
  border: 1px solid var(--timeline-marker-tone);
  border-radius: 999px;
  padding: 2px 8px;
}

.initiative-timeline__marker-label--planned {
  --timeline-marker-tone: color-mix(in srgb, var(--cp-color-accent) 58%, #ffffff 42%);
}

.initiative-timeline__marker-label--target {
  --timeline-marker-tone: color-mix(in srgb, #7c3aed 48%, #ffffff 52%);
}

.initiative-timeline__marker-label--actual {
  --timeline-marker-tone: color-mix(in srgb, #0f766e 66%, #ffffff 34%);
}

.initiative-timeline__marker-label--forecast {
  --timeline-marker-tone: color-mix(in srgb, #0369a1 62%, #ffffff 38%);
}

.initiative-timeline__marker-label--measurement {
  --timeline-marker-tone: color-mix(in srgb, #b45309 64%, #ffffff 36%);
}

.initiative-timeline__marker-label--initiative {
  --timeline-marker-tone: color-mix(in srgb, #1d4ed8 64%, #ffffff 36%);
}

.initiative-timeline__marker-label--today {
  --timeline-marker-tone: color-mix(in srgb, #0f172a 76%, #ffffff 24%);
  background: #0f172a;
  color: #ffffff;
}

.initiative-timeline__marker-label--top {
  top: calc(var(--timeline-marker-lane, 0) * (var(--timeline-marker-row-height) + var(--timeline-marker-row-gap)));
}

.initiative-timeline__marker-label--bottom {
  bottom: calc(var(--timeline-marker-lane, 0) * (var(--timeline-marker-row-height) + var(--timeline-marker-row-gap)));
}

.initiative-timeline__marker-label--top::after,
.initiative-timeline__marker-label--bottom::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  pointer-events: none;
}

.initiative-timeline__marker-label--top::after {
  bottom: -6px;
  border-top: 6px solid var(--timeline-marker-tone);
}

.initiative-timeline__marker-label--bottom::after {
  top: -6px;
  border-bottom: 6px solid var(--timeline-marker-tone);
}

.initiative-timeline__progress {
  display: grid;
  gap: 6px;
}

.initiative-timeline__progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cp-color-border-subtle) 65%, #f8fafc 35%);
  overflow: hidden;
}

.initiative-timeline__progress-forecast {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--cp-color-accent) 40%, #ffffff 60%);
}

.initiative-timeline__progress-manual {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--cp-color-text-primary) 56%, #ffffff 44%);
}

.initiative-timeline__progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--cp-color-text-muted);
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .initiative-detail__grid {
    grid-template-columns: 1fr;
  }

  .initiative-detail__span {
    grid-column: auto;
  }

  .initiative-timeline__canvas {
    min-height: 196px;
  }

  .initiative-timeline__scale {
    inset: 12px 8px 12px 8px;
  }

  .initiative-timeline__marker-label {
    font-size: 0.66rem;
  }
}
