/* ============================================
   教学执事面板 - 设计系统
   关键决策：系统名称整体更名为“教学执事面板”，设计系统头部的系统标题同步更新。
   设计决策：深色侧边栏 + 浅色内容区，专业学术风格
   ============================================ */

/* ---- CSS Variables (Design Tokens) ---- */
:root {
    /* 主色调 - 学术蓝，调至微调活力 */
    --primary: #4f6ef7;
    --primary-dark: #3754e3;
    --primary-light: #7b93fa;
    --primary-bg: rgba(79, 110, 247, 0.08);

    /* 语义色 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* 中性色 - 关键决策说明：
       背景调和至更明快轻盈的灰蓝色 (#f4f6fa)，以代替原有的粗糙暗灰，整体看起来更有飞书、Notion 的现代办公质感。 */
    --bg-page: #f4f6fa;
    --bg-card: #ffffff;
    --bg-sidebar: linear-gradient(180deg, #131728 0%, #1e243f 100%);
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg-sidebar-active: rgba(255, 255, 255, 0.12);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* 阴影 - 关键决策说明：
       重构为极轻缓、大范围的柔和散光（Soft Ambient Shadow），代替原本突兀明显的重影，从而在卡片堆叠时呈现精致的浮雕效果。 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 20px -2px rgba(0, 0, 0, 0.04), 0 2px 8px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 40px -4px rgba(0, 0, 0, 0.06), 0 4px 16px -2px rgba(0, 0, 0, 0.02);

    /* 圆角 - 关键决策说明：
       全面优化圆角梯度，卡片提升至 12px，表单/按钮提升至 8px，提升系统的柔和美感和现代扁平化亲和感。 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* 字体 */
    --font-sans: 'Noto Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* 布局 */
    --sidebar-width: 240px;
}

/* ---- Global Scrollbar - 关键决策说明：
   自定义全局现代小巧滚动条，规避浏览器默认粗丑的滚动条。亮色背景下用轻微透明灰，深色区域（如侧边栏）下用淡白，提升品质感。 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.22);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(19, 23, 40, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.nav-menu {
    list-style: none;
    padding: 16px 8px;
    flex: 1;
    overflow-y: auto;
}
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
.nav-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

.nav-item {
    margin-bottom: 4px;
}

/* 关键决策说明：
   取消激活菜单左侧传统的 3px border，改为“悬浮胶囊卡片（Capsule）”式的高亮状态，
   并且配合微弱的阴影，让侧边栏层次感更为饱满。 */
.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item a:hover {
    background: var(--bg-sidebar-hover);
    color: #f1f5f9;
}

.nav-item.active a {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* 如果支持，激活菜单可以用主色渐变高亮 */
.nav-item.active a {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.25);
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.04);
    color: var(--text-sidebar);
    font-size: 11px;
    text-align: center;
    opacity: 0.5;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    /* 关键决策说明：
       由于整个页面框架采用 Flexbox 布局（.app-layout 为 display: flex），
       作为 flex 容器子项的 .main-content 必须显式设置 min-width: 0;
       以覆盖浏览器默认的 min-width: auto。这能让其允许收缩以适应视口，
       而不会被其内部极宽的表格无限撑大，从而避免了浏览器层级产生横向溢出滚动条。 */
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.content-body {
    padding: 24px 32px;
}

/* ---- Cards ---- */
/* 关键决策说明：
   为卡片和统计面板设置 cubic-bezier 过渡动画，使悬停时上浮 3px 的物理效果平滑有弹性。
   微弱淡入的边框颜色变化（border-color 0.3s ease）增强了聚焦状态，摆脱了原本直接变换的生硬感。 */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 110, 247, 0.18);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* ---- Stat Cards ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 110, 247, 0.18);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: rgba(79, 110, 247, 0.08); color: var(--primary); }
.stat-icon.green { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.08); color: #8b5cf6; }

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---- Tables ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 2px solid var(--border-light);
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: #334155;
}

.data-table tr {
    transition: background-color 0.2s ease;
}

