@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;600;700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
    --primary: #C4857A;
    --primary-dark: #A66B62;
    --primary-light: #E8B4A0;
    --primary-bg: #FDF8F6;
    --secondary: #1A1A2E;
    --accent: #D4A574;
    --accent-light: #F5EDE0;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F6F4;
    --bg-card: #FFFFFF;
    --text-primary: #2D2D2D;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #EEEEEE;
    --border-light: #F5F5F5;
    --success: #52C41A;
    --success-bg: #F6FFED;
    --warning: #FAAD14;
    --warning-bg: #FFFBE6;
    --danger: #FF4D4F;
    --danger-bg: #FFF1F0;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; }

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* === 通用容器 === */
.container { max-width: 1360px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 20px; }

/* === 卡片 === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}
.card-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
}

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(196, 133, 122, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(196, 133, 122, 0.4);
}
.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-secondary); }
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #E63C3E; }
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* === 表单 === */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196, 133, 122, 0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }

/* === 导航栏 === */
.navbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-xs);
}
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.navbar-brand {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-brand::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 2px;
}
.navbar-nav { display: flex; align-items: center; gap: 4px; list-style: none; }
.navbar-nav a {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.navbar-nav a:hover, .navbar-nav a.active { color: var(--primary); background: rgba(196,133,122,0.08); }
.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.navbar-user-info {
    text-align: right;
}
.navbar-user-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.navbar-user-id { font-size: 0.75rem; color: var(--text-muted); font-family: 'DM Sans', monospace; }

/* === 搜索框 === */
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 18px;
    gap: 8px;
    transition: var(--transition);
    min-width: 320px;
}
.search-box:focus-within {
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(196, 133, 122, 0.1);
}
.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    color: var(--text-primary);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box .btn { border-radius: var(--radius-full); padding: 8px 20px; }

/* === 标签页 === */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: var(--transition);
    font-family: inherit;
}
.tab:hover { color: var(--primary); }
.tab.active {
    background: var(--bg-primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
.tab-locked {
    opacity: 0.7;
    color: #999;
}

/* === 课程卡片网格 === */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.course-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: visible;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}
.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.course-card-img {
    height: 160px;
    background: linear-gradient(135deg, var(--primary-bg), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.course-card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(196,133,122,0.1), rgba(212,165,116,0.1));
}
.course-card-img-icon {
    font-size: 3rem;
    opacity: 0.6;
}
.course-card-hot {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(255,107,107,0.4);
}
.course-card-unread {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #C4857A, #B8737A);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(196,133,122,0.4);
    white-space: nowrap;
}
.course-card-body { padding: 18px; }
.course-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.course-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.course-card-category {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}
.course-card-like {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    transition: var(--transition);
}
.course-card-like.liked { color: var(--danger); }
.course-card-like:hover { color: var(--danger); }

/* === 分页 === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}
.pagination a:hover { background: var(--bg-secondary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; }
.pagination .disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* === 表格 === */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.875rem;
}
.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.table td { border-bottom: 1px solid var(--border-light); color: var(--text-primary); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-secondary); }
.table td.actions { display: flex; gap: 6px; }

