body.change-form #content h1,
body #content:has(#change-history) h1 {
    color: var(--admin-text);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 0;
}

body.change-form #content:has(.object-tools) > h1 {
    max-inline-size: calc(100% - 10rem);
}

body.change-form #content:has(.object-tools li + li) > h1 {
    max-inline-size: calc(100% - 20rem);
}

body.change-form #content h2 {
    border-block-end: 1px solid var(--admin-border-soft);
    color: var(--admin-muted);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    margin: 0;
    padding-block: 0.5rem 2.25rem;
}

body.change-form #content-main {
    inline-size: 100%;
    min-inline-size: 0;
}

body.change-form #content-main > form {
    margin: 0;
    max-inline-size: 100%;
    padding-block-end: 5.25rem;
}

body.change-form #content-main fieldset.module.aligned {
    background: transparent;
    border: 0;
    border-radius: 0;
    margin: 0.75rem 0 1rem;
    padding: 0;
}

body.change-form #content-main fieldset.module.aligned + fieldset.module.aligned {
    border-block-start: 1px solid var(--admin-border-soft);
    padding-block-start: 0.75rem;
}

body.change-form #content-main fieldset.module.aligned > h2 {
    border: 0;
    font-size: 0.875rem;
    font-weight: 650;
    margin: 0;
    padding: 0 0 0.5rem;
}

body.change-form #content-main fieldset.module.aligned .form-row {
    margin: 0;
    padding: 0.6rem 0;
}

body.change-form #content-main fieldset.module.aligned .form-row > div {
    align-items: flex-start;
    column-gap: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    row-gap: 0.2rem;
}

body.change-form #content-main fieldset.module.aligned .form-row:has(.checkbox-row) > div {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    row-gap: 0.25rem;
    position: relative;
}

body.change-form #content-main fieldset.module.aligned .flex-container {
    display: contents;
}

body.change-form #content-main fieldset.module.aligned .form-row > .form-multiline {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    inline-size: 100%;
}

body.change-form #content-main fieldset.module.aligned .form-multiline > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-inline-size: 0;
}

/* Label, help and field stack as in a single-field row. */
body.change-form #content-main fieldset.module.aligned .form-multiline .fieldBox:not(.checkbox-row) {
    display: contents;
}

body.change-form #content-main fieldset.module.aligned .form-multiline .fieldBox.checkbox-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

body.change-form #content-main fieldset.module.aligned .form-multiline .fieldBox :is(label, input, select, textarea, .readonly, .related-widget-wrapper) {
    flex: none;
    inline-size: 100%;
    order: 2;
}

body.change-form #content-main fieldset.module.aligned .form-multiline .fieldBox label {
    order: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row label {
    color: var(--admin-text);
    font-size: 0.875rem;
    font-weight: 600;
    flex: 0 0 100%;
    margin: 0;
    order: 0;
    padding: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row :is(input, select, textarea, .related-widget-wrapper, .readonly) {
    flex: 1 1 18rem;
    inline-size: auto;
    max-inline-size: 100%;
    order: 2;
}

body.change-form #content-main fieldset.module.aligned .form-row :is(input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="password"], input[type="date"], input[type="datetime-local"], select, textarea) {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-text);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
    min-block-size: 2.25rem;
    padding: 0.4rem 0.65rem;
}

body.change-form #content-main fieldset.module.aligned .form-row .related-widget-wrapper {
    align-items: flex-start;
    display: flex;
    gap: 0;
    min-inline-size: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row :is(input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea) {
    max-inline-size: min(44rem, 100%);
}

body.change-form #content-main fieldset.module.aligned .form-row select:not([multiple]) {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--admin-muted) 50%),
        linear-gradient(135deg, var(--admin-muted) 50%, transparent 50%);
    background-position: calc(100% - 1rem) 50%, calc(100% - 0.72rem) 50%;
    background-repeat: no-repeat;
    background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
    block-size: 2.25rem;
    flex: 0 0 auto;
    inline-size: max-content;
    line-height: 1.4;
    min-block-size: 2.25rem;
    min-inline-size: 0;
    max-inline-size: min(24rem, 100%);
    padding: 0.4rem 2.25rem 0.4rem 0.65rem;
}

body.change-form #content-main fieldset.module.aligned .form-row .related-widget-wrapper > select {
    order: 0;
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link {
    align-items: center;
    border-radius: 0.25rem;
    display: inline-flex;
    flex: 0 0 1rem;
    inline-size: 1rem;
    justify-content: center;
    margin: 0;
    min-block-size: 1rem;
    order: 1;
    padding: 0;
    text-decoration: none;
    transition: background-color 120ms ease;
}