.data-table tr:hover td {
    background: rgba(79, 110, 247, 0.035);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ---- Buttons ---- */
/* 关键决策说明：
   为按钮引入微弱的缩放点击反馈（active { transform: scale(0.97) }），并升级悬停下的发光阴影与平滑过渡，
   从而赋予用户一种坚实的“物理按钮被按下”的直观响应。 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-family: var(--font-sans);
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}
.btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px rgba(79, 110, 247, 0.35);
}

.btn-secondary {
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}
.btn-success:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}
.btn-danger:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

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

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

/* 关键决策说明：
   表单控件输入框在 Focus 时引入淡蓝色的呼吸光晕阴影，
   并为背景、边框的交互转换应用渐变动效，在各种屏幕尺寸下获得优异视觉反馈。 */
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
    background: #fcfdfe;
    color: var(--text-primary);
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ---- Upload Area ---- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-card);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-text { font-size: 15px; color: var(--text-secondary); }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: rgba(34,197,94,0.1); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }

/* ---- Toast / Alert ---- */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---- Loading ---- */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 15px; }

/* ---- Grid Helpers ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ============================================
   报告页面专用样式
   ============================================ */

/* ---- Report Layout (无侧边栏，全屏报告) ---- */
.report-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px;
    background: var(--bg-card);
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
}

/* 关键决策说明：
   为报告头部加上微弱优雅的淡蓝色内发光与底部主色渐变线条，
   使用户在预览及下载 PDF 打印时，能体会到类似出版物版面的高级感。 */
