:root {
    color-scheme: dark;
    --bg: #020617;
    --bg-accent: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.16), transparent 45%),
                 radial-gradient(circle at 80% 5%, rgba(129, 140, 248, 0.18), transparent 55%),
                 radial-gradient(circle at 50% 90%, rgba(14, 116, 144, 0.2), transparent 60%),
                 #020617;
    --panel: rgba(15, 23, 42, 0.78);
    --panel-strong: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(148, 163, 184, 0.16);
    --primary: #38bdf8;
    --primary-strong: #0ea5e9;
    --text-main: #f8fafc;
    --text-sub: rgba(203, 213, 225, 0.85);
    --error: #f87171;
    --success: #34d399;
    --radius: 18px;
    --shadow: 0 35px 80px rgba(2, 6, 23, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: #000;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.app {
    width: 100%;
}

.login-container {
    margin: 0 auto;
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0;
    backdrop-filter: blur(24px);
    background: rgba(2, 6, 23, 0.85);
    border-radius: calc(var(--radius) + 6px);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(15, 118, 110, 0.35);
    overflow: hidden;
}

.brand-panel {
    padding: clamp(2.5rem, 5vw, 4rem);
    background: linear-gradient(180deg, rgba(8, 47, 73, 0.9), rgba(15, 118, 110, 0.4));
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    position: relative;
}

.brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(248, 250, 252, 0.35), transparent 55%),
                radial-gradient(circle at 80% 70%, rgba(96, 165, 250, 0.25), transparent 60%);
    mix-blend-mode: screen;
    opacity: 0.6;
}

.brand-logo {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.25);
    backdrop-filter: blur(14px);
    position: relative;
}

.brand-logo svg {
    width: 30px;
    height: 30px;
    color: var(--text-main);
}

.brand-title {
    position: relative;
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-desc {
    position: relative;
    font-size: 1rem;
    line-height: 1.8;
    color: rgba(226, 232, 240, 0.85);
}

.card {
    padding: clamp(2.75rem, 4vw, 4rem);
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(18px);
    border-left: 1px solid rgba(15, 118, 110, 0.35);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.card-header h2 {
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.card-form {
    display: grid;
    gap: 1.5rem;
}

.input-group {
    display: grid;
    gap: 0.65rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper svg {
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 1.05rem;
    color: rgba(148, 163, 184, 0.7);
    transform: translateY(-50%);
}

.input-wrapper input {
    width: 100%;
    padding: 0.95rem 1.1rem 0.95rem 3.05rem;
    border-radius: calc(var(--radius) - 6px);
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(2, 6, 23, 0.75);
    color: var(--text-main);
    font-size: 0.98rem;
    transition: border 0.18s ease, box-shadow 0.18s ease;
}

.input-wrapper input::placeholder {
    color: rgba(148, 163, 184, 0.55);
}

.input-wrapper input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.input-wrapper.error input {
    border-color: rgba(248, 113, 113, 0.6);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}

.code-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.code-input {
    flex: 1;
}

.code-input input {
    padding-right: 1.1rem;
}

.code-btn {
    position: relative;
    border: none;
    border-radius: calc(var(--radius) - 10px);
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #0f172a;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 110px;
}

.code-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    background: rgba(148, 163, 184, 0.35);
    color: rgba(248, 250, 252, 0.7);
}

.error-text {
    margin-top: 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.86rem;
    font-weight: 500;
    color: rgba(252, 165, 165, 0.95);
    letter-spacing: 0.01em;
}

.error-text::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(252, 165, 165, 0.18);
}

.submit-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 1rem 1.2rem;
    border-radius: calc(var(--radius) - 6px);
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #0f172a;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
}

.submit-btn .loading {
    display: none;
}

.submit-btn[data-loading="true"] .label {
    display: none;
}

.submit-btn[data-loading="true"] .loading {
    display: inline-flex;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 26px 60px rgba(14, 165, 233, 0.45);
}

.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
    box-shadow: none;
}

.loading svg {
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
}

.feedback {
    border-radius: calc(var(--radius) - 8px);
    padding: 0.9rem 1rem;
    font-size: 0.92rem;
    border: 1px solid transparent;
    margin-top: 0.4rem;
    text-align: center;
}

.feedback.error {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.28);
    color: rgba(254, 226, 226, 0.92);
}

.feedback.success {
    background: rgba(52, 211, 153, 0.18);
    border-color: rgba(45, 212, 191, 0.32);
    color: rgba(209, 250, 229, 0.95);
}

@media (max-width: 768px) {
    body {
        padding: 1.75rem 1.25rem;
    }

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

    .brand-panel {
        text-align: center;
        align-items: center;
    }

    .brand-desc {
        max-width: 32ch;
    }

    .card {
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }
}

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