.environments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

@scope (.environment-card) {
  :scope {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-success);
    border-radius: var(--radius-lg);
  }

  /* Excluded environments stay editable but read as set aside. */
  :scope.environment-card--excluded {
    border-left-color: var(--color-warning);
    background: var(--color-surface-muted);

    .environment-card__name,
    .environment-card__items,
    .environment-card__total {
      opacity: 0.6;
    }
  }

  .environment-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-lg);
  }

  .environment-card__title-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-right: auto;
  }

  .environment-card__name {
    font-size: var(--text-heading-5, 1.125rem);
    font-weight: var(--font-semibold);
    color: var(--color-text-heading);
  }

  .environment-card__total {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
    font-size: var(--text-body-sm);
    color: var(--color-text-muted);

    & strong {
      font-size: var(--text-body);
      color: var(--color-text-heading);
    }
  }

  .environment-card__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2xs);

    & form {
      display: contents;
    }
  }

  .environment-card__error {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-error-muted);
    color: var(--color-error-text);
    border-radius: var(--radius-md);
    font-size: var(--text-body-sm);
  }

  .environment-card__upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px dashed var(--color-input-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
  }

  .environment-card__upload--attached {
    border-style: solid;
    border-color: var(--color-border);
  }

  .environment-card__upload-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    color: var(--color-primary);
  }

  .environment-card__upload-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-right: auto;
  }

  .environment-card__upload-title,
  .environment-card__file-name {
    font-weight: var(--font-medium);
    color: var(--color-text-heading);
    overflow-wrap: anywhere;
  }

  .environment-card__upload-hint {
    font-size: var(--text-caption);
    color: var(--color-text-muted);
  }

  .environment-card__upload-button {
    cursor: pointer;

    &:has(input:focus-visible) {
      outline: 2px solid var(--color-focus);
      outline-offset: 2px;
    }
  }

  .environment-card__items {
    overflow-x: auto;
  }

  .environment-card__empty {
    font-size: var(--text-body-sm);
    color: var(--color-text-muted);
  }
}
