/* Isolated Bootstrap compatibility for platform-owned TGX modals. */

.tgx-system-modal,
.tgx-system-modal * {
    box-sizing: border-box;
}

.tgx-system-modal {
    --tgx-modal-z: 2147482500;
    --tgx-modal-width: 500px;
    --tgx-modal-gutter: 1.75rem;
    position: fixed;
    inset: 0;
    z-index: var(--tgx-modal-z);
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    color: #212529;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    text-align: left;
}

.tgx-system-modal.show {
    display: block;
}

.tgx-system-modal.tgx-modal-fade {
    transition: opacity .15s linear;
}

.tgx-system-modal.tgx-modal-fade:not(.show) {
    opacity: 0;
}

.tgx-system-modal .tgx-modal-dialog {
    position: relative;
    width: auto;
    max-width: var(--tgx-modal-width);
    margin: .5rem auto;
    pointer-events: none;
    transition: transform .3s ease-out;
    transform: translateY(-50px);
}

.tgx-system-modal.show .tgx-modal-dialog {
    transform: none;
}

.tgx-system-modal .tgx-modal-dialog-centered {
    display: flex;
    min-height: calc(100% - 1rem);
    align-items: center;
}

.tgx-system-modal .tgx-modal-sm {
    --tgx-modal-width: 300px;
}

.tgx-system-modal .tgx-modal-lg,
.tgx-system-modal .tgx-modal-xl {
    --tgx-modal-width: 800px;
}

.tgx-system-modal .tgx-modal-dialog > * {
    max-width: 100%;
    pointer-events: auto;
}

.tgx-system-modal .tgx-modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.tgx-system-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147482400;
    width: 100vw;
    height: 100vh;
    background: #000;
}

.tgx-system-modal-backdrop.tgx-modal-fade {
    opacity: 0;
}

.tgx-system-modal-backdrop.show {
    opacity: .75;
}

/* Scoped utilities used by the canonical system modal templates. */
.tgx-system-modal .position-relative {
    position: relative !important;
}

.tgx-system-modal .position-absolute {
    position: absolute !important;
}

.tgx-system-modal .sticky-top {
    position: sticky !important;
    top: 0;
}

.tgx-system-modal .sticky-bottom {
    position: sticky !important;
    bottom: 0;
}

.tgx-system-modal .top-0 {
    top: 0 !important;
}

.tgx-system-modal .end-0 {
    right: 0 !important;
}

.tgx-system-modal .z-index-1 {
    z-index: 1 !important;
}

.tgx-system-modal .d-flex {
    display: flex !important;
}

.tgx-system-modal .d-inline-flex {
    display: inline-flex !important;
}

.tgx-system-modal .d-none {
    display: none !important;
}

.tgx-system-modal .flex-column {
    flex-direction: column !important;
}

.tgx-system-modal .flex-wrap {
    flex-wrap: wrap !important;
}

.tgx-system-modal .flex-grow-1 {
    flex-grow: 1 !important;
}

.tgx-system-modal .align-items-center {
    align-items: center !important;
}

.tgx-system-modal .justify-content-center {
    justify-content: center !important;
}

.tgx-system-modal .justify-content-end {
    justify-content: flex-end !important;
}

.tgx-system-modal .w-100 {
    width: 100% !important;
}

.tgx-system-modal .h-100 {
    height: 100% !important;
}

.tgx-system-modal .overflow-auto {
    overflow: auto !important;
}

.tgx-system-modal .text-end {
    text-align: right !important;
}

.tgx-system-modal .text-nowrap {
    white-space: nowrap !important;
}