.report-header {
    text-align: center;
    padding: 36px 20px;
    background: linear-gradient(180deg, rgba(79, 110, 247, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, transparent 10%, var(--primary) 50%, transparent 90%) 1;
    margin-bottom: 36px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.report-student-name {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.report-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 6px;
    text-indent: 6px;
    margin-bottom: 12px;
}

.report-meta {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 16px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.report-meta span { display: flex; align-items: center; gap: 6px; }

/* ---- Report Sections ---- */
.report-section {
    margin-bottom: 36px;
}

/* 关键决策说明：
   报告标题彩条背景改用更加温和精细的双色渐变线，
   配以微微的背景融合及左侧 4px 彩条，使得阅读段落指引时视觉聚焦度倍增。 */
.report-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 11px 18px;
    background: linear-gradient(90deg, rgba(79, 110, 247, 0.08) 0%, rgba(79, 110, 247, 0.01) 100%);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Report Score Table ---- */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.report-table th {
    background: #f8fafc;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    text-align: center;
}

.report-table td {
    padding: 12px 14px;
    border: 1px solid var(--border);
    text-align: center;
    font-size: 13.5px;
    color: #334155;
}

.report-table tr:hover td {
    background: rgba(79, 110, 247, 0.02);
}

.report-table .score-high { color: var(--success); font-weight: 600; }
.report-table .score-mid { color: var(--warning); font-weight: 600; }
.report-table .score-low { color: var(--danger); font-weight: 600; }

/* ---- Chart Containers ---- */
.chart-container {
    width: 100%;
    height: 350px;
    margin: 16px 0;
}

.chart-container-sm { height: 280px; }
.chart-container-lg { height: 420px; }

/* ---- Comment Block ---- */
/* 关键决策说明：
   评语块背景使用高雅的极淡紫色到淡蓝色的柔和对角渐变（#f3f7ff 到 #faf6ff），
   并在左侧引入主色实体边线，比原先单调颜色填充更能传递教师关怀的温度感。 */
.comment-block {
    background: linear-gradient(135deg, #f3f7ff 0%, #faf6ff 100%);
    border-radius: var(--radius-md);
    padding: 22px 26px;
    margin: 16px 0;
    border: 1px solid rgba(79, 110, 247, 0.08);
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.02);
}

.comment-category {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.comment-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ---- Progress Bar ---- */
/* 关键决策说明：
   进度条槽位加入微弱的内阴影，填充条加入色彩渐变（如绿到淡绿，黄到淡黄），
   使其拥有精致的微立体感，避免扁平设计流于单调粗糙。 */
.progress-bar {
    height: 8px;
    background: #f1f5f9;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.high { background: linear-gradient(90deg, #10b981 0%, #34d399 100%); }
.progress-fill.mid { background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%); }
.progress-fill.low { background: linear-gradient(90deg, #ef4444 0%, #f87171 100%); }

/* ---- Score Comparison Row ---- */
.score-compare-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.score-compare-label {
    width: 80px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.score-compare-bar { flex: 1; }

.score-compare-value {
    width: 60px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
}

/* ---- Print Styles ---- */
@media print {
    .sidebar, .page-header, .page-actions, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .report-layout { padding: 16px; max-width: none; }
    .report-section { break-inside: avoid; }
    .chart-container { break-inside: avoid; }
    body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================
   认证 / 权限管理系统 UI
   ============================================ */

/* ---- 登录页 ---- */
/* 关键决策说明：
   登录背景由单调双色渐变，重构为带有科技蓝散射晕染的光晕辐射纹理。
   通过伪元素引入斜切光圈，使用户进入系统的一瞬间被“智能分析”的高级感所触动。 */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(26, 31, 54, 1) 0%, rgba(15, 18, 32, 1) 90.2%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-body::before, .login-body::after {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 110, 247, 0.12) 0%, rgba(79, 110, 247, 0) 70%);
    z-index: 1;
    pointer-events: none;
}

.login-body::before { top: -100px; left: -100px; }
.login-body::after { bottom: -100px; right: -100px; }

.login-container { width: 100%; max-width: 420px; z-index: 2; }

/* 关键决策说明：
   登录卡片采用微磨砂玻璃拟态效果，搭配高透白色内描边与柔和下阴影，
   在暗色深邃背景的衬托下极具层次深度，完全拉开与廉价后台模版的距离。 */
.login-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 44px 38px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { font-size: 44px; margin-bottom: 12px; filter: drop-shadow(0 4px 8px rgba(79,110,247,0.2)); }
.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.login-subtitle { color: #64748b; font-size: 13.5px; }

.login-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}
.login-tab {
    flex: 1;
    padding: 9px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.login-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.login-form .form-group { margin-bottom: 18px; }
.btn-block { width: 100%; display: block; }
.login-footer {
    text-align: center;
    margin-top: 24px;
    color: #94a3b8;
}
.sms-row { display: flex; gap: 8px; }
.sms-row .form-control { flex: 1; }
.btn-send-code { white-space: nowrap; min-width: 108px; }
.form-hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.hidden { display: none !important; }

/* ---- 用户菜单 (顶部) ---- */
.page-actions-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}
.user-menu { position: relative; }
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}
.user-menu-trigger:hover { border-color: var(--primary); }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.user-name { font-weight: 500; color: var(--text-primary); }
.user-role-chip {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
/* 关键决策说明：
   限制班级标签容器的最大宽度并允许其折行，
   以防止因班级字段过长将左右列强行压缩，确保 UI 布局美观、规整。 */
.class-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 250px;
}
.class-tag {
    display: inline-block;
    padding: 2px 6px;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.class-tag.class-tag-more {
    background: #e5e7eb;
    color: #374151;
    cursor: help;
}
.user-caret { color: var(--text-muted); font-size: 10px; }
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 100;
    transform-origin: top right;
}
.user-menu.open .user-menu-dropdown {
    display: block;
    animation: fadeInScale 0.2s ease;
}
.user-menu-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
}
.user-menu-item:hover { background: var(--bg-page); }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 31, 54, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ---- Account page ---- */
.info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.info-row:last-child { border-bottom: none; }
.info-label {
    width: 120px;
    color: var(--text-secondary);
    font-weight: 500;
}
.alert-info {
    padding: 10px 14px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 3px solid var(--primary);
}
.mt-16 { margin-top: 16px; }

/* ---- Sidebar nav section title ---- */
.nav-section-group {
    list-style: none;
}
.nav-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 18px 20px 8px;
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.nav-section-title:hover {
    color: var(--text-sidebar-active);
}
.section-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-section-title:hover .section-arrow {
    opacity: 0.9;
}
.nav-section-group:not(.collapsed) .section-arrow {
    transform: rotate(90deg);
}
.nav-section-children {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease;
}
.nav-section-group.collapsed .nav-section-children {
    max-height: 0;
}

/* ---- 角色权限矩阵 (飞书风格) ---- */
.role-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: flex-start;
}
.role-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: sticky;
    top: 16px;
}
.role-list-header {
    padding: 14px 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
}
.role-list { list-style: none; padding: 8px; max-height: 70vh; overflow-y: auto; }
.role-card {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.role-card:hover { background: var(--bg-page); }
.role-card.active {
    background: var(--primary-bg);
    box-shadow: inset 3px 0 0 var(--primary);
}
.role-card-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.role-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.role-tag {
    display: inline-block;
    padding: 1px 6px;
    background: var(--border-light);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}
.role-detail {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    min-height: 60vh;
}
.role-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 18px;
    gap: 16px;
}
.role-detail-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}
.role-detail-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}
.role-code {
    font-family: monospace;
    background: var(--bg-page);
    padding: 2px 8px;
    border-radius: 4px;
}
.role-perm-count { color: var(--primary); font-weight: 600; }
.role-detail-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 8px;
}
.role-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.perm-matrix { display: flex; flex-direction: column; gap: 12px; }
.perm-module {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.perm-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-light);
}
.perm-module-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.perm-module-name { font-weight: 600; font-size: 14px; }
.perm-module-count {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 8px;
    background: var(--bg-card);
    border-radius: 999px;
}
.perm-module-body { padding: 4px 0; }
.perm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}
.perm-row:first-child { border-top: none; }
.perm-row.is-locked { opacity: 0.6; }
.perm-info { flex: 1; }
.perm-name { font-size: 14px; font-weight: 500; }
.perm-code {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 2px;
}

