/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4F6EF7;
  --primary-light: #EEF1FD;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --purple: #8B5CF6;
  --sidebar-w: 220px;
  --top-h: 60px;
  --bg: #F3F5FA;
  --card: #fff;
  --border: #E5E7EB;
  --text: #1F2937;
  --text-muted: #6B7280;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.07);
  --shadow-md: 0 4px 24px rgba(0,0,0,.10);
}
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ===== Layout ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: #1E293B; color: #fff;
  display: flex; flex-direction: column;
  transition: width .25s; overflow: hidden;
  z-index: 100;
}
.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar-header { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.logo-icon { font-size: 22px; flex-shrink: 0; }
.logo-text { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.sidebar.collapsed .logo-text, .sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; color: rgba(255,255,255,.65);
  text-decoration: none; transition: all .18s; white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.feishu-badge { font-size: 12px; color: rgba(255,255,255,.5); display: flex; align-items: center; gap: 6px; }

/* ===== Main ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar {
  height: var(--top-h); background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
  flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.menu-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.page-title { flex: 1; font-size: 17px; font-weight: 600; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.page-container { flex: 1; overflow-y: auto; padding: 20px; }

/* ===== Pages ===== */
.page { display: none; }
.page.active { display: block; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Stats Grid ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}
.stat-blue { border-left-color: var(--primary); }
.stat-green { border-left-color: var(--success); }
.stat-orange { border-left-color: var(--warning); }
.stat-purple { border-left-color: var(--purple); }
.stat-icon { font-size: 32px; }
.stat-num { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== Dashboard Row ===== */
.dashboard-row { display: flex; gap: 16px; margin-bottom: 20px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* ===== Card ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { font-size: 15px; font-weight: 600; }

/* ===== Activity List ===== */
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 8px; background: var(--bg); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-text { flex: 1; font-size: 13px; line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--text-muted); }

/* ===== Today Classes ===== */
.today-classes { display: flex; flex-direction: column; gap: 10px; }
.today-class-item { padding: 10px 14px; border-radius: 8px; background: var(--primary-light); border-left: 3px solid var(--primary); }
.today-class-name { font-weight: 600; font-size: 13px; }
.today-class-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== Page Actions ===== */
.page-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

/* ===== Class Grid ===== */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.class-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); cursor: pointer; transition: all .2s;
  border: 2px solid transparent; position: relative; overflow: hidden;
}
.class-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-2px); }
.class-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.class-name { font-size: 17px; font-weight: 700; }
.class-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.class-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.class-stat-item { background: var(--bg); border-radius: 8px; padding: 8px 12px; }
.class-stat-num { font-size: 20px; font-weight: 700; }
.class-stat-label { font-size: 11px; color: var(--text-muted); }
.class-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.class-color-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; }
.table thead th { background: var(--bg); padding: 10px 14px; text-align: left; font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; border-bottom: 2px solid var(--border); }
.table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table tbody tr:hover td { background: var(--primary-light); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== Kanban ===== */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kanban-col { background: var(--bg); border-radius: var(--radius); padding: 14px; min-height: 480px; }
.kanban-col-header { font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.pending-header  { background: #FEF3C7; color: #92400E; }
.assigned-header { background: #DBEAFE; color: #1E40AF; }
.grading-header  { background: #EDE9FE; color: #5B21B6; }
.done-header     { background: #D1FAE5; color: #065F46; }
.kanban-items { display: flex; flex-direction: column; gap: 10px; }
.kanban-card {
  background: var(--card); border-radius: 10px; padding: 14px;
  box-shadow: var(--shadow); cursor: grab; transition: all .18s;
  border: 1px solid var(--border);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.kanban-card-class { font-size: 12px; color: var(--primary); font-weight: 500; }
.kanban-card-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.kanban-card-ta { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.kanban-card-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ===== Settlement ===== */
.settlement-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.settle-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); text-align: center; }
.settle-card-num { font-size: 30px; font-weight: 700; color: var(--primary); }
.settle-card-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== Buttons ===== */
.btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .18s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-notify  { background: #00B96B; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

/* ===== Form Controls ===== */
.input, .select, .textarea {
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; transition: border-color .18s; background: var(--card);
  color: var(--text);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.select { cursor: pointer; }
.textarea { resize: vertical; min-height: 80px; width: 100%; }
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 500; margin-bottom: 6px; display: block; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-control { width: 100%; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 999; display: none; }
.modal-overlay.show { display: block; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.95);
  background: var(--card); border-radius: 16px; width: 90%; max-width: 540px;
  max-height: 85vh; overflow-y: auto; z-index: 1000;
  box-shadow: 0 20px 60px rgba(0,0,0,.2); display: none; padding: 0;
  transition: transform .2s;
}
.modal.show { display: block; transform: translate(-50%, -50%) scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px 24px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Status Badge ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-pending  { background: #FEF3C7; color: #92400E; }
.badge-assigned { background: #DBEAFE; color: #1E40AF; }
.badge-grading  { background: #EDE9FE; color: #5B21B6; }
.badge-done     { background: #D1FAE5; color: #065F46; }
.badge-paid     { background: #D1FAE5; color: #065F46; }
.badge-unpaid   { background: #FEE2E2; color: #991B1B; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1E293B; color: #fff; padding: 12px 24px; border-radius: 30px;
  font-size: 14px; opacity: 0; transition: all .3s; z-index: 9999; white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Calendar Custom ===== */
.fc { font-size: 13px; }
.fc-toolbar-title { font-size: 16px !important; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; height: 100vh; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.mobile-open { transform: translateX(0); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .dashboard-row { flex-direction: column; }
  .settlement-summary { grid-template-columns: 1fr; }
}

/* ===== Color Themes ===== */
.color-0 { background: linear-gradient(135deg, #4F6EF7, #7C3AED); }
.color-1 { background: linear-gradient(135deg, #22C55E, #16A34A); }
.color-2 { background: linear-gradient(135deg, #F59E0B, #D97706); }
.color-3 { background: linear-gradient(135deg, #EF4444, #DC2626); }
.color-4 { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }
.color-5 { background: linear-gradient(135deg, #06B6D4, #0891B2); }
.color-6 { background: linear-gradient(135deg, #EC4899, #DB2777); }
.color-7 { background: linear-gradient(135deg, #F97316, #EA580C); }

.text-0 { color: #4F6EF7; } .text-1 { color: #22C55E; } .text-2 { color: #F59E0B; }
.text-3 { color: #EF4444; } .text-4 { color: #8B5CF6; } .text-5 { color: #06B6D4; }
.text-6 { color: #EC4899; } .text-7 { color: #F97316; }
.bg-0 { background: #EEF1FD; } .bg-1 { background: #DCFCE7; } .bg-2 { background: #FEF3C7; }
.bg-3 { background: #FEE2E2; } .bg-4 { background: #EDE9FE; } .bg-5 { background: #CFFAFE; }
.bg-6 { background: #FCE7F3; } .bg-7 { background: #FFEDD5; }

/* ===== 登录页 ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1E293B 0%, #4F6EF7 100%); }
.login-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { font-size: 48px; text-align: center; margin-bottom: 12px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 4px; }
.login-hint { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.login-hint a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ===== 角色徽章 ===== */
.role-badge { padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.role-admin { background: #FEF3C7; color: #92400E; }
.role-ta    { background: #D1FAE5; color: #065F46; }

/* ===== 用户侧边栏信息 ===== */
.user-info-sidebar { padding: 4px 0 8px; }

/* 侧边栏底部退出按钮 */
.sidebar-footer .btn-outline {
  border-color: rgba(255,255,255,.3);
  color: rgba(255,255,255,.8);
}
.sidebar-footer .btn-outline:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ===== 页签 ===== */
.page-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-btn { background: none; border: none; padding: 10px 18px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .18s; border-radius: 6px 6px 0 0; }
.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }

/* ===== 提交统计行 ===== */
.submissions-stats { margin-bottom: 14px; }
.sub-stat-row { display: flex; align-items: center; gap: 16px; background: var(--card); border-radius: var(--radius); padding: 14px 20px; box-shadow: var(--shadow); flex-wrap: wrap; }
.sub-stat-item { display: flex; align-items: center; gap: 8px; }
.sub-stat-num { font-size: 22px; font-weight: 700; }
.sub-stat-label { font-size: 12px; color: var(--text-muted); }
.sub-stat-item.ok     .sub-stat-num { color: var(--success); }
.sub-stat-item.warn   .sub-stat-num { color: var(--warning); }
.sub-stat-item.danger .sub-stat-num { color: var(--danger); }
.sub-stat-item.purple .sub-stat-num { color: var(--purple); }

/* ===== 批改弹窗 ===== */
.sub-info-box { background: var(--bg); border-radius: 8px; padding: 12px; margin-bottom: 16px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.link { color: var(--primary); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ===== 作业类型卡片 ===== */
.hw-types-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.hw-type-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start; border: 1.5px solid var(--border); transition: all .18s; }
.hw-type-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.hw-type-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.hw-type-info { flex: 1; }
.hw-type-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.hw-type-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.hw-type-price { display: flex; align-items: baseline; gap: 6px; }
.price-label { font-size: 12px; color: var(--text-muted); }
.price-value { font-size: 22px; font-weight: 700; color: var(--primary); }
.price-unit { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.hw-type-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ===== 批量费用编辑 ===== */
.batch-price-list { display: flex; flex-direction: column; gap: 10px; }
.batch-price-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--bg); border-radius: 8px; }
.batch-price-name { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hw-type-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.batch-price-input { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ===== 进度列表（总览） ===== */
.progress-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.progress-item:last-child { border-bottom: none; }
.progress-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; max-width: 50%; }
.progress-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.progress-class { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.progress-right { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; }
.progress-bar-wrap { flex: 1; max-width: 120px; background: var(--bg); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width .5s; }
.progress-pct { font-size: 12px; font-weight: 600; width: 36px; text-align: right; }
.progress-ddl { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ===== 颜色选择器 ===== */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: all .18s; }
.color-dot:hover { transform: scale(1.15); }
.color-dot.selected { border-color: #fff; box-shadow: 0 0 0 2px #1E293B; transform: scale(1.1); }

/* ===== 助教复选框 ===== */
.ta-checkboxes { display: flex; flex-direction: column; gap: 8px; }
.ta-check-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 6px 10px; border-radius: 6px; border: 1.5px solid var(--border); transition: all .15s; }
.ta-check-item:hover { border-color: var(--primary); background: var(--primary-light); }
.ta-check-item input { cursor: pointer; }

/* ===== 价格提示 ===== */
.price-preview { margin: 4px 0 8px; }
.price-hint { background: var(--primary-light); border-left: 3px solid var(--primary); padding: 8px 12px; border-radius: 0 6px 6px 0; font-size: 13px; color: var(--primary); }

/* ===== 信息框 ===== */
.info-box { background: #FEF3C7; border-left: 3px solid var(--warning); padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: 13px; color: #92400E; margin-bottom: 14px; }

/* ===== 全局加载 ===== */
.global-loading { position: fixed; inset: 0; background: rgba(255,255,255,.6); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.loading-spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
