/* ===== 管理员后台样式:深色侧边栏 + 浅色内容区 ===== */

/* --- 页面级背景与布局框架 --- */
.admin-page {
    background: #f1f5f9;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.05) 0%, transparent 30%),
        radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.04) 0%, transparent 25%);
}

/* 隐藏前台导航栏/页脚(DOM 保留,移动端 JS 不报错) */
body.admin-page .navbar { display: none; }
body.admin-page .footer { display: none; }

/* 内容区:给侧边栏让位 */
body.admin-page .main-content {
    max-width: none;
    margin: 0 0 0 240px;
    padding: var(--space-6) var(--space-8);
    transition: margin-left .25s ease;
}

body.admin-page.sidebar-collapsed .main-content { margin-left: 64px; }

body.admin-page .flash-container { top: 16px; right: 16px; }

/* 后台内容区铺满可用宽度(不再设 1400/1500px 上限,避免大屏留白、小屏挤压换行) */
.admin-page .container { max-width: none; }

.admin-page .dashboard {
    max-width: none;
    padding: var(--space-4) 0;
    animation: fadeInUp 0.4s ease-out;
}

/* ===== 侧边栏 ===== */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    transition: width .25s ease, transform .25s ease;
}

.admin-sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 64px;
    min-width: 0;
    overflow: hidden;
    padding: 0 14px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(148, 163, 184, .15);
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
}

.admin-sidebar-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-sidebar-brand-text {
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 700;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar-toggle {
    border: none;
    background: rgba(255, 255, 255, .06);
    color: #94a3b8;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s, color .2s;
}

.admin-sidebar-toggle:hover { background: rgba(255, 255, 255, .12); color: #f1f5f9; }
.admin-sidebar-toggle svg { width: 16px; height: 16px; transition: transform .25s ease; }
body.sidebar-collapsed .admin-sidebar-toggle svg { transform: rotate(180deg); }

.admin-sidebar-sections {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px;
}

.admin-sidebar-sections::-webkit-scrollbar { width: 5px; }
.admin-sidebar-sections::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .25); border-radius: 3px; }

.admin-sidebar-group { margin-bottom: 10px; }

.admin-sidebar-section-label {
    padding: 12px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: .5px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .2s;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 9px;
    margin-bottom: 2px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    transition: background .15s, color .15s;
}

.admin-sidebar-link:hover { background: rgba(255, 255, 255, .06); color: #f1f5f9; }

.admin-sidebar-link.active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, .35);
}

.admin-sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: #60a5fa;
}

.admin-sidebar-link .side-ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.admin-sidebar-link-text { overflow: hidden; text-overflow: ellipsis; }

/* 折叠态(64px 图标栏) */
body.sidebar-collapsed .admin-sidebar { width: 64px; }
body.sidebar-collapsed .admin-sidebar-header { padding: 0 14px; justify-content: center; }
body.sidebar-collapsed .admin-sidebar-brand-text,
body.sidebar-collapsed .admin-sidebar-section-label,
body.sidebar-collapsed .admin-sidebar-link-text,
body.sidebar-collapsed .admin-sidebar-user-info,
body.sidebar-collapsed .admin-sidebar-user-links { display: none; }
body.sidebar-collapsed .admin-sidebar-sections { padding: 10px 8px; }
body.sidebar-collapsed .admin-sidebar-link { justify-content: center; padding: 10px; }
body.sidebar-collapsed .admin-sidebar-link.active::before { left: -8px; }
body.sidebar-collapsed .admin-sidebar-group { margin-bottom: 8px; }
body.sidebar-collapsed .admin-sidebar-header { gap: 0; }
body.sidebar-collapsed .admin-sidebar-brand { display: none; }
body.sidebar-collapsed .admin-sidebar-toggle { display: inline-flex; }
body.sidebar-collapsed .admin-sidebar-footer { align-items: center; padding: 12px 8px; }
body.sidebar-collapsed .admin-sidebar-user { justify-content: center; }

.admin-sidebar-footer {
    flex-shrink: 0;
    padding: 10px 8px;
    border-top: 1px solid rgba(148, 163, 184, .15);
}

.admin-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}