body.change-form #content-main .related-widget-wrapper > select + .related-widget-wrapper-link {
    margin-inline-start: 0.25rem;
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link svg {
    block-size: 0.75rem;
    display: block;
    inline-size: 0.75rem;
    stroke-width: 2;
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link.change-related {
    color: var(--admin-warning);
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link.add-related {
    color: var(--admin-success);
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link.delete-related {
    color: var(--admin-danger);
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link.view-related {
    color: var(--admin-info);
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link:hover {
    background: color-mix(in srgb, currentColor 10%, var(--admin-surface));
}

body.change-form #content-main .related-widget-wrapper .related-widget-wrapper-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

body.change-form #content-main fieldset.module.aligned .form-row textarea {
    block-size: 8rem;
    min-block-size: 8rem;
    resize: vertical;
}

body.change-form #content-main fieldset.module.aligned .form-row :is(input, select, textarea):focus-visible {
    border-color: var(--admin-brand);
    outline: 2px solid color-mix(in srgb, var(--admin-brand) 18%, transparent);
    outline-offset: 1px;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset {
    border: 0;
    inline-size: 100%;
    margin: 0;
    min-inline-size: 0;
    padding: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset > legend {
    color: var(--admin-text);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    margin-block-end: 0.5rem;
    padding: 0;
}

/* Choice lists put their help between the legend and the choices too. */
body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(> div > .help) > legend {
    margin-block-end: 0.2rem;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset > div > .flex-container > * {
    order: 2;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-inline-size: 44rem;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div > div {
    min-inline-size: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div > div > label {
    align-items: center;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-text);
    cursor: pointer;
    display: flex;
    flex: none;
    font-size: 0.8125rem;
    font-weight: 600;
    gap: 0.625rem;
    inline-size: 100%;
    min-block-size: 3rem;
    padding: 0.65rem 0.85rem;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div > div > label:has(input:checked) {
    background: var(--admin-brand-soft);
    border-color: var(--admin-brand);
    color: var(--admin-brand-strong);
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div > div > label:has(input:focus-visible) {
    outline: 2px solid var(--admin-brand);
    outline-offset: 2px;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div > div > label:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.55;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) input[type="radio"] {
    accent-color: var(--admin-brand);
    block-size: 1rem;
    flex: 0 0 1rem;
    inline-size: 1rem;
    margin: 0;
    order: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset div:has(> div > label > input[type="checkbox"]) {
    display: grid;
    flex: 1 1 auto;
    gap: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-inline-size: 44rem;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset label:has(> input[type="checkbox"]) {
    align-items: center;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-text);
    cursor: pointer;
    display: flex;
    font-size: 0.8125rem;
    font-weight: 600;
    gap: 0.625rem;
    inline-size: 100%;
    min-block-size: 3rem;
    padding: 0.65rem 0.85rem;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset label:has(> input[type="checkbox"]:checked) {
    background: var(--admin-brand-soft);
    border-color: var(--admin-brand);
    color: var(--admin-brand-strong);
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset label:has(> input[type="checkbox"]:focus-visible) {
    outline: 2px solid var(--admin-brand);
    outline-offset: 2px;
}

body.change-form #content-main fieldset.module.aligned .form-row > fieldset label > input[type="checkbox"] {
    accent-color: var(--admin-brand);
    block-size: 1rem;
    clip-path: none;
    flex: 0 0 1rem;
    inline-size: 1rem;
    margin: 0;
    opacity: 1;
    order: 0;
    overflow: visible;
    position: static;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"] {
    block-size: 1px;
    clip-path: inset(50%);
    flex: 0 0 1px;
    inline-size: 1px;
    margin: -1px;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    white-space: nowrap;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"] + label.vCheckboxLabel {
    cursor: pointer;
    flex: 0 0 auto;
    min-block-size: 3.125rem;
    padding-block-end: 1.625rem;
    position: relative;
    width: 100%;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"] + label.vCheckboxLabel::before {
    background: var(--admin-track-off);
    border-radius: 999px;
    block-size: 1.25rem;
    content: "";
    inline-size: 2.5rem;
    inset-block-end: 0;
    inset-inline-start: 0;
    position: absolute;
    transition: background-color 160ms ease;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"] + label.vCheckboxLabel::after {
    background: var(--admin-on-accent);
    border-radius: 50%;
    block-size: 1rem;
    box-shadow: 0 1px 2px rgb(32 37 52 / 20%);
    content: "";
    inline-size: 1rem;
    inset-block-end: 0.125rem;
    inset-inline-start: 0.125rem;
    position: absolute;
    transform: none;
    transition: transform 160ms ease;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"]:checked + label.vCheckboxLabel::before {
    background: #1867ff;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"]:checked + label.vCheckboxLabel::after {
    transform: translateX(1.25rem);
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"]:focus-visible + label.vCheckboxLabel::before {
    outline: 2px solid var(--admin-brand);
    outline-offset: 2px;
}

body.change-form #content-main fieldset.module.aligned .form-row input[type="checkbox"]:disabled + label.vCheckboxLabel {
    cursor: not-allowed;
    opacity: 0.5;
}

body.change-form #content-main fieldset.module.aligned .form-row .help,
body.change-form #content-main fieldset.module.aligned .form-row .help-tooltip {
    color: var(--admin-muted);
    font-size: 0.75rem;
    flex: 0 0 100%;
    line-height: 1.4;
    order: 1;
}

body.change-form #content-main fieldset.module.aligned .form-row .help p {
    margin: 0;
}

body.change-form #content-main fieldset.module.aligned .form-row .readonly {
    color: var(--admin-muted);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
    padding-block: 0.4rem;
}

body.change-form #content-main .form-row .readonly a.admin-readonly-link {
    align-items: center;
    color: var(--admin-brand-strong);
    display: inline-flex;
    font-weight: 600;
    gap: 0.375rem;
    text-decoration: none;
}

body.change-form #content-main .form-row .readonly a.admin-readonly-link:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

body.change-form #content-main .form-row .readonly a.admin-readonly-link svg {
    block-size: 0.875rem;
    flex: 0 0 0.875rem;
    inline-size: 0.875rem;
}

body.change-form #content-main .errorlist,
body.change-form #content-main .errornote {
    color: var(--admin-danger);
    font-size: 0.875rem;
    margin: 0.3rem 0;
}

body.change-form #content-main .errornote {
    background: color-mix(in srgb, var(--admin-danger) 7%, var(--admin-surface));
    border: 1px solid color-mix(in srgb, var(--admin-danger) 26%, var(--admin-surface));
    border-radius: var(--admin-radius);
    padding: 0.75rem 1rem;
}

body.change-form #content-main .object-tools {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    list-style: none;
    inset-block-start: 2rem;
    inset-inline-end: 1.25rem;
    margin: 0;
    padding: 0;
    position: absolute;
    z-index: 1;
}

body.change-form #content-main .object-tools a {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-text);
    display: inline-flex;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.45rem 0.75rem;
    text-decoration: none;
}

body.change-form #content-main .object-tools a:hover {
    background: var(--admin-surface-muted);
}

