@font-face {
    font-family: 'Fraunces';
    src: url('/fonts/sinapse/fraunces-normal.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Fraunces';
    src: url('/fonts/sinapse/fraunces-italic.woff2') format('woff2');
    font-weight: 300 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Manrope';
    src: url('/fonts/sinapse/manrope.woff2') format('woff2');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #16152f;
    --text: #201f3d;
    --text-muted: #5c5a80;
    --indigo: #4f46e5;
    --indigo-600: #4338ca;
    --tint: #eef2ff;
    --paper: #fdfdff;
    --paper-2: #f4f5fb;
    --line: rgba(22, 21, 47, 0.12);
    --focus: #4f46e5;
    --gold: #c98a2e;
    --shadow: 0 24px 60px -30px rgba(22, 21, 47, 0.35);
    --danger: #dc2626;

    --brand-bg: #14132b;
    --brand-bg-2: #201d4c;
    --brand-node: #f4f3ff;
    --brand-hub: #e8b04b;
    --brand-text: #f6f5ff;
    --brand-text-muted: #b3aee0;
    --brand-mono: #9a94d6;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #edecf9;
        --text: #edecf9;
        --text-muted: #aba8cf;
        --indigo: #9089f5;
        --indigo-600: #7a71f0;
        --tint: #1a1938;
        --paper: #100f26;
        --paper-2: #17162f;
        --line: rgba(237, 236, 249, 0.14);
        --focus: #9089f5;
        --gold: #e8b662;
        --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.6);
        --danger: #f87171;
    }
}
:root[data-theme="dark"] {
    --ink: #edecf9;
    --text: #edecf9;
    --text-muted: #aba8cf;
    --indigo: #9089f5;
    --indigo-600: #7a71f0;
    --tint: #1a1938;
    --paper: #100f26;
    --paper-2: #17162f;
    --line: rgba(237, 236, 249, 0.14);
    --focus: #9089f5;
    --gold: #e8b662;
    --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.6);
    --danger: #f87171;
}

* { box-sizing: border-box; min-width: 0; }

html, body {
    margin: 0;
    background: var(--tint);
    color: var(--text);
    font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.auth-stage {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
}

@media (max-width: 880px) {
    .auth-stage { grid-template-columns: 1fr; }
    .panel-brand { min-height: 300px; gap: 1.5rem; }
    .orbit-labels { display: none; }
}

/* ---------- Brand panel ---------- */

.panel-brand {
    position: relative;
    background: radial-gradient(120% 90% at 18% 8%, var(--brand-bg-2) 0%, var(--brand-bg) 55%);
    color: var(--brand-text);
    padding: clamp(2rem, 4vw, 4.5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2.5rem;
    overflow: hidden;
    min-height: clamp(380px, 60vh, 100vh);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    z-index: 2;
}

.brand-mark svg { display: block; flex: none; }

.brand-wordmark {
    font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 2.75rem;
    letter-spacing: -0.02em;
    color: var(--brand-text);
}

.brand-eyebrow {
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brand-mono);
    position: relative;
    z-index: 2;
    overflow-wrap: break-word;
}

.brand-copy { position: relative; z-index: 2; max-width: 30rem; }

.brand-copy h1 {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: clamp(1.9rem, 2.6vw + 1rem, 2.9rem);
    line-height: 1.14;
    letter-spacing: -0.01em;
    margin: 0.9rem 0 0.85rem;
    text-wrap: balance;
}

.brand-copy h1 em { font-style: italic; color: var(--brand-hub); }

.brand-copy p {
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--brand-text-muted);
    margin: 0;
    max-width: 26rem;
}

.orbit-stage { position: absolute; inset: 0; z-index: 1; }
.orbit-stage canvas { width: 100%; height: 100%; display: block; }
.orbit-labels { position: absolute; inset: 0; pointer-events: none; }

