/*
 * The account pages share this file (#833). A rule that changes a shared class for one page goes at
 * the end, under that page's body class. A class that only one page uses needs no prefix.
 * The colour, radius and font tokens copy the frontend's layout.css on purpose: the two apps are
 * served from different origins, and each one's CSP allows styles only from its own origin.
 * --container-max and --container-px are the login page's own layout and differ from the frontend's.
 */
:root {
    --bg:        oklch(0.16 0.011 80);
    --bg-2:      oklch(0.20 0.013 80);
    --surface:   oklch(0.23 0.014 80);
    --surface-hi:oklch(0.28 0.016 80);
    --border:    oklch(0.34 0.016 80);
    --border-hi: oklch(0.44 0.020 80);

    --text:      oklch(0.96 0.008 85);
    --text-mute: oklch(0.80 0.012 85);
    --text-dim:  oklch(0.68 0.014 85);

    --accent:     oklch(0.78 0.11 84);
    --accent-hi:  oklch(0.85 0.12 84);
    --accent-dim: oklch(0.48 0.07 84);

    --danger-hi:   oklch(0.76 0.18 25);
    --danger-dim:  oklch(0.42 0.10 25);

    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 0 oklch(0.38 0.013 80 / 0.5) inset, 0 8px 24px -12px rgba(0,0,0,0.55);

    --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --container-max: 1200px;
    --container-px: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
button { cursor: pointer; }

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 600px at 80% -200px, oklch(0.28 0.055 84 / 0.35), transparent 60%),
        radial-gradient(900px 500px at -100px 100px, oklch(0.22 0.025 80 / 0.5), transparent 60%);
}

/* ── Top bar ── */
.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: oklch(0.15 0.011 80 / 0.7);
    backdrop-filter: blur(10px);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
}
.brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(160deg, var(--accent), var(--accent-dim));
    color: oklch(0.16 0.012 80);
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 1px oklch(0.60 0.07 84 / 0.5) inset;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-accent { color: var(--accent-hi); }
.auth-top .top-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mute);
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-2);
    transition: color .15s, border-color .15s, background .15s;
}
.auth-top .top-link:hover { color: var(--text); border-color: var(--border-hi); background: var(--surface-hi); }
.auth-top .top-link svg { width: 13px; height: 13px; }

/* ── Layout ── */
.auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 56px;
}
.auth-stack { width: 100%; max-width: 416px; }
.prose-main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 52px 28px 64px;
}

.auth-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-align: center;
    margin: 0 0 16px;
    text-transform: uppercase;
}
.auth-eyebrow.danger { color: var(--danger-hi); }

/* ── Panel ── */
.auth-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
}
.auth-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(to bottom,
        oklch(0.25 0.016 80 / 0.6),
        oklch(0.22 0.014 80 / 0));
}
.auth-panel-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.auth-panel-head .panel-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--accent-hi);
    display: grid;
    place-items: center;
    flex: 0 0 30px;
}
.auth-panel-head .panel-icon svg { width: 16px; height: 16px; }
.auth-panel-head .panel-aside {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.auth-panel-body {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.auth-lead {
    margin: -2px 0 0;
    font-size: 13.5px;
    color: var(--text-mute);
    line-height: 1.5;
}

/* ── Fields ── */
.auth-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.auth-field label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-mute);
}
.auth-input-wrap { position: relative; }
.auth-input-wrap > svg.leading {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-mute);
    pointer-events: none;
    width: 16px; height: 16px;
}
.auth-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-input::placeholder { color: var(--text-dim); }
.auth-input:hover:not(:disabled) { border-color: var(--border-hi); }
.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px oklch(0.78 0.11 84 / 0.18);
}
.auth-field-help {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ── Alert ── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    background: oklch(0.30 0.07 25 / 0.4);
    border: 1px solid var(--danger-dim);
    border-radius: var(--radius-sm);
    color: oklch(0.92 0.04 25);
    font-size: 13px;
    line-height: 1.45;
}
.auth-alert > svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--danger-hi); margin-top: 1px; }
.auth-alert .t { font-weight: 600; display: block; }
.auth-alert .s {
    display: block;
    margin-top: 3px;
    color: oklch(0.82 0.06 25);
    font-size: 12.5px;
}
.auth-alert.success {
    background: oklch(0.28 0.06 150 / 0.42);
    border-color: oklch(0.55 0.13 150 / 0.5);
    color: oklch(0.94 0.04 150);
}
.auth-alert.success > svg { color: var(--accent-hi); }
.auth-alert.success .s { color: oklch(0.84 0.05 150); }