.tgx-system-modal .text-truncate {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.tgx-system-modal .align-middle {
    vertical-align: middle !important;
}

.tgx-system-modal .bg-transparent {
    background: transparent !important;
}

.tgx-system-modal .bg-light {
    background: #f8f9fa !important;
}

.tgx-system-modal .text-white {
    color: #fff !important;
}

.tgx-system-modal .text-muted {
    color: #6c757d !important;
}

.tgx-system-modal .text-danger,
.tgx-system-modal .link-danger {
    color: #dc3545 !important;
}

.tgx-system-modal .link-primary {
    color: #0d6efd !important;
}

.tgx-system-modal .link-success {
    color: #198754 !important;
}

.tgx-system-modal .link-info {
    color: #0dcaf0 !important;
}

.tgx-system-modal .small {
    font-size: .875em !important;
}

.tgx-system-modal .lead {
    font-size: 1.25rem;
    font-weight: 300;
}

.tgx-system-modal .rounded {
    border-radius: .375rem !important;
}

.tgx-system-modal .border {
    border: 1px solid #dee2e6 !important;
}

.tgx-system-modal .border-bottom {
    border-bottom: 1px solid #dee2e6 !important;
}

.tgx-system-modal .container-fluid {
    width: 100%;
    padding-inline: .75rem;
}

.tgx-system-modal .m-0 {
    margin: 0 !important;
}

.tgx-system-modal .m-3 {
    margin: 1rem !important;
}

.tgx-system-modal .mt-4 {
    margin-top: 1.5rem !important;
}

.tgx-system-modal .mb-4 {
    margin-bottom: 1.5rem !important;
}

.tgx-system-modal .my-2 {
    margin-block: .5rem !important;
}

.tgx-system-modal .my-3 {
    margin-block: 1rem !important;
}

.tgx-system-modal .ms-1 {
    margin-left: .25rem !important;
}

.tgx-system-modal .ms-2 {
    margin-left: .5rem !important;
}

.tgx-system-modal .ms-4 {
    margin-left: 1.5rem !important;
}

.tgx-system-modal .me-2 {
    margin-right: .5rem !important;
}

.tgx-system-modal .px-3 {
    padding-inline: 1rem !important;
}

.tgx-system-modal .pb-3 {
    padding-bottom: 1rem !important;
}

.tgx-system-modal .gap-1 {
    gap: .25rem !important;
}

.tgx-system-modal .gap-2 {
    gap: .5rem !important;
}

.tgx-system-modal .gap-3 {
    gap: 1rem !important;
}

.tgx-system-modal .gap-4 {
    gap: 1.5rem !important;
}

.tgx-system-modal h3 {
    margin-top: 0;
    font-size: calc(1.3rem + .6vw);
    line-height: 1.2;
}

.tgx-system-modal table {
    caption-side: bottom;
    border-collapse: collapse;
}

.tgx-system-modal button,
.tgx-system-modal input,
.tgx-system-modal select,
.tgx-system-modal textarea {
    margin: 0;
    font: inherit;
}

.tgx-system-modal button {
    cursor: pointer;
}

.tgx-system-modal .form-label {
    display: inline-block;
    margin-bottom: .5rem;
}

.tgx-system-modal .form-control,
.tgx-system-modal .form-select {
    display: block;
    width: 100%;
    min-width: 0;
    padding: .375rem .75rem;
    color: #212529;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    appearance: none;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.tgx-system-modal .form-select {
    padding-right: 2.25rem;
    background-image: linear-gradient(45deg, transparent 50%, #6c757d 50%), linear-gradient(135deg, #6c757d 50%, transparent 50%);
    background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.tgx-system-modal .form-control:focus,
.tgx-system-modal .form-select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

.tgx-system-modal textarea.form-control {
    min-height: calc(1.5em + .75rem + 2px);
}

.tgx-system-modal .collapse:not(.show) {
    display: none;
}

.tgx-system-modal .collapsing {
    height: 0;
    overflow: hidden;
    transition: height .35s ease;
}

/* Record and DOM editor forms use semantic grid rows, not table layout. */
.tgx-system-modal .tgx-modal-record-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.tgx-system-modal .tgx-modal-record-layout,
.tgx-system-modal .tgx-modal-record-host,
.tgx-system-modal .tgx-modal-record-host > .tgx-box-container-blur {
    min-height: 0;
}

.tgx-system-modal .tgx-modal-record-layout,
.tgx-system-modal .tgx-modal-record-host > .tgx-box-container-blur {
    flex: 1 1 auto;
}

.tgx-system-modal .tgx-modal-record-scroll {
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.tgx-system-modal .tgx-modal-fields {
    display: grid;
    gap: 1rem;
    width: 100%;
    min-width: 0;
}

.tgx-system-modal .tgx-modal-empty-fields {
    padding: 1rem;
    border: 1px solid rgb(255 255 255 / 45%);
    border-radius: .75rem;
    background: rgb(0 0 0 / 18%);
    color: #fff;
}

.tgx-system-modal .tgx-modal-empty-fields h4 {
    margin: 0 0 .75rem;
}

.tgx-system-modal .tgx-modal-empty-fields p {
    margin: .75rem 0;
}

.tgx-system-modal .tgx-modal-empty-fields code {
    overflow-wrap: anywhere;
    color: #d7e7ef;
}

.tgx-system-modal .tgx-modal-field {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-width: 0;
}

.tgx-system-modal .tgx-modal-field-label {
    min-width: 0;
    justify-content: flex-end;
    padding-top: .5rem;
    text-align: right;
}

.tgx-system-modal .tgx-modal-field-control {
    width: 100%;
    min-width: 0;
}

.tgx-system-modal .tgx-modal-field-control .form-control,
.tgx-system-modal .tgx-modal-field-control .form-select,
.tgx-system-modal .tgx-modal-field-control textarea {
    width: 100%;
}

.tgx-system-modal .btn-toggle {
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    padding: .25rem;
    border-radius: .25rem;
    background: #fff;
    box-shadow: 0 0 0 1px #dee2e6;
    transition: color .15s ease-in-out;
}
.tgx-system-modal .btn-toggle:hover {
    color: #212529;
}

.tgx-system-modal .tgx-modal-field.tgx-row-expanded {
    grid-template-columns: minmax(0, 1fr);
}

.tgx-system-modal .tgx-modal-field.tgx-row-expanded .tgx-modal-field-label {
    justify-content: flex-start;
    padding-top: 0;
    text-align: left;
}

.tgx-system-modal .tgx-modal-field .tgx-field-expanded {
    width: 100%;
}

.tgx-system-modal .tgx-modal-close-button {
    appearance: none;
    position: fixed;
    top: .25rem;
    right: .5rem;
    z-index: 5;
    width: 2.25rem;
    height: 2.25rem;
    min-width: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff;
    cursor: pointer;
    opacity: .8;
    filter: drop-shadow(0 1px 2px #000);
}

.tgx-system-modal .tgx-modal-close-button::before,
.tgx-system-modal .tgx-modal-close-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 15%;
    width: 70%;
    height: 2px;
    background: currentColor;
}

.tgx-system-modal .tgx-modal-close-button::before {
    transform: rotate(45deg);
}

.tgx-system-modal .tgx-modal-close-button::after {
    transform: rotate(-45deg);
}

.tgx-system-modal .tgx-modal-close-button:hover {
    opacity: 1;
}

@media (min-width: 576px) {
    .tgx-system-modal .tgx-modal-dialog {
        margin-block: var(--tgx-modal-gutter);
    }

    .tgx-system-modal .tgx-modal-dialog-centered {
        min-height: calc(100% - (var(--tgx-modal-gutter) * 2));
    }

    .tgx-system-modal .tgx-modal-fullscreen-sm-down {
        --tgx-modal-width: 800px;
    }
}

@media (min-width: 768px) {
    .tgx-system-modal .flex-md-row {
        flex-direction: row !important;
    }

    .tgx-system-modal .gap-md-3 {
        gap: 1rem !important;
    }

    .tgx-system-modal .tgx-modal-xl {
        --tgx-modal-width: 1140px;
    }
}

@media (max-width: 767.98px) {
    .tgx-system-modal .tgx-modal-field {
        grid-template-columns: minmax(0, 1fr);
        gap: .5rem;
    }

    .tgx-system-modal .tgx-modal-field-label {
        justify-content: flex-start;
        padding-top: 0;
        text-align: left;
    }

    .tgx-system-modal .tgx-modal-record-dialog {
        margin: .25rem;
        min-height: calc(100% - .5rem);
    }

    .tgx-system-modal .tgx-modal-record-host {
        min-height: calc(100dvh - .5rem);
    }

    .tgx-system-modal .tgx-modal-record-host > .tgx-box-container-blur {
        height: 100%;
        max-height: calc(100dvh - .5rem);
    }
}

@media (max-width: 575.98px) {
    .tgx-system-modal .tgx-modal-fullscreen-sm-down {
        width: 100vw;
        max-width: none;
        height: 100%;
        margin: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tgx-system-modal.tgx-modal-fade,
    .tgx-system-modal .tgx-modal-dialog,
    .tgx-system-modal .form-control,
    .tgx-system-modal .form-select {
        transition: none;
    }
}