/* Login page. The only screen with no topbar and no nav, so it centres a
   single card in the viewport rather than using layout.css.

   Class names are deliberately login-scoped. This page does not link
   modals.css or layout.css — it has neither modals nor a nav — so naming its
   input .finput or its wordmark .logo would silently redefine classes that
   those files own. The submit button is the one exception: it reuses the
   shared .btn.primary from components.css and overrides only its shape.

   The look follows the topbar: system sans, soft rounded grounds, a dark
   glassy panel — so signing in reads as the same product you land in. */

body {
    /* base.css lays the app out as a column with overflow hidden. Here there
       is one card to centre, and `margin: auto` on it is what does that —
       justify-content: center would clip the top of the card instead of
       letting it scroll on a viewport shorter than the card. */
    overflow: auto;
    padding: 24px 16px;
    font-family: var(--sans);
    position: relative;
}

/* A faint light behind the card plus a fading dot grid: depth without a
   picture, and nothing that competes with the form. */
.login-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(600px 380px at 50% 38%, rgba(107, 158, 232, 0.10), transparent 70%),
        radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1.2px) 0 0 / 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 100%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 100%);
}

.login-box {
    position: relative;
    z-index: 1;
    margin: auto;
    width: 100%;
    max-width: 384px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 32px 30px 26px;
    background: rgba(20, 20, 20, 0.78);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
    animation: login-in var(--t-slow) var(--e-out) both;
}

@keyframes login-in {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--text);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.login-wordmark {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.login-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-title {
    margin: 0;
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}

.login-sub {
    margin: 0;
    font-size: 14px;
    color: var(--text2);
}

.login-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.login-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-label);
}

.login-control {
    position: relative;
    display: flex;
    align-items: center;
}

.login-icon {
    position: absolute;
    left: 14px;
    width: 17px;
    height: 17px;
    color: var(--text3);
    pointer-events: none;
    transition: color var(--t-fast) linear;
}

.login-control:focus-within .login-icon {
    color: var(--text2);
}

.login-input {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 42px;
    font-family: var(--sans);
    font-size: 15px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    transition: border-color var(--t-fast) linear,
                background-color var(--t-fast) linear,
                box-shadow var(--t-fast) linear;
}

.login-input.has-toggle {
    padding-right: 46px;
}

.login-input:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

.login-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(107, 158, 232, 0.7);
    box-shadow: 0 0 0 4px rgba(107, 158, 232, 0.14);
}

/* Chrome paints autofilled fields its own pale yellow; keep the dark ground. */
.login-input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px #1b1b1b inset;
    caret-color: var(--text);
}

.login-reveal {
    position: absolute;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: none;
    color: var(--text3);
    cursor: pointer;
    transition: color var(--t-fast) linear, background-color var(--t-fast) linear;
}

.login-reveal:hover,
.login-reveal:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    outline: none;
}

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

.login-reveal .eye-shut,
.login-reveal[aria-pressed="true"] .eye-open {
    display: none;
}

.login-reveal[aria-pressed="true"] .eye-shut {
    display: block;
}

.login-hint {
    font-size: 12px;
    color: var(--amber-text);
}

/* Shape-only delta on top of .btn.primary: full width, a field's height and
   radius, centred since the shared .btn is a left-aligned inline-flex. */
.login-btn {
    position: relative;
    width: 100%;
    height: 46px;
    margin-top: 4px;
    justify-content: center;
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    transition: background-color var(--t-fast) linear, transform var(--t-instant) linear;
}

.login-btn:active:not(:disabled) {
    transform: scale(0.99);
}

.login-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

.login-spin {
    display: none;
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--bg);
    border-radius: 50%;
    animation: login-spin 0.7s linear infinite;
}

.login-btn.is-busy .login-btn-label {
    visibility: hidden;
}

.login-btn.is-busy .login-spin {
    display: block;
}

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

.login-error {
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.4;
    background: var(--red-bg);
    color: var(--red-text);
    border: 1px solid rgba(224, 102, 102, 0.22);
    border-radius: 12px;
}

.login-error svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin-top: 1px;
}

.login-error.is-visible {
    display: flex;
    animation: login-shake 320ms var(--e-out);
}

.login-error.is-info {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text2);
    border-color: rgba(255, 255, 255, 0.1);
    animation: none;
}

@keyframes login-shake {
    0%, 100% { transform: none; }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

.login-foot {
    margin: 2px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--text3);
}

@media (max-width: 420px) {
    .login-box {
        padding: 26px 20px 22px;
        border-radius: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-box, .login-error.is-visible { animation: none; }
    .login-input, .login-icon, .login-reveal, .login-btn { transition: none; }
}
