:root {
    color-scheme: light;
    --ink: #15203a;
    --muted: #697386;
    --line: #d9dee8;
    --paper: #ffffff;
    --sepia: #f4eee3;
    --blue: #2055a6;
    --blue-soft: #eef4ff;
    --danger: #a12626;
    --radius: 22px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 15%, rgba(255, 187, 72, .15), transparent 32rem),
        radial-gradient(circle at 90% 80%, rgba(65, 168, 255, .12), transparent 34rem),
        var(--sepia);
}

button, input { font: inherit; }

.rainbow-line {
    position: fixed;
    inset: 0 0 auto;
    z-index: 5;
    height: 4px;
    background: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6);
}

.auth-shell {
    width: min(100% - 28px, 560px);
    margin: 0 auto;
    padding: max(28px, env(safe-area-inset-top)) 0 max(40px, env(safe-area-inset-bottom));
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 22px;
    color: inherit;
    text-decoration: none;
}

.auth-brand-mark {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid rgba(21, 32, 58, .12);
    border-radius: 16px;
    background: rgba(255, 255, 255, .78);
}

.auth-brand-mark img { width: 72px; height: 72px; object-fit: contain; }
.auth-brand strong { display: grid; font-size: 18px; line-height: 1.05; }

.auth-card {
    overflow: hidden;
    padding: clamp(22px, 5vw, 36px);
    border: 1px solid rgba(21, 32, 58, .13);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 18px 60px rgba(45, 50, 68, .12);
}

.auth-card-header { margin-bottom: 24px; }
.auth-eyebrow { margin: 0 0 8px !important; color: var(--blue) !important; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.auth-card h1 { margin: 0; font-size: clamp(28px, 7vw, 38px); line-height: 1.06; letter-spacing: -.035em; }
.auth-card p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.auth-form { display: grid; gap: 17px; }
.auth-field { display: grid; gap: 7px; font-weight: 750; }
.auth-field small { color: var(--muted); font-weight: 500; line-height: 1.4; }
.auth-field input {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 13px;
    outline: none;
    background: #fff;
}
.auth-field input:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, .14); }
.auth-code-input { font-size: 24px !important; font-weight: 800; letter-spacing: .12em; text-align: center; }
.auth-check { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-weight: 650; line-height: 1.4; }
.auth-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue); }

.auth-button, .auth-button-secondary {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 0;
    border-radius: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.auth-button { color: #fff; background: linear-gradient(135deg, #214b98, #2575c8); box-shadow: 0 9px 24px rgba(32, 85, 166, .22); }
.auth-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.auth-button-secondary { color: var(--ink); border: 1px solid var(--line); background: #fff; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.auth-link { color: var(--blue); font-weight: 750; text-underline-offset: 3px; }
.auth-alert { margin: 0 0 18px; padding: 12px 14px; border: 1px solid #c7d9f6; border-radius: 12px; color: #1f4c8b; background: var(--blue-soft); line-height: 1.45; }
.auth-alert-error { border-color: #f0c1c1; color: var(--danger); background: #fff3f3; }
.auth-steps { display: flex; gap: 7px; margin-bottom: 20px; }
.auth-step { height: 5px; flex: 1; border-radius: 9px; background: #e4e8ef; }
.auth-step.is-active { background: linear-gradient(90deg, #f97316, #eab308, #22c55e, #3b82f6); }

.auth-qr {
    display: grid;
    width: min(100%, 280px);
    min-height: 280px;
    place-items: center;
    margin: 0 auto 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}
.auth-qr svg { display: block; width: 100%; height: auto; }
.auth-secret { overflow-wrap: anywhere; padding: 12px; border-radius: 10px; color: var(--ink); background: #f4f6f9; font: 700 14px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.auth-recovery-option { color: var(--muted); }
.auth-recovery-option summary { color: var(--blue); font-weight: 750; cursor: pointer; }
.auth-recovery-option[open] summary { margin-bottom: 12px; }
.auth-recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 18px 0; padding: 0; list-style: none; }
.auth-recovery li { padding: 9px; border-radius: 9px; background: #f4f6f9; font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.auth-device-list { display: grid; gap: 12px; margin: 20px 0; padding: 0; list-style: none; }
.auth-device { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.auth-device strong { display: flex; align-items: center; gap: 7px; }
.auth-current { padding: 3px 7px; border-radius: 99px; color: #23613b; background: #e9f8ee; font-size: 11px; text-transform: uppercase; }
.auth-device span { color: var(--muted); font-size: 13px; }
.auth-device form { grid-area: 1 / 2 / 3 / 3; align-self: center; }
.auth-danger-button { padding: 8px 10px; color: var(--danger); border: 1px solid #efcccc; border-radius: 9px; background: #fff8f8; font-weight: 750; cursor: pointer; }
.auth-divider { height: 1px; margin: 24px 0; border: 0; background: var(--line); }

@media (max-width: 420px) {
    .auth-shell { width: min(100% - 20px, 560px); }
    .auth-card { padding: 22px 18px; border-radius: 18px; }
    .auth-recovery { grid-template-columns: 1fr; }
    .auth-device { grid-template-columns: 1fr; }
    .auth-device form { grid-area: auto; }
    .auth-danger-button { width: 100%; }
}