/* ---- iOS 风格 Toggle Switch ---- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: 0.25s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input:disabled + .toggle-slider { cursor: not-allowed; opacity: 0.6; }
.toggle-switch-sm { width: 36px; height: 20px; }
.toggle-switch-sm .toggle-slider::before { width: 16px; height: 16px; }
.toggle-switch-sm input:checked + .toggle-slider::before { transform: translateX(16px); }

.badge-muted { background: var(--border-light); color: var(--text-secondary); }

/* ---- Dropdown Menu (Fixed from absolute modal) ---- */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 180px;
    padding: 6px 0;
    animation: fadeInScale 0.2s ease;
    transform-origin: top right;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: var(--bg-page);
    color: var(--primary);
}

.dropdown-item i {
    font-size: 14px;
    opacity: 0.7;
}

/* ==========================================================================
   关键设计决策说明：
   1. 为了实现酷似 Excel 的多维筛选交互，我们将表头设为可触发状态（.th-filterable），并在右侧空出 24px 以便容纳漏斗指示图标。
   2. 为了在视觉上直观提醒用户“哪些列已被应用了过滤”，当该列存在有效过滤条件时，.filter-icon.active 将点亮成系统主色（蓝色），其余列则维持柔和的浅灰色以减少视觉噪音。
   3. 筛选弹框（.filter-popover）采用 backdrop-filter 的磨砂玻璃感设计，配合柔和阴影，在与数据表格重叠时能维持极好的立体深度层次，防止内容粘连。
   4. z-index 设为 1050，确保其高于页面内的表格粘性表头（sticky th）与部分基础卡片，但低于模态遮罩层（通常为 1100+），维持正确的图层堆叠顺序。
   ========================================================================== */
.th-filterable {
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-right: 28px !important;
    transition: background-color 0.2s ease;
}

.th-filterable:hover {
    background-color: #f1f5f9 !important;
}

.filter-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: transparent;
}

.th-filterable:hover .filter-icon {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
}

.filter-icon.active {
    color: var(--primary) !important;
    background: var(--primary-bg) !important;
    font-weight: bold;
}

.filter-popover {
    position: absolute;
    z-index: 1050;
    width: 230px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
    animation: fadeInScale 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-popover.show {
    display: flex;
}

.filter-popover-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.filter-popover-search:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 110, 247, 0.1);
}

.filter-popover-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0;
    border-top: 1px solid var(--border-light);
    padding-top: 6px;
}

.filter-popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    user-select: none;
    transition: background 0.15s ease;
}

.filter-popover-item:hover {
    background-color: var(--bg-page);
}

.filter-popover-item input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

