:root {
    color-scheme: light;
    --auth-ink: #17211d;
    --auth-muted: #65716b;
    --auth-line: #dde3df;
    --auth-soft: #f4f6f4;
    --auth-forest: #14231d;
    --auth-accent: #f6b94f;
    --auth-accent-hover: #ffc865;
    --auth-error: #b73d37;
}

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

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

body {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--auth-ink);
    background:
        radial-gradient(circle at 12% 16%, rgba(246, 185, 79, 0.12), transparent 24rem),
        radial-gradient(circle at 88% 86%, rgba(31, 77, 59, 0.09), transparent 25rem),
        #eef1ef;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.auth-page {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 3rem);
}

.auth-shell {
    display: grid;
    width: min(100%, 70rem);
    min-height: min(42rem, calc(100dvh - 2rem));
    grid-template-columns: minmax(22rem, 0.91fr) minmax(28rem, 1.09fr);
    overflow: hidden;
    border: 1px solid rgba(20, 35, 29, 0.08);
    border-radius: 1.75rem;
    background: #ffffff;
    box-shadow:
        0 30px 70px -42px rgba(20, 35, 29, 0.48),
        0 8px 24px -18px rgba(20, 35, 29, 0.2);
}

.auth-story {
    position: relative;
    isolation: isolate;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 2.2rem 2.35rem 2rem;
    background: linear-gradient(145deg, #12221b 0%, #1b3329 100%);
    color: #ffffff;
}

.auth-story::after {
    position: absolute;
    z-index: -1;
    right: -6rem;
    bottom: -7rem;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: rgba(246, 185, 79, 0.08);
    content: "";
}

.auth-story__orb {
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(246, 185, 79, 0.16);
    border-radius: 50%;
    pointer-events: none;
}

.auth-story__orb--one {
    top: -8rem;
    right: -6rem;
    width: 22rem;
    height: 22rem;
}

.auth-story__orb--two {
    top: -4.5rem;
    right: -2.5rem;
    width: 14rem;
    height: 14rem;
}

.auth-story__route {
    position: absolute;
    z-index: -1;
    inset: 0;
    width: 100%;
    height: 100%;
    color: rgba(246, 185, 79, 0.2);
    pointer-events: none;
}

.auth-brand,
.auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.72rem;
}

.auth-brand__mark {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 179, 0, 0.34);
    border-radius: 0.85rem;
    background: #1b2c25;
    box-shadow: 0 12px 26px -16px rgba(255, 111, 24, 0.82);
}

.auth-brand__mark img {
    width: 1.72rem;
    height: 2.08rem;
    object-fit: contain;
}

.auth-brand__copy {
    display: grid;
    gap: 0.08rem;
    line-height: 1.1;
}

.auth-brand__copy strong {
    color: inherit;
    font-size: 0.98rem;
    font-weight: 770;
    letter-spacing: -0.015em;
}

.auth-brand__copy > span {
    color: #93a59c;
    font-size: 0.61rem;
    font-weight: 660;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.auth-story__content {
    display: flex;
    max-width: 25rem;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 0;
}

.auth-eyebrow {
    margin: 0;
    color: #9a5809;
    font-size: 0.68rem;
    font-weight: 760;
    letter-spacing: 0.115em;
    line-height: 1.4;
    text-transform: uppercase;
}

.auth-eyebrow--light {
    color: #e4ad4f;
}

.auth-story h2 {
    margin: 0.78rem 0 0;
    font-size: clamp(2.35rem, 4vw, 3.45rem);
    font-weight: 760;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.auth-story__content > p:not(.auth-eyebrow) {
    max-width: 22rem;
    margin: 1.25rem 0 0;
    color: #bdcbc4;
    font-size: 0.9rem;
    line-height: 1.65;
}

.auth-benefits {
    display: grid;
    gap: 0.78rem;
    margin: 1.65rem 0 0;
    padding: 0;
    list-style: none;
}

.auth-benefits li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #dde6e1;
    font-size: 0.78rem;
    font-weight: 560;
    line-height: 1.35;
}

.auth-benefits li > span {
    display: inline-flex;
    width: 1.55rem;
    height: 1.55rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(246, 185, 79, 0.12);
    color: #f4bd5e;
}

.auth-benefits svg {
    width: 1rem;
    height: 1rem;
}

.auth-story__footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #8fa299;
    font-size: 0.67rem;
    font-weight: 610;
    letter-spacing: 0.025em;
}

