@layer infine.components {
.connect-field-section {
    margin-bottom: var(--mantine-spacing-lg);
}

.connect-field-section-grid {
    grid-template-columns: auto 1fr auto;
}

.connect-field-section-grid .criteria-divider {
    grid-column: 2 / 4;
}

/* Group header pills cluster — Optional (neutral) on the left, Required
   (color-coded) on the right. Both share the white-on-divider background
   so the divider line reads cleanly behind them. */
.connect-field-section-grid .connect-group-pills {
    grid-column: 3;
    grid-row: 1;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: var(--mantine-spacing-xs);
    background: white;
    padding-left: var(--mantine-spacing-xs);
}

.connect-field-section-grid .connect-group-completeness {
    margin-left: 0;
    margin-right: 0;
}

.connect-field-section-label {
    color: var(--infine-blue);
    font-family: var(--mantine-font-family-headings);
    font-weight: 600;
    font-size: 24px;
    margin-left: 4px;
}

.connect-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--mantine-spacing-md) var(--mantine-spacing-xl);
    padding: var(--mantine-spacing-md);
}

.connect-field-grid .full-row {
    grid-column: 1 / -1;
}

/* Cluster wrapper — groups consecutive fields sharing a `:cluster` key
   (e.g. ingredient-list + its derived per-ingredient fields). The wrapper
   spans both grid columns and reproduces the parent grid inside so the
   field-block layout stays unchanged. The previous left-edge rail was
   removed because it added visual chaos around composite fields without
   meaningfully helping the reader understand the parent/derived link —
   the section heading and field order already carry that. */
.connect-field-cluster {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--mantine-spacing-md) var(--mantine-spacing-xl);
}

.connect-field-cluster .connect-field-block.full-row {
    grid-column: 1 / -1;
}

.connect-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--mantine-font-size-sm);
    font-weight: 600;
    color: var(--infine-blue);
    margin-bottom: 4px;
}

.required {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: var(--infine-yellow-bright);
    -webkit-mask: url("/required-marker.svg") no-repeat center / contain;
    mask: url("/required-marker.svg") no-repeat center / contain;
    text-indent: -9999px;
    overflow: hidden;
    vertical-align: middle;
    flex-shrink: 0;
}

.connect-field-label .required {
    margin-left: auto;
}

.optional {
    font-size: var(--mantine-font-size-xs);
    font-weight: 600;
    color: var(--infine-blue-light);
    letter-spacing: 0;
    text-transform: none;
}

.connect-field-label .optional {
    margin-left: auto;
}

/* Field-state edge accent (Direction A) ---------------------------------
   A 4 px stripe on the left edge of each field block carries the live
   state. Required-empty = orange, error = red, filled/optional = stripe
   collapses to nothing. Multi-control composite fields (ingredient list,
   ingredient origins, weight list, nutrition, checkbox group) share one
   stripe spanning the whole block — they're rendered inside the same
   .connect-field-block wrapper. Animation deflates downward so completion
   reads as the orange "draining to the ground". */
}
