/* ==========================================================================
   B60 OS — Login
   Full-page auth takeover. Two panes on desktop (brand illustration + form),
   stacked to a single column on narrow screens and short viewports.
   Tokens only — no literal colors.
   ========================================================================== */

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--ds-canvas);
}

@media (min-width: 900px) {
    .login-shell {
        grid-template-columns: 1.05fr 1fr;
    }
}

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

.login-brand {
    display: none;
    position: relative;
    overflow: hidden;
    padding: var(--ds-space-8);
    background: var(--ds-primary-tint);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--ds-space-6);
}

@media (min-width: 900px) {
    .login-brand { display: flex; }
}

/* Decorative wash behind the illustration. Sits under content via z-index
   rather than opacity so the artwork itself stays fully saturated. */
.login-brand::before {
    content: '';
    position: absolute;
    inset-block-start: -18%;
    inset-inline-start: -12%;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--ds-surface);
    opacity: 0.55;
    z-index: 0;
}

.login-brand > * {
    position: relative;
    z-index: 1;
}

.login-wordmark {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ds-primary);
}

.login-wordmark-chip {
    padding: 2px 10px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-primary);
    color: var(--ds-sidebar-pill);
    font-size: 20px;
    font-weight: 700;
}

.login-wordmark-sub {
    margin: 0;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ds-text-tertiary);
}

.login-art {
    width: min(340px, 70%);
    height: auto;
}

/* ── Form pane ──────────────────────────────────────────────────────────── */

.login-pane {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ds-space-6);
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-card-head {
    text-align: center;
    margin-block-end: var(--ds-space-6);
}

/* Compact brand lockup for the stacked layout, where the brand pane is gone. */
.login-mini-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-block-end: var(--ds-space-5);
}

@media (min-width: 900px) {
    .login-mini-brand { display: none; }
}

#loginBrandLogo,
#loginBrandIcon {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: var(--ds-radius-md);
}

#loginBrandIcon { color: var(--ds-primary); }

.login-title {
    margin: 0 0 var(--ds-space-2) 0;
}

.login-subtitle {
    margin: 0;
    font-size: var(--ds-text-sm);
}

.login-field {
    margin-block-end: var(--ds-space-4);
    text-align: start;
}

/* Leading icon + trailing reveal button share the input box, so the input
   needs padding on both sides rather than a wrapper that fakes a border. */
.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-wrap .ds-input {
    width: 100%;
    padding-inline-start: 40px;
}

.login-input-wrap.has-reveal .ds-input {
    padding-inline-end: 44px;
}

.login-input-icon {
    position: absolute;
    inset-inline-start: 12px;
    width: 18px;
    height: 18px;
    color: var(--ds-text-tertiary);
    pointer-events: none;
}

.login-reveal {
    position: absolute;
    inset-inline-end: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--ds-radius-sm);
    background: transparent;
    color: var(--ds-text-tertiary);
    cursor: pointer;
}

.login-reveal:hover { color: var(--ds-text-secondary); }

.login-reveal:focus-visible {
    outline: 2px solid var(--ds-primary);
    outline-offset: 2px;
}

.login-reveal svg {
    width: 18px;
    height: 18px;
}

.login-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    margin-block-end: var(--ds-space-5);
}

.login-remember {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-2);
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--ds-primary);
    cursor: pointer;
}

.login-link {
    border: 0;
    background: none;
    padding: 0;
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-primary);
    cursor: pointer;
}

.login-link:hover { text-decoration: underline; }

.login-submit {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    background: var(--ds-primary-gradient);
}

.login-submit svg {
    width: 18px;
    height: 18px;
}

/* Arrow leads toward the reading direction in both LTR and RTL. */
[dir="rtl"] .login-submit svg { transform: scaleX(-1); }

.login-submit[disabled] {
    opacity: 0.7;
    cursor: progress;
}

.login-footnote {
    margin: var(--ds-space-5) 0 0 0;
    text-align: center;
    font-size: var(--ds-text-sm);
}

.login-footnote a {
    color: var(--ds-primary);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .login-submit { transition: none; }
}

/* ── Account recovery dialog (migration 030) ───────────────────────────────
   Self-contained rather than reusing the app-shell modal: this has to render
   on the login screen, which is the one state where the shell does not exist.
   Someone who cannot log in must not be blocked by a dialog that only appears
   after logging in. */

.recovery-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ds-space-4);
    background: rgba(0, 0, 0, 0.55);
    overflow-y: auto;
}

.recovery-dialog {
    position: relative;
    width: 100%;
    max-width: 26rem;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--ds-space-6);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    box-shadow: var(--ds-shadow-lg, 0 20px 50px rgba(0, 0, 0, 0.3));
}

.recovery-close {
    position: absolute;
    inset-block-start: var(--ds-space-3);
    inset-inline-end: var(--ds-space-3);
    width: 2rem;
    height: 2rem;
    font-size: 1.4rem;
    line-height: 1;
    border: none;
    border-radius: var(--ds-radius-sm);
    background: none;
    color: var(--ds-text-secondary);
    cursor: pointer;
}

.recovery-close:hover {
    background: var(--ds-surface-2, var(--ds-border));
    color: var(--ds-text-primary);
}

/* Staff outnumber owners, and their answer is one sentence long. Putting it
   first stops most people reading the owner flow at all. */
.recovery-note {
    padding: var(--ds-space-3);
    border-radius: var(--ds-radius-md);
    background: var(--ds-primary-tint, var(--ds-surface-2));
    border: 1px solid var(--ds-border);
    font-size: var(--ds-text-sm);
    color: var(--ds-text-primary);
}

.recovery-error,
.recovery-success {
    margin-block-start: var(--ds-space-3);
    padding: var(--ds-space-3);
    border-radius: var(--ds-radius-md);
    font-size: var(--ds-text-sm);
}

.recovery-error {
    background: var(--ds-danger-tint, rgba(220, 38, 38, 0.1));
    color: var(--ds-danger, #b91c1c);
    border: 1px solid var(--ds-danger, #b91c1c);
}

.recovery-success {
    background: var(--ds-success-tint, rgba(16, 185, 129, 0.1));
    color: var(--ds-text-primary);
    border: 1px solid var(--ds-success, #059669);
}

.recovery-code-out {
    font-family: var(--ds-font-mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: center;
    margin-block: var(--ds-space-3);
    padding: var(--ds-space-3);
    border: 1px dashed var(--ds-border);
    border-radius: var(--ds-radius-md);
    background: var(--ds-surface);
    user-select: all;
    overflow-wrap: anywhere;
}

.recovery-actions {
    display: flex;
    gap: var(--ds-space-2);
    margin-block-start: var(--ds-space-5);
}

.recovery-actions .ds-btn {
    flex: 1;
}

.recovery-footnote {
    margin-block: var(--ds-space-4) 0;
    font-size: var(--ds-text-xs);
    color: var(--ds-text-secondary);
}

.recovery-footnote code {
    font-family: var(--ds-font-mono, ui-monospace, Menlo, Consolas, monospace);
    overflow-wrap: anywhere;
}