/* ── Password rules ── */
.pw-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin: 2px 0 0;
    padding: 13px 15px;
    list-style: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-2);
}
.pw-rules li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-dim);
}
.pw-rules li .dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-hi);
    display: grid;
    place-items: center;
    flex: 0 0 14px;
}
.pw-rules li .dot svg {
    width: 9px; height: 9px;
    color: oklch(0.16 0.012 80);
    opacity: 0;
    transform: scale(0.6);
}

/* ── Consents ── */
.auth-consents {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 15px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-2);
}
.checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-mute);
    line-height: 1.45;
    user-select: none;
}
.checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox .box {
    width: 18px; height: 18px;
    margin-top: 1px;
    border-radius: 5px;
    background: var(--surface);
    border: 1px solid var(--border-hi);
    display: grid;
    place-items: center;
    transition: background .15s, border-color .15s;
    flex: 0 0 18px;
}
.checkbox .box svg {
    width: 12px; height: 12px;
    color: oklch(0.16 0.012 80);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity .12s, transform .12s;
}
.checkbox input:checked ~ .box {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox input:checked ~ .box svg { opacity: 1; transform: scale(1); }
.checkbox input:focus-visible ~ .box {
    box-shadow: 0 0 0 3px oklch(0.78 0.11 84 / 0.25);
}
.checkbox:hover .box { border-color: var(--text-mute); }
.checkbox a { color: var(--accent-hi); font-weight: 600; }
.checkbox a:hover { color: var(--accent); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14.5px;
    transition: transform .08s, background .15s, border-color .15s, color .15s;
}
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.btn-primary {
    background: var(--accent);
    color: oklch(0.16 0.012 80);
    border-color: oklch(0.62 0.09 84);
}
.btn-primary:hover:not([disabled]) { background: var(--accent-hi); }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }
.btn .spinner-sm {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid oklch(0.16 0.012 80 / 0.35);
    border-top-color: oklch(0.16 0.012 80);
    animation: spin 0.7s linear infinite;
    display: none;
}
.btn.is-loading .spinner-sm { display: inline-block; }
.btn.is-loading .submit-arrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-ghost {
    background: transparent;
    color: var(--text-mute);
    border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hi); background: var(--surface-hi); }
.btn-block { width: 100%; }

.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }

.auth-panel-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    font-size: 13px;
    color: var(--text-mute);
}
.auth-panel-foot a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-hi);
    font-weight: 600;
}
.auth-panel-foot a:hover { color: var(--accent); }
.auth-panel-foot a svg { width: 13px; height: 13px; }

.auth-meta {
    margin-top: 16px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
}
.auth-meta svg { width: 12px; height: 12px; color: var(--accent-hi); }

/* ── Document (the privacy policy) ── */
.prose h1 {
    font-size: clamp(30px, 4vw, 40px);
    line-height: 1.08;
    letter-spacing: -0.025em;
    font-weight: 800;
    margin: 0 0 12px;
    text-wrap: balance;
}
.prose .updated {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 0 0 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.prose h2 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 38px 0 12px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.prose h2 .sec-num {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--accent);
    flex: 0 0 auto;
}
.prose p { margin: 0 0 14px; color: var(--text-mute); font-size: 15px; line-height: 1.7; }
.prose p strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--accent); }
.prose ul { margin: 0 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.prose ul li {
    position: relative;
    padding-left: 24px;
    color: var(--text-mute);
    font-size: 14.5px;
    line-height: 1.6;
}
.prose ul li::before {
    content: "";
    position: absolute;
    left: 4px; top: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.prose ul li strong { color: var(--text); font-weight: 600; }
.prose-card {
    margin-top: 30px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow);
}
.prose-card svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--accent-hi); margin-top: 2px; }
.prose-card .pc-t { font-weight: 700; color: var(--text); font-size: 14.5px; }
.prose-card .pc-s { color: var(--text-mute); font-size: 13.5px; margin-top: 2px; line-height: 1.55; }

/* ── Foot ── */
.foot {
    padding: 22px 28px 26px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.foot p {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-mute);
}

@media (max-width: 640px) {
    .auth-top { padding: 14px 18px; }
    .auth-top .top-link span { display: none; }
    .pw-rules { grid-template-columns: 1fr; }
}

