/* Login page redesign. Global legacy login rules are overridden here. */

.login-page {
    --login-green: #234f38;
    --login-green-dark: #16291e;
    --login-gold: #b79a4e;
    --login-blue: #426f86;
    --login-ink: #17221b;
    --login-muted: #657166;
    --login-line: rgba(35, 79, 56, 0.14);
    --login-soft: #f5f8f6;
    width: min(1180px, calc(100% - 32px));
    min-height: calc(100vh - 118px);
    display: flex;
    align-items: center;
    margin: 0 auto;
    padding: 2rem 0 3rem;
    color: var(--login-ink);
}

footer {
    background: #eef2f5;
    border-top: 1px solid rgba(35, 79, 56, 0.08);
}

.login-shell {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
    gap: 1rem;
    align-items: stretch;
}

.login-intro-panel,
.login-card {
    border: 1px solid var(--login-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 38px rgba(23, 34, 27, 0.06);
}

.login-intro-panel {
    position: relative;
    overflow: hidden;
    min-height: 34rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.35rem;
    background:
        linear-gradient(135deg, rgba(35, 79, 56, 0.08), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #f8faf7 100%);
}

.login-intro-panel::after {
    content: "";
    position: absolute;
    inset: auto 1.35rem 1.35rem;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--login-green), var(--login-gold), var(--login-blue));
}

.login-brand-link {
    width: fit-content;
    display: inline-grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    color: var(--login-ink);
    text-decoration: none;
}

.login-brand-link:hover,
.login-brand-link:focus {
    color: var(--login-green-dark);
}

.login-brand-mark,
.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.login-brand-mark {
    width: 2.75rem;
    height: 2.75rem;
    color: #ffffff;
    background: var(--login-green);
}

.login-brand-link strong,
.login-brand-link small {
    display: block;
    line-height: 1.05;
}

.login-brand-link strong {
    color: var(--login-green);
    font-size: 1.25rem;
    font-weight: 900;
}

.login-brand-link small {
    margin-top: 0.15rem;
    color: var(--login-muted);
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0;
}

.login-intro-copy {
    max-width: 38rem;
    align-self: center;
    text-align: center;
}

.login-eyebrow {
    display: block;
    color: var(--login-gold);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.login-intro-copy h1 {
    margin: 0.55rem 0 0.75rem;
    color: var(--login-ink);
    font-size: clamp(2.45rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: 0;
}

.login-intro-copy p {
    max-width: 35rem;
    margin: 0 auto;
    color: var(--login-muted);
    font-size: 1rem;
    line-height: 1.65;
}

.login-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.login-status-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.58rem;
    row-gap: 0.15rem;
    align-items: center;
    align-content: center;
    min-height: 5.15rem;
    padding: 0.8rem;
    border: 1px solid rgba(35, 79, 56, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
}

.login-status-item i {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-row: span 2;
    align-self: center;
    border-radius: 8px;
    color: var(--login-green);
    background: #eaf2ed;
}

.login-status-item:nth-child(2) i {
    color: var(--login-blue);
    background: #edf4f7;
}

.login-status-item:nth-child(3) i {
    color: #765f19;
    background: rgba(183, 154, 78, 0.16);
}

.login-status-item span,
.login-status-item strong {
    display: block;
    min-width: 0;
}

.login-status-item span {
    align-self: end;
    color: var(--login-muted);
    font-size: 0.75rem;
    font-weight: 850;
    line-height: 1;
    text-transform: uppercase;
}

.login-status-item strong {
    align-self: start;
    color: var(--login-green-dark);
    font-size: 0.86rem;
    font-weight: 900;
    line-height: 1.18;
}

.login-status-item:nth-child(2) strong {
    white-space: nowrap;
}

.login-card {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 0;
    padding: 1.15rem;
    text-align: left;
    backdrop-filter: none;
}

.login-card-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.8rem;
    align-items: center;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid var(--login-line);
}

.login-icon {
    width: 2.85rem;
    height: 2.85rem;
    margin: 0;
    color: var(--login-green);
    background: #eaf2ed;
    font-size: 1.05rem;
}

.login-title {
    margin: 0;
    color: var(--login-ink);
    font-size: 1.25rem;
    font-weight: 900;
}

.login-subtitle {
    margin: 0.25rem 0 0;
    color: var(--login-muted);
    font-size: 0.96rem;
    line-height: 1.45;
}

.btn-login,
.temp-key-button,
.login-card .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.48rem;
    min-height: 2.75rem;
    border-radius: 8px;
    font-weight: 850;
    line-height: 1.1;
    letter-spacing: 0;
    white-space: nowrap;
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.72rem 1rem;
    border: 1px solid var(--login-green);
    color: #ffffff;
    background: var(--login-green);
}

