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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #4a90d9 0%, #3b82f6 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.card-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-header p {
    font-size: 14px;
    opacity: 0.9;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 16px;
    border: none;
    background: none;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    color: #3b82f6;
}

.tab-btn.active {
    color: #3b82f6;
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #4a90d9 0%, #3b82f6 100%);
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    outline: none;
}

.form-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
    color: #aaa;
}

.code-input-group {
    display: flex;
    gap: 10px;
}

.code-input-group input {
    flex: 1;
}

.code-btn {
    padding: 14px 20px;
    border: none;
    background: linear-gradient(135deg, #4a90d9 0%, #3b82f6 100%);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.code-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.code-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.code-btn.danger-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
}

.code-btn.danger-btn:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    background: linear-gradient(135deg, #4a90d9 0%, #3b82f6 100%);
    color: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* 内联 loading 旋转动画 */
.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.submit-btn.small-btn {
    width: auto;
    padding: 10px 24px;
    font-size: 14px;
}

.agreement-text {
    text-align: center;
    font-size: 13px;
    color: #999;
    margin-top: 10px;
}

.agreement-text a {
    color: #4a90d9;
    text-decoration: none;
}

.agreement-text a:hover {
    text-decoration: underline;
}

.error-message {
    color: #ff6b6b;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

.invite-status {
    font-size: 13px;
    margin-top: 8px;
    min-height: 20px;
}

.invite-status.valid {
    color: #52c41a;
}

.invite-status.invalid {
    color: #ff6b6b;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    font-weight: normal;
    margin-bottom: 0;
}

.radio-group input[type="radio"] {
    display: none;
}

.radio-group input[type="radio"] + span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s;
}

.radio-group input[type="radio"] + span::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #3b82f6;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.radio-group input[type="radio"]:checked + span {
    border-color: #3b82f6;
}

.radio-group input[type="radio"]:checked + span::after {
    opacity: 1;
    transform: scale(1);
}

.radio-group input[type="radio"]:hover + span {
    border-color: #3b82f6;
}

.form-group input[type="file"] {
    display: none;
}

label.file-upload-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 24px;
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 400;
    color: inherit;
    margin-bottom: 0;
}

label.file-upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

label.file-upload-area:active {
    transform: scale(0.99);
}

.upload-icon {
    display: block;
    width: 32px;
    height: 32px;
    color: #3b82f6;
    flex-shrink: 0;
}

.file-upload-area:hover .upload-icon {
    transform: scale(1.1);
}

.upload-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    line-height: 1.4;
}

.upload-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.upload-hint {
    font-size: 12px;
    color: #999;
}

.file-name {
    display: block;
    margin-top: 10px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    word-break: break-all;
}

.file-name:empty {
    display: none;
}

.admin-panel {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.admin-panel h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.invite-controls {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.invite-controls .form-group {
    flex: 1;
    margin-bottom: 0;
}

.invite-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.invite-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invite-list th {
    background: #f5f5f5;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #666;
    position: sticky;
    top: 0;
}

.invite-list td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.invite-list tr:hover {
    background: #fafafa;
}

.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 12px;
}

.modal-content p {
    color: #666;
    font-size: 15px;
    margin-bottom: 24px;
}

/* Passkey Login Styles */
.passkey-login-card {
    text-align: center;
    padding: 40px 20px;
}

.passkey-login-card h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}

.passkey-login-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

.passkey-btn {
    width: 100%;
    padding: 16px;
    border: none;
    background: linear-gradient(135deg, #4a90d9 0%, #3b82f6 100%);
    color: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.passkey-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.passkey-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.passkey-hint {
    margin-top: 16px !important;
    color: #999 !important;
    font-size: 13px !important;
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .card-header {
        padding: 22px;
    }
    
    .card-header h1 {
        font-size: 24px;
    }
    
    .tab-content {
        padding: 22px;
    }
    
    .tab-btn {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .invite-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .submit-btn.small-btn {
        width: 100%;
    }
}