.admin-sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-sidebar-user-name {
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar-user-role { color: #64748b; font-size: 11px; }

.admin-sidebar-user-links {
    display: flex;
    gap: 14px;
    padding: 6px 12px 4px;
}

.admin-sidebar-user-links a {
    color: #64748b;
    font-size: 12px;
    text-decoration: none;
    transition: color .15s;
}

.admin-sidebar-user-links a:hover { color: #f1f5f9; }

.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 890;
}

/* ===== 页面标题区 ===== */
.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
}

.admin-page-header-text { flex: 1 1 auto; min-width: 0; }

.admin-page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.admin-page-header h1 .ico {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: var(--shadow-colored);
}

.admin-page-header p {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
    overflow-wrap: break-word;
}

.admin-page-header-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

/* ===== 卡片/区块 ===== */
.admin-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
    transition: box-shadow 0.2s ease;
}

.admin-card:hover { box-shadow: var(--shadow); }

.admin-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* --- 班级卡片精修(classes.html) --- */
.admin-class-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.admin-class-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.admin-class-card .admin-class-num {
    font-size: 30px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    margin: var(--space-1) 0;
}

.admin-class-card .admin-class-num small {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.admin-class-card .admin-class-meta {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
    margin-top: var(--space-2);
}

.admin-class-card .admin-class-badge {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.admin-class-card .admin-class-badge.secondary {
    background: var(--bg-soft);
    color: var(--text-secondary);
}

.admin-class-card .card-actions { margin-top: var(--space-4); }

/* --- 学习日历热力图(student_detail) --- */
.calendar-heatmap { display: flex; flex-wrap: wrap; gap: 3px; line-height: 0; }

.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    display: inline-block;
}

.heatmap-l0 { background: #f1f5f9; }
.heatmap-l1 { background: #bfdbfe; }
.heatmap-l2 { background: #93c5fd; }
.heatmap-l3 { background: #60a5fa; }
.heatmap-l4 { background: #2563eb; }
.heatmap-l5 { background: #1d4ed8; }

.heatmap-legend { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--text-secondary); }

/* --- 迷你进度条 --- */
.progress-track {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.green { background: #10b981; }
.progress-fill.yellow { background: #f59e0b; }
.progress-fill.red { background: #ef4444; }

.progress-row { display: flex; align-items: center; gap: 8px; }

/* --- 徽章卡片 --- */
.badge-tile {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: center;
    min-width: 100px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.badge-tile:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }

.badge-tile .badge-tile-icon { font-size: 32px; }
.badge-tile .badge-tile-name { font-weight: 700; font-size: 14px; margin-top: 4px; }
.badge-tile .badge-tile-date { font-size: 11px; color: var(--text-muted); }

/* --- 知识点树缩进(admin_units) --- */
.unit-name-cell .unit-connector { color: var(--text-muted); }

.unit-name-cell.unit-root { font-weight: 700; color: #0f172a; }

.unit-level-0 { padding-left: 12px; }
.unit-level-1 { padding-left: 36px; }
.unit-level-2 { padding-left: 60px; }
.unit-level-3 { padding-left: 84px; }
.unit-level-4 { padding-left: 108px; }
.unit-level-5 { padding-left: 132px; }
.unit-level-6 { padding-left: 156px; }
.unit-level-7 { padding-left: 180px; }
.unit-level-8 { padding-left: 204px; }

/* --- 统计卡片(仪表盘/未深度改版页面通用) --- */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.admin-stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.admin-stat .num {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.admin-stat .label { color: var(--text-secondary); font-size: 13px; margin-top: var(--space-2); }

.admin-stat-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.admin-stat-link:hover { border-color: var(--primary); }

/* ===== 仪表盘专用 ===== */
.admin-dash-hero {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .28);
    margin-bottom: var(--space-6);
}

.admin-dash-hero-label { font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .85); }

.admin-dash-hero-num {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.admin-dash-hero-sub { font-size: 13px; color: rgba(255, 255, 255, .8); margin-top: 4px; }

.hero-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, .15);
}

.hero-delta.up { color: #a7f3d0; }
.hero-delta.down { color: #fecaca; }

.admin-dash-hero-spark { width: 220px; height: 64px; flex-shrink: 0; }

.admin-dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.admin-kpi {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    text-decoration: none;
    color: inherit;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.admin-kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }

.admin-kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.admin-kpi-icon.blue { background: var(--primary-soft); }
.admin-kpi-icon.green { background: var(--success-soft); }
.admin-kpi-icon.yellow { background: #fef3c7; }
.admin-kpi-icon.red { background: #fee2e2; }
.admin-kpi-icon.cyan { background: #cffafe; }
.admin-kpi-icon.purple { background: #ede9fe; }

.admin-kpi-info { min-width: 0; }

.admin-kpi-num {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.admin-kpi-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* 平台规模小胶囊行 */
.admin-meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.admin-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

.admin-meta-chip:hover { border-color: var(--primary); color: var(--primary); }
.admin-meta-chip b { color: #0f172a; font-variant-numeric: tabular-nums; }

/* 图表网格 */
.admin-grid { display: grid; gap: var(--space-4); margin-bottom: var(--space-6); }
/* minmax(0, …) 而非 1fr：1fr 等价于 minmax(auto, 1fr)，列的最小宽度会被内容
   （尤其是 Chart.js canvas，其内联宽度随容器变化）撑大，导致整行超出容器横向溢出 */
.admin-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.admin-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.admin-chart-box { position: relative; height: 260px; min-width: 0; overflow: hidden; }
.admin-chart-box > canvas { max-width: 100%; }

/* 告警墙不设固定高度、不内部滚动（此前 max-height+overflow 导致卡片留白+滚动条，用户反馈已移除） */
.admin-alert-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.admin-alert-item:last-child { border-bottom: none; }

/* --- 筛选栏 --- */
.admin-filter-bar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
}

.admin-filter-bar .row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
}

.admin-filter-bar .form-group { margin-bottom: 0; min-width: 140px; flex: 1; }

.admin-filter-bar label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.admin-filter-bar .form-input {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 9px 12px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-filter-bar .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* 分段控件(CSS-only 链接组) */
.admin-seg {
    display: inline-flex;
    gap: 2px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.admin-seg a {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.admin-seg a:hover { color: var(--text); }

.admin-seg a.active {
    background: #fff;
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* 分段标签内的计数徽标 */
.admin-seg a .seg-count {
    margin-left: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.admin-seg a.active .seg-count { color: var(--primary); }

.admin-filter-clear {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 0;
}

.admin-filter-clear:hover { color: var(--danger); }

/* --- 表格 --- */
.admin-table-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.admin-table-wrap--sticky {
    max-height: calc(100vh - 240px);
    overflow: auto;
}

.admin-table-wrap--sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.admin-table-wrap .table { width: 100%; border-collapse: collapse; margin: 0; }

.admin-table-wrap .table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table-wrap .table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    font-size: 14px;
    /* 列表行单行显示:短内容不折行;超宽时由外层容器横向滚动 */
    white-space: nowrap;
}

/* 长文本单元格(标题/描述):单行截断 + 省略号,悬浮 title 可看全文 */
.admin-table-wrap .table .admin-cell-clip {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* clip 单元格内的块级子元素(标题行/描述行)各自省略号截断 */
.admin-table-wrap .table .admin-cell-clip > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 个别内容型表格(如审计详情)允许折行的单元格加 .admin-cell-wrap 恢复自动换行 */
.admin-table-wrap .table td.admin-cell-wrap {
    white-space: normal;
    max-width: none;
    overflow: visible;
}

.admin-table-wrap .table tbody tr:last-child td { border-bottom: none; }
.admin-table-wrap .table tbody tr:hover { background: #f8fafc; }

.num-cell { font-variant-numeric: tabular-nums; }

/* --- 角色/状态标签 --- */
.admin-role,
.admin-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.admin-role::before,
.admin-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.admin-role-admin { background: #fee2e2; color: #991b1b; }
.admin-role-admin::before { background: #ef4444; }
.admin-role-teacher { background: #ffedd5; color: #9a3412; }
.admin-role-teacher::before { background: #f97316; }
.admin-role-student { background: #dbeafe; color: #1e40af; }
.admin-role-student::before { background: #2563eb; }

.admin-status-active { background: #d1fae5; color: #065f46; }
.admin-status-active::before { background: #10b981; }
.admin-status-inactive { background: #f3f4f6; color: #4b5563; }
.admin-status-inactive::before { background: #9ca3af; }
.admin-status-pending { background: #fef3c7; color: #92400e; }
.admin-status-pending::before { background: #f59e0b; }
.admin-status-approved { background: #d1fae5; color: #065f46; }
.admin-status-approved::before { background: #10b981; }
.admin-status-rejected { background: #fee2e2; color: #991b1b; }
.admin-status-rejected::before { background: #ef4444; }
.admin-status-draft { background: #f3f4f6; color: #4b5563; }
.admin-status-draft::before { background: #9ca3af; }
.admin-status-ongoing { background: #dbeafe; color: #1e40af; }
.admin-status-ongoing::before { background: #2563eb; }
.admin-status-ended { background: #f3f4f6; color: #4b5563; }
.admin-status-ended::before { background: #9ca3af; }
.admin-status-closed { background: #fee2e2; color: #991b1b; }
.admin-status-closed::before { background: #ef4444; }

.admin-verified {
    margin-left: 6px;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #d1fae5;
    color: #065f46;
}

/* --- 操作按钮组 --- */
/* 操作列全部按钮平铺展示,保持单行不折行;整行超宽时随表格横向滚动 */
.admin-actions { display: flex; gap: var(--space-2); flex-wrap: nowrap; align-items: center; }
.admin-actions .btn { white-space: nowrap; flex-shrink: 0; }
.admin-actions form { margin: 0; display: inline-flex; }

/* --- 批量操作条 --- */
.admin-batch-bar {
    position: sticky;
    bottom: 12px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 10px 16px;
    margin-bottom: var(--space-4);
}

.admin-batch-bar select { max-width: 180px; }

.admin-batch-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.admin-batch-count b { color: var(--primary); font-variant-numeric: tabular-nums; }

/* --- 知识库操作按钮:统一样式、紧凑尺寸,文字与表格一致 --- */
.kb-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
}
.kb-act.edit { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.kb-act.edit:hover { background: #dbeafe; }
.kb-act.preview { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.kb-act.preview:hover { background: #f1f5f9; }
.kb-act.del { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.kb-act.del:hover { background: #fee2e2; }
.kb-act.design { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.kb-act.design:hover { background: #ede9fe; }
.kb-act.off { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.kb-act.off:hover { background: #fef3c7; }
.kb-act.on { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.kb-act.on:hover { background: #d1fae5; }

/* --- 快速操作 --- */
.admin-quick-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
}

.admin-quick-actions .btn { box-shadow: var(--shadow-sm); }

/* --- 空状态(两档) --- */
.admin-empty {
    text-align: center;
    padding: var(--space-10) var(--space-4);
    color: var(--text-muted);
}

.admin-empty-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: var(--space-3);
}

.admin-empty p { margin: 0 0 var(--space-4); font-size: 14px; }

.admin-empty-filtered .admin-empty-icon { font-size: 34px; }

/* --- 分页 --- */
.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-6);
    flex-wrap: wrap;
}

.admin-pagination .page-info {
    color: var(--text-secondary);
    font-size: 14px;
    margin-right: var(--space-3);
}

.admin-pagination a,
.admin-pagination .page-num,
.admin-pagination .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all .15s;
}

.admin-pagination a:hover { background: var(--bg-soft); color: var(--text); }

.admin-pagination .current {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 8px rgba(37, 99, 235, .3);
}

.admin-pagination a.disabled,
.admin-pagination span.disabled {
    opacity: .4;
    pointer-events: none;
}

/* --- 适配中等屏幕 --- */
@media (max-width: 1024px) {
    .admin-grid-2-1,
    .admin-grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* --- 适配移动端(基础;抽屉逻辑在 mobile.css) --- */
@media (max-width: 768px) {
    .admin-page-header { align-items: flex-start; flex-direction: column; }
    .admin-page-header h1 { font-size: 22px; }
    .admin-dash-hero-spark { width: 100%; }
    .admin-filter-bar .row { flex-direction: column; align-items: stretch; }
    .admin-filter-bar .form-group { min-width: auto; }
    .admin-table-wrap { overflow-x: auto; }
    .admin-table-wrap--sticky { max-height: none; }
}

/* ===== AI 生题弹窗 ===== */
.ai-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.ai-modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%; max-width: 920px; max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow);
}
.ai-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.ai-modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; color: #0f172a; }
.ai-close {
    border: none; background: none;
    font-size: 20px; line-height: 1; cursor: pointer;
    color: var(--text-secondary); padding: 4px 8px; border-radius: 6px;
}
.ai-close:hover { background: var(--bg-soft); color: var(--text); }
.ai-modal-body { padding: 16px 20px; overflow-y: auto; }
.ai-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex; gap: 12px; align-items: center;
    background: #fff;
}
.ai-modal-footer label { font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.ai-param-form {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    padding: 12px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    margin-bottom: 14px;
}
.ai-param-form .form-group { min-width: 140px; margin-bottom: 0; }
.ai-feedback {
    padding: 10px 14px; border-radius: var(--radius);
    margin-bottom: 12px; display: none; font-size: 13px;
}
.ai-feedback.error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.ai-feedback.success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.ai-candidate-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px; margin-bottom: 12px;
    background: #fff;
}
.ai-candidate-card.invalid {
    border-color: #fca5a5;
    border-left: 4px solid #ef4444;
}
.ai-card-head {
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 10px;
}
.ai-card-head input[type="checkbox"] { margin-top: 4px; transform: scale(1.15); }
.ai-card-head .ai-title { flex: 1; }
.ai-card-head .ai-badges { flex-shrink: 0; display: flex; gap: 6px; align-items: center; }
.ai-card-head .ai-badges .badge { font-size: 12px; }
.ai-card-head label { margin-bottom: 3px; }
.ai-candidate-card .ai-fields {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin-top: 8px;
}
.ai-candidate-card .ai-fields .ai-span-2 { grid-column: span 2; }
.ai-candidate-card label {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    display: block; margin-bottom: 3px;
}
.ai-candidate-card input, .ai-candidate-card textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 8px; font-size: 13px;
    font-family: inherit;
}
.ai-candidate-card textarea.ai-json {
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 12px; min-height: 90px; line-height: 1.45;
}
.ai-err { color: #dc2626; font-size: 12px; margin: 8px 0 0; padding-left: 18px; }
.ai-err li { margin: 2px 0; }
.ai-spinner {
    display: inline-block; width: 14px; height: 14px; margin-right: 6px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff; border-radius: 50%;
    animation: ai-spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-muted { font-size: 12px; color: var(--text-secondary); }
/* AI 弹窗内类型下拉：与徽章观感一致 */
.ai-badges select {
    padding: 4px 8px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--border); border-radius: 6px;
    background: #fff; color: #334155;
}
.ai-badges select:focus { outline: none; border-color: #2563eb; }

/* ===== 三列栅格 ===== */
.admin-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) {
    .admin-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-grid-3 > :last-child { grid-column: span 2; }
}
@media (max-width: 768px) {
    .admin-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .admin-grid-3 > :last-child { grid-column: auto; }
}

/* ===== 活动动态 feed ===== */
.admin-act-feed {
    max-height: 460px; overflow-y: auto;
    display: flex; flex-direction: column;
}
.admin-act-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 8px; border-bottom: 1px dashed var(--border);
}
.admin-act-item:last-child { border-bottom: none; }
.admin-act-icon {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; background: var(--bg-soft);
}
.admin-act-icon--success { background: #d1fae5; }
.admin-act-icon--danger { background: #fee2e2; }
.admin-act-icon--warning { background: #fef3c7; }
.admin-act-icon--info { background: #dbeafe; }
.admin-act-body { flex: 1; min-width: 0; }
.admin-act-line { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.admin-act-line .text-muted { font-size: 12px; }
.admin-act-sub {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-top: 3px; font-size: 12px; color: var(--text-secondary);
}
.admin-act-target {
    max-width: 300px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.admin-act-result { font-weight: 600; }
.admin-act-result.ok { color: #059669; }
.admin-act-result.bad { color: #dc2626; }
.admin-act-time { margin-left: auto; color: var(--text-muted); white-space: nowrap; }

/* ===== 教师详情页 ===== */
.admin-name-link {
    color: var(--text); font-weight: 600; text-decoration: none;
    border-bottom: 1px dashed #2563eb;
}
.admin-name-link:hover { color: #2563eb; }
.admin-detail-list { display: flex; flex-direction: column; }
.admin-detail-row {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 10px 2px; border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
}
.admin-detail-row:last-child { border-bottom: none; }
.admin-detail-key { color: var(--text-secondary); flex-shrink: 0; }
.admin-detail-val { text-align: right; min-width: 0; }
