/* Shared form and dialog presentation. The application owns the controls and their values. */
:root {
    --gsh-form-green: #087f5b;
    --gsh-form-deep: #064e3b;
    --gsh-form-tint: #ecf9f2;
    --gsh-form-ink: #162e27;
    --gsh-form-muted: #526b61;
    --gsh-form-border: #b9ccc3;
    --gsh-form-rule: #e0eae5;
    --gsh-form-error: #b4232c;
}

.gsh-forms-portal :is(.gsh-control,.form-control,.custom-select):not([type=hidden],[type=checkbox],[type=radio],[type=range],[type=file],[type=submit],[type=button],[type=reset],[type=color],.form-control-sm,.select2-hidden-accessible) {
    min-width: 0; min-height: 46px; max-width: 100%; padding: 9px 12px;
    border: 1px solid var(--gsh-form-border); border-radius: 10px;
    background-color: #fbfdfc; color: var(--gsh-form-ink); font-size: 14px; line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.gsh-forms-portal select.gsh-control:not([multiple],.select2-hidden-accessible,.form-control-sm) {
    appearance: none; padding-right: 34px;
    background: #fbfdfc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23476659' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
}
.gsh-forms-portal :is(.gsh-control,.form-control,.custom-select):not([type=checkbox],[type=radio]):hover:not(:disabled,[readonly]) { border-color: #7d9d8e; }
.gsh-forms-portal :is(.gsh-control,.form-control,.custom-select):not([type=checkbox],[type=radio]):focus {
    border-color: var(--gsh-form-green); outline: 0; background-color: white; box-shadow: 0 0 0 3px #087f5b22;
}
.gsh-forms-portal :is(.gsh-control,.form-control,.custom-select):is(:disabled,[readonly]):not([type=checkbox],[type=radio]) {
    background-color: #edf3f0; color: #50665c; opacity: 1;
}
.gsh-forms-portal :is(.gsh-control,.form-control,.custom-select):is(.input-validation-error,.is-invalid,[aria-invalid=true]) { border-color: var(--gsh-form-error); }
.gsh-forms-portal :is(.gsh-control,.form-control,.custom-select):is(.input-validation-error,.is-invalid,[aria-invalid=true]):focus { box-shadow: 0 0 0 3px #b4232c22; }
.gsh-forms-portal textarea:is(.gsh-control,.form-control) { width: 100%; height: auto; min-height: 100px; resize: vertical; }
.gsh-forms-portal input[type=date], .gsh-forms-portal input[type=time], .gsh-forms-portal input[type=datetime-local], .gsh-forms-portal input[type=month] { color-scheme: light; }
.gsh-forms-portal input:is([type=checkbox],[type=radio]) { width: 1.05em; height: 1.05em; accent-color: var(--gsh-form-green); }
.gsh-forms-portal input:is([type=checkbox],[type=radio]):disabled { opacity: .62; }
.gsh-forms-portal :is(.custom-checkbox,.custom-radio,.custom-switch) .custom-control-input:checked ~ .custom-control-label::before { border-color: var(--gsh-form-green); background: var(--gsh-form-green); }
.gsh-forms-portal :is(.gsh-field,.gsh-auth-field) > label { margin-bottom: 6px; color: #29463a; font-size: 13px; font-weight: 700; }
.gsh-field { min-width: 0; }
.gsh-choice label { cursor: pointer; }
.gsh-required { margin-left: .25em; color: var(--gsh-form-error); }
.gsh-field-feedback, .gsh-field-count, .gsh-file-note { margin: 6px 0 0; font-size: 12px; line-height: 1.45; }
.gsh-field-count, .gsh-file-note { color: var(--gsh-form-muted); }
.gsh-field-feedback, .gsh-forms-portal :is(.field-validation-error,.validation-summary-errors,.invalid-feedback) { color: var(--gsh-form-error); }
.gsh-forms-portal .validation-summary-errors { padding: 10px 14px; border: 1px solid #edbdc1; border-radius: 10px; background: #fff5f5; }
.gsh-forms-portal .validation-summary-errors ul { margin-bottom: 0; }
.gsh-form-grid { row-gap: 2px; }
.gsh-form-section-heading { flex: 0 0 100%; width: 100%; margin: 8px 0 15px; padding: 12px 15px 8px; border-bottom: 1px solid var(--gsh-form-rule); color: var(--gsh-form-deep); font-size: 14px; font-weight: 800; }
.gsh-form-section-heading:first-child { margin-top: 0; }
.gsh-fieldset { min-width: 0; padding: 14px 16px; margin-bottom: 14px; border: 1px solid var(--gsh-form-rule); border-radius: 12px; }
.gsh-fieldset > legend { width: auto; padding: 0 6px; color: var(--gsh-form-deep); font-size: 15px; font-weight: 750; }
.gsh-form.card { padding: clamp(16px, 3vw, 28px); }

.gsh-forms-portal .gsh-dialog { --gsh-dialog-width: 760px; }
.gsh-forms-portal .gsh-dialog-simple { --gsh-dialog-width: 600px; }
.gsh-forms-portal .gsh-dialog-complex { --gsh-dialog-width: 1000px; }
.gsh-forms-portal .gsh-dialog-record { --gsh-dialog-width: 1180px; }
.gsh-forms-portal .gsh-dialog-confirmation { --gsh-dialog-width: 440px; }
.gsh-forms-portal .gsh-dialog :is(.modal-dialog,.modal-dialog-scrollable) {
    width: calc(100% - 36px); max-width: var(--gsh-dialog-width) !important;
    height: auto; max-height: none; min-height: 0; margin: 18px auto;
}
.gsh-forms-portal .gsh-dialog .modal-dialog.modal-dialog-centered { min-height: calc(100dvh - 36px); }
.gsh-forms-portal .gsh-dialog .modal-content {
    max-height: calc(100dvh - 36px); min-width: 0; overflow: auto;
    border: 1px solid #d7e5dd; border-radius: 17px; background: #fff;
    box-shadow: 0 28px 72px #12362944, 0 4px 14px #1236291a;
    overscroll-behavior: contain;
}
.gsh-forms-portal .gsh-dialog .modal-content > :not(.modal-header,.modal-footer,.modal-body) { flex-shrink: 0; min-width: 0; }
.gsh-forms-portal .gsh-dialog .modal-header.gsh-dialog-header {
    position: sticky; top: 0; z-index: 3; flex: none;
    grid-template-columns: 42px minmax(0,1fr) auto; grid-template-rows: auto auto; align-items: center;
    gap: 2px 13px; min-width: 0; padding: 16px clamp(16px,3vw,25px) !important;
    border: 0; border-bottom: 1px solid var(--gsh-form-rule) !important; border-radius: 16px 16px 0 0;
    background: #f3faf6 !important; color: var(--gsh-form-ink) !important;
}
.gsh-forms-portal .gsh-dialog-branded { display: grid; }
.gsh-dialog-emblem { grid-column: 1; grid-row: 1 / span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--gsh-form-deep); background: #ddf2e7; }
.gsh-dialog-emblem .gsh-icon { width: 21px; height: 21px; }
.gsh-dialog-context { grid-column: 2; grid-row: 1; color: var(--gsh-form-muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gsh-forms-portal .gsh-dialog-header .modal-title { grid-column: 2; grid-row: 2; min-width: 0; margin: 0 !important; color: var(--gsh-form-ink) !important; font-size: clamp(16px,2.5vw,22px) !important; font-weight: 800 !important; letter-spacing: -.025em; line-height: 1.2; overflow-wrap: anywhere; }
.gsh-forms-portal .gsh-dialog-header :is(.close,[data-dismiss=modal],[data-bs-dismiss=modal],.btn-close) { grid-column: 3; grid-row: 1 / span 2; display: grid; place-items: center; width: 38px; height: 38px; padding: 0 !important; margin: 0 !important; border: 1px solid #d1e3d9; border-radius: 10px; background-color: white; color: var(--gsh-form-deep) !important; opacity: 1; text-shadow: none; }
.gsh-forms-portal .gsh-dialog-header :is(.close,[data-dismiss=modal],[data-bs-dismiss=modal],.btn-close):hover { background-color: #e0f2e8; }
.gsh-forms-portal .gsh-dialog .gsh-dialog-body { min-width: 0; min-height: 0; padding: clamp(16px,3vw,25px) !important; background: white !important; }
.gsh-forms-portal .gsh-dialog:not(.gsh-dialog-pinned) .modal-body { overflow: visible; }
.gsh-forms-portal .gsh-dialog-pinned .modal-content { overflow: hidden; }
.gsh-forms-portal .gsh-dialog-pinned .modal-body { overflow: auto; }
.gsh-forms-portal .gsh-dialog :is(.gsh-dialog-actions,.modal-footer) {
    position: sticky; bottom: 0; z-index: 2; justify-content: flex-end; flex-wrap: wrap; gap: 9px; flex: none;
    padding: 12px clamp(16px,3vw,25px) !important; margin: 0 !important;
    border-top: 1px solid var(--gsh-form-rule) !important; border-radius: 0 0 16px 16px; background: #f7fbf9 !important;
}
.gsh-forms-portal .gsh-dialog-actions > * { margin: 0; }
.gsh-forms-portal :is(.gsh-dialog-actions,.gsh-form,.gsh-auth-form-card) .btn { min-height: 42px; border-radius: 9px; }
.gsh-forms-portal :is(.gsh-dialog-actions,.gsh-form) :is(.btn-primary,.btn-success) { background: var(--gsh-form-green) !important; border-color: var(--gsh-form-green) !important; color: white !important; }
.gsh-forms-portal :is(.gsh-dialog-actions,.gsh-form) :is(.btn-primary,.btn-success):hover:not(:disabled) { background: var(--gsh-form-deep) !important; border-color: var(--gsh-form-deep) !important; }
.gsh-forms-portal .gsh-dialog-actions :is(.btn-secondary,.btn-light,[data-dismiss=modal],[data-bs-dismiss=modal]) { border: 1px solid #bacfc3; background: white; color: #294d3f; }
.gsh-forms-portal :is(.gsh-dialog-actions,.gsh-form) .btn:disabled { opacity: .58; cursor: not-allowed; }
.gsh-forms-portal .gsh-form-card-heading { padding: 12px 16px !important; border-bottom: 1px solid var(--gsh-form-rule) !important; background: #f4f9f6 !important; color: var(--gsh-form-deep) !important; }
.gsh-forms-portal .gsh-form-card-heading :is(h3,h4,h5,h6) { color: inherit !important; }
.gsh-native-dialog { border-radius: 16px; }
.gsh-forms-portal .swal2-popup { max-width: calc(100vw - 24px); border: 1px solid var(--gsh-form-rule); border-radius: 17px; box-shadow: 0 24px 60px #17362944; }
.gsh-forms-portal .swal2-popup:not(.swal2-toast) { padding: 20px; }
.gsh-forms-portal .swal2-actions button { min-height: 41px; border-radius: 9px; }

.gsh-forms-portal .select2-container { max-width: 100%; }
.gsh-forms-portal .select2-container :is(.select2-selection--single,.select2-selection--multiple) { min-height: 46px; height: auto; border: 1px solid var(--gsh-form-border); border-radius: 10px; background: #fbfdfc; }
.gsh-forms-portal .select2-container .select2-selection--single .select2-selection__rendered { padding: 11px 30px 11px 12px; color: var(--gsh-form-ink); font-size: 14px; line-height: 22px; }
.gsh-forms-portal .select2-container .select2-selection--single .select2-selection__arrow { height: 44px; right: 8px; }
.gsh-forms-portal .select2-container .select2-selection--multiple { padding: 3px 6px; }
.gsh-forms-portal .select2-container .select2-selection__choice { border-color: #c8e8d8; border-radius: 6px; background: #e4f5eb; color: var(--gsh-form-deep); }
.gsh-forms-portal .select2-container--focus .select2-selection { border-color: var(--gsh-form-green); box-shadow: 0 0 0 3px #087f5b22; }
.gsh-forms-portal .select2-container--disabled .select2-selection { background: #edf3f0; }
.gsh-forms-portal :is(.select2-dropdown,.datepicker-dropdown,.ui-datepicker,.daterangepicker) { max-width: calc(100vw - 20px); border: 1px solid #d5e6dc; border-radius: 11px; box-shadow: 0 13px 36px #18392c26; }
.gsh-forms-portal .select2-container--open:has(> .select2-dropdown), .gsh-forms-portal .datepicker-dropdown, .gsh-forms-portal .ui-datepicker { z-index: 1065 !important; }
.gsh-forms-portal .select2-results__option--selectable, .gsh-forms-portal .select2-results__message { padding: 8px 12px; font-size: 13px; }
.gsh-forms-portal .select2-search--dropdown .select2-search__field { min-height: 36px; border: 1px solid var(--gsh-form-border); border-radius: 7px; }
.gsh-forms-portal .datepicker table tr td.active, .gsh-forms-portal .ui-datepicker .ui-state-active { background: var(--gsh-form-green) !important; color: white !important; }
.gsh-forms-portal input[type=file].gsh-file-control { width: 100%; max-width: 100%; height: auto; padding: 12px; border: 1px dashed #a1c4b2; border-radius: 11px; background: #f5faf7; color: var(--gsh-form-ink); font-size: 13px; }
.gsh-file-control::file-selector-button { min-height: 37px; padding: 6px 12px; margin-right: 9px; border: 1px solid #bad6c7; border-radius: 8px; background: white; color: var(--gsh-form-deep); font-weight: 700; cursor: pointer; }
.gsh-file-note { overflow-wrap: anywhere; }
.gsh-clear-selection { padding: 4px 8px; margin: 5px 0 0; border: 1px solid #bed5c8; border-radius: 7px; background: white; color: var(--gsh-form-deep); font-size: 12px; font-weight: 650; }

@media (max-width: 767.98px) {
    .gsh-forms-portal .gsh-dialog :is(.modal-dialog,.modal-dialog-scrollable) { width: calc(100% - 16px); margin: 8px auto; }
    .gsh-forms-portal .gsh-dialog .modal-dialog.modal-dialog-centered { min-height: calc(100dvh - 16px); }
    .gsh-forms-portal .gsh-dialog .modal-content { max-height: calc(100dvh - 16px); }
    .gsh-forms-portal .gsh-dialog .gsh-dialog-header { grid-template-columns: 34px minmax(0,1fr) auto; padding-block: 11px !important; }
    .gsh-dialog-emblem { width: 34px; height: 34px; border-radius: 9px; }
    .gsh-forms-portal .gsh-dialog .gsh-dialog-actions { padding-block: 9px !important; }
    .gsh-forms-portal :is(.gsh-dialog-body,.gsh-form) :is(.row,.form-row) > .gsh-field { flex: 0 0 100%; max-width: 100%; }
    .gsh-forms-portal .gsh-dialog .table-responsive { max-width: 100%; }
    .gsh-forms-portal .daterangepicker.show-calendar { max-height: 60vh; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) { .gsh-forms-portal :is(.gsh-control,.gsh-dialog .modal-dialog) { transition: none !important; } }

/* Section rhythm for the legacy client portal grids. */
.gsh-forms-portal .gsh-dialog-emblem .gsh-icon { display: block; width: 21px; height: 21px; }
.gsh-forms-portal .gsh-dialog-body :is([data-gsh-section],.gsh-dependent-section) {
    padding: 9px 12px; border-left: 3px solid #9ecdb8; border-radius: 0 7px 7px 0;
    background: #eff8f3; color: var(--gsh-form-deep) !important; font-size: 14px; font-weight: 750;
}
.gsh-forms-portal .gsh-dialog-body .gsh-field { margin-bottom: 16px; }
.gsh-forms-portal .gsh-dialog-body .form-group:has(> :is(.form-control,.gsh-control)) { min-width: 0; }
.gsh-forms-portal .gsh-dialog-body :is(.table-responsive,.dataTables_scrollBody) { overflow-x: auto; }
.gsh-forms-portal .gsh-dialog-body .row > [class*=col] { min-width: 0; }
.gsh-forms-portal [data-gsh-auth-panel] { padding: clamp(16px,4vw,32px); border-radius: 18px; }
.gsh-forms-portal [data-gsh-auth-panel] .btn-primary { background: var(--gsh-form-green) !important; border-color: var(--gsh-form-green) !important; }
.gsh-forms-portal .select2-container--bootstrap .select2-selection { box-shadow: none; }
.gsh-forms-portal .gsh-dialog-pinned .modal-content { display: flex; flex-direction: column; }
.gsh-forms-portal .gsh-dialog-pinned .modal-content > .modal-body { flex: 1 1 auto; }
.gsh-forms-portal .gsh-dialog-header { box-shadow: none; }
@media (max-width: 767.98px) {
    .gsh-forms-portal .gsh-dialog-body :is(.row,.form-row) > [class*=col]:has(> :is(.form-control,.gsh-control)) { flex: 0 0 100%; max-width: 100%; }
}

.gsh-forms-portal .gsh-authorization-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding-inline: 7px; }
.gsh-authorization-details > :is(.gsh-form-section-heading,.gsh-field:has(select),.gsh-field:has(textarea)) { grid-column: 1 / -1; }
.gsh-forms-portal .gsh-control[aria-invalid=true] + .select2 .select2-selection { border-color: var(--gsh-form-error); }
.gsh-forms-portal .gsh-dialog-actions button[aria-busy=true] { cursor: progress; }
@media (max-width: 767.98px) { .gsh-forms-portal .gsh-authorization-details { grid-template-columns: minmax(0,1fr); } }

.gsh-forms-portal [data-gsh-standalone-form] { min-height: 75vh; height: auto; padding: 18px; box-sizing: border-box; }
.gsh-forms-portal [data-gsh-standalone-form] .gsh-form { max-width: 100%; padding: clamp(16px,5vw,38px); border-radius: 16px; box-sizing: border-box; }
.gsh-forms-portal [data-gsh-standalone-form] .gsh-control { width: 100%; box-sizing: border-box; }
.gsh-forms-portal .gsh-field:has(select:disabled) .gsh-clear-selection { display: none; }
