/* ========================================
   Login page: dashboard background
   ======================================== */
.login-page {
    overflow: hidden;
}

.login-bg {
    position: fixed;
    inset: 0;
    background: #0a0a0a;
    pointer-events: none;
    z-index: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #fff;
    line-height: 1.5;
}

/* --- Header --- */
.login-bg-header {
    height: 56px;
    background: #0a0a0a;
    border-bottom: 1px solid rgb(34, 34, 34);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.login-bg-header-left,
.login-bg-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-bg-logo {
    font-size: 18px;
    font-weight: 600;
    color: #1e90ff;
    padding-right: 8px;
}

.login-bg-btn {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #1e1e1e;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
}

/* --- Body --- */
.login-bg-body {
    display: flex;
    height: calc(100vh - 56px);
}

/* --- Sidebar --- */
.login-bg-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #0a0a0a;
    border-right: 1px solid rgb(34, 34, 34);
    padding: 16px;
    overflow: hidden;
}

.login-bg-nav {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: oklch(70.8% 0 0);
    font-size: 14px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    margin-bottom: 2px;
    text-decoration: none;
    gap: 10px;
}

.login-bg-nav.active {
    background: #191919;
    color: #fff;
}

.login-bg-nav.sub {
    padding-left: 40px;
    font-size: 13px;
}

.login-bg-nav-dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.login-bg-nav.active .login-bg-nav-dot {
    background: rgba(255, 255, 255, 0.15);
}

.login-bg-arrow {
    font-size: 10px;
    color: #a5a5a5;
    margin-left: auto;
}

.login-bg-nav-group {
    margin-top: 4px;
}

/* --- Main content --- */
.login-bg-content {
    flex: 1;
    padding: 24px;
    overflow: hidden;
}

.login-bg-h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1e90ff;
    margin: 0 0 0.5em;
}

.login-bg-h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 0.5em;
}

/* --- Summary boxes --- */
.login-bg-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.login-bg-summary-item {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 130px;
    text-align: center;
}

.login-bg-summary-label {
    font-size: 0.85rem;
    color: #a5a5a5;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.login-bg-summary-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e90ff;
}

/* --- Chart --- */
.login-bg-chart {
    height: 160px;
    margin-bottom: 24px;
}

.login-bg-chart-svg {
    width: 100%;
    height: 100%;
}

/* --- Data table --- */
.login-bg-table {
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
}

.login-bg-table-row {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    gap: 12px;
    position: relative;
}

.login-bg-table-row span:first-child {
    width: 60px;
    flex-shrink: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
}

.login-bg-bar {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(30, 144, 255, 0.1);
    pointer-events: none;
}

.login-bg-table-count {
    margin-left: auto;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    position: relative;
}

/* --- Blur overlay on top of bg --- */
.login-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ========================================
   Login overlay (centered form)
   ======================================== */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* --- Choice screen --- */
.auth-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.auth-choice-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.auth-choice-buttons {
    display: flex;
    gap: 14px;
    width: 400px;
}

.auth-choice-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
}

.auth-choice-btn:hover {
    opacity: 0.9;
}

.auth-choice-btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.auth-choice-btn-secondary:hover {
    border-color: var(--text-muted);
    opacity: 1;
}

/* --- Auth form --- */
.auth-back {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
    margin-right: auto;
    margin-bottom: 6px;
    transition: color 0.2s;
}

.auth-back:hover {
    color: var(--text);
}

.auth-shell {
    position: relative;
    width: min(440px, 100%);
    padding: 34px 30px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.7);
}

.tab-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
}

.tab-btn {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0 0 4px;
    cursor: pointer;
    transition:
        color 0.2s,
        border-color 0.2s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--text);
    border-color: #0088ff;
}

.tab-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-section h2 {
    margin-bottom: 12px;
    color: var(--text);
    font-size: 1.52rem;
    font-weight: 600;
    line-height: 1.24;
    letter-spacing: -0.015em;
}

.auth-shell form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-shell label {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.86rem;
    letter-spacing: 0.01em;
}

.auth-shell input[type="text"],
.auth-shell input[type="password"] {
    width: 100%;
    border: 1px solid #2f2f2f;
    border-radius: 12px;
    padding: 12px 13px;
    background: #101010;
    color: var(--text);
    font-size: 0.95rem;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.auth-shell input[type="text"]::placeholder,
.auth-shell input[type="password"]::placeholder {
    color: #666666;
}

.auth-shell input[type="text"]:focus,
.auth-shell input[type="password"]:focus {
    outline: none;
    border-color: #0088ff;
    box-shadow: 0 0 0 3px #0088ff2b;
}

#totpCode {
    letter-spacing: 1px;
    text-align: center;
}

.primary-btn {
    margin-top: 14px;
    border: 1px solid var(--primary);
    border-radius: 12px;
    background: var(--primary);
    color: #000000;
    padding: 11px 16px;
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition:
        background-color 0.2s,
        border-color 0.2s,
        color 0.2s;
}

.primary-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.primary-btn:disabled {
    opacity: 0.52;
    cursor: not-allowed;
}

.terms-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
}

.terms-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: #0088ff;
}

.terms-container label {
    margin: 0;
    line-height: 1.45;
    font-size: 0.84rem;
}

.terms-container a {
    color: #9dc9ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.terms-container a:hover {
    color: #c2deff;
}

.twofactor-desc {
    margin: 0 0 10px;
    color: #9da7b3;
    font-size: 0.9rem;
    line-height: 1.45;
}

#resultArea {
    margin-top: 16px;
    min-height: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(4px);
    transition:
        opacity 0.2s,
        transform 0.2s;
}

#resultArea.is-visible {
    opacity: 1;
    transform: translateY(0);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
}

#resultArea.is-error {
    color: #ffc4ce;
    border-color: #6b2b36;
    background: #271418;
}

#resultArea.is-success {
    color: #b8efcf;
    border-color: #2a5b3f;
    background: #13261b;
}

#rateLimitOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.86);
    color: #ffc98a;
}

#loadingOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
    transition: opacity 0.35s ease-out;
}

#loadingOverlay.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    margin-bottom: 12px;
    color: #e5eaf0;
    font-size: 0.95rem;
}

#loadingOverlay.is-success .loading-text {
    margin-bottom: 0;
    max-width: 340px;
    text-align: center;
    line-height: 1.55;
    color: #b8efcf;
    font-size: 1.02rem;
    font-weight: 600;
}

.progress-container {
    width: 220px;
    height: 3px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.14);
}

.progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: #0088ff;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .login-bg-sidebar {
        display: none;
    }

    .login-bg-header-left .login-bg-btn,
    .login-bg-header-right {
        display: none;
    }

    .login-overlay {
        padding: 16px;
        overflow-y: auto;
    }

    .auth-choice-buttons {
        flex-direction: column;
        width: 100%;
    }

    .auth-shell {
        width: 100%;
        padding: 24px 18px;
        border-radius: 14px;
    }

    .auth-section h2 {
        font-size: 1.34rem;
    }

    .tab-row {
        gap: 18px;
        margin-bottom: 22px;
    }

    .tab-btn {
        font-size: 0.89rem;
    }

    .primary-btn {
        width: 100%;
    }
}
