/*
 * Five-stage procurement lifecycle spine (Procurement and Notice documents).
 *
 * Mobile-first. The five nodes share one row on every width (minmax(0, 1fr)
 * tracks, wrapping labels) so the spine never scrolls sideways; amounts and
 * dates drop out of the node on a narrow screen and stay in the open panel.
 */

.lifecycle-spine {
  margin: var(--space-4, 1rem) 0 var(--space-4, 1rem);
  min-width: 0;
  max-width: 100%;
}

.lifecycle-spine-heading {
  margin: 0 0 var(--space-2, 0.5rem);
  font-size: 1.05rem;
  line-height: 1.3;
}

.lifecycle-entities {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2, 0.5rem) var(--space-4, 1rem);
  margin: 0 0 var(--space-3, 0.75rem);
  min-width: 0;
}

.lifecycle-entity {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lifecycle-entity-type {
  color: var(--color-text-muted, #5b6470);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lifecycle-delta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  margin: 0 0 var(--space-3, 0.75rem);
}

.lifecycle-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
}

/* Amber means "this value moved", never "this is wrong". */
.lifecycle-badge-delta {
  color: var(--cs-caution, #8a5a00);
  background: var(--cs-caution-tint, #fbf1d8);
  border: 1px solid var(--cs-caution-border, #e6c88a);
}

.lifecycle-delta-text {
  color: var(--color-text-soft, #37414d);
  font-size: 0.9rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lifecycle-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-1, 0.25rem);
  margin: 0;
  padding: 0;
}

.lifecycle-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
  min-height: 44px;
  padding: var(--space-2, 0.5rem);
  border: 1px solid var(--color-border, #dde1e7);
  border-block-start: 4px solid var(--color-border-strong, #7a828f);
  border-radius: var(--radius-sm, 0.375rem);
  background: var(--color-surface, #fff);
  color: var(--color-text, #12181f);
  font: inherit;
  text-align: start;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.lifecycle-node[data-lifecycle-status="observed"] {
  border-block-start-color: var(--cs-success, #1a6b34);
}

.lifecycle-node[data-lifecycle-status="discrepancy"] {
  border-block-start-color: var(--cs-caution, #8a5a00);
  background: var(--cs-caution-tint, #fbf1d8);
}

.lifecycle-node[data-lifecycle-status="not_observed"] {
  border-style: dashed;
  border-block-start-style: dashed;
  color: var(--color-text-muted, #5b6470);
}

.lifecycle-node[aria-selected="true"] {
  background: var(--cs-action-tint, #eef2ff);
  border-color: var(--color-action, #1a44e0);
  box-shadow: inset 0 0 0 1px var(--color-action, #1a44e0);
}

.lifecycle-node:focus-visible,
.lifecycle-panel:focus-visible {
  outline: 3px solid var(--color-action, #1a44e0);
  outline-offset: 2px;
}

.lifecycle-node-index {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-muted, #5b6470);
}

.lifecycle-node-label {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.lifecycle-node-status {
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--color-text-soft, #37414d);
}

.lifecycle-node-amount,
.lifecycle-node-date {
  font-size: 0.7rem;
  line-height: 1.25;
}

.lifecycle-node .lifecycle-badge {
  font-size: 0.7rem;
  padding: 0 0.35rem;
}

.lifecycle-panel {
  margin-block-start: var(--space-2, 0.5rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border: 1px solid var(--color-border, #dde1e7);
  border-radius: var(--radius-sm, 0.375rem);
  background: var(--color-surface, #fff);
  min-width: 0;
}

.lifecycle-panel[hidden] {
  display: none;
}

.lifecycle-panel-title {
  margin: 0 0 var(--space-2, 0.5rem);
  font-size: 1rem;
}

.lifecycle-panel-status {
  margin-inline-start: var(--space-2, 0.5rem);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-soft, #37414d);
}

.lifecycle-summary {
  margin: 0 0 var(--space-2, 0.5rem);
}

.lifecycle-not-observed {
  margin: 0;
  color: var(--color-text-soft, #37414d);
}

.lifecycle-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2, 0.5rem);
  margin: 0 0 var(--space-3, 0.75rem);
}

.lifecycle-detail > div {
  min-width: 0;
}

.lifecycle-detail dt {
  font-size: 0.8rem;
  color: var(--color-text-muted, #5b6470);
}

.lifecycle-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.lifecycle-provenance {
  color: var(--color-text-muted, #5b6470);
  font-size: 0.85rem;
}

.lifecycle-panel h4 {
  margin: var(--space-3, 0.75rem) 0 var(--space-1, 0.25rem);
  font-size: 0.9rem;
}

.lifecycle-sources {
  margin: 0;
  padding-inline-start: 1.1rem;
}

.lifecycle-sources li {
  overflow-wrap: anywhere;
}

.lifecycle-sources code,
.lifecycle-compare code,
.lifecycle-detail code {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.lifecycle-compare {
  width: 100%;
  margin: 0 0 var(--space-3, 0.75rem);
  border-collapse: collapse;
  table-layout: fixed;
}

.lifecycle-compare caption {
  text-align: start;
  font-weight: 700;
  margin-block-end: var(--space-1, 0.25rem);
}

.lifecycle-compare th,
.lifecycle-compare td {
  padding: var(--space-1, 0.25rem) var(--space-2, 0.5rem);
  border: 1px solid var(--color-border, #dde1e7);
  text-align: start;
  overflow-wrap: anywhere;
  vertical-align: top;
}

@media (min-width: 640px) {
  .lifecycle-node {
    padding: var(--space-3, 0.75rem);
  }

  .lifecycle-node-label {
    font-size: 0.9rem;
  }

  .lifecycle-node-status,
  .lifecycle-node-amount,
  .lifecycle-node-date {
    font-size: 0.8rem;
  }

  .lifecycle-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  /* The panel carries the amount and date; the node keeps its name and state.
     Tighter padding and type let "Solicitation" and "Registered contract" fit
     five across at 360px without splitting a word. */
  .lifecycle-node {
    padding: 0.4rem 0.25rem;
  }

  .lifecycle-node-amount,
  .lifecycle-node-date {
    display: none;
  }

  .lifecycle-node-label {
    font-size: 0.625rem;
    overflow-wrap: break-word;
  }

  .lifecycle-node-status {
    font-size: 0.6rem;
    overflow-wrap: break-word;
  }

  .lifecycle-node .lifecycle-badge {
    font-size: 0.6rem;
  }
}

/* Executive signal strip: one wrapping row of short readings above the track. */
.lifecycle-signals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2, 0.5rem);
  margin: 0 0 var(--space-3, 0.75rem);
  padding: 0;
  list-style: none;
  min-width: 0;
}

.lifecycle-signal {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--color-border, #cfd6de);
  border-radius: var(--radius-pill, 999px);
  background: var(--color-surface-subtle, #f4f6f8);
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.lifecycle-signal-label {
  font-weight: 700;
}

.lifecycle-signal-detail {
  color: var(--color-text-muted, #5b6470);
}

/* The entity header links lead with their destination, so keep the pair on one line. */
.lifecycle-entity .ui-constellation-link {
  white-space: normal;
}

/* One quiet drawer for match keys, record ids and source fields. */
.lifecycle-provenance-drawer {
  margin: var(--space-3, 0.75rem) 0 0;
  color: var(--color-text-muted, #5b6470);
  font-size: 0.85rem;
}

.lifecycle-provenance-drawer > summary {
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
}

.lifecycle-provenance-drawer > summary::after {
  content: " ▾";
}

.lifecycle-provenance-drawer[open] > summary::after {
  content: " ▴";
}

.lifecycle-provenance-stage h4 {
  margin: var(--space-2, 0.5rem) 0 var(--space-1, 0.25rem);
  font-size: 0.85rem;
}
