:root {
    --auth-bg: var(--th-modal-bg);
    --auth-panel-left: var(--th-bg2);
    --auth-accent: #10b981; /* Professional emerald green */
    --auth-accent-soft: rgba(16, 185, 129, 0.08);
    --auth-text-main: var(--th-text);
    --auth-text-muted: var(--th-muted);
    --auth-input-bg: var(--th-input-bg);
    --auth-input-border: var(--th-border);
    --auth-radius: 20px;
}

#handleSetupModal {
    background: var(--th-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 5000;
}

/* The redesigned container */
.auth-premium-container {
    width: min(900px, 94%);
    height: min(580px, 90vh);
    background: var(--auth-bg);
    border-radius: var(--auth-radius);
    border: 1px solid var(--th-border);
    display: grid;
    grid-template-columns: 40% 1fr;
    overflow: hidden;
    /* Clean blur focus: No external shadows/glows */
    box-shadow: none !important;
    position: relative;
    animation: authZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authZoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Left Panel */
.auth-left-panel {
    background: var(--auth-panel-left);
    position: relative;
    padding: 80px 28px 32px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 32px;
    border-right: 1px solid var(--th-border);
    overflow: hidden;
}

/* Grid background pattern */
.auth-left-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--th-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--th-border) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3;
    pointer-events: none;
}

/* Removed left panel glow */

.auth-brand-info {
    position: relative;
    z-index: 2;
}

.auth-logo-box {
    width: auto;
    height: auto;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: transparent !important;
    box-shadow: none !important;
}

.auth-logo-box .auth-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--auth-text-main);
    text-shadow: none !important;
}

.auth-logo-box .auth-logo-text span {
    color: var(--auth-accent);
    text-shadow: none !important;
}

.auth-welcome-text h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 12px;
    color: var(--auth-text-main);
}

.auth-welcome-text p {
    color: var(--auth-text-muted);
    font-size: 1rem;
    line-height: 1.5;
    max-width: 280px;
}

.auth-tip-card {
    background: var(--th-bg2);
    border: 1px solid var(--th-border);
    padding: 20px;
    border-radius: 16px;
    position: relative;
    z-index: 2;
}

.auth-tip-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--auth-accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-tip-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--auth-text-muted);
    margin: 0;
}

.auth-tip-card b {
    color: var(--auth-text-main);
}

/* Right Panel */
.auth-right-panel {
    padding: 60px 40px 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: var(--auth-bg);
    position: relative;
    overflow-y: auto;
    scrollbar-width: none;
}

.auth-right-panel::-webkit-scrollbar {
    display: none;
}

.auth-close-x {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.auth-close-x:hover {
    color: var(--auth-text-main);
    background: var(--th-subtle-bg);
    transform: rotate(90deg);
}

.auth-form-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-form-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.auth-status-pill {
    display: inline-flex;
    align-items: center;
    background: var(--th-input-bg);
    border: 1px solid var(--th-border);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--auth-text-muted);
    transition: all 0.2s ease;
    user-select: none;
}

.auth-status-pill:hover {
    background: var(--th-bg2);
    border-color: var(--th-border-hover);
    color: var(--auth-text-main);
    transform: translateY(-1px);
}

.auth-status-pill:active {
    transform: translateY(0);
}

.auth-status-pill svg {
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.auth-status-pill:hover svg {
    opacity: 1;
    transform: rotate(15deg);
}

.auth-field-group {
    margin-bottom: 20px;
}
.auth-dynamic-stable {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.auth-label-row {
    display: flex;
    align-items: center;
    min-height: 26px;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--auth-text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-label-row svg {
    color: var(--auth-accent);
}

.auth-input-container {
    position: relative;
}

.auth-input-container input {
    width: 100%;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--auth-text-main);
    font-size: 0.95rem;
    transition: 0.2s;
}

.auth-input-container input:focus {
    border-color: var(--auth-accent);
    outline: none;
    box-shadow: none;
}
.auth-input-container .input-icon-left {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-text-muted);
}

.auth-input-container.with-icon-left input {
    padding-left: 48px;
}

.auth-input-meta {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--auth-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-input-meta b {
    color: var(--auth-accent);
}

.auth-forgot-link {
    margin: 0;
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: 0.2s;
}

.auth-forgot-link:hover {
    color: var(--auth-accent);
    text-decoration: underline;
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: var(--auth-accent);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 8px;
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

[data-theme="light"] .auth-submit-btn svg {
    color: #000000 !important;
}

.auth-footer {
    margin-top: 40px;
    padding-bottom: 20px;
    text-align: center;
}

.auth-or-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--th-border);
    margin-bottom: 20px;
}

.auth-or-divider::before,
.auth-or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: currentColor;
}

.auth-or-divider span {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--auth-text-muted);
}

.auth-switch-prompt {
    font-size: 1rem;
    color: var(--auth-text-muted);
}

.auth-switch-prompt button {
    background: transparent;
    border: none;
    color: var(--auth-accent);
    font-weight: 700;
    cursor: pointer;
    font-size: inherit;
    padding: 0 4px;
    transition: 0.2s;
}

.auth-switch-prompt button:hover {
    text-decoration: underline;
}

/* Strength Meter */
.auth-strength-wrap {
    margin-top: 4px;
}

.auth-strength-track {
    height: 10px;
    background: var(--th-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

/* Sharp segments using a repeating gradient mask on top */
.auth-strength-track::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        to right,
        var(--auth-bg) 0px,
        var(--auth-bg) 3px,
        transparent 3px,
        transparent 20%
    );
    z-index: 5;
    pointer-events: none;
}

.auth-strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: inherit;
    position: relative;
    z-index: 1;
}

.auth-strength-fill[data-strength="weak"] {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.auth-strength-fill[data-strength="medium"] {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.auth-strength-fill[data-strength="strong"] {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.auth-strength-meta {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-strength-meta span:first-child {
    color: var(--auth-text-muted);
}

.auth-strength-meta span:last-child {
    color: var(--auth-accent);
}

/* Verification Block */
.handle-verification-block {
    margin-top: 32px;
    padding: 24px;
    background: var(--auth-panel-left);
    border-radius: 20px;
    border: 1px dashed var(--th-border);
    text-align: center;
}

.verification-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

#handleVerificationProblemLink {
    display: inline-block;
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 12px;
}

#handleVerificationProblemLink:hover {
    text-decoration: underline;
}

.handle-verification-status {
    font-size: 0.85rem;
    color: var(--auth-text-muted);
    margin-bottom: 16px;
}

#verifyHandleCeBtn {
    background: var(--auth-accent);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#verifyHandleCeBtn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Responsive */
@media (max-width: 900px) {
    .auth-premium-container {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 94vh;
        width: min(480px, 94%);
    }

    .auth-left-panel {
        display: none;
    }

    .auth-right-panel {
        padding: 40px;
    }
}
