.ams-form-container {
    container-type: inline-size;
    min-width: 0;
}

.ams-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

@container (min-width: 48rem) {
    .ams-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ams-field {
    min-width: 0;
}

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

.ams-field-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
}

.ams-field-input {
    position: relative;
    min-width: 0;
}

.ams-input {
    display: block;
    width: 100%;
}

.ams-validator {
    z-index: 999;
}

.ams-section {
    width: 100%;
}

.ams-section-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.ams-button-bar {
    margin: 1.5rem 0;
}

/* A grid header must offer the same available width as a standalone filter bar. */
.rz-custom-header:has(> .ams-filter-bar) {
    flex: 1;
    min-width: 0;
}

.ams-filter-bar {
    width: 100%;
    min-width: 0;
}

.ams-filter-bar > * {
    min-width: 0;
    max-width: 100%;
}

.ams-filter-bar-grow > .ams-field {
    flex: 1 1 10rem;
}

.ams-filter-bar-grow > .ams-field:first-child {
    flex-basis: 14rem;
}

.ams-filter-bar > .ams-button {
    flex: 0 0 auto;
}

.ams-search {
    width: 25rem;
    max-width: 100%;
    min-width: 0;
}

.ams-hint { display: block; color: var(--rz-text-secondary-color); font-size: .875rem; margin-top: .375rem; }
.ams-text.ams-tone-muted { color: var(--rz-text-secondary-color); }
.ams-text.ams-tone-success { color: var(--rz-success); }
.ams-text.ams-tone-info { color: var(--rz-info); }
.ams-text.ams-tone-warning { color: var(--rz-warning); }
.ams-text.ams-tone-danger { color: var(--rz-danger); }
.ams-heading { margin-top: 0; }

.ams-field-inline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.5rem;
}

.ams-field-inline > .ams-field-label {
    margin-bottom: 0;
    cursor: pointer;
}

.ams-field-inline > .ams-hint {
    grid-column: 1 / -1;
}

.ams-detail-row { min-width: 0; }
.ams-detail-row-separated { border-bottom: 1px solid var(--rz-border-color); padding: 0.45rem 0; }
.ams-detail-label, .ams-detail-value { min-width: 0; overflow-wrap: anywhere; }
.ams-detail-label { color: var(--rz-text-tertiary-color); }
.ams-detail-row .ams-text { margin-block: 0.25rem; }

/* Compact editors retain an associated label for assistive technology. */
.ams-field-compact > .ams-field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.ams-button-bar-compact { margin: 0; }
