/* Give presses a physical response without bringing back the browser's tap tint. */
:where(button, input[type="submit"], input[type="button"], [role="button"]):active:not(:disabled):not([aria-disabled="true"]):not([data-sliding-tabs] *) {
    scale: .98;
}

.page-loading[hidden] { display: none !important; }

.page-loading {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    z-index: 2147483647;
    overflow: hidden;
    background: #f5f7fb;
    pointer-events: auto;
    touch-action: none;
}

.page-loading__announcement {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.page-loading__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    padding-inline: max(20px, calc((100vw - 1200px) / 2));
    background: #fff;
    border-bottom: 1px solid #e6eaf1;
}

.page-loading__header > div {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}
.page-loading__header img { width: 112px; height: auto; object-fit: contain; }
.page-loading__header-title { display: none; font-size: 16px; font-weight: 700; }
.page-loading__body {
    width: min(100%, 1160px);
    margin: 0 auto;
    padding: 24px 20px;
    box-sizing: border-box;
}
.page-loading__title {
    margin: 0 0 18px;
    font-size: clamp(20px, 3vw, 30px);
    line-height: 1.2;
}
.page-loading__title:empty { display: none; }
.page-loading[data-layout="unknown"] .page-loading__header::after {
    content: "";
    position: absolute;
    inset: 64px 0 auto;
    height: 3px;
    background: #8ab5ff;
}
.page-loading__content { display: grid; gap: 14px; }
.page-loading__content h2 { margin: 0; font-size: 15px; color: #1e293b; }
.page-loading-note { margin: 0; font-size: 14px; color: #52647c; }
.page-loading-card {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
}
.page-loading-split,
.page-loading-tiles,
.page-loading-fields,
.page-loading-gallery,
.page-loading-mpr,
.page-loading-calendar {
    display: grid;
    gap: 12px;
    min-width: 0;
}
.page-loading-split { grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); }
.page-loading-split .page-loading-split { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.page-loading-tiles { grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); }
.page-loading-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.page-loading-mpr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-loading-calendar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.page-loading-fields > div { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.page-loading-empty-field {
    height: 40px;
    border: 1px solid #dbe3ef;
    border-radius: 9px;
    background: #fff;
}
.page-loading-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-loading-actions span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #dbe6f8;
    border-radius: 9px;
    background: #f3f7ff;
    color: #2457a6;
    font-size: 13px;
    font-weight: 600;
}
.page-loading-records { display: grid; gap: 8px; min-width: 0; }
.page-loading-records__labels,
.page-loading-record {
    display: grid;
    grid-template-columns: minmax(44px, 1fr) minmax(0, 3fr) minmax(56px, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}
.page-loading-records__labels { color: #64748b; font-size: 12px; font-weight: 600; }
.page-loading-record { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; min-height: 64px; }
.page-loading-record > div { display: grid; gap: 8px; }
.page-loading-records[data-row-shape="scan"] .page-loading-record {
    grid-template-columns: 128px minmax(0, 1fr) 120px;
    gap: 24px;
    padding: 20px;
    min-height: 156px;
}
.page-loading-ghost {
    display: block;
    height: 11px;
    border-radius: 7px;
    background: #e2e7ef;
    animation: page-loading-pulse 1.45s ease-in-out infinite alternate;
}
.page-loading-ghost--short { width: 50%; height: 9px; }
.page-loading-ghost--badge { width: min(100%, 72px); height: 20px; border-radius: 99px; }
.page-loading-ghost--document { width: 30px; height: 38px; }
.page-loading-ghost--scan { min-height: 116px; background: #d4deeb; }
.page-loading-ghost--field { height: 40px; border-radius: 9px; }
.page-loading-ghost--task { height: 62px; }
.page-loading-ghost--media { height: auto; aspect-ratio: 4 / 3; border-radius: 12px; }
.page-loading-ghost--stack { height: 154px; }
.page-loading-ghost--canvas,
.page-loading-ghost--chart,
.page-loading-ghost--conversation,
.page-loading-ghost--formula {
    height: clamp(200px, 44vh, 480px);
    border-radius: 12px;
}
.page-loading-ghost--chart {
    background: repeating-linear-gradient(to bottom, transparent 0 38px, #dce5f1 39px 40px), #f4f7fc;
}
.page-loading-ghost--formula { background: #e7edf6; }
.page-loading-ghost--scan-pane {
    height: clamp(180px, 32vh, 420px);
    background: #253248;
    border: 1px solid #43546c;
    border-radius: 9px;
}
.page-loading[data-variant="auth"] { background: #f4f7fd; }
.page-loading[data-variant="auth"] .page-loading__header { justify-content: center; background: transparent; border-bottom: 0; }
.page-loading[data-variant="auth"] .page-loading__body { width: min(100%, 470px); }
.page-loading[data-variant="viewer"] { background: #121b2a; color: #f1f5f9; }
.page-loading[data-variant="viewer"] .page-loading__header { background: #f9fbff; color: #172238; }
.page-loading[data-variant="viewer"] .page-loading__body { width: min(100%, 1540px); }
.page-loading[data-layout="settings"] .page-loading__body { width: min(100%, 960px); }
.page-loading-mobile-only { display: none; }

.page-loading-canvas {
    min-height: clamp(240px, 52vh, 640px);
    border-radius: 14px;
    background: #e2e7ef;
}

@keyframes page-loading-pulse {
    from { opacity: 1; }
    to { opacity: .68; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .page-loading__body { padding: 20px 16px; }
    .page-loading-split { grid-template-columns: minmax(190px, 1fr) minmax(0, 2fr); }
}

@media (max-width: 768px) {
    .page-loading__header { min-height: 54px; padding-inline: 14px; }
    .page-loading[data-layout="unknown"] .page-loading__header::after { top: 52px; }
    .page-loading__header img { width: 76px; }
    .page-loading__header-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .page-loading__body { padding: 16px 14px; }
    .page-loading__title { display: none; }
    .page-loading[data-variant="auth"] .page-loading__header-title { display: none; }
    .page-loading[data-variant="auth"] .page-loading__title { display: block; }
    .page-loading-split,
    .page-loading-split .page-loading-split { grid-template-columns: minmax(0, 1fr); }
    .page-loading-tiles,
    .page-loading-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-loading-calendar { grid-template-columns: minmax(0, 1fr); }
    .page-loading-calendar > :nth-child(n + 2),
    .page-loading-desktop-only { display: none; }
    .page-loading-mobile-only { display: block; }
    .page-loading-records__labels { display: none; }
    .page-loading-record { padding: 9px; gap: 9px; }
    .page-loading-records[data-row-shape="scan"] .page-loading-record {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 14px;
        min-height: 142px;
        padding: 16px;
    }
    .page-loading-records[data-row-shape="scan"] .page-loading-record > .page-loading-ghost--badge { display: none; }
    .page-loading-ghost--scan { min-height: 108px; }
    .page-loading-ghost--scan-pane { min-height: 120px; height: 30vh; }
}

@media (prefers-reduced-motion: reduce) {
    .page-loading-ghost { animation: none; }
    :where(button, input[type="submit"], input[type="button"], [role="button"]):active { scale: none !important; }
}

.page-loading-inline {
    animation: page-loading-pulse 1.45s ease-in-out infinite alternate;
}

.page-loading-inline[hidden] { display: none; }

.chart-canvas-wrap { position: relative; }

.chart-canvas-wrap > .page-loading-inline {
    position: absolute;
    inset: 0;
    min-height: 0;
    pointer-events: none;
}

.teeth-svg-loading:not(.teeth-svg-loading--error) {
    display: grid;
    place-items: end center;
    width: min(100%, 280px);
    min-height: min(180px, 28vh);
    padding: 8px;
    border-radius: 14px;
    background: #e2e7ef;
}

@media (prefers-reduced-motion: reduce) {
    .page-loading-inline { animation: none; }
}

.calendar-loading:has(.page-loading-calendar) { align-items: stretch; background: transparent; }
.calendar-loading .page-loading-calendar { width: 100%; }
.calendar-loading .page-loading-card { min-height: 230px; }
.calendar-workspace:has(.calendar-day) .calendar-loading { display: none; }
#profile-form[aria-busy="true"] input, #current-email[aria-busy="true"] {
    background: #e2e7ef;
    color: transparent;
}

/* Native document navigation keeps the old page usable until the response arrives. */
.page-navigation-progress {
    position: fixed;
    inset: 0 0 auto;
    height: 3px;
    z-index: 2147483647;
    pointer-events: none;
    overflow: hidden;
    background: #dce8ff;
}

.page-navigation-progress::after {
    content: "";
    display: block;
    width: 35%;
    height: 100%;
    background: #2767db;
    animation: page-navigation-travel 1.1s ease-in-out infinite;
}

@keyframes page-navigation-travel {
    from { transform: translateX(0); }
    to { transform: translateX(290%); }
}

@media (prefers-reduced-motion: reduce) {
    .page-navigation-progress::after { animation: none; width: 100%; }
}

[data-doctor-media-region] { display: contents; }
body.order-edit-page .photos_container [data-doctor-media-region] .order-media-placeholder {
    background: #e2e7ef;
    outline: none;
}
[data-doctor-media-region]:not([aria-busy="true"]) .order-media-placeholder,
.order-media-error[hidden] { display: none; }
.order-media-error { align-self: center; padding: 8px; }

[data-history-loading] .history-item { pointer-events: none; min-height: 76px; }
.history-placeholder-name { width: 57%; }
.history-placeholder-date { width: 36%; height: 8px; }
.history-placeholder-status { width: 44%; height: 14px; margin-top: 4px; }
.history-placeholder-preview { width: 86%; height: 9px; margin-top: 4px; }

@media (max-width: 1180px), (max-width: 1366px) and (pointer: coarse) {
    .teeth-svg-loading.doctor-formula-placeholder:not(.teeth-svg-loading--error) {
        display: grid;
        place-items: center;
        width: min(100%, 280px);
        max-height: 100%;
        aspect-ratio: 554 / 752;
        min-height: 0;
        padding: 0;
        background: transparent;
    }

    .doctor-formula-placeholder__chart {
        width: 80%;
        height: 75%;
        border-radius: 42% 42% 42% 42% / 27% 27% 27% 27%;
        border: clamp(14px, 4vw, 24px) solid #e2e7ef;
        background: linear-gradient(transparent 49%, #e9edf4 49% 51%, transparent 51%);
        box-sizing: border-box;
    }
}

.gallery-item-inner:has(.gallery-image) { background-color: #e2e7ef; }

#referral-discount[aria-busy="true"] .page-loading-ghost {
    display: inline-block;
    vertical-align: middle;
    width: 34px;
    height: 16px;
}
.colleague-placeholder { width: min(100%, 210px); margin: 8px 0; }

@media (min-width: 1181px) and (pointer: fine), (min-width: 1367px) {
    .viewer-bootstrap { display: none !important; }
}

/* The browser can dispatch the tap without waiting for a second tap. */
:where(a[href], button, input[type="submit"], [data-csp-nav]) {
    touch-action: manipulation;
}

@media (max-width: 768px) {
    body:has(.mobile-filter-nav) .dc-push-banner {
        bottom: calc(83px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 768px) {
    body:has(.filters-section.is-controls-open) .dc-push-banner { visibility: hidden; }
}
