@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --auth-bg: #f4f6fb;
    --auth-ink: #0f172a;
    --auth-ink-2: #334155;
    --auth-muted: #5b6b83;
    --auth-line: #dfe5f0;
    --auth-primary: #004287;
    --auth-primary-deep: #00356e;
    --auth-primary-ink: #312e81;
    --auth-ring: rgba(79, 70, 229, 0.16);
    --auth-success: #059669;
    --auth-success-bg: #ecfdf5;
    --auth-success-line: #a7f3d0;
    --auth-danger: #dc2626;
    --auth-danger-bg: #fef2f2;
    --auth-danger-line: #fecaca;
    --auth-info: #00356e;
    --auth-info-bg: #e9f1f9;
    --auth-info-line: #dfe5ff;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--auth-bg);
    color: var(--auth-ink);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
}

/* ---------- Brand hero ---------- */
.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    color: #fff;
    background:
        radial-gradient(1100px 620px at 12% -12%, rgba(56, 132, 255, 0.30), transparent 60%),
        radial-gradient(900px 720px at 112% 38%, rgba(21, 96, 176, 0.38), transparent 58%),
        radial-gradient(760px 540px at 18% 112%, rgba(56, 189, 248, 0.16), transparent 60%),
        linear-gradient(152deg, #071c38 0%, #0b2f5e 48%, #12509e 100%);
}

.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.075) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 92%);
    pointer-events: none;
}

.auth-hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    padding: 46px 56px 34px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    box-sizing: border-box;
}

/* Brand */
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: #fff;
    text-decoration: none;
    animation: auth-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-logo-plate {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 10px 26px -10px rgba(2, 6, 23, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-logo-plate img {
    max-width: 68%;
    max-height: 68%;
    object-fit: contain;
    display: block;
}

.auth-logo-fallback {
    display: none;
    font-weight: 800;
    font-size: 21px;
    color: var(--auth-primary);
    letter-spacing: 0.5px;
}

.auth-logo-plate.noimg img {
    display: none;
}

.auth-logo-plate.noimg .auth-logo-fallback {
    display: block;
}

.auth-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.auth-brand-name {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.1px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-brand-sub {
    font-size: 12px;
    color: rgba(214, 222, 255, 0.72);
    letter-spacing: 0.2px;
    margin-top: 2px;
}

/* Hero copy */
.auth-hero-copy {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 54px 0 40px;
    animation: auth-rise 0.6s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-hero-copy h2 {
    margin: 0;
    font-size: clamp(27px, 2.6vw, 40px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.5px;
    color: #fff;
}

.auth-hero-copy h2 em {
    font-style: normal;
    background: linear-gradient(92deg, #4d8bd9 0%, #7dd3fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-hero-text {
    margin: 16px 0 0;
    max-width: 440px;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(222, 228, 255, 0.82);
}

.auth-hero-features {
    list-style: none;
    margin: 30px 0 0;
    padding: 0;
    display: grid;
    gap: 15px;
}

.auth-hero-features li {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(238, 242, 255, 0.95);
}

.auth-hero-features .dot {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #b8cfe4;
    box-shadow: 0 4px 12px -4px rgba(2, 6, 23, 0.35);
}

.auth-hero-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    font-size: 12.5px;
    color: rgba(200, 210, 255, 0.62);
    animation: auth-rise 0.55s 0.16s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-hero-foot .sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(200, 210, 255, 0.4);
}

.auth-hero-foot .lock {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.auth-hero-foot .lock i {
    font-size: 10.5px;
    color: #8fb4d8;
}

/* ---------- Form panel ---------- */
.auth-panel {
    display: grid;
    place-items: center;
    padding: 44px 28px;
    background:
        radial-gradient(560px 420px at 88% -6%, rgba(21, 96, 176, 0.08), transparent 62%),
        radial-gradient(520px 420px at 4% 106%, rgba(56, 189, 248, 0.07), transparent 60%),
        var(--auth-bg);
    box-sizing: border-box;
}

.auth-box {
    width: min(420px, 100%);
    animation: auth-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-title {
    margin: 0;
    font-size: clamp(24px, 2vw, 28px);
    font-weight: 700;
    letter-spacing: -0.4px;
    line-height: 1.2;
    color: var(--auth-ink);
}

.auth-sub {
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--auth-muted);
}

/* Alerts */
.auth-alerts {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
}

.auth-alert .fas {
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: 14px;
}

.auth-alert.ok {
    background: var(--auth-success-bg);
    border-color: var(--auth-success-line);
    color: #065f46;
}

.auth-alert.ok .fas {
    color: var(--auth-success);
}

.auth-alert.err {
    background: var(--auth-danger-bg);
    border-color: var(--auth-danger-line);
    color: #991b1b;
}

.auth-alert.err .fas {
    color: var(--auth-danger);
}

/* ---------- Form ---------- */
.auth-form {
    margin-top: 24px;
    display: grid;
    gap: 18px;
}

.auth-alerts + .auth-form {
    margin-top: 20px;
}

.auth-field {
    display: grid;
    gap: 7px;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.auth-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-ink-2);
    letter-spacing: 0.1px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .lead {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14.5px;
    color: #9aa7bd;
    pointer-events: none;
    transition: color 0.15s ease;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 15px;
    color: var(--auth-ink);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.auth-input-wrap:has(> .lead) .auth-input {
    padding-left: 42px;
}

.auth-input::placeholder {
    color: #a3aec2;
}

.auth-input:hover {
    border-color: #c7d1e2;
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px var(--auth-ring);
}

.auth-input:focus ~ .lead,
.auth-input-wrap:focus-within .lead {
    color: var(--auth-primary);
}

.auth-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #fff inset;
    -webkit-text-fill-color: var(--auth-ink);
}

.auth-input.has-error {
    border-color: var(--auth-danger);
}

.auth-input.has-error:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

/* Password reveal */
.auth-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #8a97ad;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.auth-toggle:hover {
    background: #eef1f8;
    color: var(--auth-ink-2);
}

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

.auth-input-with-toggle {
    padding-right: 46px;
}

/* Field error */
.auth-field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--auth-danger);
    margin-top: -1px;
}

.auth-field-error i {
    margin-top: 2px;
    font-size: 11px;
}

/* Options row (remember / forgot) */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: -2px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #42536b;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-link {
    color: var(--auth-primary);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-link:hover {
    color: var(--auth-primary-deep);
    text-decoration: underline;
}

.auth-link:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Submit */
.auth-btn {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #004287 0%, #00356e 100%);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 14px 26px -13px rgba(79, 70, 229, 0.6);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
    margin-top: 4px;
}

.auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 17px 30px -13px rgba(79, 70, 229, 0.68);
}

.auth-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.auth-btn:disabled {
    opacity: 0.82;
    cursor: default;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: auth-spin 0.7s linear infinite;
    flex: 0 0 auto;
}

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

/* Note / info box (2FA helper) */
.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--auth-info-bg);
    border: 1px solid var(--auth-info-line);
    font-size: 13px;
    line-height: 1.55;
    color: #3b3a9e;
}

