/* AIOS V21.1 — fixes ONLY Admin/Requests/Details edit result / referral modal.
   All selectors are scoped so scanner, marketing and other dialogs are unchanged. */
#editRequestModal { padding: clamp(12px, 3vw, 32px); align-items: center; justify-content: center; }
#editRequestModal .edit-request-modal__card {
    display: flex;
    flex-direction: column;
    flex: 0 1 960px;
    width: min(960px, 100%);
    max-width: 960px;
    max-height: min(90dvh, 920px);
    min-height: 0;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    background: #132335;
    border: 1px solid #375669;
    box-shadow: 0 26px 90px rgba(0, 0, 0, .45);
    text-align: right;
}
#editRequestModal .edit-request-modal__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    margin: 0;
    padding: 17px 22px;
    background: #172c40 !important;
    border-bottom: 1px solid #345066;
    border-radius: 19px 19px 0 0;
    position: relative;
    z-index: 2;
}
#editRequestModal .edit-request-modal__header strong {
    color: #f1f9ff;
    font-size: 16px;
    line-height: 1.6;
    min-width: 0;
}
#editRequestModal .edit-request-modal__header .icon-btn {
    display: inline-grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
}
#editRequestModal .edit-request-modal__form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}
#editRequestModal .edit-request-modal__scroller {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    padding: 18px 24px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
#editRequestModal .edit-request-modal__section { min-width: 0; margin: 0 0 18px; padding: 0 0 18px; border-bottom: 1px solid #294459; }
#editRequestModal .edit-request-modal__section:last-child { border-bottom: none; margin-bottom: 0; }
#editRequestModal .edit-request-modal__section h3 {
    margin: 0 0 13px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.6;
    color: #99ddd6;
}
#editRequestModal .edit-request-modal__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 16px;
    row-gap: 13px;
    min-width: 0;
    overflow: visible;
}
#editRequestModal .edit-request-modal__wide { grid-column: 1 / -1; }
#editRequestModal .field { min-width: 0; max-width: 100%; margin: 0; }
#editRequestModal .field > label:not(.check) { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; margin-bottom: 7px; font-size: 12px; color: #dbeef5; }
#editRequestModal .field input:not([type="checkbox"]),
#editRequestModal .field textarea,
#editRequestModal .field select:not(.search-select-native) {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
#editRequestModal .field textarea { min-height: 90px; height: 96px; max-height: 280px; resize: vertical; line-height: 1.75; }
#editRequestModal .edit-request-modal__check {
    margin: 11px 0 0 !important;
    display: inline-flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    max-width: 100%;
    font-size: 12px;
    line-height: 1.6;
}
#editRequestModal .search-select { position: relative; width: 100%; min-width: 0; max-width: 100%; }
#editRequestModal .search-select__control { width: 100%; min-width: 0; max-width: 100%; }
#editRequestModal .search-select__value { min-width: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
#editRequestModal .search-select__menu { z-index: 850; max-height: 260px; overflow: hidden; }
#editRequestModal .search-select__options { max-height: 160px; overflow-y: auto; }
#editRequestModal .onsite-required-warning[hidden],
#editRequestModal [hidden] { display: none !important; }
#editRequestModal .edit-request-modal__footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 14px 24px;
    border-top: 1px solid #345066;
    background: #172c40;
    position: relative;
    z-index: 2;
}
#editRequestModal .edit-request-modal__footer .btn { min-height: 43px; }
/* Put the dropdown ABOVE its trigger when there is insufficient scroll-space below. */
@media (min-width: 760px) {
    html:not(.aios-touch-compact) #editRequestModal .search-select.edit-open-up .search-select__menu {
        top: auto;
        bottom: calc(100% + 7px);
    }
}
/* Narrow screens: one-column form, bottom-sheet dialog and comfortable controls. */
@media (max-width: 759px) {
    #editRequestModal { padding: 0; align-items: flex-end; }
    #editRequestModal .edit-request-modal__card {
        flex: 0 1 auto;
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - env(safe-area-inset-top) - 8px);
        border-radius: 18px 18px 0 0;
        margin: 0;
    }
    #editRequestModal .edit-request-modal__header {
        padding: 13px 16px;
        border-radius: 18px 18px 0 0;
    }
    #editRequestModal .edit-request-modal__scroller { padding: 15px 14px 6px; scrollbar-gutter: auto; }
    #editRequestModal .edit-request-modal__grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    #editRequestModal .edit-request-modal__wide { grid-column: 1; }
    #editRequestModal .edit-request-modal__footer {
        padding: 12px 14px max(14px, env(safe-area-inset-bottom));
    }
    #editRequestModal .edit-request-modal__footer .btn { flex: 1 1 125px; }
    #editRequestModal .field textarea { min-height: 90px; }
}
/* Also preserve compact form in phones using browser Desktop Site. */
html.aios-touch-compact #editRequestModal .edit-request-modal__grid { grid-template-columns: minmax(0, 1fr); }
html.aios-touch-compact #editRequestModal .edit-request-modal__wide { grid-column: 1; }
html.aios-touch-compact #editRequestModal .edit-request-modal__card { max-height: calc(100dvh - 18px); }