body.change-form #content-main .object-tools a.default {
    background: var(--admin-brand);
    border-color: var(--admin-brand);
    color: var(--admin-on-accent);
}

body.change-form #content-main .object-tools a.default:hover {
    background: var(--admin-brand-strong);
}

/* Actions posted from the object tools (forms with a submit button). */
body.change-form #content-main .object-tools form {
    margin: 0;
}

body.change-form #content-main .object-tools button {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.45rem 0.75rem;
}

body.change-form #content-main .object-tools button:hover {
    background: var(--admin-surface-muted);
}

body.change-form #content-main .object-tools button.default {
    background: var(--admin-brand);
    border-color: var(--admin-brand);
    color: var(--admin-on-accent);
}

body.change-form #content-main .object-tools button.default:hover {
    background: var(--admin-brand-strong);
}

body #content:has(#change-history) h1 {
    border-block-end: 1px solid var(--admin-border-soft);
    padding-block-end: 2.25rem;
}

body #content:has(#change-history) #content-main {
    inline-size: 100%;
    min-inline-size: 0;
}

body #content:has(#change-history) #change-history {
    background: transparent;
    border: 0;
    margin: 1.5rem 0 0;
    overflow-x: auto;
    padding: 0;
}

body #content:has(#change-history) #change-history table {
    border-collapse: collapse;
    inline-size: 100%;
    margin: 0;
}

body #content:has(#change-history) #change-history th,
body #content:has(#change-history) #change-history td {
    border-block-end: 1px solid var(--admin-border-soft);
    padding: 0.85rem 0;
    text-align: start;
    vertical-align: top;
}

body #content:has(#change-history) #change-history thead th {
    color: var(--admin-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

body #content:has(#change-history) #change-history tbody th {
    font-weight: 500;
}

