* { box-sizing: border-box; }

:root {
    color-scheme: light;
    --navy: #0a1c50;
    --blue: #0060d5;
}

html { min-height: 100%; }

body.login-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    color: var(--navy);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-weight: 400;
    background: #123455 url('../../img/login-background-wide.png') left center / cover no-repeat;
}

.corner-ribbon {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20%;
    height: 24%;
    z-index: -1;
    background: #008843;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    pointer-events: none;
}

.corner-ribbon::after {
    content: '';
    position: absolute;
    inset: 23% 0 0 18%;
    background: #003779;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.login-main {
    width: 100%;
    flex: 1;
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 64px 5.5% 24px;
}

.login-panel {
    width: 400px;
    max-width: 100%;
    padding: 28px;
    border: 1px solid rgba(227, 232, 239, .9);
    border-radius: 14px;
    background: rgba(252, 253, 255, .97);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(14, 37, 71, .16);
}

h1 {
    margin: 0;
    text-align: center;
    font-size: 26px;
    line-height: 1.25;
    font-weight: 500;
    letter-spacing: -.4px;
}

.login-intro {
    margin: 10px 0 24px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5e78;
}

.form-field { position: relative; margin-bottom: 14px; }

.form-field input {
    width: 100%;
    height: 48px;
    border: 1px solid #d3dbe7;
    border-radius: 7px;
    background: rgba(255, 255, 255, .78);
    color: var(--navy);
    padding: 0 48px 0 43px;
    font: inherit;
    font-size: 15px;
    box-shadow: inset 0 0 0 1px rgba(218, 226, 238, .15);
}

.form-field input::placeholder { color: #506b8f; opacity: 1; }
#username { padding-right: 14px; }

.field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    width: 18px;
    color: #365472;
    text-align: center;
    pointer-events: none;
}

.toggle-password {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #506b8f;
    font-size: 17px;
    cursor: pointer;
}

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 7px;
    background: linear-gradient(115deg, #0065d9, #0056ca);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.login-button:hover { background: #004fbb; box-shadow: 0 4px 12px #0056ca30; }
.login-button:disabled { cursor: wait; }
.login-button i { font-size: 16px; }

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 17px;
    font-size: 12px;
    line-height: 1.5;
}

.remember-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.remember-label input {
    appearance: none;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid #6c8098;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.remember-label input:checked {
    background: var(--blue);
    border-color: var(--blue);
}

.remember-label input:checked::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    margin: 1px 0 0 5px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

a { color: #0065b7; text-underline-offset: 2px; }
a:hover { color: #004584; }
.return-link { color: #fff; font-size: 15px; }
.return-link:hover { color: #fff; }
.recovery-intro { margin: 18px 0 24px; }
.setup-panel .form-field input { padding-right: 12px; }
.setup-hint { margin: -5px 0 14px; font-size: 12px; color: #71849b; }
.setup-preview { display: block; margin-top: 18px; text-align: center; font-size: 12px; }

:focus-visible { outline: 3px solid #1483e8; outline-offset: 4px; }
.form-field input:focus-visible { outline-offset: 1px; }

.form-message {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 20;
    width: max-content;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #efc6c6;
    border-left: 3px solid #c83d3d;
    border-radius: 7px;
    background: #fff8f8;
    color: #7a1f1f;
    box-shadow: 0 7px 22px rgba(21, 35, 57, .16);
    font-size: 13px;
    line-height: 1.5;
    transform: translateX(-50%);
}

.login-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-top: auto;
    padding: 20px 4% 22px;
    color: #fff;
    text-shadow: 0 1px 3px #102a46;
}

.benefits {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: 46%;
    max-width: 580px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.benefits li { text-align: center; }
.benefits i { display: block; margin: 0 0 9px; font-size: 24px; line-height: 1; }
.benefits .fa-truck, .benefits .fa-users { font-size: 27px; }
.benefits span { display: block; font-size: 12px; font-weight: 400; text-transform: uppercase; line-height: 1.5; }

.footer-details { display: flex; align-items: center; gap: 18px; padding-bottom: 3px; font-size: 12px; line-height: 1.5; }
.version { white-space: nowrap; }
.footer-motto { padding-left: 18px; border-left: 1px solid #c4d3e4; white-space: nowrap; }
.country-flag { width: 42px; height: 33px; object-fit: cover; flex-shrink: 0; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (orientation: portrait) {
    body.login-page { background-image: url('../../img/login-background.png'); }
}

@media (max-width: 1100px) {
    .login-main { padding-right: 4%; }
    .login-footer { gap: 24px; }
    .benefits { width: 50%; }
    .footer-details { gap: 12px; }
    .footer-motto { padding-left: 12px; }
}

@media (max-width: 760px) {
    body.login-page { background-position: 32% top; background-size: auto 100svh; }
    .login-main { min-height: auto; flex: 1; justify-content: center; padding: clamp(90px, 16svh, 150px) 20px 36px; }
    .login-panel { width: 100%; max-width: 380px; padding: 26px 22px; }
    h1 { font-size: 24px; }
    .form-field input { font-size: 16px; }
    .login-options { flex-wrap: wrap; row-gap: 12px; }
    .login-footer { flex-direction: column; align-items: center; gap: 24px; padding: 20px 20px 24px; background: linear-gradient(transparent, #092851b3); }
    .benefits { width: 100%; max-width: 500px; gap: 12px; }
    .footer-details { flex-wrap: wrap; justify-content: center; }
    .corner-ribbon { width: 45%; height: 20%; }
}

@media (max-width: 480px) {
    .benefits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 15px; }
}

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