.login-card .btn-primary:hover,
.login-card .btn-primary:focus {
    border-color: var(--login-green-dark);
    color: #ffffff;
    background: var(--login-green-dark);
}

.login-card .btn-outline-secondary {
    border-color: rgba(35, 79, 56, 0.22);
    color: var(--login-green);
    background: #ffffff;
}

.login-card .btn-outline-secondary:hover,
.login-card .btn-outline-secondary:focus {
    border-color: rgba(35, 79, 56, 0.36);
    color: var(--login-green-dark);
    background: var(--login-soft);
}

.btn-login,
.login-card .temp-key-button {
    position: relative;
    width: 100%;
    max-width: none;
    min-height: 3.18rem;
    justify-content: flex-start;
    gap: 0.7rem;
    margin: 0;
    padding: 0.55rem 3rem 0.55rem 0.55rem;
    text-align: left;
    white-space: normal;
    box-shadow: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.btn-login {
    border: 1px solid rgba(35, 79, 56, 0.2);
    color: var(--login-green-dark);
    background: #ffffff;
}

.btn-login > i,
.login-card .temp-key-button > i {
    width: 2.08rem;
    height: 2.08rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
    color: #ffffff;
    background: var(--login-green);
}

.btn-login > span,
.login-card .temp-key-button > span {
    min-width: 0;
    color: inherit;
    font-size: 0.96rem;
    font-weight: 850;
    line-height: 1.2;
}

.btn-login::after,
.login-card .temp-key-button::after {
    content: "\f061";
    position: absolute;
    top: 50%;
    right: 0.95rem;
    transform: translateY(-50%);
    color: currentColor;
    font-family: "Font Awesome 6 Free";
    font-size: 0.78rem;
    font-weight: 900;
    opacity: 0.58;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-login:hover,
.btn-login:focus {
    color: var(--login-green-dark);
    background: var(--login-soft);
    border-color: rgba(35, 79, 56, 0.36);
    transform: translateY(-1px);
    filter: none;
    box-shadow: none;
}

.btn-login:hover > i,
.btn-login:focus > i {
    background: var(--login-green-dark);
}

.btn-login:hover::after,
.btn-login:focus::after,
.login-card .temp-key-button:hover::after,
.login-card .temp-key-button:focus::after {
    opacity: 0.9;
    transform: translate(0.15rem, -50%);
}

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

.btn-login:disabled::after {
    opacity: 0;
}

.login-card .temp-key-button {
    border-color: rgba(183, 154, 78, 0.28);
    color: #6f5a1d;
    background: #fffaf0;
}

.login-card .temp-key-button > i {
    color: #725d20;
    background: rgba(183, 154, 78, 0.18);
}

.login-card .temp-key-button:hover,
.login-card .temp-key-button:focus {
    border-color: rgba(183, 154, 78, 0.44);
    color: #5d4913;
    background: #fff6dc;
}

.auth-link-hidden,
.is-hidden {
    display: none;
}

.is-visible {
    display: block;
}

.qr-auth-panel {
    display: grid;
    gap: 0.9rem;
}

.qr-auth-copy {
    display: grid;
    gap: 0.35rem;
}

.qr-auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--login-blue);
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
}

.qr-auth-kicker i {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #edf4f7;
}

.qr-auth-copy strong {
    color: var(--login-green-dark);
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.2;
}

.qr-auth-copy p {
    margin: 0;
    color: var(--login-muted);
    line-height: 1.5;
}

.qr-auth-fallback:empty {
    display: none;
}

.qr-auth-frame {
    width: min(100%, 14rem);
    margin: 0 auto;
    padding: 0.75rem;
    border: 1px solid rgba(35, 79, 56, 0.14);
    border-radius: 8px;
    background: #ffffff;
}

.telegram-qr {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    color: var(--login-muted);
    font-weight: 850;
    text-align: center;
}

.telegram-qr svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.qr-auth-loading {
    max-width: 9rem;
    line-height: 1.35;
}

.auth-link {
    margin: 0;
    padding: 0.9rem;
    border: 1px solid rgba(66, 111, 134, 0.22);
    border-radius: 8px;
    background: #f4f8fa;
}

#tempAccessAccordion {
    margin-top: -0.25rem;
}