body #content:has(#change-history) #change-history .paginator {
    color: var(--admin-muted);
    font-size: 0.875rem;
    margin: 0;
    padding-block: 0.85rem;
}

body.change-form #content-main .inline-group {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    margin: 1rem 0;
    overflow-x: auto;
}

body.change-form #content-main .inline-group h2 {
    border-block-end: 1px solid var(--admin-border-soft);
    font-size: 0.9375rem;
    margin: 0;
    padding: 0.85rem 1.25rem;
}

body.change-form #content-main .inline-group table {
    border-collapse: collapse;
    inline-size: 100%;
}

body.change-form #content-main .inline-group th,
body.change-form #content-main .inline-group td {
    border-block-end: 1px solid var(--admin-border-soft);
    padding: 0.6rem 0.75rem;
    text-align: start;
    vertical-align: middle;
}

body.change-form #content-main .inline-group thead th {
    background: var(--admin-surface-muted);
    color: var(--admin-muted);
    font-size: 0.7rem;
    font-weight: 650;
}

body.change-form #content-main .submit-row {
    align-items: center;
    background: color-mix(in srgb, var(--admin-surface) 94%, transparent);
    border-block-start: 1px solid var(--admin-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    inset-block-end: 0;
    inset-inline: 0;
    margin: 0;
    padding: 0.75rem 1.5rem;
    position: fixed;
    z-index: 10;
}

body.change-form #content-main .submit-row input[type="submit"],
body.change-form #content-main .submit-row button,
body.change-form #content-main .submit-row a.closelink {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
    min-block-size: 2.5rem;
    padding: 0.5rem 0.9rem;
}

body.change-form #content-main .submit-row input[type="submit"].default {
    background: var(--admin-brand);
    border-color: var(--admin-brand);
    color: var(--admin-on-accent);
}

body.change-form #content-main .submit-row input[type="submit"]:hover,
body.change-form #content-main .submit-row button:hover,
body.change-form #content-main .submit-row a.closelink:hover {
    background: var(--admin-surface-muted);
}

/* Read-only change forms only offer "Close", rendered as a link. */
body.change-form #content-main .submit-row a.closelink {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    text-decoration: none;
}

body.change-form #content-main .submit-row input[type="submit"].default:hover {
    background: var(--admin-brand-strong);
}

body.change-form #content-main .submit-row .submit-more {
    margin-inline-end: auto;
    order: -1;
    position: relative;
}

body.change-form #content-main .submit-row .submit-more > summary {
    align-items: center;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    color: var(--admin-muted);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    list-style: none;
    min-block-size: 2.5rem;
    min-inline-size: 2.5rem;
}

body.change-form #content-main .submit-row .submit-more > summary::-webkit-details-marker {
    display: none;
}

body.change-form #content-main .submit-row .submit-more > summary:hover,
body.change-form #content-main .submit-row .submit-more[open] > summary {
    background: var(--admin-surface-muted);
    color: var(--admin-text);
}

body.change-form #content-main .submit-row .submit-more svg {
    block-size: 1rem;
    flex: 0 0 1rem;
    inline-size: 1rem;
}

body.change-form #content-main .submit-row .submit-more__panel {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    inset-block-end: calc(100% + 0.5rem);
    inset-inline-start: 0;
    min-inline-size: 12rem;
    padding: 0.35rem;
    position: absolute;
}

body.change-form #content-main .submit-row a.deletelink {
    align-items: center;
    border-radius: var(--admin-radius);
    color: var(--admin-danger);
    display: flex;
    font-size: 0.8125rem;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    text-decoration: none;
}

body.change-form #content-main .submit-row a.deletelink:hover {
    background: color-mix(in srgb, var(--admin-danger) 8%, var(--admin-surface));
}

@media (max-width: 48rem) {
    body.change-form #content-main fieldset.module.aligned .form-row > .form-multiline {
        grid-template-columns: 1fr;
    }

    body.change-form #content-main fieldset.module.aligned .form-row > fieldset:has(input[type="radio"]) .flex-container > div {
        grid-template-columns: 1fr;
    }

    body.change-form #content-main .object-tools {
        inset-block-start: 1.5rem;
        inset-inline-end: 0.75rem;
    }

    body.change-form #content-main fieldset.module.aligned .form-row :is(input, select, textarea, .related-widget-wrapper, .readonly) {
        flex-basis: 100%;
    }

    body.change-form #content-main .submit-row {
        margin-inline: -0.75rem;
        padding-inline: 0.75rem;
    }
}
