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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f7fa;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
    outline: none;
}

a {
    text-decoration: none;
    color: inherit;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    border-color: #667eea;
    color: #667eea;
}

.btn-danger {
    background: #fff;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.btn-danger:hover {
    background: #fff1f0;
    border-color: #ff4d4f;
}

.btn-success {
    background: #52c41a;
    color: white;
}

.btn-success:hover {
    background: #73d13d;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
    max-width: 80%;
    padding: 14px 22px 14px 18px;
    background: #ffffff;
    color: #333;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
    pointer-events: none;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
    border-left: 4px solid #667eea;
}

.toast::before {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #667eea;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.toast.success {
    border-left-color: #52c41a;
}
.toast.success::before {
    content: '✓';
    background: #52c41a;
}

.toast.error {
    border-left-color: #ff4d4f;
}
.toast.error::before {
    content: '✕';
    background: #ff4d4f;
}

.toast.warning {
    border-left-color: #faad14;
}
.toast.warning::before {
    content: '!';
    background: #faad14;
}

.toast.info {
    border-left-color: #1890ff;
}
.toast.info::before {
    content: 'i';
    background: #1890ff;
    font-style: italic;
    font-family: Georgia, serif;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8e8e8;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: #666;
    font-size: 14px;
}

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

/* ========== 弹窗（统一美化、居中） ========== */
.modal,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal.show,
.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 14px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-content.modal-sm { max-width: 400px; }
.modal-content.modal-lg { max-width: 800px; }
.modal-content.modal-xl { max-width: 1100px; }

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(16px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.nav-topbar {
    height: 60px;
    background: white;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-topbar .logo {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-topbar .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.nav-topbar .nav-links {
    display: flex;
    gap: 8px;
}

.nav-topbar .nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-topbar .nav-link:hover {
    background: #f5f7fa;
    color: #333;
}

.nav-topbar .nav-link.active {
    background: #f0f2ff;
    color: #667eea;
}

.nav-topbar .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-topbar .username {
    font-size: 14px;
    color: #333;
}

.nav-topbar .logout-btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    background: #f5f5f5;
    color: #666;
}

.nav-topbar .logout-btn:hover {
    background: #ffebea;
    color: #ff4d4f;
}
