:root {
    --auth-primary: #a02317;
    --auth-primary-dark: #74170f;
    --auth-primary-soft: #f6e7e4;
    --auth-bg: #f5eee9;
    --auth-card: #fffdfb;
    --auth-ink: #171412;
    --auth-muted: #6f655f;
    --auth-line: #e8ddd7;
    --auth-focus: rgba(160, 35, 23, .2);
    --auth-danger: #b42318;
}

html.auth-page,
html.auth-page body {
    min-height: 100%;
}

html.auth-page body {
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-ink);
    font-family: 'Poppins', 'Trebuchet MS', sans-serif;
    letter-spacing: -.01em;
}

.body-sign {
    min-height: 100vh;
    background: transparent;
}

.auth-shell {
    width: 100vw;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 56px);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(135deg, #fbf8f6 0%, #f4ece6 100%);
}

body > .auth-shell,
.body-sign.auth-shell {
    left: 0;
    right: 0;
}

.auth-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    opacity: .9;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900'%3E%3Cpath fill='none' stroke='%23a0231718' stroke-width='2' d='M120 140c180-80 330 90 510 10s290-140 470-30 280 90 420-40'/%3E%3Cpath fill='%23a0231708' d='M-80 220c170-70 340 60 520-20s260-150 470-50 360 120 690-20v770H-80z'/%3E%3Cpath fill='%23a0231712' d='M-120 640c220-120 430 100 650 0s360-180 560-80 330 90 510-20v380H-120z'/%3E%3Cpath fill='none' stroke='%23a0231715' stroke-width='1.5' d='M180 760c180-140 420-40 620-130s320-170 560-90'/%3E%3C/svg%3E") center/cover no-repeat,
    linear-gradient(135deg, #fbf8f6 0%, #f4ece6 100%);
}

.auth-shell::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle at 12% 20%, rgba(160, 35, 23, .10), transparent 18%),
    radial-gradient(circle at 84% 18%, rgba(160, 35, 23, .08), transparent 22%),
    radial-gradient(circle at 24% 82%, rgba(160, 35, 23, .08), transparent 20%),
    radial-gradient(circle at 88% 78%, rgba(160, 35, 23, .08), transparent 22%);
}

.body-sign .center-sign,
.auth-main {
    width: min(100%, 520px);
    max-width: 520px;
    margin: 0 auto;
    padding: 0;
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin: 0 0 24px;
}

.auth-brand__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(300px, 70vw);
    min-height: 118px;
    padding: 20px 26px;
    border-radius: 28px;
    background: linear-gradient(135deg, #fef6f5 0%, #fffefe 100%);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.6),
    0 12px 32px rgba(160, 35, 23, 0.24);
    border: none;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.auth-brand__link:hover,
.auth-brand__link:focus {
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.8),
    0 20px 48px rgba(160, 35, 23, 0.32);
    transform: translateY(-2px);
}

.auth-brand__logo {
    display: block;
    width: 100%;
    height: auto;
}

.auth-panel {
    width: 100%;
}

.body-sign .card-sign.auth-card {
    margin: 0;
    border-radius: 36px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 40px 120px rgba(44, 31, 25, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    overflow: hidden;
    animation: auth-card-in 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.body-sign .card-sign.auth-card .card-body {
    padding: clamp(30px, 5vw, 48px);
    border: 0;
}

.auth-card__header {
    padding-bottom: 22px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--auth-line);
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--auth-primary);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.auth-title {
    margin: 0;
    color: var(--auth-ink);
    font-size: clamp(2rem, 4vw, 2.7rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.06em;
}

.auth-subtitle {
    margin: 10px 0 0;
    color: var(--auth-muted);
    font-size: .95rem;
    line-height: 1.55;
}

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

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

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

.auth-field label,
.auth-label {
    margin: 0;
    color: #302925;
    font-size: .86rem;
    font-weight: 700;
}

.auth-input {
    position: relative;
}

.auth-input .form-control {
    min-height: 56px;
    border: 1px solid var(--auth-line);
    border-radius: 18px !important;
    background: #fff;
    color: var(--auth-ink);
    font-size: 1rem;
    padding: .9rem 1.05rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
    transition: border-color .16s ease,
    box-shadow .16s ease,
    background-color .16s ease,
    transform .2s ease;
}

.auth-input .form-control:hover {
    border-color: #d9c8c0;
    background: #fff;
}


.auth-input .form-control:focus {
    border-color: var(--auth-primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--auth-focus),
    0 0 10px var(--auth-primary-soft);
    outline-offset: 2px;
}

.auth-input .form-control:-webkit-autofill,
.auth-input .form-control:-webkit-autofill:hover,
.auth-input .form-control:-webkit-autofill:focus,
.auth-input .form-control:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--auth-ink) !important;
    caret-color: var(--auth-ink);
    border-color: var(--auth-line);
    transition: background-color 99999s ease-in-out 0s;
}