.login-choice-divider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    margin: 0.1rem 0;
    color: var(--login-muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.login-choice-divider::before,
.login-choice-divider::after {
    content: "";
    height: 1px;
    background: var(--login-line);
}

.login-choice-divider span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
}

.auth-link-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
}

.auth-link-head i {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--login-blue);
    background: #ffffff;
}

.auth-link-head strong,
.auth-link-head p {
    display: block;
}

.auth-link-head strong {
    color: var(--login-ink);
    font-weight: 900;
}

.auth-link-head p {
    margin: 0.15rem 0 0;
    color: var(--login-muted);
}

.telegram-auth-link {
    display: block;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(66, 111, 134, 0.16);
    border-radius: 8px;
    color: var(--login-blue);
    background: #ffffff;
    font-weight: 800;
    text-decoration: none;
    word-break: break-all;
}

.telegram-auth-link:hover,
.telegram-auth-link:focus {
    color: #2d566b;
    background: #eef5f8;
}

.wait-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    color: var(--login-muted);
    font-weight: 800;
}

.wait-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--login-gold);
    box-shadow: 0 0 0 0.35rem rgba(183, 154, 78, 0.16);
}

.temp-access-panel .accordion-item {
    border: 1px solid var(--login-line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.temp-access-panel .accordion-button {
    min-height: 3rem;
    padding: 0.75rem 0.85rem;
    border: 0;
    color: var(--login-green-dark);
    background: #ffffff;
    box-shadow: none;
    font-weight: 900;
}

.temp-access-panel .accordion-button:not(.collapsed) {
    color: var(--login-green-dark) !important;
    background: var(--login-soft) !important;
}

.temp-access-panel .accordion-button:focus {
    border-color: transparent;
    box-shadow: 0 0 0 0.2rem rgba(35, 79, 56, 0.12) !important;
}

.temp-access-panel .button-text {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.temp-access-panel .button-text i {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--login-gold);
    background: rgba(183, 154, 78, 0.12);
}

.qr-access-panel .button-text i {
    color: var(--login-blue);
    background: #edf4f7;
}

.temp-access-panel .accordion-body {
    padding: 0.9rem;
    border-top: 1px solid var(--login-line);
}

.info-text {
    margin: 0 0 0.85rem;
    color: var(--login-muted);
    line-height: 1.55;
}

#temp-key-display {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.temp-key-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.temp-key-head > span:first-child {
    color: var(--login-green-dark);
    font-weight: 900;
}

.timer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.65rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    color: #765f19;
    background: rgba(183, 154, 78, 0.16);
    font-size: 0.82rem;
    font-weight: 850;
    white-space: nowrap;
}

.temp-key-value-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.temp-key-code {
    min-height: 2.75rem;
    margin: 0;
    padding: 0.72rem 0.85rem;
    border: 1px solid rgba(35, 79, 56, 0.16);
    border-radius: 8px;
    color: var(--login-green-dark);
    background: var(--login-soft);
    font-size: 0.86rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.btn-copy {
    width: 2.75rem;
    padding: 0;
}

.temp-key-note {
    display: flex;
    gap: 0.45rem;
    margin: 0.75rem 0 0;
    color: var(--login-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.temp-key-note i {
    color: var(--login-blue);
    margin-top: 0.18rem;
}

.temp-key-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 0.75rem;
}

.qr-refresh-button {
    width: 100%;
}

@media (min-width: 1400px) {
    .qr-auth-frame {
        width: min(100%, 15.5rem);
    }
}

@media (max-width: 991px) {
    .login-page {
        align-items: flex-start;
        padding-top: 1rem;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-intro-panel {
        min-height: auto;
        gap: 1.4rem;
        padding-bottom: 1rem;
    }

    .login-intro-panel::after {
        position: static;
        display: block;
        align-self: stretch;
        height: 3px;
        margin-top: 0.1rem;
        inset: auto;
    }

    .login-status-grid {
        display: none;
    }

    .login-choice-divider,
    .qr-access-panel {
        display: none;
    }
}

@media (max-width: 575px) {
    .login-page {
        width: min(100%, calc(100% - 24px));
        padding-bottom: 2rem;
    }

    .login-intro-panel,
    .login-card {
        padding: 1rem;
    }

    .login-status-grid,
    .temp-key-value-row {
        grid-template-columns: 1fr;
    }

    .login-status-item {
        min-height: 4.75rem;
    }

    .login-intro-copy h1 {
        font-size: clamp(2.15rem, 13vw, 3rem);
    }

    .temp-key-actions .btn {
        width: 100%;
    }
}
