:root {
    color-scheme:light;
    --page:#f0f3ef;
    --surface:#fff;
    --text:#182c25;
    --muted:#69786f;
    --border:#e2e8e3;
    --field:#fafcf9;
    --accent:#187a54;
    --accent-hover:#126442;
    --accent-soft:#eaf5ed;
    --focus:rgba(24,122,84,.15);
}

html[data-theme=dark] {
    color-scheme:dark;
    --page:#101b17;
    --surface:#18251f;
    --text:#edf4ef;
    --muted:#a2b2a8;
    --border:#324339;
    --field:#1c2c24;
    --accent:#87deb0;
    --accent-hover:#a1e9c1;
    --accent-soft:#263e30;
    --focus:rgba(135,222,176,.16);
}

* {
    box-sizing:border-box;
}

body {
    margin:0;
    font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    color:var(--text);
    background:var(--page);
}

button,input {
    font:inherit;
}

button,a,input {
    -webkit-tap-highlight-color:transparent;
}

button {
    cursor:pointer;
}

svg {
    width:24px;
    height:24px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.6;
    stroke-linecap:round;
    stroke-linejoin:round;
}

button:focus-visible,a:focus-visible {
    outline:3px solid var(--accent);
    outline-offset:4px;
}

.login-page {
    min-height:100svh;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:40px 28px 24px;
    background-image:radial-gradient(ellipse at 12% 5%,rgba(130,176,147,.1),transparent 55%);
}

.auth-shell {
    display:grid;
    grid-template-columns:1fr 1.08fr;
    width:min(1120px,100%);
    min-height:690px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:28px;
    overflow:hidden;
    box-shadow:0 24px 80px -40px rgba(22,49,35,.3);
    animation:arrive .6s ease-out both;
}

.auth-story {
    position:relative;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    margin:10px;
    border-radius:20px;
    padding:38px;
    color:#f1f5f2;
    background:#203b31;
    isolation:isolate;
}

.auth-story::before {
    content:"";
    position:absolute;
    inset:0;
    z-index:-2;
    background:url('./architecture.jpg') 64% center / cover no-repeat;
    filter:saturate(.55);
}

.auth-story::after {
    content:"";
    position:absolute;
    inset:0;
    z-index:-1;
    background:linear-gradient(180deg,rgba(12,34,27,.5),rgba(12,34,27,.08) 35%,rgba(12,34,27,.78) 72%,#102c23 100%);
}

.story-identity {
    flex:1;
    display:flex;
    flex-direction:column;
    justify-content:flex-end;
    align-items:flex-start;
    padding:150px 0 34px;
}

.story-logo {
    width:142px;
    height:auto;
    flex-shrink:0;
}

.story-identity h1 {
    margin:0;
    font-size:48px;
    line-height:1.12;
    font-weight:500;
    letter-spacing:-1.8px;
    color:#fff;
}

.story-identity p {
    margin:18px 0 0;
    font-size:14px;
    line-height:1.6;
    color:#d3e0d9;
}

.story-bottom {
    padding-top:22px;
    border-top:1px solid #ffffff20;
    color:#96aaa0;
    font-size:10px;
    letter-spacing:.4px;
}

.auth-form-panel {
    display:flex;
    flex-direction:column;
    padding:30px 42px 28px;
}

.panel-top {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
}

.panel-label {
    font-size:9px;
    font-weight:600;
    letter-spacing:2px;
    color:var(--muted);
}

.theme-switch {
    display:grid;
    place-items:center;
    width:36px;
    height:36px;
    border:1px solid var(--border);
    border-radius:50%;
    background:var(--surface);
    color:var(--muted);
    transition:background .2s,color .2s;
}

.theme-switch:hover {
    background:var(--accent-soft);
    color:var(--accent);
}

.theme-switch svg {
    width:17px;
    height:17px;
}

.theme-sun {
    display:none;
}

html[data-theme=dark] .theme-sun {
    display:block;
}

html[data-theme=dark] .theme-moon {
    display:none;
}

.form-content {
    width:100%;
    max-width:365px;
    margin:auto;
    padding:35px 0;
}

.welcome-icon {
    display:grid;
    place-items:center;
    width:46px;
    height:46px;
    margin-bottom:24px;
    background:var(--accent-soft);
    border:1px solid var(--border);
    color:var(--accent);
    border-radius:14px;
}

.welcome-icon svg {
    width:22px;
    height:22px;
}

.form-content h2 {
    margin:0;
    font-size:32px;
    letter-spacing:-1.2px;
    line-height:1.2;
    font-weight:620;
}

.form-intro {
    margin:12px 0 31px;
    font-size:13px;
    line-height:1.7;
    color:var(--muted);
}

.form-field {
    margin-bottom:20px;
}

.form-field>label {
    display:block;
    margin-bottom:9px;
    font-size:12px;
    font-weight:600;
    color:var(--text);
}

.field-wrap {
    display:flex;
    align-items:center;
    height:51px;
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--field);
    transition:border-color .2s,box-shadow .2s;
}

