html,
body {
    min-height: 100%;
    height: auto;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-body {
    margin: 0;
    color: #191919;
    min-height: 100%;
    background: #f5f6fb;
    opacity: 1 !important;
    transform: none !important;
    font-family: "Roboto", "Inter", Arial, sans-serif;
    touch-action: pan-y;
}

.auth-body.page-transitioning {
    opacity: 0 !important;
    transform: translateY(-6px) !important;
    transition: opacity 180ms ease, transform 180ms ease !important;
}

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

.auth-body input,
.auth-body textarea,
.auth-body button {
    font: inherit;
}

.auth-body input,
.auth-body textarea {
    user-select: text;
}

.auth-screen {
    position: relative;
    min-height: 100dvh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    touch-action: pan-y;
}

.auth-screen::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #f5f6fb url("/assets/img/bg_light.png") center / cover no-repeat;
}

.auth-shell {
    width: min(100%, 430px);
    min-height: calc(100dvh - 36px);
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 8px 0 0;
    touch-action: pan-y;
}

.auth-shell[data-panel-open="true"] {
    min-height: auto;
}

.auth-brand {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-logo {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 15px;
}

.auth-logo img {
    width: 45px;
    height: 45px;
    display: block;
}

.auth-brand strong {
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
}

.auth-hero {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.auth-hero h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: 0;
}

.auth-hero p {
    margin: 0;
    color: rgb(105, 105, 120);
    font-size: 16px;
    line-height: 1.45;
}

.auth-choice {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

.auth-shell[data-panel-open="true"] .auth-choice {
    display: none;
}

.auth-choice-button {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 20px;
    color: rgb(40, 95, 244);
    background: rgb(230, 236, 251);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.auth-choice-button.is-active {
    color: #fff;
    background: rgb(40, 95, 244);
    box-shadow: 0 12px 20px rgba(40, 95, 244, 0.18);
}

.auth-choice-button:active {
    transform: scale(0.985);
}

.auth-panel {
    display: none;
    position: relative;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 24px rgba(20, 34, 68, 0.1);
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    animation: authPanelEnter 260ms ease forwards;
}

.auth-shell[data-panel-open="true"] .auth-panel {
    display: block;
}

.auth-panel[hidden] {
    display: none !important;
}

.auth-back {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    margin: 0 0 12px;
    background: rgb(230, 236, 251);
    cursor: pointer;
}

.auth-back::before {
    content: "";
    width: 12px;
    height: 12px;
    border-left: 2px solid rgb(40, 95, 244);
    border-bottom: 2px solid rgb(40, 95, 244);
    transform: translateX(2px) rotate(45deg);
}

.auth-shell.is-switching .auth-panel,
.auth-shell.is-switching .auth-choice {
    opacity: 0;
    transform: translateY(14px);
}

@keyframes authPanelEnter {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#loginForm,
#registerForm {
    display: grid;
    gap: 14px;
}

.auth-form[hidden] {
    display: none !important;
}

.form-group {
    display: grid;
    gap: 7px;
}

.form-group label,
.remember-row,
.auth-admin-hint {
    color: rgb(105, 105, 120);
    font-size: 14px;
    line-height: 1.35;
}

.form-group label {
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    border: 1px solid rgba(25, 25, 25, 0.14);
    border-radius: 16px;
    background: rgb(244, 245, 250);
    color: #191919;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.form-group input {
    min-height: 54px;
    padding: 0 14px;
}

.form-group textarea {
    min-height: 94px;
    padding: 14px;
    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(105, 105, 120, 0.86);
    font-weight: 500;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: rgba(40, 95, 244, 0.7);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(40, 95, 244, 0.12);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.password-toggle::before {
    content: "";
    width: 28px;
    height: 28px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23696978' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.password-toggle::after {
    display: none;
}

.password-toggle.is-visible::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23285ff4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.94 10.94 0 0 1 12 20c-6.5 0-10-8-10-8a21.8 21.8 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A10.94 10.94 0 0 1 12 4c6.5 0 10 8 10 8a21.8 21.8 0 0 1-4.12 5.19'/%3E%3Cpath d='M2 2l20 20'/%3E%3C/svg%3E");
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.remember-row input {
    width: 18px;
    height: 18px;
    accent-color: rgb(40, 95, 244);
}

.auth-submit {
    width: 100%;
    min-height: 56px;
    border: 0;
    border-radius: 20px;
    color: #fff !important;
    background: rgb(40, 95, 244) !important;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 20px rgba(40, 95, 244, 0.2);
    transition: transform 180ms ease, opacity 180ms ease;
}

.auth-submit:active {
    transform: scale(0.985);
}

.auth-submit:disabled {
    cursor: wait;
    opacity: 0.7;
}

.auth-admin-hint {
    margin: -2px 0 0;
    text-align: center;
}

.alert {
    display: none;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
}

.alert-success {
    color: #116531;
    background: #e6f7ed;
}

.alert-error {
    color: #a42525;
    background: #fde9e9;
}

.loading {
    display: none;
    text-align: center;
    color: rgb(105, 105, 120);
    font-size: 14px;
}

.loading p {
    margin: 8px 0 0;
}

.spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto;
    border: 3px solid rgba(40, 95, 244, 0.14);
    border-top-color: rgb(40, 95, 244);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

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

.auth-footer {
    display: grid;
    gap: 8px;
    margin-top: 0;
    padding-bottom: 2px;
}

.auth-shell[data-panel-open="true"] .auth-footer {
    margin-top: 4px;
}

.auth-logo-strip {
    min-height: 38px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
}

.auth-logo-strip img {
    max-width: 100%;
    max-height: 23px;
    margin: 0 auto;
    object-fit: contain;
}

.auth-footer p {
    margin: 0;
    color: rgb(105, 105, 120);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.full-screen-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(13, 20, 35, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.full-screen-overlay.visible {
    display: flex;
}

.overlay-content {
    width: min(100%, 430px);
    padding: 20px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(13, 20, 35, 0.22);
}

.overlay-content h2 {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.18;
    font-weight: 800;
    letter-spacing: 0;
}

.overlay-content p {
    margin: 0 0 14px;
    color: rgb(105, 105, 120);
    font-size: 14px;
    line-height: 1.45;
}

.token-display {
    position: relative;
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 12px 86px 12px 12px;
    border-radius: 14px;
    background: rgb(244, 245, 250);
    color: #191919;
    font-size: 14px;
    line-height: 1.35;
    word-break: break-all;
}

.token-display button {
    position: absolute;
    top: 8px;
    right: 8px;
    min-height: 36px;
    border: 0;
    border-radius: 11px;
    padding: 0 12px;
    color: rgb(40, 95, 244);
    background: rgb(230, 236, 251);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.countdown-message {
    min-height: 20px;
    margin-top: 12px !important;
    text-align: center;
}

.overlay-submit {
    margin-top: 2px;
}

@media (min-width: 720px) {
    .auth-screen {
        padding: 28px;
    }

    .auth-shell {
        min-height: calc(100dvh - 56px);
        padding: 18px 0;
    }

    .auth-shell[data-panel-open="true"] {
        min-height: auto;
    }
}

@media (max-width: 380px) {
    .auth-screen {
        padding-left: 14px;
        padding-right: 14px;
    }

    .auth-shell {
        gap: 18px;
    }

    .auth-hero h1 {
        font-size: 29px;
    }

    .auth-brand strong {
        font-size: 22px;
    }

    .auth-panel {
        padding: 14px;
    }
}

@media (max-height: 720px) {
    .auth-shell[data-panel-open="true"] .auth-footer {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-body *,
    .auth-body *::before,
    .auth-body *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0ms !important;
    }
}



