:root {
    color-scheme: light;
    --auth-ink: #17233a;
    --auth-muted: #5d6b7f;
    --auth-line: #d6dfeb;
    --auth-paper: #f4f7fb;
    --auth-white: #ffffff;
    --auth-accent: #2b62c8;
    --auth-danger: #ad4c4c;
}

* { box-sizing: border-box; }
.auth-page [hidden] { display: none !important; }

body.auth-page {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--auth-ink);
    background-color: var(--auth-paper);
    background-image: radial-gradient(#b7c8dd 0.7px, transparent 0.7px);
    background-size: 19px 19px;
    font-family: "Space Grotesk", sans-serif;
}

.auth-shell {
    width: min(100% - 40px, 520px);
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 52px 0 30px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    width: fit-content;
    margin: 0 0 27px 2px;
    color: var(--auth-ink);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.auth-brand img { display: block; object-fit: contain; }
.auth-brand span span { color: var(--auth-muted); font-weight: 500; }

.auth-panel {
    overflow: hidden;
    border: 1px solid var(--auth-line);
    background: var(--auth-white);
    box-shadow: 8px 8px 0 rgba(23, 33, 31, 0.06);
    animation: auth-enter 420ms ease-out both;
}

.auth-panel-top,
.auth-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--auth-muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
}

.auth-panel-top { padding: 15px 20px; border-bottom: 1px solid var(--auth-line); }
.auth-panel-top span:last-child { color: var(--auth-accent); }
.auth-content { padding: 35px 38px 30px; }
.auth-modes { display: flex; gap: 6px; margin-bottom: 28px; padding: 4px; background: var(--auth-paper); border: 1px solid var(--auth-line); border-radius: 5px; }
.auth-modes a { flex: 1; padding: 10px 8px; color: var(--auth-muted); font-size: 13px; font-weight: 600; text-align: center; text-decoration: none; border-radius: 3px; }
.auth-modes a[aria-current="page"] { background: var(--auth-white); color: var(--auth-accent); box-shadow: 0 1px 4px #17233a12; }
.auth-modes a:focus-visible { outline: 3px solid #91b1ed; }

.auth-eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 17px;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 600;
}

.auth-eyebrow[hidden] { display: none; }

.auth-eyebrow span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b9274;
    box-shadow: 0 0 0 3px rgba(59, 146, 116, 0.12);
}

.auth-content h1 {
    margin: 0;
    font-size: clamp(38px, 9vw, 52px);
    line-height: 1.03;
    font-weight: 600;
}

.auth-content h1 span { color: var(--auth-accent); }
.auth-content h1 .auth-account-title { color: var(--auth-ink); }
.auth-intro { max-width: 360px; margin: 17px 0 28px; color: var(--auth-muted); font-size: 14px; line-height: 1.65; }
.auth-form { display: grid; gap: 10px; }
.auth-form[hidden], .auth-profile[hidden], .auth-danger-zone[hidden] { display: none; }

.auth-form label { margin-top: 2px; font-size: 12px; font-weight: 600; }

.auth-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--auth-line);
    border-radius: 3px;
    outline: none;
    background: #fff;
    color: var(--auth-ink);
    font: inherit;
    font-size: 15px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-form input:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 3px rgba(41, 46, 44, 0.12); }
#code { font-family: "IBM Plex Mono", monospace; font-size: 21px; letter-spacing: 4px; }
.auth-destination { overflow-wrap: anywhere; margin: 0 0 6px; color: var(--auth-muted); font-size: 13px; }
.auth-destination strong { color: var(--auth-ink); font-weight: 600; }

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    margin-top: 5px;
    padding: 0 15px;
    border: 0;
    border-radius: 3px;
    background: var(--auth-accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms ease, transform 140ms ease;
}

.auth-submit:hover { background: #204d9f; transform: translateY(-1px); }
.auth-submit:focus-visible, .auth-text-button:focus-visible, .auth-secondary-button:focus-visible, .auth-danger-button:focus-visible { outline: 3px solid rgba(43, 98, 200, 0.3); outline-offset: 3px; }
.auth-submit:disabled { opacity: 0.65; cursor: wait; transform: none; }
.auth-submit span:last-child { font-size: 19px; }
.auth-text-button { width: fit-content; padding: 7px 0; border: 0; background: none; color: var(--auth-accent); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-status { min-height: 20px; margin: 14px 0 0; color: var(--auth-danger); font-size: 12px; line-height: 1.5; }
.auth-status:empty { margin-top: 6px; }
.auth-status[data-kind="success"] { color: #287458; }
.auth-avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.auth-avatar-actions button:disabled { opacity: 0.6; cursor: wait; }
.auth-hint { margin: -3px 0 2px; color: var(--auth-muted); font-size: 11px; }
.turnstile-container { min-height: 65px; margin-top: 4px; }

.auth-profile { display: grid; gap: 17px; }
.auth-profile-heading { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--auth-line); background: linear-gradient(135deg, #f7f8f4, #eef0eb); }
.auth-profile-heading > div:last-child { display: grid; gap: 4px; min-width: 0; }
.auth-profile-label { color: var(--auth-muted); font-family: "IBM Plex Mono", monospace; font-size: 9px; }
.auth-profile-heading strong { overflow-wrap: anywhere; font-size: 20px; letter-spacing: -0.02em; }
.auth-avatar { width: 68px; height: 68px; flex: none; overflow: hidden; border: 1px solid #b9c1bb; border-radius: 18px; background: #ddd; box-shadow: 3px 3px 0 rgba(23, 33, 31, 0.1); }
.auth-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.auth-continue { margin-top: -1px; }
.auth-inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.auth-inline-form input { min-width: 0; }
.auth-small-button, .auth-secondary-button, .auth-danger-button { min-height: 42px; padding: 0 13px; border: 1px solid var(--auth-line); border-radius: 3px; background: #fff; color: var(--auth-ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-small-button:hover, .auth-secondary-button:hover { border-color: var(--auth-ink); }
.auth-secondary-button { justify-self: start; }
.auth-secondary-button span { margin-right: 5px; font-size: 16px; }
.auth-danger-zone { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--auth-line); }
.auth-danger-zone > p { margin: 0; font-size: 13px; font-weight: 600; }
.auth-danger-zone > span { color: var(--auth-muted); font-size: 11px; line-height: 1.5; }
.auth-danger-button { justify-self: start; border-color: #929a94; background: transparent; }
.auth-danger-button:hover { border-color: var(--auth-ink); background: #f1f2ee; }
.auth-profile > .auth-text-button { margin-top: -8px; }
.auth-footer { margin-top: 23px; font-size: 9px; }

/* The account page has more controls than the sign-in form; keep all of them
   reachable in a regular laptop viewport without making the panel feel cramped. */
.profile-page .auth-shell { justify-content: flex-start; padding-top: 30px; }
.profile-page .auth-brand { margin-bottom: 18px; }
.profile-page .auth-content { padding: 26px 34px 23px; }
.profile-page .auth-content h1 { font-size: clamp(38px, 7vw, 45px); }
.profile-page .auth-profile { gap: 12px; }
.profile-page .auth-danger-zone { gap: 6px; padding-top: 13px; }
.profile-page .auth-footer { margin-top: 16px; }

@keyframes auth-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .auth-shell { width: min(100% - 28px, 520px); padding-top: 30px; }
    .auth-content { padding: 29px 23px 23px; }
    .auth-panel-top { padding-inline: 15px; }
}

@media (max-width: 360px) {
    .auth-shell { width: calc(100% - 18px); }
    .auth-content { padding-inline: 17px; }
    .turnstile-container { min-height: 140px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