.field-wrap:focus-within {
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--focus);
}

.field-icon {
    flex:0 0 18px;
    width:18px;
    height:18px;
    margin-left:15px;
    color:var(--muted);
}

.field-wrap input {
    min-width:0;
    width:100%;
    height:100%;
    padding:0 12px;
    border:0;
    border-radius:10px;
    background:transparent;
    color:var(--text);
    outline:none;
    font-size:13px;
}

.field-wrap input::placeholder {
    color:var(--muted);
    opacity:.8;
}

.field-wrap input:-webkit-autofill {
    -webkit-text-fill-color:var(--text);
    box-shadow:0 0 0 1000px var(--field) inset;
}

.toggle-password {
    display:grid;
    place-items:center;
    flex:0 0 42px;
    height:44px;
    margin-right:3px;
    border:0;
    border-radius:8px;
    background:transparent;
    color:var(--muted);
}

.toggle-password:hover {
    color:var(--accent);
}

.toggle-password svg {
    width:18px;
    height:18px;
}

.eye-slash {
    display:none;
}

.toggle-password[aria-pressed=true] .eye-slash {
    display:block;
}

.field-wrap.has-error {
    border-color:#c75353;
}

.field-error {
    font-size:12px;
    color:#c75353;
    margin:8px 0 0;
    line-height:1.5;
}

.form-options {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin:4px 0 27px;
    font-size:11px;
}

.remember-option {
    display:flex;
    align-items:center;
    gap:8px;
    cursor:pointer;
    color:var(--muted);
}

.remember-option input {
    width:15px;
    height:15px;
    margin:0;
    accent-color:var(--accent);
    cursor:pointer;
}

.forgot-link {
    color:var(--accent);
    font-weight:650;
    text-decoration:none;
}

.forgot-link:hover {
    text-decoration:underline;
    text-underline-offset:4px;
}

.auth-back-link {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:9px;
    margin-top:24px;
    color:var(--accent);
    font-size:12px;
    font-weight:600;
    text-decoration:none;
}

.auth-back-link svg {
    width:16px;
    height:16px;
}

.auth-back-link:hover {
    text-decoration:underline;
    text-underline-offset:4px;
}

.btn-login {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
    width:100%;
    height:51px;
    padding:0 22px;
    border:1px solid transparent;
    border-radius:10px;
    background:var(--accent);
    color:#fff;
    box-shadow:0 5px 12px #187a5418;
    font-size:13px;
    font-weight:600;
    transition:background .2s,transform .2s;
}

.btn-login:hover {
    background:var(--accent-hover);
    transform:translateY(-1px);
}

.button-arrow {
    width:18px;
    height:18px;
}

.btn-login:disabled {
    cursor:wait;
    opacity:.8;
    transform:none;
}

html[data-theme=dark] .btn-login {
    color:#123025;
}

.button-spinner {
    display:none;
    width:17px;
    height:17px;
    border:2px solid currentColor;
    border-right-color:transparent;
    border-radius:50%;
    animation:spin .7s linear infinite;
}

