:root {
    color-scheme: light;
    --auth-navy: #062142;
    --auth-blue: #1769c2;
    --auth-blue-bright: #2d8de3;
    --auth-text: #10233d;
    --auth-muted: #637083;
    --auth-border: #d7e0ea;
    --auth-surface: #ffffff;
    --auth-field: #f7f9fc;
    --auth-danger: #b42318;
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body.auth-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 20px;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--auth-text);
    background:
        radial-gradient(circle at 50% 18%, rgba(55, 151, 232, .33), transparent 32rem),
        linear-gradient(145deg, #04172d 0%, #0a376a 58%, #1267ad 100%);
}

body.auth-page::before,
body.auth-page::after {
    content: "";
    position: fixed;
    pointer-events: none;
}

body.auth-page::before {
    inset: 0;
    opacity: .09;
    background-image:
        linear-gradient(rgba(255,255,255,.42) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.42) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
}

body.auth-page::after {
    width: 760px;
    height: 170px;
    left: 50%;
    bottom: -112px;
    transform: translateX(-50%);
    border: 2px solid rgba(255,255,255,.14);
    border-radius: 50%;
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 380px);
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.auth-logo {
    display: block;
    width: clamp(176px, 52vw, 216px);
    height: auto;
    filter: drop-shadow(0 14px 28px rgba(0, 8, 22, .34));
    -webkit-mask-image: radial-gradient(ellipse 61% 61% at 50% 50%, #000 70%, transparent 98%);
    mask-image: radial-gradient(ellipse 61% 61% at 50% 50%, #000 70%, transparent 98%);
}

.auth-card {
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 20px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 26px 70px rgba(0, 13, 33, .34), inset 0 1px 0 #fff;
}

.auth-heading { text-align: center; }

.auth-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 27px;
    margin-bottom: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    color: #12603d;
    background: #e9f8f0;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.auth-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #27a568;
    box-shadow: 0 0 0 3px rgba(39, 165, 104, .14);
}

.auth-status.is-offline {
    color: #8a4b08;
    background: #fff3df;
}

.auth-status.is-offline::before {
    background: #e28a22;
    box-shadow: 0 0 0 3px rgba(226, 138, 34, .16);
}

.auth-title {
    margin: 0;
    color: var(--auth-text);
    font-size: 24px;
    line-height: 1.2;
    font-weight: 760;
    letter-spacing: -.025em;
}

.auth-copy {
    margin: 8px auto 24px;
    max-width: 290px;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.55;
}

.auth-alert {
    margin: 0 0 18px;
    padding: 11px 13px;
    border: 1px solid #f2c6c2;
    border-radius: 10px;
    color: var(--auth-danger);
    background: #fff3f2;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.45;
    text-align: left;
}

.auth-alert[hidden] { display: none; }

.auth-group { margin-bottom: 16px; }

.auth-label {
    display: block;
    margin: 0 0 7px;
    color: #31435a;
    font-size: 12px;
    font-weight: 700;
}

.auth-input-wrap { position: relative; }

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    outline: none;
    appearance: none;
    color: var(--auth-text);
    background: var(--auth-field);
    font: inherit;
    font-size: 15px;
    font-weight: 550;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.auth-input-wrap .auth-input { padding-right: 48px; }

.auth-input::placeholder {
    color: #99a5b4;
    font-weight: 450;
}

.auth-input:hover { border-color: #b9c6d5; }

.auth-input:focus {
    border-color: var(--auth-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(23, 105, 194, .12);
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 38px;
    height: 38px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #637083;
    background: transparent;
    cursor: pointer;
}

.auth-password-toggle:hover { color: var(--auth-blue); background: #eaf2fb; }
.auth-password-toggle:focus-visible { outline: 3px solid rgba(23, 105, 194, .25); }
.auth-password-toggle svg { width: 19px; height: 19px; }

.auth-submit {
    width: 100%;
    height: 49px;
    margin-top: 5px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #0d4f98, #237fd1);
    box-shadow: 0 10px 22px rgba(19, 101, 183, .24);
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 13px 26px rgba(19, 101, 183, .29); }
.auth-submit:active { transform: translateY(0); }
.auth-submit:focus-visible { outline: 3px solid rgba(45, 141, 227, .35); outline-offset: 3px; }
.auth-submit:disabled { opacity: .68; cursor: wait; transform: none; }

.auth-footer {
    margin: 18px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: rgba(255, 255, 255, .74);
    font-size: 11px;
    font-weight: 550;
    text-align: center;
}

.auth-footer svg { width: 13px; height: 13px; flex: 0 0 auto; }

@media (max-width: 420px) {
    body.auth-page { padding: 20px 16px; }
    .auth-brand { margin-bottom: 10px; }
    .auth-logo { width: 172px; }
    .auth-card { padding: 25px 21px; border-radius: 18px; }
    .auth-title { font-size: 22px; }
}

@media (max-height: 690px) {
    body.auth-page { align-items: start; padding-top: 18px; }
    .auth-logo { width: 145px; }
    .auth-brand { margin-bottom: 6px; }
    .auth-card { padding-top: 22px; padding-bottom: 22px; }
    .auth-copy { margin-bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Screenshot-inspired dark authentication presentation. */
body.auth-page {
    padding: 28px 16px;
    color: #f5f7fb;
    background:
        radial-gradient(circle at 50% 18%, rgba(23, 92, 171, .26), transparent 30rem),
        linear-gradient(180deg, #020b18 0%, #04142a 55%, #020914 100%);
}

body.auth-page::before {
    opacity: .06;
}

.auth-shell {
    width: min(100%, 540px);
}

.auth-card {
    padding: 42px 44px 34px;
    border: 1px solid rgba(101, 133, 171, .46);
    border-radius: 24px;
    color: #f5f7fb;
    background:
        radial-gradient(circle at 50% 8%, rgba(20, 83, 165, .2), transparent 22rem),
        rgba(3, 16, 34, .94);
    box-shadow: 0 26px 70px rgba(0, 4, 13, .48), inset 0 1px 0 rgba(255,255,255,.04);
}

.auth-title {
    color: #339cff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 7vw, 49px);
    font-weight: 750;
    letter-spacing: -.025em;
    text-shadow: 0 0 20px rgba(31, 131, 255, .2);
}

.auth-copy {
    max-width: none;
    margin: 10px auto 15px;
    color: #c3cbd7;
    font-size: 16px;
}

.auth-status {
    order: 3;
    margin: 0 auto 4px;
    color: #a8f2c7;
    border: 1px solid rgba(40, 205, 115, .52);
    background: rgba(11, 66, 51, .46);
}

.auth-status.is-offline {
    color: #ffd594;
    border-color: rgba(226, 138, 34, .55);
    background: rgba(91, 49, 9, .44);
}

.auth-heading {
    display: flex;
    flex-direction: column;
}

.auth-brand {
    margin: 10px -20px 24px;
}

.auth-logo {
    width: 100%;
    max-width: 500px;
    border-radius: 10px;
    filter: brightness(1.03) contrast(1.04) drop-shadow(0 12px 24px rgba(0,0,0,.4));
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.auth-group {
    margin-bottom: 20px;
}

.auth-label {
    margin-bottom: 9px;
    color: #3199ff;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.auth-input {
    height: 58px;
    border-color: #405773;
    border-radius: 12px;
    color: #f6f8fb;
    background: rgba(2, 12, 26, .76);
    font-size: 17px;
}

.auth-input:hover {
    border-color: #557498;
}

.auth-input:focus {
    border-color: #2d9cff;
    background: rgba(4, 18, 38, .94);
    box-shadow: 0 0 0 4px rgba(45, 156, 255, .12), 0 0 18px rgba(45, 156, 255, .14);
}

.auth-password-toggle {
    color: #2d9cff;
}

.auth-password-toggle:hover {
    color: #79c5ff;
    background: rgba(45, 156, 255, .12);
}

.auth-submit {
    height: 58px;
    margin-top: 4px;
    border: 1px solid rgba(94, 183, 255, .72);
    border-radius: 12px;
    background: linear-gradient(135deg, #1973df, #2d9cff);
    box-shadow: 0 12px 26px rgba(17, 104, 214, .28), inset 0 1px 0 rgba(255,255,255,.2);
    font-size: 18px;
}

.auth-alert {
    border-color: rgba(248, 113, 113, .45);
    color: #fecaca;
    background: rgba(127, 29, 29, .36);
}

.auth-footer {
    color: rgba(207, 216, 229, .68);
    font-size: 12px;
}

@media (max-width: 560px) {
    body.auth-page {
        align-items: start;
        padding: 16px 12px 24px;
    }

    .auth-card {
        padding: 30px 22px 26px;
        border-radius: 21px;
    }

    .auth-copy {
        font-size: 14px;
    }

    .auth-brand {
        margin: 10px -12px 20px;
    }

    .auth-logo {
        width: 100%;
    }

    .auth-input,
    .auth-submit {
        height: 56px;
    }
}

/* Brief installed-app launch transition; hidden during normal browser visits. */
.pwa-launch-screen {
    display: none;
}

html.pwa-launching .pwa-launch-screen {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    opacity: 1;
    visibility: visible;
    background:
        radial-gradient(circle at 50% 42%, rgba(32, 123, 219, .28), transparent 25rem),
        linear-gradient(180deg, #020b18 0%, #041936 100%);
    transition: opacity 220ms ease, visibility 220ms ease;
}

html.pwa-launching .pwa-launch-screen img {
    display: block;
    width: min(84vw, 520px);
    height: auto;
    border-radius: 10px;
    filter: brightness(1.03) contrast(1.04) drop-shadow(0 12px 28px rgba(0, 0, 0, .48));
}

html.pwa-launch-ready .pwa-launch-screen {
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

/* Auth-matched password security page. */
.auth-password-page .card.auth-card {
    width: 100%;
    max-width: none;
}

.auth-password-page .user-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 22px;
    padding: 14px;
    border: 1px solid #405773;
    border-radius: 12px;
    background: rgba(2, 12, 26, .76);
}

.auth-password-page .user-info-block {
    min-width: 0;
}

.auth-password-page .user-info-block label {
    display: block;
    margin-bottom: 4px;
    color: #3199ff;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.auth-password-page .user-info-block span {
    display: block;
    overflow-wrap: anywhere;
    color: #f6f8fb;
    font-size: 15px;
    font-weight: 750;
}

.auth-password-page .show-pass-wrapper {
    margin: 2px 0 20px;
    color: #c3cbd7;
}

.auth-password-page .show-pass-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2d9cff;
}

.auth-password-page .show-pass-wrapper label {
    color: #c3cbd7;
    font-size: 13px;
}

.auth-password-page .card-nav {
    margin-top: 22px;
}

.auth-password-page .card-nav a {
    color: #45a8ff;
    font-size: 13px;
}

.auth-password-page #success-toast {
    border: 1px solid rgba(69, 223, 138, .55);
    color: #f5f7fb;
    background: rgba(3, 16, 34, .97);
    box-shadow: 0 12px 34px rgba(0, 4, 13, .5), 0 0 16px rgba(69, 223, 138, .18);
}

.auth-password-page .toast-check {
    color: #45df8a;
}

@media (max-width: 420px) {
    .auth-password-page .card.auth-card {
        margin: 0;
    }
}

/* Shared primary action for online login, offline login, and password updates. */
.auth-submit {
    border: 2px solid #2d9cff;
    color: #45df8a;
    background: rgba(4, 25, 52, .9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06),
        0 0 0 1px rgba(45, 156, 255, .2),
        0 0 18px rgba(45, 156, 255, .58);
    text-shadow: 0 0 12px rgba(69, 223, 138, .42);
}

.auth-submit:hover {
    color: #68f0a4;
    background: rgba(7, 38, 77, .96);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08),
        0 0 0 1px rgba(45, 156, 255, .3),
        0 0 24px rgba(45, 156, 255, .72);
}