.auth-note i {
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: 14px;
    color: var(--auth-info);
}

/* Code input (2FA) */
.auth-code {
    height: 54px;
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    text-align: center;
    font-family: 'Inter', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Extra links under the form */
.auth-extra {
    margin-top: 30px;
    text-align: center;
    font-size: 14px;
    color: var(--auth-muted);
}

.auth-extra .auth-link {
    font-size: 14px;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--auth-muted);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 24px;
    transition: color 0.15s ease;
}

.auth-back:hover {
    color: var(--auth-primary);
}

.auth-back i {
    font-size: 11.5px;
}

/* Legal (only on small screens where the hero footer is hidden) */
.auth-legal {
    display: none;
}

/* ---------- Animations ---------- */
@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand,
    .auth-hero-copy,
    .auth-hero-foot,
    .auth-box {
        animation: none;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
    .auth-hero-inner {
        padding: 40px 44px 28px;
    }

    .auth-hero-copy {
        padding: 40px 0 28px;
    }
}

@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .auth-hero {
        background:
            radial-gradient(720px 300px at 8% -60%, rgba(56, 132, 255, 0.28), transparent 62%),
            radial-gradient(560px 260px at 100% 0%, rgba(56, 189, 248, 0.14), transparent 60%),
            linear-gradient(152deg, #071c38 0%, #0b2f5e 52%, #12509e 100%);
    }

    .auth-hero-inner {
        min-height: 0;
        padding: 20px 24px;
    }

    .auth-brand {
        animation: none;
    }

    .auth-hero-copy,
    .auth-hero-foot,
    .auth-hero::before {
        display: none;
    }

    .auth-panel {
        padding: 30px 20px 40px;
    }

    .auth-box {
        animation: none;
    }

    .auth-legal {
        display: block;
        margin: 22px 0 0;
        text-align: center;
        font-size: 12.5px;
        color: #94a3b8;
    }
}