.auth-story__shield {
    display: inline-flex;
}

.auth-story__shield svg {
    width: 1.05rem;
    height: 1.05rem;
}

.auth-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
}

.auth-panel__inner {
    width: min(100%, 27.5rem);
    margin: auto;
    padding: 3rem 2rem 2rem;
}

.auth-mobile-brand {
    display: none;
    color: var(--auth-ink);
}

.auth-panel__header h1 {
    margin: 0.55rem 0 0;
    color: var(--auth-ink);
    font-size: clamp(1.85rem, 3vw, 2.25rem);
    font-weight: 770;
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.auth-panel__header > p:last-child {
    margin: 0.72rem 0 0;
    color: var(--auth-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.auth-role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    margin-top: 1rem;
}

.auth-role-list span {
    display: inline-flex;
    min-height: 1.7rem;
    align-items: center;
    padding: 0.28rem 0.6rem;
    border: 1px solid #e4e8e5;
    border-radius: 999px;
    background: #f7f9f8;
    color: #69756f;
    font-size: 0.62rem;
    font-weight: 680;
    line-height: 1;
}

.auth-alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.7rem;
    margin-top: 1.15rem;
    padding: 0.78rem 0.85rem;
    border: 1px solid;
    border-radius: 0.9rem;
    font-size: 0.72rem;
    line-height: 1.45;
}

.auth-alert__icon {
    display: inline-flex;
    margin-top: 0.05rem;
}

.auth-alert__icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.auth-alert > span:last-child {
    display: grid;
    gap: 0.12rem;
}

.auth-alert strong {
    font-size: 0.73rem;
    font-weight: 760;
}

.auth-alert--notice {
    border-color: #f0d597;
    background: #fff8e8;
    color: #77510f;
}

.auth-alert--error {
    border-color: #f0c2bf;
    background: #fff1f0;
    color: #9d342f;
}

.auth-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.4rem;
}

.auth-field {
    display: grid;
    gap: 0.42rem;
}

.auth-field label {
    color: #25312c;
    font-size: 0.75rem;
    font-weight: 710;
    line-height: 1.3;
}

.auth-input-shell {
    display: flex;
    min-height: 3.25rem;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--auth-line);
    border-radius: 0.92rem;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(20, 35, 29, 0.025);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

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

.auth-input-shell:focus-within {
    border-color: #b57413;
    box-shadow: 0 0 0 3px rgba(246, 185, 79, 0.2);
}

.auth-input-shell--error {
    border-color: #d97974;
    background: #fffbfb;
}

.auth-input-shell--error:focus-within {
    border-color: var(--auth-error);
    box-shadow: 0 0 0 3px rgba(183, 61, 55, 0.12);
}

.auth-input-shell__icon {
    display: inline-flex;
    flex: 0 0 auto;
    padding-left: 0.92rem;
    color: #8c9892;
}

.auth-input-shell__icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.auth-input-shell input {
    width: 100%;
    min-width: 0;
    height: 3.1rem;
    padding: 0 0.75rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--auth-ink);
    font-size: 0.84rem;
    line-height: 1;
}

.auth-input-shell input::placeholder {
    color: #a0aaa5;
    opacity: 1;
}

.auth-field__help {
    margin: 0;
    color: #7d8882;
    font-size: 0.66rem;
    line-height: 1.45;
}

.auth-password-toggle {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin-right: 0.25rem;
    border: 0;
    border-radius: 0.72rem;
    outline: 0;
    background: transparent;
    color: #7c8882;
    cursor: pointer;
}

.auth-password-toggle:hover {
    background: var(--auth-soft);
    color: #38453f;
}

.auth-password-toggle:focus-visible {
    background: #fff5df;
    box-shadow: 0 0 0 3px rgba(246, 185, 79, 0.28);
    color: #8b5409;
}

.auth-password-toggle svg {
    width: 1.12rem;
    height: 1.12rem;
}

