/*
 * Bootstrap 5 critical structural fallback.
 *
 * This file is intentionally loaded immediately BEFORE the Bootstrap CDN CSS.
 * Keep selectors at Bootstrap utility specificity so the full CDN stylesheet
 * wins in the normal path.  When the CDN is unavailable, these rules preserve
 * the login/onboarding grid, forms, cards, dialogs and essential navigation.
 * This is not a visual replacement for the complete Bootstrap distribution.
 */

:root {
    --bs-blue: #0d6efd;
    --bs-indigo: #6610f2;
    --bs-purple: #6f42c1;
    --bs-red: #dc3545;
    --bs-yellow: #ffc107;
    --bs-green: #198754;
    --bs-cyan: #0dcaf0;
    --bs-white: #fff;
    --bs-gray: #6c757d;
    --bs-gray-dark: #343a40;
    --bs-primary: #0d6efd;
    --bs-secondary: #6c757d;
    --bs-success: #198754;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
    --bs-body-color: #212529;
    --bs-body-bg: #fff;
    --bs-border-color: #dee2e6;
    --bs-border-radius: 0.375rem;
    --bs-border-radius-sm: 0.25rem;
    --bs-border-radius-lg: 0.5rem;
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden],
.d-none {
    display: none !important;
}

button,
input,
optgroup,
select,
textarea {
    margin: 0;
    font: inherit;
}

button,
select {
    text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
}

/* Containers and the grid used throughout account + onboarding templates. */
.container,
.container-fluid {
    width: 100%;
    padding-right: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    padding-left: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    margin-right: auto;
    margin-left: auto;
}

.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
    margin-left: calc(-0.5 * var(--bs-gutter-x));
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    margin-top: var(--bs-gutter-y);
}

.col-12 {
    flex: 0 0 auto;
    width: 100%;
}

.col-6 {
    flex: 0 0 auto;
    width: 50%;
}

