.offline-document, .offline-document * { box-sizing: border-box; }
html[data-auth-theme-reveal]::view-transition-old(root),
html[data-auth-theme-reveal]::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}
html[data-auth-theme-reveal]::view-transition-old(root) { z-index: 1; }
html[data-auth-theme-reveal]::view-transition-new(root) {
    z-index: 2;
    animation: bepl-theme-shutter 500ms cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes bepl-theme-shutter {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0); }
}
.theme-button .theme-sun, [data-bs-theme="dark"] .theme-button .theme-moon { display: none; }
[data-bs-theme="dark"] .theme-button .theme-sun { display: block; }
[data-setup-validation][aria-busy="true"] button[type="submit"] svg { display: none; }
[data-setup-validation][aria-busy="true"] button[type="submit"] .auth-spinner { display: block; }
@media (prefers-reduced-motion: no-preference) {
    [data-setup-validation][aria-busy="true"] button[type="submit"] .auth-spinner { animation: auth-spin .8s linear infinite; }
}
:is(.product-auth:not(.workspace-page), .offline-document, [data-workspace-offline]) {
    -webkit-user-select: none;
    user-select: none;
}
:root:has(.offline-document) {
    color-scheme: light;
    --surface: #fff;
    --text: #1f2020;
    --muted: #5e6672;
    --border: #e2e8f0;
    --accent: #011eb2;
    --focus: #91acf0;
}
:root[data-bs-theme="dark"]:has(.offline-document) {
    color-scheme: dark;
    --surface: #030318;
    --text: #eef1ff;
    --muted: #a5aec1;
    --border: #161641;
    --accent: #a7b5ff;
    --focus: #819be1;
}
.offline-document {
    isolation: isolate;
    display: grid;
    place-items: center;
    margin: 0;
    min-height: var(--bepl-viewport-height, 100dvh);
    padding: 1rem;
    color: var(--text);
    background: radial-gradient(ellipse at center, var(--surface) 24%, transparent 85%),
        linear-gradient(135deg, rgb(1 30 178 / 12%), var(--surface) 48%, rgb(1 30 178 / 16%)) var(--surface);
    font: var(--bepl-weight-regular) var(--bepl-type-body)/1.5 var(--bepl-ui-font);
}
.offline-document::before { content: ''; position: fixed; inset: 0; z-index: -1; background: #011eb2; mask: url('/assets/img/auth-pattern.svg') center / cover no-repeat; pointer-events: none; }
.offline-document main { width: min(100%, 500px); border: 1px solid var(--border); border-radius: 8px; padding: clamp(1.25rem, 5vw, 2.5rem); background: var(--surface); box-shadow: 0 14px 38px rgb(26 49 127 / 10%); }
:is(.product-auth:not(.workspace-page), .offline-document, .workspace-page:has([data-offline-content]:not([hidden]))) {
    min-height: var(--bepl-viewport-height, 100dvh);
    align-items: safe center;
    padding-block: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-bottom));
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
}
:is(.product-auth-card, .offline-document main) {
    box-sizing: border-box;
    min-width: 0;
}
@media (max-height: 720px) {
    :is(.product-auth-card, .offline-document main) { padding-block: clamp(1rem, 4dvh, 1.75rem); }
    :is(.product-auth-card, .offline-document main) header {
        padding-bottom: .875rem;
        margin-bottom: .875rem;
    }
    .product-auth-card form { gap: .875rem; margin-top: 1rem; }
    .product-auth-card form.auth-resend { margin-top: .625rem; }
}
@media (width <= 575px) {
    .product-auth-card input:not([type="hidden"]) { font-size: max(16px, var(--bepl-type-body)); }
    .product-auth-card :is(.theme-button, [data-password-toggle]) { min-height: 44px; }
}
@media (width <= 360px) {
    :is(.product-auth-card, .offline-document main) { padding-inline: .875rem; }
    .product-auth-card .auth-otp-slots { gap: 5px; }
    .product-auth-card .auth-otp-slots span { font-size: 1.25rem; }
}
.offline-document header { display: flex; align-items: center; gap: .75rem; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.offline-document .theme-button {
    display: grid;
    place-items: center;
    margin-inline-start: auto;
    width: 2.75rem;
    min-height: 2rem;
    border: 1px solid var(--accent);
    border-radius: 3px;
    background: var(--surface);
    color: var(--accent);
    cursor: pointer;
}
.offline-document .theme-button svg { width: 1rem; height: 1rem; }
@media (hover: hover) {
    .offline-document .theme-button:enabled:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
}
.offline-document p { color: var(--muted); margin: .5rem 0; }
.offline-document h1 { margin: 1rem 0 0; }
.offline-document h1,
.product-auth-card [data-offline-content] h1 {
    font-size: var(--bepl-type-offline-heading);
    font-weight: var(--bepl-weight-semibold);
    line-height: 1.2;
}
.offline-document [hidden] { display: none; }
.product-auth-card #offline-title:focus { outline: none; }
.offline-document :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (forced-colors: none) {
    :is(.product-auth:not(.workspace-page), .offline-document, [data-workspace-offline]) :focus-visible {
        outline: none;
    }
    :is(.product-auth:not(.workspace-page), .offline-document, [data-workspace-offline]) button:focus-visible {
        filter: brightness(.94);
    }
    :is(.product-auth:not(.workspace-page), .offline-document, [data-workspace-offline]) a:focus-visible {
        text-decoration: underline;
    }
}

.product-auth-card [data-reconnect],
.offline-document :is([data-reconnect], noscript a) {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 48px;
    padding: .625rem .75rem;
    margin-top: 1.25rem;
    border: 1px solid var(--bepl-primary, #011eb2);
    border-radius: 3px;
    background: var(--bepl-action, linear-gradient(110deg, #011eb2, #2854d7));
    color: var(--bepl-on-primary, #fff);
    font: var(--bepl-weight-medium) var(--bepl-type-body)/1.5 var(--bepl-ui-font);
    box-shadow: 0 2px 5px rgb(26 49 127 / 8%);
    text-decoration: none;
    cursor: pointer;
}
.offline-document [data-reconnect][hidden] { display: none; }
:is(.product-auth-card, .offline-document) [data-reconnect][aria-busy="true"] { cursor: default; opacity: 1; }
[data-reconnect] svg { flex: 0 0 var(--bepl-action-icon-size); width: var(--bepl-action-icon-size); height: var(--bepl-action-icon-size); }
[data-reconnect]::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--bepl-action-hover, linear-gradient(110deg, #00178e, #2046bc));
    opacity: 0;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    [data-reconnect]:not(:disabled):hover::before { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
    [data-reconnect]::before { transition: opacity 240ms cubic-bezier(.25, .6, .35, 1); }
}

@media (max-width: 575.98px) { .offline-document::before { opacity: .55; } }

.connection-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .625rem;
    border: 1px solid rgb(1 30 178 / 15%);
    border-radius: 4px;
    background: rgb(1 30 178 / 8%);
    color: var(--bepl-accent, var(--accent));
    font-size: var(--bepl-type-caption);
}
.connection-badge + h1 { margin-block-start: 1rem; }
.connection-footer {
    margin-top: 1.5rem;
    padding-top: .875rem;
    border-top: 1px solid var(--auth-border, var(--bepl-border, var(--border)));
    color: var(--bepl-auth-muted, var(--muted));
    font-size: var(--bepl-type-caption);
}
.offline-document .connection-footer,
[data-offline-content] .connection-footer { font-size: var(--bepl-type-offline-footer); }
.product-auth-card [data-offline-content] .auth-description { line-height: 1.5; }
[data-connection-status] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (prefers-reduced-motion: no-preference) {
    [data-reconnect][aria-busy="true"] svg { animation: reconnect-spin 1.1s linear infinite; }
}
.connection-dots { display: inline-flex; white-space: nowrap; }
[data-reconnect]:not([aria-busy="true"]) .connection-dots { display: none; }
@media (prefers-reduced-motion: no-preference) {
    [data-reconnect][aria-busy="true"] .connection-dots span {
        animation: reconnect-dot 1.4s ease-in-out infinite;
    }
    [data-reconnect][aria-busy="true"] .connection-dots span:nth-child(2) { animation-delay: 140ms; }
    [data-reconnect][aria-busy="true"] .connection-dots span:nth-child(3) { animation-delay: 280ms; }
}
@keyframes reconnect-dot {
    0%, 65%, 100% { opacity: .45; }
    30% { opacity: 1; }
}
@keyframes reconnect-spin { to { transform: rotate(360deg); } }

.auth-wordmark { display: block; position: relative; isolation: isolate; overflow: hidden; flex: 0 1 128px; min-width: 0; }
.auth-wordmark img { display: block; width: 100%; height: auto; }
.auth-wordmark .auth-wordmark-dark,
[data-bs-theme="dark"] .auth-wordmark:has(.auth-wordmark-dark) .auth-wordmark-light { display: none; }
[data-bs-theme="dark"] .auth-wordmark .auth-wordmark-dark { display: block; }
.auth-wordmark .auth-wordmark-ink {
    position: absolute;
    inset: 0;
    filter: brightness(0) invert(1);
    clip-path: polygon(23.5% 0, 69% 0, 69% 70%, 100% 70%, 100% 100%, 23.5% 100%);
    pointer-events: none;
}

.auth-wordmark::after {
    content: '';
    position: absolute;
    inset: -45% auto -45% 0;
    width: 55%;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / 18%) 25%, rgb(255 255 255 / 72%) 50%, rgb(255 255 255 / 18%) 75%, transparent);
    transform: translateX(-135%) skewX(-25deg);
}
@media (prefers-reduced-motion: no-preference) {
    :root:not([data-auth-theme-reveal]) .auth-wordmark::after {
        animation: auth-logo-travel var(--bepl-glass-wordmark-duration) linear infinite,
            auth-logo-glow var(--bepl-glass-wordmark-duration) linear infinite;
    }
}
@keyframes auth-logo-travel {
    0% { transform: translateX(-135%) skewX(-25deg); }
    72%, 100% { transform: translateX(270%) skewX(-25deg); }
}
@keyframes auth-logo-glow {
    0% { opacity: 0; }
    3%, 57% { opacity: 1; }
    72%, 100% { opacity: 0; }
}

/* Keep the dark sweep inside the wordmark's alpha silhouette. */
[data-bs-theme="dark"] .auth-wordmark::after {
    inset: 0;
    width: 100%;
    transform: none;
    background-repeat: no-repeat;
    background-size: 55% 100%;
    background-position: -130% 0;
    mask: url('/branding/logo-wordmark-dark-2x.webp') center / 100% 100% no-repeat;
}
@media (prefers-reduced-motion: no-preference) {
    :root[data-bs-theme="dark"]:not([data-auth-theme-reveal]) .auth-wordmark::after {
        animation-name: auth-logo-dark-travel, auth-logo-glow;
    }
}
@keyframes auth-logo-dark-travel {
    0% { background-position: -130% 0; }
    72%, 100% { background-position: 230% 0; }
}

.product-auth-card :is(button, .auth-error-actions a)::after, .offline-document [data-reconnect]::after { content: ''; position: absolute; inset: -60% auto -60% -65%; width: 40%; pointer-events: none; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 12%) 25%, rgb(255 255 255 / 45%) 50%, rgb(255 255 255 / 12%) 75%, transparent); transform: translateX(0) skewX(-25deg); opacity: 0; }
@keyframes bepl-glass-sweep {
    0% { transform: translateX(0) skewX(-25deg); opacity: 0; }
    35%, 58% { opacity: .8; }
    100% { transform: translateX(490%) skewX(-25deg); opacity: 0; }
}
@media (prefers-reduced-motion: no-preference) {
    :root:not([data-auth-theme-reveal]) [data-reconnect][aria-busy="true"]::after {
        animation: bepl-glass-sweep var(--bepl-glass-reconnect-duration) var(--bepl-glass-easing) infinite;
    }
    @media (hover: hover) and (pointer: fine) {
        :root:not([data-auth-theme-reveal]) [data-reconnect]:enabled:not([aria-busy="true"]):hover::after {
            animation: bepl-glass-sweep var(--bepl-glass-action-duration) var(--bepl-glass-easing);
        }
    }
}
.clipboard-menu {
    -webkit-user-select: none;
    user-select: none;
    position: fixed;
    inset: auto;
    margin: 0;
    min-width: 8rem;
    max-width: calc(var(--bepl-viewport-width, 100vw) - 16px);
    padding: .375rem;
    border: 1px solid var(--bepl-border, #dce3ef);
    border-radius: 6px;
    background: var(--bepl-surface, #fff);
    color: var(--bepl-auth-text, #202632);
    box-shadow: 0 14px 38px rgb(26 49 127 / 10%);
}
.clipboard-menu button {
    display: block;
    width: 100%;
    padding: .5rem .625rem;
    border-radius: 3px;
    text-align: start;
    cursor: pointer;
}
.clipboard-menu button:is(:hover, :focus-visible) {
    background: color-mix(in srgb, var(--bepl-primary, #173fc6) 8%, transparent);
}
.clipboard-menu [role="status"]:not(:empty) { padding: .5rem; font-size: .8125rem; }