.is-submitting .button-spinner {
    display:block;
}

.is-submitting .button-arrow {
    display:none;
}

.login-note {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    margin-top:27px;
    padding-top:23px;
    border-top:1px solid var(--border);
    font-size:10px;
    color:var(--muted);
}

.login-note svg {
    width:14px;
    height:14px;
    flex-shrink:0;
}

.panel-bottom {
    display:flex;
    justify-content:space-between;
    gap:14px;
    color:var(--muted);
    font-size:9px;
    letter-spacing:.3px;
}

.panel-bottom>span:first-child {
    font-weight:650;
    letter-spacing:1px;
}

.login-powered-by {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:9px;
    margin-top:22px;
    color:var(--muted);
    font-size:10px;
}

.login-powered-by a {
    display:flex;
    padding:4px;
}

.login-powered-by-logo {
    width:77px;
    height:auto;
    opacity:.65;
}

html[data-theme=dark] .login-powered-by-logo {
    filter:brightness(0) invert(1);
    opacity:.65;
}

@keyframes arrive {
    from {
        opacity:0;
        transform:translateY(12px);
    }
    to {
        opacity:1;
        transform:translateY(0);
    }
}

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

@media(min-width:1500px) {
    .auth-shell {
        min-height:730px;
    }
}

@media(max-width:960px) {
    .login-page {
        padding:24px 20px 18px;
    }
    .auth-shell {
        grid-template-columns:.95fr 1fr;
        min-height:650px;
    }
    .auth-story {
        padding:30px;
    }
    .auth-form-panel {
        padding:25px 28px;
    }
    .story-identity p {
        font-size:13px;
    }
}

@media(max-width:720px) {
    .login-page {
        padding:16px 16px 20px;
        justify-content:flex-start;
    }
    .auth-shell {
        display:flex;
        flex-direction:column;
        max-width:470px;
        min-height:0;
        border-radius:23px;
    }
    .auth-story {
        margin:7px;
        padding:28px 24px;
        border-radius:17px;
    }
    .story-logo {
        width:125px;
    }
    .story-bottom {
        display:none;
    }
    .story-identity {
        padding:50px 0 0;
    }
    .story-identity h1 {
        font-size:28px;
        letter-spacing:-.7px;
    }
    .story-identity h1 br {
        display:none;
    }
    .story-identity p {
        margin:15px 0 0;
        font-size:12px;
    }
    .auth-form-panel {
        padding:14px 25px 25px;
    }
    .panel-label {
        font-size:8px;
    }
    .form-content {
        padding:23px 0 30px;
    }
    .welcome-icon {
        display:none;
    }
    .form-content h2 {
        font-size:28px;
    }
    .form-intro {
        font-size:12px;
        margin:10px 0 27px;
    }
    .field-wrap input {
        font-size:16px;
    }
    .form-options {
        font-size:11px;
    }
    .login-note {
        font-size:9px;
    }
    .panel-bottom {
        font-size:8px;
    }
    .login-powered-by {
        margin-top:14px;
    }
}

@media(prefers-reduced-motion:reduce) {
    *,*::before,*::after {
        animation:none!important;
        transition:none!important;
    }
}

/* MFA uses the same surfaces and controls as the login form. */
.core-otp-row { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; }
.core-otp-input { min-width:0; width:100%; height:51px; border:1px solid var(--border); border-radius:10px; background:var(--field); color:var(--text); text-align:center; font-size:22px; outline:none; }
.core-otp-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--focus); }
.mfa-select-wrap select { width:100%; height:100%; padding:0 12px; border:0; border-radius:10px; background:var(--field); color:var(--text); font:inherit; font-size:13px; cursor:pointer; }
.mfa-secondary-actions { display:flex; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-top:24px; font-size:12px; }
.mfa-secondary-actions button { padding:0; border:0; background:none; }
[data-auth-page="mfa"] [hidden] { display:none!important; }
