/* Opt-in fields: never restyle raw inputs on unmigrated pages. */
.app-field { min-width: 0; }
.app-field .app-field__label { display: block; margin-bottom: .35rem; color: var(--ui-text); font-size: .875rem; font-weight: 600; }
.app-field .app-field__control { width: 100%; min-height: var(--ui-control-height); border-color: var(--ui-border); border-radius: var(--ui-radius); }
.app-field--compact .app-field__control { min-height: 2rem; font-size: .8125rem; }
.app-field .app-field__control:focus { border-color: var(--ui-focus); box-shadow: var(--ui-focus-ring); }
.app-field .app-field__control.is-invalid { border-color: var(--ui-danger); }
.app-field .app-field__control.is-invalid:focus { box-shadow: var(--ui-danger-ring); }
.app-field .app-field__control:disabled, .app-field .app-field__control[readonly] { background-color: var(--ui-surface-page); color: var(--ui-muted); }
.app-field .app-field__help, .app-field .app-field__error { overflow-wrap: anywhere; font-size: .8rem; }
.app-field .app-field__error { color: var(--ui-danger); }
.app-field .app-field__error:not([hidden]) { display: block; }
.app-field .app-field__error[hidden], .app-field__required[hidden] { display: none; }
.app-field__required { color: var(--ui-danger); font-weight: 700; }
/* Keep the dropdown affordance even when legacy styles reset the background. */
body.app-shell .app-field select.form-select {
    appearance: none;
    padding-right: 2.6rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%2352675c' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5 7 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .8rem center;
    background-size: 1rem 1rem;
    cursor: pointer;
}
body.app-shell .app-field select.form-select:disabled { cursor: default; }
@media (forced-colors: active) {
    body.app-shell .app-field select.form-select { appearance: auto; background-image: none; }
}
.app-field[hidden] { display: none; }
.app-field--check { display: grid; grid-template-columns: 1.15rem minmax(0, 1fr); column-gap: .65rem; align-content: start; padding: var(--ui-card-space, 12px); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: #fff; }
.app-field--check .app-field__check { float: none; margin: .2rem 0 0; width: 1.1rem; height: 1.1rem; cursor: pointer; }
.app-field--check .app-field__label { margin: 0; cursor: pointer; }
.app-field--check .app-field__help, .app-field--check .app-field__error { grid-column: 2; }
.app-field--check:has(:checked) { border-color: #83b99c; background: #f4faf6; }
.app-field--check:has(:disabled) { opacity: .7; }
.app-field--check .app-field__check:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }

/* One integrated calendar affordance, never a filled action button. */
body.app-shell .app-field .flatpickr-wrapper > button.date-picker-button {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 44px;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0 !important;
    border-radius: 0 var(--ui-radius) var(--ui-radius) 0;
    background: transparent !important;
    color: #777 !important;
    box-shadow: none !important;
    transform: none;
}
body.app-shell .app-field .flatpickr-wrapper > button.date-picker-button:hover { color: #444 !important; }
body.app-shell .app-field .flatpickr-wrapper > button.date-picker-button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -4px; }
body.app-shell .app-field .flatpickr-wrapper > button.date-picker-button:disabled { cursor: default; opacity: .5; }
body.app-shell .app-field .flatpickr-wrapper > .app-field__control:not([type="hidden"]) { padding-right: 48px; }
body.app-shell .app-field .flatpickr-wrapper > .app-field__control.is-invalid { background-image: none; }

.app-field .app-password { display: block; position: relative; }
.app-field .app-password > .app-field__control { padding-right: 48px; }
.app-field .app-password > .app-field__control.is-invalid { background-image: none; }
body.app-shell .app-field .app-password > button.app-password__toggle {
    position: absolute;
    inset: 0 0 0 auto;
    display: grid;
    place-items: center;
    width: 44px;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0 var(--ui-radius) var(--ui-radius) 0;
    background: transparent;
    color: #777 !important;
    box-shadow: none;
    cursor: pointer;
}
body.app-shell .app-field .app-password > button.app-password__toggle:hover { background: transparent; color: #444 !important; }
body.app-shell .app-field .app-password > button.app-password__toggle:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -4px; }
body.app-shell .app-field .app-password > button.app-password__toggle:disabled { opacity: .5; cursor: default; }
.app-password__slash { display: none; }
[aria-pressed="true"] .app-password__slash { display: block; }
.app-field--radios { margin: 0; padding: 0; border: 0; }
.app-field--radios > legend { float: none; width: auto; }
.app-radio-option { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.app-radio-option > input { flex-shrink: 0; margin: 0; }
.app-radio-option > label { flex: 1; padding-block: 10px; cursor: pointer; font-size: .875rem; }

/*
 * Outlined fields. The real associated label is never a placeholder.
 * Live CSS state covers server values, autofill, .value assignments and reset,
 * including modals inserted in body, without observers or value interception.
 */
.app-field--outlined { padding-top: .5rem; }
.app-field--outlined .app-field__outline { position: relative; min-width: 0; }
.app-field--outlined .app-field__control {
    min-height: max(var(--ui-control-height, 36px), 40px);
    padding: .5rem .75rem;
    background-color: var(--ui-surface, #fff);
}
.app-field--outlined .app-field__outline > .app-field__label {
    position: absolute;
    z-index: 1;
    top: 0;
    left: .55rem;
    max-width: calc(100% - 3.5rem);
    margin: 0;
    padding: 0 .2rem;
    transform: translateY(-50%);
    background: var(--ui-surface, #fff);
    color: var(--ui-muted);
    font-size: .75rem;
    line-height: 1.2;
    font-weight: 500;
    cursor: text;
    overflow-wrap: anywhere;
}
/* Select prompts and date masks already contain text: keep their label notched. */
@supports selector(:has(*)) {
    .app-field--outlined:not(.app-field--masked-date):not(:where(.app-catalog-filter-panel *)) .app-field__outline:not(:focus-within):has(input:placeholder-shown, textarea:placeholder-shown)
        > .app-field__label {
        top: .65rem;
        transform: none;
        background: transparent;
        font-size: .875rem;
    }
    .app-field--outlined:not(.app-field--masked-date):not(:where(.app-catalog-filter-panel *)) .app-field__outline:not(:focus-within) .app-field__control:placeholder-shown::placeholder { color: transparent; }
    /* Autofill wins even in engines that keep :placeholder-shown during autofill. */
    .app-field--outlined:not(:where(.app-catalog-filter-panel *)) .app-field__outline:has(input:autofill) > .app-field__label {
        top: 0;
        transform: translateY(-50%);
        background: var(--ui-surface, #fff);
        font-size: .75rem;
    }
}
.app-field--outlined .app-field__outline:focus-within > .app-field__label { color: var(--ui-focus); }
.app-field--outlined .app-field__outline:has(.is-invalid, [aria-invalid="true"]) > .app-field__label { color: var(--ui-danger); }
.app-field--outlined .app-field__outline:has(:disabled, [readonly]) > .app-field__label {
    color: var(--ui-muted);
    background-color: var(--ui-surface-page);
}
.app-field--outlined .app-field__outline:has(:disabled) > .app-field__label { cursor: default; }
/* Narrow header labels stay notched and in flow: long labels reserve their
   own height below sorting tools instead of painting over the column heading. */
.app-catalog-filter-panel .app-field--outlined { padding-top: 0; }
.app-catalog-filter-panel .app-field--outlined .app-field__outline { display: flex; flex-direction: column; align-items: stretch; }
.app-catalog-filter-panel .app-field--outlined .app-field__outline > .app-field__label {
    position: relative;
    align-self: flex-start;
    left: auto;
    max-width: calc(100% - 1.5rem);
    margin: 0 .55rem -.45em;
    transform: none;
}
@media (max-width: 767.98px), (pointer: coarse), (hover: none) {
    .app-field .app-field__control { min-height: var(--ui-touch-target-safe, 45px); font-size: 1rem; }
    .app-field--outlined .app-field__control { min-height: var(--ui-touch-target-safe, 45px); }
}