.auth-remember {
    display: flex;
    min-height: 2.7rem;
    align-items: center;
    gap: 0.7rem;
    padding: 0.58rem 0.72rem;
    border: 1px solid #e0e6e2;
    border-radius: 0.82rem;
    background: #f8faf9;
    color: #4d5a54;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.auth-remember:hover {
    border-color: #cbd7d0;
    background: #f3f7f5;
}

.auth-remember input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.auth-remember__check {
    display: inline-flex;
    width: 1.2rem;
    height: 1.2rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfcac4;
    border-radius: 0.36rem;
    background: #ffffff;
    color: transparent;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.auth-remember__check svg {
    width: 0.82rem;
    height: 0.82rem;
}

.auth-remember input:checked + .auth-remember__check {
    border-color: var(--auth-forest);
    background: var(--auth-forest);
    color: #ffffff;
}

.auth-remember:has(input:focus-visible) {
    border-color: #91a69b;
    box-shadow: 0 0 0 3px rgba(20, 35, 29, 0.14);
}

.auth-remember:active .auth-remember__check {
    transform: scale(0.92);
}

.auth-remember__copy {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
    font-size: 0.68rem;
    line-height: 1.35;
}

.auth-remember__copy strong {
    color: #34423b;
    font-size: 0.72rem;
    font-weight: 720;
}

.auth-remember__copy > span {
    color: #7c8982;
}

[hidden] {
    display: none !important;
}

/* Cloudflare Turnstile — present only when a super admin has switched the
   challenge on in /super/settings. The widget itself is an iframe Cloudflare
   owns, so everything here dresses the space around it. */

.auth-turnstile {
    display: grid;
    gap: 0.5rem;
    padding: 0.85rem 0.85rem 0.7rem;
    border: 1px solid var(--auth-line);
    border-radius: 0.92rem;
    background: var(--auth-soft);
}

.auth-turnstile--error {
    border-color: #d97974;
    background: #fffbfb;
}

.auth-turnstile .cf-turnstile {
    display: flex;
    max-width: 100%;
    justify-content: center;
    overflow: hidden;
}

.auth-turnstile .cf-turnstile iframe {
    max-width: 100%;
}

.auth-turnstile__note {
    margin: 0;
    color: #7d8882;
    font-size: 0.64rem;
    line-height: 1.45;
    text-align: center;
}

.auth-turnstile__note--warn {
    color: var(--auth-error);
    font-weight: 660;
}

.auth-submit {
    display: flex;
    width: 100%;
    min-height: 3.3rem;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 0.15rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e3a73e;
    border-radius: 0.95rem;
    outline: 0;
    background: var(--auth-accent);
    box-shadow: 0 14px 28px -18px rgba(177, 108, 8, 0.78);
    color: #30260f;
    font-size: 0.82rem;
    font-weight: 760;
    cursor: pointer;
    transition: transform 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    background: var(--auth-accent-hover);
    box-shadow: 0 16px 30px -17px rgba(177, 108, 8, 0.88);
}

.auth-submit:focus-visible {
    box-shadow: 0 0 0 4px rgba(246, 185, 79, 0.3), 0 14px 28px -18px rgba(177, 108, 8, 0.78);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit > svg {
    width: 1rem;
    height: 1rem;
}

.auth-submit__loading {
    display: none;
    align-items: center;
    gap: 0.55rem;
}

.auth-submit--loading {
    pointer-events: none;
    opacity: 0.82;
}

.auth-submit--loading .auth-submit__label,
.auth-submit--loading > svg {
    display: none;
}

.auth-submit--loading .auth-submit__loading {
    display: inline-flex;
}

.auth-spinner {
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid rgba(48, 38, 15, 0.28);
    border-top-color: #30260f;
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

.auth-help {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem;
    align-items: start;
    margin-top: 1.35rem;
    padding-top: 1.15rem;
    border-top: 1px solid #ecefed;
    color: #77827d;
}

.auth-help > span {
    display: inline-flex;
    color: #87938d;
}

.auth-help svg {
    width: 1rem;
    height: 1rem;
}

.auth-help p {
    margin: 0;
    font-size: 0.66rem;
    line-height: 1.5;
}

.auth-help strong {
    color: #4b5751;
    font-weight: 720;
}

.auth-panel__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 1rem 1.5rem 1.25rem;
    color: #9aa49f;
    font-size: 0.61rem;
    font-weight: 620;
}

/* Desktop: the card is a fixed stage, so the whole sign-in has to land inside
   the viewport — no page scroll, no dead band above the card. The vertical
   rhythm is driven by dvh instead of fixed rem so it compresses on short
   laptop screens rather than pushing the footer past the fold. */

@media (min-width: 901px) {
    .auth-page {
        --auth-gutter: clamp(0.6rem, 2vh, 2rem);

        padding-block: var(--auth-gutter);
    }

    .auth-shell {
        min-height: min(42rem, calc(100dvh - var(--auth-gutter) * 2));
    }

    .auth-story {
        padding-block: clamp(1.5rem, 4vh, 2.2rem) clamp(1.35rem, 3.6vh, 2rem);
    }

    .auth-story__content {
        padding-block: clamp(1.4rem, 4vh, 3rem);
    }

    .auth-panel__inner {
        padding-block: clamp(1.5rem, 4.4vh, 3rem) clamp(1.1rem, 3vh, 2rem);
    }

    .auth-form {
        gap: clamp(0.8rem, 1.9vh, 1rem);
        margin-top: clamp(1rem, 2.6vh, 1.4rem);
    }

    .auth-help {
        margin-top: clamp(1rem, 2.4vh, 1.35rem);
        padding-top: clamp(0.85rem, 2vh, 1.15rem);
    }

    .auth-panel__footer {
        padding-block: clamp(0.7rem, 1.7vh, 1rem) clamp(0.85rem, 2.1vh, 1.25rem);
    }
}

/* Short desktop screens (720p panels, laptops with a deep browser chrome).
   The dvh clamps above are already bottomed out here, so the last of the
   height has to come out of the type scale and the control heights. */

@media (min-width: 901px) and (max-height: 720px) {
    .auth-story h2 {
        font-size: clamp(1.95rem, 3.2vw, 2.6rem);
    }

    .auth-story__content > p:not(.auth-eyebrow) {
        margin-top: 0.9rem;
    }

    .auth-benefits {
        gap: 0.6rem;
        margin-top: 1.15rem;
    }

    .auth-panel__header h1 {
        font-size: clamp(1.6rem, 2.4vw, 1.9rem);
    }

    .auth-panel__header > p:last-child {
        margin-top: 0.55rem;
    }

    .auth-role-list {
        margin-top: 0.7rem;
    }

    .auth-field {
        gap: 0.35rem;
    }

    .auth-input-shell {
        min-height: 2.95rem;
    }

    .auth-input-shell input {
        height: 2.8rem;
    }

    .auth-submit {
        min-height: 3rem;
    }

    .auth-help {
        margin-top: 0.9rem;
        padding-top: 0.8rem;
    }

    .auth-help p {
        line-height: 1.4;
    }

    .auth-panel__footer {
        padding-block: 0.6rem 0.75rem;
    }
}

@media (max-width: 900px) {
    .auth-page {
        padding: 1.5rem;
    }

    .auth-shell {
        width: min(100%, 35rem);
        min-height: auto;
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-story {
        display: none;
    }

    .auth-mobile-brand {
        display: flex;
        margin-bottom: 2.25rem;
    }

    .auth-mobile-brand .auth-brand__mark {
        color: #30260e;
    }

    .auth-mobile-brand .auth-brand__copy > span {
        color: #84918a;
    }

    .auth-panel__inner {
        padding: 2.25rem 2.25rem 1.7rem;
    }
}

@media (max-width: 480px) {
    body {
        background: #ffffff;
    }

    .auth-page {
        display: block;
        padding: 0;
    }

    .auth-shell {
        min-height: 100vh;
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-panel__inner {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .auth-mobile-brand {
        margin-bottom: 2.5rem;
    }

    .auth-role-list {
        gap: 0.35rem;
    }

    .auth-role-list span {
        font-size: 0.59rem;
    }

    .auth-panel__footer {
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }
}

@media (max-width: 340px) {
    .auth-panel__inner {
        padding-inline: 1rem;
    }

    .auth-input-shell input {
        font-size: 0.78rem;
    }

    .auth-field__help {
        font-size: 0.63rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .auth-spinner {
        animation-duration: 1.5s;
    }
}
