/* Shared spacing for native CMS, service forms and confirmation dialogs.
   This Core asset is loaded on every platform page by default_assets.yml. */
.sp .modal .modal-dialog {
    width: calc(100% - 32px);
    max-width: 720px;
    max-height: calc(100% - 32px);
    margin: 0;
    overscroll-behavior: contain;
}

.sp .modal .modal-dialog.modal-dialog-large {
    width: calc(100% - 32px) !important;
    max-width: 1440px;
}

.sp .modal .modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e2e2;
}

.sp .modal .modal-title {
    flex: 1;
    order: 0;
    min-width: 0;
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.sp .modal .modal-header .close {
    order: 1;
    flex: 0 0 32px;
    float: none;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    margin: 0;
    font-size: 24px;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: 0;
}

.sp .modal .modal-header .close:hover,
.sp .modal .modal-header .close:focus-visible {
    background: #f3f3f3;
}

.sp .modal .modal-body {
    padding: 20px;
    overflow-wrap: anywhere;
}

.sp .modal .modal-body .form-group {
    margin-bottom: 16px;
}

.sp .modal .modal-body > .form-group:last-child,
.sp .modal .modal-body > p:last-child {
    margin-bottom: 0;
}

.sp .modal .modal-body .form-group:not(.row) > label {
    display: block;
    margin-bottom: 6px;
}

.sp .modal .modal-body .service-checkbox {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sp .modal .service-signature + button {
    margin-top: 8px;
}

.sp .modal .modal-footer,
.sp .modal .panel-footer {
    padding: 16px 20px;
    margin: 0;
    background: #f3f3f3;
    border-top: 1px solid #e2e2e2;
}

/* Legacy native forms keep their footer inside the body. Align its edges
   with the common header/footer without adding a second layer of padding. */
.sp .modal .modal-body > form > .panel-footer {
    margin: 20px -20px -20px;
}

.sp .modal .panel-footer > .row {
    margin: 0;
}

.sp .modal .panel-footer > .row > [class*="col-"] {
    float: none;
    width: 100%;
    padding: 0;
    margin-left: 0;
}

.sp .modal .modal-footer,
.sp .modal .panel-footer .btn-toolbar,
.sp .jconfirm .jconfirm-box .jconfirm-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    text-align: right;
}

.sp .modal .panel-footer .btn-toolbar {
    margin: 0;
}

.sp .modal .modal-footer .btn,
.sp .modal .panel-footer .btn,
.sp .jconfirm .jconfirm-box .jconfirm-buttons .btn {
    float: none !important;
    order: 1;
    max-width: 100%;
    margin: 0;
    white-space: normal;
}

.sp .modal .modal-footer [data-dismiss="modal"],
.sp .modal .panel-footer [data-dismiss="modal"],
.sp .jconfirm .jconfirm-buttons .btn-default {
    order: 0;
}

.sp .jconfirm .jconfirm-box-container {
    float: none;
    width: calc(100% - 32px);
    max-width: 720px;
    margin: 0 auto;
    padding: 0;
}

.sp .jconfirm .jconfirm-box {
    padding: 0;
    border-radius: 0;
    font-size: 14px;
}

.sp .jconfirm .jconfirm-box div.jconfirm-title-c {
    display: flex;
    align-items: center;
    min-height: 65px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e2e2;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 700;
}

.sp .jconfirm .jconfirm-box div.jconfirm-content-pane {
    width: calc(100% - 40px);
    margin: 20px;
}

.sp .jconfirm .jconfirm-box .jconfirm-buttons {
    float: none;
    padding: 16px 20px;
    background: #f3f3f3;
    border-top: 1px solid #e2e2e2;
}

@media (max-width: 480px) {
    .sp .modal .modal-dialog,
    .sp .jconfirm .jconfirm-box-container {
        width: calc(100% - 24px);
    }

    .sp .modal .modal-dialog {
        max-height: calc(100% - 24px);
    }

    .sp .modal .modal-dialog.modal-dialog-large {
        width: calc(100% - 24px) !important;
    }
}

/* Image galleries share the native header/body/footer spacing above, including the public product gallery. */
html.image-lightbox-open, html.platform-dialog-open { overflow: hidden; }
.sp dialog.modal:is(.image-lightbox, .platform-dialog) {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    height: 100dvh;
    max-height: none;
    padding: 0;
    margin: 0;
    border: 0;
    color: var(--ink, #151515);
    background: transparent;
}
.sp dialog.modal:is(.image-lightbox, .platform-dialog):not([open]) { display: none; }
.sp dialog.modal:is(.image-lightbox, .platform-dialog)[open] { display: flex; align-items: center; justify-content: center; }
.sp dialog:is(.image-lightbox, .platform-dialog)::backdrop { background: #0b1520d9; }
.sp .platform-dialog .modal-content { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); overflow: hidden; border-radius: 8px; background: #fff; }
.sp .platform-dialog .modal-header { flex: 0 0 auto; }
.sp .platform-dialog .modal-body { min-height: 0; overflow-y: auto; }
.sp .platform-dialog .modal-body > [role="status"]:empty { display: none; }
.sp .platform-dialog .modal-body > div > form > .panel-footer { margin: 20px -20px -20px; }
.sp .image-lightbox .modal-dialog { height: calc(100% - 32px); }
.sp .image-lightbox .modal-content { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 8px; background: #fff; }
.sp .image-lightbox .modal-header, .sp .image-lightbox .modal-footer { flex: 0 0 auto; }
.sp .image-lightbox .image-lightbox-stage { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; overflow: auto; background: #142a3b; }
.sp .image-lightbox-stage img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.sp .image-lightbox-stage [hidden] { display: none; }
.sp .image-lightbox-stage p { color: #fff; }
.sp .image-lightbox .modal-footer { justify-content: space-between; }
.sp .image-lightbox-navigation { display: flex; align-items: center; gap: 12px; }
.sp .image-lightbox-navigation button { min-width: 44px; min-height: 44px; padding: 0; }
.sp .image-lightbox-navigation [role="status"] { min-width: 45px; text-align: center; font-variant-numeric: tabular-nums; }
.sp .image-lightbox [data-gallery-original] { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
@media (max-width: 480px) {
    .sp .image-lightbox .modal-dialog { height: calc(100% - 24px); }
    .sp :is(.image-lightbox, .platform-dialog) .modal-header .close { flex-basis: 44px; width: 44px; height: 44px; }
}
