:root {
    --ink: #333540;
    --ink-strong: #23252e;
    --ink-muted: #525566;
    --ink-soft: #898a8f;
    --line: #5d6070;
    --line-soft: #d9dae0;
    --brand: #d71d22;
    --error: #bd0b0b;
    --success: #00872d;
    --panel-solid: clamp(520px, 29vw, 580px);
    --panel-fade: clamp(940px, 66vw, 1240px);
    --fade-span: calc(var(--panel-fade) - var(--panel-solid));
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.auth-body {
    min-height: 100vh;
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

.auth {
    position: relative;
    min-height: 100vh;
    background: #0b1f4d url('../images/BG-ARCOTECH-WEB.png') right center / cover no-repeat;
}

/* Progressive blur: strongest at the panel edge, gone before the tower. */
.auth::before,
.auth::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.auth::before {
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    -webkit-mask-image: var(--blur-mask);
    mask-image: var(--blur-mask);
    --blur-mask: linear-gradient(90deg,
        #000 var(--panel-solid),
        rgba(0, 0, 0, .97) calc(var(--panel-solid) + var(--fade-span) * .15),
        rgba(0, 0, 0, .86) calc(var(--panel-solid) + var(--fade-span) * .3),
        rgba(0, 0, 0, .66) calc(var(--panel-solid) + var(--fade-span) * .45),
        rgba(0, 0, 0, .42) calc(var(--panel-solid) + var(--fade-span) * .6),
        rgba(0, 0, 0, .2)  calc(var(--panel-solid) + var(--fade-span) * .75),
        rgba(0, 0, 0, .06) calc(var(--panel-solid) + var(--fade-span) * .9),
        transparent calc(var(--panel-fade) + var(--fade-span) * .1));
}
/* Smootherstep falloff: no hard onset where the solid white ends. */
.auth::after {
    background: linear-gradient(90deg,
        #fff 0,
        #fff var(--panel-solid),
        rgba(255, 255, 255, .991) calc(var(--panel-solid) + var(--fade-span) * .1),
        rgba(255, 255, 255, .942) calc(var(--panel-solid) + var(--fade-span) * .2),
        rgba(255, 255, 255, .837) calc(var(--panel-solid) + var(--fade-span) * .3),
        rgba(255, 255, 255, .683) calc(var(--panel-solid) + var(--fade-span) * .4),
        rgba(255, 255, 255, .5)   calc(var(--panel-solid) + var(--fade-span) * .5),
        rgba(255, 255, 255, .317) calc(var(--panel-solid) + var(--fade-span) * .6),
        rgba(255, 255, 255, .163) calc(var(--panel-solid) + var(--fade-span) * .7),
        rgba(255, 255, 255, .058) calc(var(--panel-solid) + var(--fade-span) * .8),
        rgba(255, 255, 255, .009) calc(var(--panel-solid) + var(--fade-span) * .9),
        rgba(255, 255, 255, 0)    var(--panel-fade));
}

.auth-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: calc(412px + 2 * clamp(24px, 6vw, 104px));
    min-height: 100vh;
    padding: 36px clamp(24px, 6vw, 104px);
    display: flex;
    flex-direction: column;
}

.auth-logo { display: inline-block; align-self: flex-start; line-height: 0; }
.auth-logo img {
    width: clamp(140px, 11vw, 200px);
    height: auto;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .18));
}

.auth-content { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 0 24px; }

.auth-title { margin: 0; font-size: 32px; font-weight: 800; line-height: 1.2; color: var(--ink-strong); }
.auth-subtitle { margin: 8px 0 32px; font-size: 18px; color: var(--ink-muted); }

.auth-field { margin-bottom: 18px; }
.auth-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink-strong); }

.auth-input-wrap { position: relative; }
.auth-input {
    width: 100%;
    height: 44px;
    padding: 0 20px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-input::placeholder { color: var(--ink-soft); }
.auth-input:focus { border-color: var(--ink-strong); box-shadow: 0 0 0 3px rgba(51, 53, 64, .15); }
.auth-input.has-toggle { padding-right: 52px; }
.auth-input.is-invalid { border-color: var(--error); }
.auth-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(189, 11, 11, .15); }

.auth-toggle {
    position: absolute;
    top: 0; right: 6px;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    padding: 0;
    background: none; border: 0; border-radius: 999px;
    color: var(--ink-strong);
    cursor: pointer;
}
.auth-toggle svg { width: 22px; height: 22px; }
.auth-toggle .icon-hide { display: none; }
.auth-toggle[aria-pressed="true"] .icon-show { display: none; }
.auth-toggle[aria-pressed="true"] .icon-hide { display: block; }

.auth-error { margin: 6px 0 0 20px; font-size: 13px; color: var(--error); }

.auth-alert {
    margin-bottom: 20px;
    padding: 12px 18px;
    font-size: 14px;
    color: var(--success);
    background: #e8f6ed;
    border: 1px solid #bfe5cc;
    border-radius: 16px;
}
.auth-note { margin: -16px 0 24px; font-size: 14px; color: var(--ink-muted); }

.auth-check {
    display: inline-flex; align-items: center; gap: 10px;
    margin: -6px 0 24px;
    font-size: 14px; color: var(--ink);
    cursor: pointer;
}
.auth-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink-strong); cursor: pointer; }

.auth-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%;
    height: 44px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--ink);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.auth-btn:hover { background: var(--ink-strong); }
.auth-btn:active { transform: translateY(1px); }

.auth-btn-outline {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px;
    padding: 0 16px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-strong);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s;
}
.auth-btn-outline:hover { background: #f2f2f5; }

.auth-link {
    display: block;
    margin: 20px auto 0;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: var(--ink-strong);
    text-decoration: underline;
    text-underline-offset: 2px;
    background: none; border: 0;
    cursor: pointer;
}
.auth-link:hover { color: var(--brand); }

.auth-divider { height: 1px; margin: 40px 0 32px; background: var(--line-soft); border: 0; }

.auth-cta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; font-size: 15px; color: var(--ink-strong); }
.auth-cta .auth-btn-outline { padding: 0 14px; }

.auth-btn:focus-visible, .auth-btn-outline:focus-visible, .auth-link:focus-visible, .auth-toggle:focus-visible, .auth-logo:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .auth {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .7) 140px, #fff 240px),
            url('../images/BG-ARCOTECH-WEB.png') center top / auto 280px no-repeat,
            #fff;
    }
    .auth::before, .auth::after { display: none; }
    .auth-panel { max-width: 460px; margin: 0 auto; padding: 120px 16px 28px; }
    .auth-logo { align-self: center; }
    .auth-logo img { width: 120px; }
    .auth-content { justify-content: flex-start; padding-top: 24px; }
    .auth-title, .auth-subtitle { text-align: center; }
    .auth-title { font-size: 26px; }
    .auth-subtitle { font-size: 16px; margin-bottom: 24px; }
    .auth-note { text-align: center; }
    .auth-divider { margin: 32px 0 24px; }
    .auth-cta { font-size: 15px; }
}