/* === 徽章 === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-pending { background: var(--warning-bg); color: #D48806; }
.badge-active, .badge-success { background: var(--success-bg); color: #389E0D; }
.badge-disabled, .badge-danger { background: var(--danger-bg); color: #CF1322; }
.badge-info { background: #E6F7FF; color: #0958D9; }
.badge-hot { background: #FFF1E6; color: #D48806; }
.btn-hot { background: #FFF1E6; border: 1px solid #FFD180; color: #D48806; }
.btn-hot:hover { background: #FFE0B2; }

/* === 模态框 === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border-light);
}
.modal-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary);
}
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 24px 28px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 28px 24px;
    border-top: 1px solid var(--border-light);
}

/* === 提示消息 === */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.message-success { background: var(--success-bg); color: #389E0D; border: 1px solid #B7EB8F; }
.message-warning { background: var(--warning-bg); color: #D48806; border: 1px solid #FFE58F; }
.message-danger { background: var(--danger-bg); color: #CF1322; border: 1px solid #FFCCC7; }
.message-info { background: #E6F7FF; color: #0958D9; border: 1px solid #91D5FF; }
.message-icon { font-size: 1.2rem; flex-shrink: 0; }
.message-content { flex: 1; }
.message-close { background: none; border: none; cursor: pointer; color: inherit; opacity: 0.6; }
.message-close:hover { opacity: 1; }

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state-icon { font-size: 4rem; opacity: 0.3; margin-bottom: 16px; }
.empty-state-title { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 0.875rem; color: var(--text-muted); }

/* === 加载动画 === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === 水印 === */
.watermark-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}
.watermark-item {
    position: absolute;
    font-family: 'DM Sans', 'Noto Sans SC', sans-serif;
    font-size: 14px;
    color: rgba(0,0,0,0.06);
    transform: rotate(-30deg);
    white-space: nowrap;
    user-select: none;
}

/* === 响应式 === */
@media (max-width: 768px) {
    .container, .container-sm { padding: 0 10px; }
    .navbar-inner { height: 56px; }
    .navbar-nav { gap: 0; }
    .navbar-nav a { padding: 8px 12px; font-size: 0.8rem; }
    .search-box { min-width: auto; }
    .course-grid { grid-template-columns: 1fr; }
    .card { padding: 18px; }
    .table th, .table td { padding: 10px 12px; font-size: 0.8rem; }
    .modal { max-width: 100%; border-radius: var(--radius-lg); }
}

/* === 辅助类 === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-sm { font-size: 0.8rem; }
.text-lg { font-size: 1.1rem; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* === 页面头部 === */
.page-header {
    padding: 40px 0 30px;
}
.page-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 6px;
}
.page-subtitle { font-size: 0.9rem; color: var(--text-muted); }

/* === 登录页特殊样式 === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-bg) 0%, #fff 50%, var(--accent-light) 100%);
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
}
.login-logo {
    text-align: center;
    margin-bottom: 36px;
}
.login-logo-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--secondary);
}
.login-logo-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 2px;
}

/* === 课程HTML页面样式 === */
.course-viewer {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}
.course-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    position: sticky;
    top: 72px;
    z-index: 100;
}
.course-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}
.course-user-name {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}
.course-user-id {
    font-family: 'DM Sans', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.course-actions { display: flex; align-items: center; gap: 10px; }
.course-like-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.course-like-btn:hover { border-color: var(--danger); color: var(--danger); }
.course-like-btn.liked { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.course-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--success);
    color: #fff;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}
.course-download-btn:hover { background: #42C41A; transform: translateY(-1px); }

/* === 后台管理特殊样式 === */
.admin-sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--secondary);
    padding: 24px 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}
.admin-sidebar-logo {
    padding: 0 20px  24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}
.admin-sidebar-logo-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}
.admin-nav { list-style: none; }
.admin-nav-item { margin: 2px 0; }
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0;
    transition: var(--transition);
}
.admin-nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.admin-nav-link.active { color: #fff; background: rgba(196,133,122,0.3); border-right: 3px solid var(--primary); }
.admin-nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.admin-main {
    margin-left: 220px;
    min-height: 100vh;
    background: var(--bg-secondary);
    padding: 24px;
}
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.admin-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--secondary);
}
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.admin-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.admin-stat-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary);
}
.admin-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.admin-stat-change { font-size: 0.75rem; margin-top: 6px; }
.admin-stat-change.up { color: var(--success); }
.admin-stat-change.down { color: var(--danger); }

/* === 复选框美化 === */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}
.checkbox-item:hover { border-color: var(--primary); }
.checkbox-item.checked { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.checkbox-item input { display: none; }

/* === 开关 === */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* === 日期选择 === */
.date-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.date-preset-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}
.date-preset-btn:hover, .date-preset-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* === 图片上传 === */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-bg); }
.upload-area-icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 8px; }
.upload-area-text { font-size: 0.875rem; color: var(--text-muted); }
.upload-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-md);
    margin-top: 12px;
}

/* === 工具提示 === */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: var(--secondary);
    color: #fff;
    font-size: 0.75rem;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
[data-tooltip]:hover::after { opacity: 1; }

/* === 二维码展示 === */
.qr-display {
    text-align: center;
    padding: 24px;
}
.qr-display img {
    max-width: 240px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.qr-display-title { font-size: 1rem; font-weight: 600; color: var(--secondary); margin-top: 16px; }
.qr-display-desc { font-size: 0.875rem; color: var(--text-muted); margin-top: 8px; }

/* === 筛选工具栏 === */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    align-items: flex-end;
}
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.filter-item .form-input, .filter-item .form-select { min-width: 150px; }

/* === 标签 === */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.tag-primary { background: var(--primary-bg); color: var(--primary); }

/* =============================================
   后台管理 - 桌面端（>= 769px）
   ============================================= */
@media (min-width: 769px) {

    /* 隐藏移动端专用组件 */
    .admin-hamburger,
    .admin-mobile-overlay {
        display: none !important;
    }

    /* 侧边栏桌面布局 */
    .admin-layout {
        display: flex;
        min-height: 100vh;
    }

    .admin-sidebar {
        width: 220px;
        min-height: 100vh;
        background: var(--secondary);
        padding: 24px 0;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        overflow-y: auto;
        z-index: 1000;
    }

    .admin-main {
        margin-left: 220px;
        flex: 1;
        min-height: 100vh;
        background: var(--bg-secondary);
        padding: 24px;
    }
}

/* =============================================
   后台管理 - 移动端（<= 768px）
   ============================================= */