.orbit-node {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

.orbit-node .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-node);
    box-shadow: 0 0 0 3px rgba(244, 243, 255, 0.14);
    flex: none;
}

.orbit-node .tag {
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--brand-text);
    background: rgba(20, 19, 43, 0.55);
    border: 1px solid rgba(178, 173, 255, 0.25);
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    backdrop-filter: blur(2px);
}

.orbit-node.align-left { flex-direction: row-reverse; }

.brand-foot {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--brand-mono);
    border-top: 1px solid rgba(178, 173, 255, 0.18);
    padding-top: 1.1rem;
}

.brand-foot strong { color: var(--brand-text-muted); font-weight: 600; }

/* ---------- Form panel ---------- */

.panel-form {
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 4vw, 3.5rem);
}

.form-card { width: 100%; max-width: 23rem; }

.form-card .kicker {
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
}

.form-card h2 {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: -0.01em;
    margin: 0 0 0.4rem;
    color: var(--text);
}

.form-card .lede {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1.6rem;
    line-height: 1.55;
}

.status-banner {
    background: color-mix(in srgb, var(--indigo) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--indigo) 30%, transparent);
    color: var(--text);
    font-size: 0.85rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.6rem;
    margin: 0 0 1.4rem;
}

.field { margin-bottom: 1.15rem; }

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.field input {
    width: 100%;
    font: inherit;
    font-size: 0.95rem;
    padding: 0.72rem 0.85rem;
    border-radius: 0.6rem;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: var(--text-muted); opacity: 0.7; }

.field input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}

.field input.is-invalid { border-color: var(--danger); }

.field .invalid-feedback {
    display: block;
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.35rem;
}

.row-between {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 0.84rem;
    margin: 0.2rem 0 1.6rem;
}

.remember { display: flex; align-items: center; gap: 0.45rem; color: var(--text-muted); }
.remember input { accent-color: var(--indigo); width: 15px; height: 15px; }

.row-between a { color: var(--indigo); text-decoration: none; font-weight: 600; }
.row-between a:hover { text-decoration: underline; }

.row-between a:focus-visible,
.btn-primary:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.btn-primary {
    width: 100%;
    border: none;
    border-radius: 0.6rem;
    background: var(--indigo);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover { background: var(--indigo-600); }
.btn-primary:active { transform: translateY(1px); }

.form-foot {
    margin-top: 2rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.status-banner-danger {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
    color: var(--danger);
}

/* ---------- Pergunta do código de acesso ---------- */

.code-toggle-row { text-align: center; margin-top: 1.5rem; }
.code-toggle {
    background: none; border: none; padding: 0; font: inherit; font-size: 0.85rem;
    color: var(--text-muted); cursor: pointer; text-decoration: none;
}
.code-toggle strong { color: var(--indigo); font-weight: 700; margin-left: 0.3rem; }
.code-toggle:hover strong { text-decoration: underline; }
.code-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.code-reveal { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.code-reveal.open { max-height: 480px; }
.code-reveal-inner { margin-top: 1.4rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.code-reveal-inner p.lede-sm { font-size: 0.84rem; color: var(--text-muted); margin: 0 0 1.1rem; line-height: 1.5; }

.otp-row { display: flex; gap: 0.5rem; margin: 0 0 1.2rem; }
.otp-row input {
    width: 100%; aspect-ratio: 1; text-align: center; padding: 0;
    font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums;
    border-radius: 0.5rem; border: 1px solid var(--line); background: var(--paper-2); color: var(--text);
}
.otp-row input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }

.btn-secondary-block {
    width: 100%; border: 1px solid var(--line); border-radius: 0.6rem; background: transparent; color: var(--text-muted);
    font: inherit; font-weight: 600; font-size: 0.85rem; padding: 0.65rem 1rem; cursor: pointer; margin-top: 0.8rem;
}
.btn-secondary-block:hover { border-color: var(--indigo); color: var(--indigo); }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