.auth-input:focus-within .form-control:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #fff inset, 0 0 0 4px var(--auth-focus) !important;
    box-shadow: 0 0 0 1000px #fff inset, 0 0 0 4px var(--auth-focus) !important;
    border-color: var(--auth-primary);
}

.auth-input .form-control:-moz-autofill {
    box-shadow: 0 0 0 1000px #fff inset;
    -moz-text-fill-color: var(--auth-ink);
}

.auth-input--password .form-control {
    padding-right: 3.85rem;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a7e76;
    font-size: 1.35rem;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus {
    background: var(--auth-primary-soft);
    color: var(--auth-primary);
}

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

.auth-check {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--auth-muted);
    font-size: .92rem;
}

.auth-check .form-check-input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    border-color: #d8c7bd;
}

.auth-check .form-check-input:checked {
    background-color: var(--auth-primary);
    border-color: var(--auth-primary);
}

.auth-check .form-check-input:focus {
    box-shadow: 0 0 0 4px var(--auth-focus);
}

.auth-actions,
.auth-actions--split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
}

.auth-actions .btn,
.auth-button {
    min-height: 50px;
    border-radius: 999px;
    padding: .8rem 1.35rem;
    font-size: .94rem;
    font-weight: 700;
}

.auth-actions .btn-primary,
.auth-button.btn-primary {
    border-color: #a02317 #a02317 #74170f;
    background: #a02317;
    color: #fff;
    box-shadow: none;
}

.auth-actions .btn-primary:hover,
.auth-actions .btn-primary:focus,
.auth-button.btn-primary:hover,
.auth-button.btn-primary:focus {
    border-color: #74170f #74170f #5a120a;
    background: #74170f;
    box-shadow: 0 0 0 3px var(--auth-focus);
}

.auth-actions .btn-primary:active,
.auth-button.btn-primary:active {
    border-color: #5a120a #5a120a #3d0b06 !important;
    background: #5a120a !important;
    box-shadow: none;
}

.auth-link {
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
    text-underline-offset: 4px;
}

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

.auth-alert {
    border-radius: 18px;
    border: 1px solid rgba(160, 35, 23, .14);
    margin-bottom: 18px;
}

.auth-card .error {
    color: var(--auth-danger);
    font-size: .82rem;
    font-weight: 700;
    margin-top: 4px;
}

.auth-footer {
    margin: 24px 0 0;
    color: #8a7e76;
    font-size: .86rem;
    text-align: center;
    animation: auth-fade-up 1s ease forwards;
    opacity: 0;
    transform: translateY(12px);
}

@keyframes auth-fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-card-in {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .body-sign .card-sign.auth-card {
        animation: none !important;
    }

    .auth-footer {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (min-width: 1200px) {
    .body-sign .center-sign,
    .auth-main {
        width: min(100%, 560px);
        max-width: 560px;
    }

    .auth-brand__link {
        width: 320px;
        min-height: 126px;
    }
}

@media (max-width: 767.98px) {
    .auth-shell {
        align-items: flex-start;
        padding: 26px 18px 36px;
    }

    .auth-brand {
        margin-bottom: 20px;
    }

    .auth-brand__link {
        min-height: 92px;
        width: min(240px, 68vw);
        padding: 16px 22px;
        border-radius: 24px;
    }

    .body-sign .card-sign.auth-card {
        border-radius: 26px;
    }

    .body-sign .card-sign.auth-card .card-body {
        padding: 28px 22px;
    }

    .auth-actions,
    .auth-actions--split {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .auth-actions .btn,
    .auth-actions .auth-link {
        width: 100%;
        text-align: center;
    }
}