/* ── Register ── */
.page-register .auth-stack { max-width: 440px; }
.page-register .pw-rules li .dot svg { opacity: 0.55; transform: none; }

/* ── Privacy policy: a document, so the eyebrow stays on the left ── */
.page-privacy .auth-eyebrow { text-align: start; }

/* ── Login: a two-column page with no top bar ── */
.auth-brand-strip { padding: 22px 0 0; }
.page-login .brand { gap: 12px; font-size: 17px; }
.page-login .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.page-login .brand-mark svg { width: 22px; height: 22px; }

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-px);
}
.auth-wrap {
    padding-top: 56px;
    padding-bottom: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 48px;
    align-items: start;
}

.auth-intro {
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
}
.eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--accent-hi);
    text-transform: uppercase;
    margin: 0 0 14px;
}
.auth-intro h1 {
    margin: 0;
    font-size: clamp(34px, 4.4vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-weight: 700;
    text-wrap: balance;
    max-width: 14ch;
}
.auth-intro .lede {
    margin: 0;
    font-size: 16px;
    color: var(--text-mute);
    max-width: 42ch;
}
.auth-perks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px dashed var(--border);
}
.auth-perks li {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px dashed var(--border);
}
.auth-perks .ico {
    width: 22px; height: 22px;
    color: var(--accent-hi);
    display: grid;
    place-items: center;
}
.auth-perks .ico svg { width: 20px; height: 20px; }
.auth-perks .copy {
    font-size: 14.5px;
    color: var(--text);
    font-weight: 500;
}
.auth-perks .copy .sub {
    display: block;
    font-size: 12.5px;
    color: var(--text-dim);
    font-weight: 400;
    margin-top: 2px;
}

.page-login .auth-panel { max-width: 480px; justify-self: end; }

.auth-field-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.auth-field .hint-link {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--accent);
}
.auth-field .hint-link:hover { color: var(--accent-hi); }
.auth-input.has-trailing { padding-right: 44px; }
.auth-input-trailing {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    border-radius: 6px;
    border: 0;
    background: transparent;
    color: var(--text-mute);
    display: grid;
    place-items: center;
    transition: color .15s, background .15s;
}
.auth-input-trailing:hover { color: var(--text); background: var(--surface-hi); }
.auth-input-trailing svg { width: 16px; height: 16px; }

.auth-row-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.page-login .checkbox { align-items: center; font-size: 13.5px; line-height: inherit; }
.page-login .checkbox .box { margin-top: 0; background: var(--bg-2); }

.page-login .btn-primary { border-color: var(--accent); }
.page-login .btn-primary:hover:not([disabled]) { border-color: var(--accent-hi); }
.auth-submit { width: 100%; margin-top: 4px; }

.page-login .auth-alert { padding: 12px 14px; }
.page-login .auth-alert > svg { width: 16px; height: 16px; flex: 0 0 16px; }
.page-login .auth-alert .t { display: inline; }
.page-login .auth-alert .s { margin-top: 2px; }
.auth-alert .alert-action {
    display: inline-block;
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: oklch(0.95 0.05 25);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.auth-alert .alert-action:hover { color: var(--text); }

.page-login .auth-meta { margin-top: 14px; justify-content: normal; }

.auth-switch {
    margin: 18px 0 0;
    text-align: center;
    font-size: 13.5px;
    color: var(--text-mute);
}
.auth-switch a { color: var(--accent-hi); font-weight: 600; }
.auth-switch a:hover { color: var(--accent); }

.page-login .foot {
    margin-top: auto;
    padding: 24px var(--container-px);
    color: var(--text-dim);
    font-size: 12.5px;
}
.page-login .foot p { font: inherit; letter-spacing: inherit; color: inherit; }

@media (max-width: 1100px) {
    .page-login .auth-panel-head .panel-aside { display: none; }
}
@media (max-width: 980px) {
    .auth-wrap {
        grid-template-columns: 1fr;
        gap: 32px;
        padding-top: 32px;
        padding-bottom: 40px;
    }
    .page-login .auth-panel { justify-self: stretch; max-width: none; }
    .auth-intro h1 { max-width: none; }
}
@media (max-width: 560px) {
    .page-login .auth-panel-body { padding: 18px; }
    .page-login .auth-panel-head { padding: 14px 18px; }
}
