/* Workflow-stage layouts and domain-specific panels for Flextracode. */
.fx-stage {
  display: grid;
  gap: var(--fx-space-5);
  min-width: 0;
}

.fx-stage-intro {
  max-width: 58rem;
  color: var(--fx-muted);
}

.fx-stage-intro > :last-child {
  margin-bottom: 0;
}

.fx-stage-toolbar,
.fx-stage-actions,
.fx-stage-meta,
.fx-inline-controls {
  display: flex;
  align-items: center;
  gap: var(--fx-space-3);
  flex-wrap: wrap;
}

.fx-stage-toolbar {
  justify-content: space-between;
  padding-bottom: var(--fx-space-3);
  border-bottom: 1px solid var(--fx-border);
}

.fx-stage-actions {
  margin-top: var(--fx-space-4);
}

.fx-stage-section {
  display: grid;
  gap: var(--fx-space-4);
  min-width: 0;
}

.fx-stage-section__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--fx-space-4);
}

.fx-stage-section__heading h2,
.fx-stage-section__heading h3 {
  margin-bottom: 0;
}

.fx-stage-section__heading p {
  max-width: 42rem;
  margin-bottom: 0;
  color: var(--fx-muted);
  font-size: var(--fx-font-size-sm);
}

.fx-stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fx-space-4);
}

.fx-stage-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fx-stage-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fx-record-list {
  display: grid;
  gap: var(--fx-space-3);
  min-width: 0;
}

.fx-record {
  min-width: 0;
  padding: var(--fx-space-4);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-md);
  background: rgba(2, 8, 23, 0.34);
}

.fx-record--accent {
  border-color: var(--fx-border-accent);
  background: linear-gradient(120deg, rgba(52, 211, 153, 0.07), rgba(2, 8, 23, 0.34));
}

.fx-record__header,
.fx-record__footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fx-space-3);
}

.fx-record__header {
  margin-bottom: var(--fx-space-3);
}

.fx-record__header h3,
.fx-record__header h4 {
  margin-bottom: 0;
  font-size: 1rem;
}

.fx-record__body {
  min-width: 0;
  color: var(--fx-muted);
}

.fx-record__body > :last-child,
.fx-record__footer > :last-child {
  margin-bottom: 0;
}

.fx-record__footer {
  align-items: center;
  margin-top: var(--fx-space-3);
  padding-top: var(--fx-space-3);
  border-top: 1px solid var(--fx-border);
}

.fx-record__meta {
  display: flex;
  gap: var(--fx-space-2) var(--fx-space-4);
  flex-wrap: wrap;
  color: var(--fx-subtle);
  font-size: var(--fx-font-size-xs);
}

.fx-sortable-list {
  display: grid;
  gap: var(--fx-space-2);
  padding: 0;
  margin: 0;
  list-style: none;
}

.fx-sortable-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--fx-space-3);
  padding: var(--fx-space-3);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-md);
  background: rgba(2, 8, 23, 0.3);
}

.fx-sortable-item__handle {
  color: var(--fx-subtle);
  cursor: grab;
  user-select: none;
}

.fx-sortable-item__content {
  min-width: 0;
}

.fx-sortable-item__content strong {
  display: block;
  color: var(--fx-text-strong);
}

.fx-sortable-item__content small {
  display: block;
  color: var(--fx-muted);
}

.fx-question-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fx-space-4);
}

.fx-question-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--fx-space-5);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-lg);
  background: linear-gradient(145deg, var(--fx-surface-raised), var(--fx-surface));
}

.fx-question-card__number {
  margin-bottom: var(--fx-space-2);
  color: var(--fx-accent);
  font-size: var(--fx-font-size-xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fx-question-card h3 {
  margin-bottom: var(--fx-space-3);
  font-size: 1.05rem;
}

.fx-question-card__actions {
  display: flex;
  gap: var(--fx-space-2);
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: var(--fx-space-4);
}

.fx-choice-list {
  display: grid;
  gap: var(--fx-space-2);
  padding: 0;
  margin: 0;
  list-style: none;
}

.fx-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--fx-space-3);
  padding: var(--fx-space-3);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-md);
  background: rgba(2, 8, 23, 0.28);
  color: var(--fx-muted);
}

.fx-choice:has(input:checked) {
  border-color: var(--fx-border-accent);
  background: var(--fx-accent-soft);
  color: var(--fx-text-strong);
}

.fx-choice input {
  flex: 0 0 auto;
  margin-top: 0.35em;
}

.fx-guideline-card {
  border-left: 3px solid var(--fx-accent-strong);
}

.fx-proposal {
  padding: var(--fx-space-5);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-lg);
  background: rgba(2, 8, 23, 0.34);
}

.fx-proposal__content {
  color: var(--fx-muted);
  overflow-wrap: anywhere;
}

.fx-proposal__content pre {
  max-height: 34rem;
  padding: var(--fx-space-4);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-md);
  background: rgba(2, 8, 23, 0.55);
  color: var(--fx-text);
}

.fx-manifest-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--fx-space-3);
  padding: var(--fx-space-4);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-md);
  background: rgba(2, 8, 23, 0.32);
}

.fx-manifest-entry__order {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--fx-border);
  border-radius: 50%;
  color: var(--fx-text-strong);
  font-size: var(--fx-font-size-xs);
  font-weight: 800;
}

.fx-manifest-entry__details {
  min-width: 0;
}

.fx-manifest-entry__path {
  display: block;
  color: var(--fx-text-strong);
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-sm);
  overflow-wrap: anywhere;
}

.fx-measurements {
  display: flex;
  gap: var(--fx-space-2) var(--fx-space-4);
  flex-wrap: wrap;
  color: var(--fx-subtle);
  font-size: var(--fx-font-size-xs);
}

.fx-progress-track {
  height: 0.55rem;
  overflow: hidden;
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-pill);
  background: rgba(2, 8, 23, 0.72);
}

.fx-progress-track > span {
  display: block;
  width: var(--fx-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #168b70, var(--fx-cyan));
  transition: width var(--fx-duration-normal) var(--fx-ease);
}

.fx-review-result {
  padding: var(--fx-space-4);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius-md);
  background: var(--fx-surface-soft);
}

.fx-review-result--ready {
  border-color: rgba(125, 227, 172, 0.36);
  background: rgba(52, 211, 153, 0.08);
}

.fx-review-result--changes {
  border-color: rgba(244, 198, 106, 0.36);
  background: rgba(244, 198, 106, 0.07);
}

.fx-history-detail {
  max-width: 52rem;
  color: var(--fx-muted);
  overflow-wrap: anywhere;
}

.fx-history-detail__label {
  color: var(--fx-subtle);
  font-size: var(--fx-font-size-xs);
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fx-stage-callout {
  padding: var(--fx-space-4);
  border-left: 3px solid var(--fx-cyan);
  border-radius: 0 var(--fx-radius-md) var(--fx-radius-md) 0;
  background: rgba(56, 189, 248, 0.07);
  color: var(--fx-muted);
}

.fx-stage-callout > :last-child {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .fx-stage-grid--three,
  .fx-stage-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fx-stage-section__heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .fx-stage-grid,
  .fx-stage-grid--three,
  .fx-stage-grid--four,
  .fx-question-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .fx-stage-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .fx-record__header,
  .fx-record__footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .fx-manifest-entry {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .fx-manifest-entry > :last-child {
    grid-column: 2;
  }
}