.g-2 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.g-4 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }

    .col-sm-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-sm-10 {
        flex: 0 0 auto;
        width: 83.33333333%;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    .col-md-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-md-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .col-md-7 {
        flex: 0 0 auto;
        width: 58.33333333%;
    }

    .col-md-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }

    .col-lg-3 {
        flex: 0 0 auto;
        width: 25%;
    }

    .col-lg-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .col-lg-5 {
        flex: 0 0 auto;
        width: 41.66666667%;
    }

    .col-lg-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-lg-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }

    .col-lg-9 {
        flex: 0 0 auto;
        width: 75%;
    }

    .col-lg-10 {
        flex: 0 0 auto;
        width: 83.33333333%;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    .col-xl-5 {
        flex: 0 0 auto;
        width: 41.66666667%;
    }

    .col-xl-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Display, flex and sizing utilities required by these flows. */
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.flex-column { flex-direction: column !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-baseline { vertical-align: baseline !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.overflow-hidden { overflow: hidden !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.sticky-top { position: sticky; top: 0; z-index: 1020; }
.start-0 { left: 0 !important; }
.end-0 { right: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.opacity-0 { opacity: 0 !important; }
.opacity-25 { opacity: 0.25 !important; }
.pe-none { pointer-events: none !important; }
.user-select-all {
    -webkit-user-select: all !important;
    user-select: all !important;
}

@media (min-width: 576px) {
    .flex-sm-row { flex-direction: row !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    .align-items-lg-center { align-items: center !important; }
}

/* Bootstrap spacing scale (only helpers used in account/onboarding chrome). */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mt-n2 { margin-top: -0.5rem !important; }
.mt-auto { margin-top: auto !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-auto { margin-left: auto !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-4 { margin-right: 1.5rem !important; }
.me-auto { margin-right: auto !important; }
.mx-0 { margin-right: 0 !important; margin-left: 0 !important; }
.mx-3 { margin-right: 1rem !important; margin-left: 1rem !important; }
.mx-auto { margin-right: auto !important; margin-left: auto !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }
.pt-0 { padding-top: 0 !important; }
.pt-3 { padding-top: 1rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pb-0 { padding-bottom: 0 !important; }
.ps-0 { padding-left: 0 !important; }
.px-3 { padding-right: 1rem !important; padding-left: 1rem !important; }
.px-2 { padding-right: 0.5rem !important; padding-left: 0.5rem !important; }
.px-4 { padding-right: 1.5rem !important; padding-left: 1.5rem !important; }
.px-5 { padding-right: 3rem !important; padding-left: 3rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

@media (min-width: 768px) {
    .mt-md-0 { margin-top: 0 !important; }
    .p-md-5 { padding: 3rem !important; }
}

@media (min-width: 992px) {
    .p-lg-5 { padding: 3rem !important; }
    .pe-lg-4 { padding-right: 1.5rem !important; }
    .me-lg-2 { margin-right: 0.5rem !important; }
    .me-lg-5 { margin-right: 3rem !important; }
}

/* Typography, border, color and shadow helpers. */
.h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: calc(1.275rem + 0.3vw);
    font-weight: 500;
    line-height: 1.2;
}

.h5 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
}

.small,
small { font-size: 0.875em; }
.lead { font-size: 1.25rem; font-weight: 300; }
.display-4 { font-size: calc(1.475rem + 2.7vw); font-weight: 300; line-height: 1.2; }
.fs-1 { font-size: calc(1.375rem + 1.5vw) !important; }
.fs-2 { font-size: calc(1.325rem + 0.9vw) !important; }
.fs-3 { font-size: calc(1.3rem + 0.6vw) !important; }
.fs-4 { font-size: calc(1.275rem + 0.3vw) !important; }
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }
.text-decoration-none { text-decoration: none !important; }
.text-decoration-underline { text-decoration: underline !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-primary { color: var(--bs-primary) !important; }
.text-secondary { color: var(--bs-secondary) !important; }
.text-success { color: var(--bs-success) !important; }
.text-danger { color: var(--bs-danger) !important; }
.text-warning { color: #997404 !important; }
.text-info { color: #087990 !important; }
.text-dark { color: var(--bs-dark) !important; }
.text-white { color: var(--bs-white) !important; }
.text-muted { color: var(--bs-secondary) !important; }
.bg-primary { background-color: var(--bs-primary) !important; }
.bg-secondary { background-color: var(--bs-secondary) !important; }
.bg-success { background-color: var(--bs-success) !important; }
.bg-info { background-color: var(--bs-info) !important; }
.bg-light { background-color: var(--bs-light) !important; }
.bg-white { background-color: var(--bs-white) !important; }
.bg-transparent { background-color: transparent !important; }
.bg-primary-subtle { background-color: #cfe2ff !important; }
.bg-success-subtle { background-color: #d1e7dd !important; }
.bg-info-subtle { background-color: #cff4fc !important; }
.border { border: 1px solid var(--bs-border-color) !important; }
.border-0 { border: 0 !important; }
.border-2 { border-width: 2px !important; }
.border-top { border-top: 1px solid var(--bs-border-color) !important; }
.border-top-0 { border-top: 0 !important; }
.border-secondary { border-color: var(--bs-secondary) !important; }
.border-light { border-color: var(--bs-light) !important; }
.border-success-subtle { border-color: #a3cfbb !important; }
.rounded-2 { border-radius: var(--bs-border-radius) !important; }
.rounded-3 { border-radius: var(--bs-border-radius-lg) !important; }
.rounded-4 { border-radius: 1rem !important; }
.rounded-bottom-4 { border-bottom-right-radius: 1rem !important; border-bottom-left-radius: 1rem !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 50rem !important; }
.rounded-start-pill {
    border-top-left-radius: 50rem !important;
    border-bottom-left-radius: 50rem !important;
}
.rounded-end-pill {
    border-top-right-radius: 50rem !important;
    border-bottom-right-radius: 50rem !important;
}
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; }
.shadow { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; }
.shadow-none { box-shadow: none !important; }

/* Form controls remain fully usable without the vendor stylesheet. */
.form-label {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.form-select {
    padding-right: 2.25rem;
}

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

.form-control:disabled,
.form-select:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--bs-danger);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: var(--bs-danger);
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--bs-danger);
}

.form-control-sm {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: var(--bs-border-radius-sm);
}

.form-control-lg {
    min-height: calc(1.5em + 1rem + 2px);
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    border-radius: var(--bs-border-radius-lg);
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--bs-secondary);
}

.form-floating {
    position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
    height: calc(3.5rem + 2px);
    min-height: calc(3.5rem + 2px);
    line-height: 1.25;
}

.form-floating > .form-control {
    padding: 1rem 0.75rem;
}

.form-floating > .form-select {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: 1rem 0.75rem;
    overflow: hidden;
    color: rgba(33, 37, 41, 0.65);
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}

.form-check-input {
    float: left;
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    margin-left: -1.5em;
    vertical-align: top;
}

.form-check-label { cursor: pointer; }

.form-check-inline {
    display: inline-block;
    margin-right: 1rem;
}

.form-range {
    width: 100%;
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control,
.input-group > .form-select {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.form-select-lg,
.input-group-lg > .form-control,
.input-group-lg > .form-select,
.input-group-lg > .input-group-text,
.input-group-lg > .btn {
    min-height: calc(1.5em + 1rem + 2px);
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    border-radius: var(--bs-border-radius-lg);
}

/* Buttons. Project-specific variants continue to override these later. */
.btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    background-color: transparent;
}

.btn:hover { text-decoration: none; }

.btn:disabled,
.btn.disabled,
fieldset:disabled .btn {
    pointer-events: none;
    opacity: 0.65;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: var(--bs-border-radius-sm);
}

.btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    border-radius: var(--bs-border-radius-lg);
}

.btn-primary { color: #fff; background-color: var(--bs-primary); border-color: var(--bs-primary); }
.btn-secondary { color: #fff; background-color: var(--bs-secondary); border-color: var(--bs-secondary); }
.btn-success { color: #fff; background-color: var(--bs-success); border-color: var(--bs-success); }
.btn-info { color: #000; background-color: var(--bs-info); border-color: var(--bs-info); }
.btn-danger { color: #fff; background-color: var(--bs-danger); border-color: var(--bs-danger); }
.btn-outline-primary { color: var(--bs-primary); border-color: var(--bs-primary); }
.btn-outline-secondary { color: var(--bs-secondary); border-color: var(--bs-secondary); }
.btn-outline-success { color: var(--bs-success); border-color: var(--bs-success); }
.btn-outline-warning { color: #997404; border-color: var(--bs-warning); }
.btn-outline-dark { color: var(--bs-dark); border-color: var(--bs-dark); }
.btn-link { color: var(--bs-primary); text-decoration: underline; border: 0; }

.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: #000;
    border: 0;
    border-radius: var(--bs-border-radius);
    opacity: 0.5;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
}

/* Cards and list groups used for role selection and auth surfaces. */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--bs-body-color);
    overflow-wrap: break-word;
    background-color: var(--bs-body-bg);
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: var(--bs-border-radius);
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem;
}

.card-title { margin-bottom: 0.5rem; }
.card-text:last-child { margin-bottom: 0; }

.card-footer {
    padding: 0.5rem 1rem;
    background-color: rgba(33, 37, 41, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.175);
}

.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: var(--bs-border-radius);
}

.list-group-item {
    position: relative;
    display: block;
    padding: 0.5rem 1rem;
    color: var(--bs-body-color);
    text-decoration: none;
    background-color: var(--bs-body-bg);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.list-group-item + .list-group-item { border-top-width: 0; }
.list-group-item-action { width: 100%; color: #495057; text-align: inherit; }
.list-group-item-action:hover { background-color: #f8f9fa; }
.list-group-flush { border-radius: 0; }
.list-group-flush > .list-group-item { border-width: 0 0 1px; }
.list-unstyled { padding-left: 0; list-style: none; }

/* Alerts and compact status components. */
.alert {
    position: relative;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
}

.alert-dismissible { padding-right: 3rem; }
.alert-dismissible .btn-close { position: absolute; top: 0; right: 0; z-index: 2; padding: 1.25rem 1rem; }
.alert-danger { color: #58151c; background-color: #f8d7da; border-color: #f1aeb5; }
.alert-success { color: #0a3622; background-color: #d1e7dd; border-color: #a3cfbb; }
.alert-warning { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; }
.alert-info { color: #055160; background-color: #cff4fc; border-color: #b6effb; }
.alert-light { color: #636464; background-color: #fefefe; border-color: #fdfdfe; }
.alert-heading { color: inherit; }

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--bs-border-radius);
}

.progress {
    display: flex;
    height: 1rem;
    overflow: hidden;
    background-color: #e9ecef;
    border-radius: var(--bs-border-radius);
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    background-color: var(--bs-primary);
}

/* Modal visibility and geometry pair with the local bootstrap_fallback.js. */
.fade {
    transition: opacity 0.15s linear;
}

.fade:not(.show) { opacity: 0; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal.show { display: block; }

.modal-dialog {
    position: relative;
    width: auto;
    margin: 0.5rem;
    pointer-events: none;
}

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

.modal-dialog-scrollable {
    height: calc(100% - 1rem);
}

.modal-dialog-scrollable .modal-content {
    max-height: 100%;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body { overflow-y: auto; }

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    color: var(--bs-body-color);
    pointer-events: auto;
    background-color: var(--bs-body-bg);
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: var(--bs-border-radius-lg);
    outline: 0;
}

.modal-header,
.modal-footer {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    padding: 1rem;
}

.modal-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--bs-border-color);
}

.modal-footer {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--bs-border-color);
}

.modal-title { margin-bottom: 0; line-height: 1.5; }
.modal-body { position: relative; flex: 1 1 auto; padding: 1rem; }

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

.modal-backdrop.fade { opacity: 0; }
.modal-backdrop.show { opacity: 0.5; }
.modal-open { overflow: hidden; }

@media (min-width: 576px) {
    .modal-dialog { max-width: 500px; margin: 1.75rem auto; }
    .modal-dialog-centered { min-height: calc(100% - 3.5rem); }
    .modal-dialog-scrollable { height: calc(100% - 3.5rem); }
    .modal-sm { max-width: 300px; }
}

@media (min-width: 992px) {
    .modal-lg,
    .modal-xl { max-width: 800px; }
}

@media (min-width: 1200px) {
    .modal-xl { max-width: 1140px; }
}

/* Minimal shared navbar/collapse safety: the base template is present in both flows. */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.navbar > .container,
.navbar > .container-fluid {
    display: flex;
    flex-wrap: inherit;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand { padding: 0.3125rem 0; margin-right: 1rem; text-decoration: none; white-space: nowrap; }
.navbar-nav { display: flex; flex-direction: column; padding-left: 0; margin-bottom: 0; list-style: none; }
.nav-link { display: block; padding: 0.5rem 1rem; text-decoration: none; }
.navbar-toggler {
    padding: 0.25rem 0.75rem;
    background-color: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--bs-border-radius);
}
.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833,37,41,0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}
.collapse:not(.show) { display: none; }

@media (min-width: 992px) {
    .navbar-expand-lg { flex-wrap: nowrap; justify-content: flex-start; }
    .navbar-expand-lg .navbar-nav { flex-direction: row; }
    .navbar-expand-lg .navbar-collapse { display: flex !important; flex-basis: auto; }
    .navbar-expand-lg .navbar-toggler { display: none; }
}

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    z-index: 1000;
    display: none;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0;
    color: var(--bs-body-color);
    text-align: left;
    list-style: none;
    background-color: var(--bs-body-bg);
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: var(--bs-border-radius);
}

.dropdown-menu.show { display: block; }
.dropdown-menu-end { right: 0; left: auto; }
.dropdown-item { display: block; width: 100%; padding: 0.25rem 1rem; color: var(--bs-body-color); text-decoration: none; white-space: nowrap; }

/* Screen-reader utility must remain independent from any external CSS. */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes bootstrap-critical-spinner {
    to { transform: rotate(360deg); }
}

@keyframes bootstrap-critical-spinner-grow {
    0% { transform: scale(0); }
    50% { opacity: 1; transform: none; }
}

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: bootstrap-critical-spinner 0.75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

.spinner-grow {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    animation: bootstrap-critical-spinner-grow 0.75s linear infinite;
}

.spinner-grow-sm {
    width: 1rem;
    height: 1rem;
}

@media (prefers-reduced-motion: reduce) {
    .fade { transition: none; }
    .spinner-border,
    .spinner-grow { animation-duration: 1.5s; }
}

/* Keep the native hidden contract stronger than every display utility above. */
html [hidden] {
    display: none !important;
}