@media (max-width: 768px) {

    /* 恢复内容滚动 */
    html, body {
        overflow-x: hidden;
    }

    /* --- 汉堡按钮：固定在页面左上角 --- */
    .admin-hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        gap: 5px;
        background: #fff;
        border: 1.5px solid var(--border);
        border-radius: var(--radius-sm);
        cursor: pointer;
        padding: 8px;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1003;
        box-shadow: var(--shadow-sm);
        transition: var(--transition);
    }

    .admin-hamburger:active {
        background: var(--primary-bg);
    }

    .admin-hamburger span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--primary);
        border-radius: 2px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    /* 汉堡 → X 动画 */
    .admin-hamburger.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .admin-hamburger.active span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .admin-hamburger.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* --- 遮罩层 --- */
    .admin-mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1001;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .admin-mobile-overlay.show {
        opacity: 1;
        pointer-events: all;
    }

    /* --- 侧边栏：默认隐藏在左侧 --- */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        background: var(--secondary);
        z-index: 1002;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    .admin-sidebar.open {
        transform: translateX(0) !important;
    }

    /* 侧边栏顶部：Logo + 关闭按钮 */
    .admin-sidebar-logo {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 16px 16px 20px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        position: sticky;
        top: 0;
        background: var(--secondary);
        z-index: 1;
    }

    .admin-sidebar-logo-text {
        font-size: 1rem !important;
        font-weight: 700;
        color: #fff;
    }

    .admin-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: var(--radius-sm);
        color: rgba(255, 255, 255, 0.7);
        font-size: 1.4rem;
        cursor: pointer;
        flex-shrink: 0;
        line-height: 1;
        transition: var(--transition);
    }

    .admin-sidebar-close:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #fff;
    }

    /* --- 主内容区域 --- */
    .admin-main {
        margin-left: 0 !important;
        padding: 16px !important;
        padding-top: 72px !important;
        min-height: 100vh;
        background: var(--bg-secondary);
    }

    /* --- 页面头部：适配汉堡按钮偏移 --- */
    .admin-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
        padding: 0 !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        position: static !important;
        gap: 12px;
    }

    .admin-title {
        font-size: 1.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        padding-left: 48px;
    }

    /* --- 筛选工具栏：垂直堆叠 --- */
    .filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 16px !important;
        gap: 10px !important;
    }

    .filter-item {
        width: 100% !important;
    }

    .filter-item .form-input,
    .filter-item .form-select {
        min-width: unset !important;
        width: 100% !important;
    }

    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* --- 表格：横向滚动 --- */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
        font-size: 0.8rem !important;
    }

    .table th,
    .table td {
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
    }

    .table td.actions {
        flex-direction: column !important;
        gap: 4px !important;
        min-width: 80px;
    }

    .table td.actions .btn {
        width: 100%;
        justify-content: center;
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    /* --- 模态框：底部弹窗全屏 --- */
    .modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal-overlay.show {
        display: flex !important;
    }

    .modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 92vh !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        margin: 0;
        animation: modalSlideUp 0.3s ease;
    }

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

    .modal-header {
        padding: 16px 20px !important;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 1;
        border-bottom: 1px solid var(--border-light);
    }

    .modal-body {
        padding: 16px 20px !important;
        max-height: calc(92vh - 130px);
        overflow-y: auto;
    }

    .modal-footer {
        padding: 16px 20px !important;
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-light);
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }

    .modal-footer .btn-danger {
        order: -1;
        flex: 100%;
    }

    /* --- 表单项移动端垂直排列 --- */
    .modal-body .form-group {
        margin-bottom: 16px;
    }

    /* --- 统计数据卡片：2列 --- */
    .admin-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .admin-stat-card {
        padding: 16px !important;
    }

    .admin-stat-value {
        font-size: 1.4rem !important;
    }

    /* --- 分页：小屏 --- */
    .pagination a,
    .pagination span {
        min-width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem !important;
        padding: 0 8px !important;
    }

    /* --- 表单：权限复选框网格 --- */
    .perm-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    /* --- 通知条移动端适配 --- */
    #pendingAlert {
        font-size: 0.8rem !important;
        padding: 10px 16px !important;
        z-index: 10000 !important;
    }
}

/* =============================================
   超小屏幕适配（<= 480px）
   ============================================= */
@media (max-width: 480px) {
    .admin-main {
        padding: 12px !important;
        padding-top: 68px !important;
    }

    .admin-stats {
        grid-template-columns: 1fr !important;
    }

    .admin-title {
        font-size: 1rem !important;
    }

    .card {
        padding: 14px !important;
        border-radius: var(--radius-md) !important;
    }

    .table {
        font-size: 0.75rem !important;
    }

    .table th,
    .table td {
        padding: 8px 10px !important;
    }

    .modal {
        border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
        max-height: 95vh !important;
    }
}