.filter-popover-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
}

.filter-popover-footer .btn {
    padding: 5px 10px;
    font-size: 11.5px;
    border-radius: 4px;
}

/* ==========================================================================
   关键设计决策说明：
   1. 为了防止表格在大数据量、多列状态下由于浏览器默认缩放折行导致按钮换行、状态重影等极为难看的排版缺陷，
      我们对 .data-table 的 th 和 td 应用了 white-space: nowrap，彻底杜绝换行。
   2. 同时，为了使页面不被撑爆，给包含表格的 .card-body 容器引入横向溢出滚动（overflow-x: auto），
      保证在大尺寸表格下通过轻微手势或横向滚动条平滑浏览，维护了高品质的管理后台排版规范。
   ========================================================================== */
.data-table th,
.data-table td {
    white-space: nowrap !important;
}

.card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   关键设计决策说明：
   1. 为了实现将表格滚动条移到列表上方的功能，我们通过 CSS 对 .card-body 原生的 x 轴滚动条进行隐藏（高度设为 0），
      然后为表格上方引入自定义的同步滚动条 wrapper（.top-scrollbar-wrapper）。
   2. 上方滚动条在表格无溢出时不显示（display: none），在溢出时通过 JS 变更为 block。
   3. 列选项拖动项（.column-drag-item）采用简洁的轻量卡片布局，使用 flex 布局对齐元素，
      设定 grab 鼠标指针提示，配合 sortable-ghost 实现纵向拖拽时极富弹性的视觉占位过渡效果。
   ========================================================================== */
.card-body::-webkit-scrollbar {
    height: 0px !important;
}

.top-scrollbar-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    height: 10px;
    background: #f1f5f9;
    border-radius: 99px;
    margin-bottom: 12px;
    display: none;
    transition: all 0.2s ease;
}

.top-scrollbar-wrapper::-webkit-scrollbar {
    height: 8px;
}

.top-scrollbar-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.top-scrollbar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(79, 110, 247, 0.35);
    border-radius: 99px;
    border: 1px solid transparent;
}

.top-scrollbar-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.top-scrollbar-scroll {
    height: 1px;
}

.column-drag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.column-drag-item:hover {
    background-color: #f8fafc;
    border-color: var(--primary-light);
}

.column-drag-item:active {
    cursor: grabbing;
}

.column-drag-item.sortable-ghost {
    opacity: 0.35;
    background-color: var(--primary-bg);
    border: 1.5px dashed var(--primary-light);
}

.column-drag-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.column-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 16px;
    padding: 0 4px;
    user-select: none;
}

.column-drag-item.mandatory-column {
    background-color: #f8fafc;
    border-color: var(--border-light);
    opacity: 0.8;
}

.column-drag-item.mandatory-column .column-drag-handle {
    cursor: not-allowed;
    opacity: 0.4;
}

/* 关键决策说明：
   1. 引入独立的表格横向滚动容器 .table-responsive，其根本目的是为了打破 `.card-body` 
      横向滚动容器对内部 `position: absolute / fixed` 元素的空间限制。这样，表格上方的
      同步滚动条 wrapper 能够完美保持在原位，而不被随表格一起滚出屏幕。
   2. 为了在视觉上达到“滚动条放置在表头上方的单滚动条”体验，我们需要在所有主流浏览器
      （Chrome、Firefox、Safari、IE/Edge）中，将这个包裹表格的原生底部滚动条完全隐藏。 */
.table-responsive {
    /* 关键决策说明：
       在此显式地对表格滚动容器设置 width: 100% 与 max-width: 100%，
       强制将其最大可视宽度限制在父容器（Card-body）的物理边框范围内，
       阻止其不受限制地被内部 Table 的 nowrap 单元格撑大。 */
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;  /* 针对 IE 和 Edge 浏览器隐藏底部原生滚动条 */
    scrollbar-width: none;  /* 针对 Firefox 浏览器隐藏底部原生滚动条 */
}

.table-responsive::-webkit-scrollbar {
    display: none !important;  /* 针对 Webkit 内核（Chrome、Safari、新版 Edge）隐藏底部原生滚动条 */
    height: 0px !important;
}



