:root {
    --bg: #f6f7fb;
    --card: #fff;
    --text: #0f172a;
    --muted: #667085;
    --border: #e5e7eb;
    --primary: #2563eb;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(37, 99, 235, 0.02) 0%, transparent 50%),
        linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 2px 4px rgba(0, 0, 0, 0.02),
        0 8px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    animation: cardAppear 0.3s ease-out;
}

.auth-card.auth-card-wide {
    max-width: 420px;
}

.auth-header {
    margin-top: 32px;
    margin-bottom: 32px;
    text-align: center;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f9ff;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
    border: 1px solid #e0f2fe;
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.4;
}

.corner-logo {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 70px;
    height: auto;
    opacity: 0.4;
    filter: grayscale(100%);
    transition: opacity 0.3s ease;
}

.corner-logo:hover {
    opacity: 0.8;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.15s ease;
    background: white;
    color: var(--text);
    font-family: inherit;
    line-height: 1.4;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    transform: translateY(-0.5px);
}

.form-input::placeholder {
    color: #9ca3af;
}

.input-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.15s ease;
}

.password-toggle:hover {
    color: var(--text);
    background: #f3f4f6;
}

.auth-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}

.auth-btn:hover {
    background: #1d4ed8;
}

.auth-btn:active {
    transform: translateY(0.5px);
}

.auth-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.error-message {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    text-align: center;
}

.warning-message {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 16px;
    font-size: 12px;
    text-align: center;
}

.attempts-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #d97706;
    margin-top: 6px;
}

.form-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.support-info {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.support-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.support-link:hover {
    text-decoration: underline;
}

.input-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-loading {
    position: relative;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.role-list {
    display: grid;
    gap: 14px;
}

.role-form {
    margin: 0;
}

.role-button {
    width: 100%;
    padding: 16px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    font: inherit;
}

.role-button:hover,
.role-button:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    transform: translateY(-0.5px);
    outline: none;
}

.role-button.is-active {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.35);
}

.role-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.role-icon-wrap {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.role-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.role-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.role-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.role-badge {
    display: inline-flex;
    margin-top: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f0f9ff;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #e0f2fe;
}

@media (max-width: 640px) {
    .auth-card.auth-card-wide {
        padding: 28px 20px;
    }

    .auth-header {
        margin-top: 24px;
        margin-bottom: 24px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 32px 24px;
        margin: 0 16px;
    }

    .auth-title {
        font-size: 20px;
    }

    .corner-logo {
        width: 55px;
        top: 16px;
        right: 16px;
    }
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
