/* Selvedge sign-in page — static, served by the gateway.
 *
 * Login-specific styling only. The design tokens (--sv-*) come from
 * the shell's theme.css, which the gateway serves next to this file
 * and index.html links first — one home for the tokens, no copy. The
 * page still renders with every app service down: theme.css and these
 * styles are static assets baked into the gateway image.
 */

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sv-font);
    color: var(--sv-text);
    background: var(--sv-bg);
    background-image:
        radial-gradient(60rem 40rem at 15% -10%, #e0ecff 0%, rgba(224, 236, 255, 0) 60%),
        radial-gradient(50rem 35rem at 100% 100%, #e8eefb 0%, rgba(232, 238, 251, 0) 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-shell {
    width: 100%;
    max-width: 27rem;
}

/* ── Brand ───────────────────────────────────────────────── */

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.auth-brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: var(--sv-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.auth-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.auth-brand-name {
    font-size: 1.125rem;
    font-weight: 650;
}

.auth-brand-sub {
    font-size: 0.8125rem;
    color: var(--sv-text-muted);
}

/* ── Card ────────────────────────────────────────────────── */

.auth-card {
    background: var(--sv-surface);
    border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-lg);
    box-shadow: var(--sv-shadow-md);
    padding: 2rem;
}

.auth-title {
    margin: 0 0 0.375rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.auth-subtitle {
    margin: 0 0 1.5rem;
    font-size: 0.9375rem;
    color: var(--sv-text-muted);
}

.auth-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--sv-primary);
    border: 1px solid transparent;
    border-radius: var(--sv-radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-btn:hover { background: var(--sv-primary-hover); }

.auth-btn:focus-visible {
    outline: 2px solid var(--sv-primary);
    outline-offset: 2px;
}

.auth-btn-secondary {
    color: var(--sv-text);
    background: var(--sv-surface);
    border-color: var(--sv-border-strong);
}

.auth-btn-secondary:hover { background: #f8fafc; }

/* ── States ──────────────────────────────────────────────── */

.auth-status {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.9375rem;
    color: var(--sv-text-muted);
}

.auth-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--sv-border-strong);
    border-top-color: var(--sv-primary);
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .auth-spinner { animation-duration: 2s; }
}

.auth-error {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    color: var(--sv-danger-text);
    background: var(--sv-danger-bg);
    border: 1px solid var(--sv-danger-border);
    border-radius: var(--sv-radius);
}

.auth-error::before {
    content: "!";
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
    color: #fff;
    background: #dc2626;
    border-radius: 50%;
}

/* ── Local development auth ──────────────────────────────── */

.auth-local {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--sv-border-strong);
}

.auth-local-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #92400e;
    background: #fef3c7;
    border-radius: 999px;
}

.auth-local-hint {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--sv-text-muted);
}

.auth-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--sv-text);
    background: var(--sv-surface);
    border: 1px solid var(--sv-border-strong);
    border-radius: var(--sv-radius);
}

.auth-input:focus-visible {
    outline: 2px solid var(--sv-primary);
    outline-offset: -1px;
    border-color: var(--sv-primary);
}

/* ── Footer ──────────────────────────────────────────────── */

.auth-footer {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: var(--sv-text-muted);
    text-align: center;
}

.hidden { display: none !important; }
