*{margin:0;padding:0;box-sizing:border-box}
html,body{width:100%;min-height:100%;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;background:#f0f0f0;color:#222;overflow-x:hidden}

/* ====== 登录页 ====== */
#loginPage{display:flex;align-items:center;justify-content:center;min-height:100vh;background:linear-gradient(135deg,#07c160,#0288d1);padding:20px}
.login-box{background:#fff;border-radius:16px;padding:40px 32px;width:100%;max-width:380px;box-shadow:0 8px 32px rgba(0,0,0,.15);text-align:center}
.login-title{font-size:24px;font-weight:700;color:#333;margin-bottom:4px}
.login-sub{font-size:13px;color:#888;margin-bottom:24px}
.login-input{width:100%;padding:12px 14px;border:1px solid #e0e0e0;border-radius:10px;font-size:15px;margin-bottom:12px;outline:none;transition:border-color .2s}
.login-input:focus{border-color:#07c160}
.login-btn{width:100%;padding:12px;border:none;border-radius:10px;background:#07c160;color:#fff;font-size:16px;font-weight:600;cursor:pointer;margin-top:4px}
.login-btn:hover{background:#06ad56}
.login-error{color:#f44336;font-size:13px;margin-top:8px;min-height:20px}
.login-hint{color:#999;font-size:12px;margin-top:12px}

/* ====== 主界面 ====== */
#app{display:block}
#app.hide{display:none}
.hide{display:none!important}

#topBar{position:sticky;top:0;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;padding:0 12px;height:52px;z-index:100;gap:8px;flex-wrap:wrap}
#topBar .title{font-size:16px;font-weight:600;flex-shrink:0}
.student-select{padding:4px 8px;border:1px solid #ddd;border-radius:8px;font-size:13px;background:#fff;max-width:140px;cursor:pointer}
.nav-btns{display:flex;gap:4px;flex-wrap:wrap}
.nav-btn{padding:5px 10px;border-radius:14px;border:none;font-size:12px;cursor:pointer;background:#f0f0f0;color:#666;white-space:nowrap}
.nav-btn.active{background:#07c160;color:#fff}

#content{padding:12px;max-width:800px;margin:0 auto;padding-bottom:60px}
.tab-content{display:none}
.tab-content.active{display:block}

.section{background:#fff;border-radius:12px;padding:16px;margin-bottom:12px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.section-title{font-size:15px;font-weight:600;color:#333;margin-bottom:12px}
.row{display:flex;gap:12px}
.half{flex:1;min-width:0}

#studentInfo{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.info-avatar{width:44px;height:44px;border-radius:50%;background:#e8f5e9;display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}
.info-name{font-size:17px;font-weight:600}
.info-meta{font-size:12px;color:#888;margin-top:2px}
.info-goal{margin-left:auto;font-size:13px;color:#07c160;background:#e8f8ec;padding:4px 10px;border-radius:8px;white-space:nowrap}

.chart-wrap{position:relative;width:100%;max-width:400px;margin:0 auto}
.chart-wrap canvas{width:100%!important;height:auto!important}
.chart-legend{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin-top:8px}
.legend-item{display:flex;align-items:center;gap:4px;font-size:12px;color:#555}
.legend-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}

.change-item{display:flex;align-items:center;padding:8px 0;border-bottom:1px solid #f5f5f5}
.change-item:last-child{border-bottom:none}
.change-subject{width:48px;font-size:14px;font-weight:500;flex-shrink:0}
.change-bar-wrap{flex:1;margin:0 10px}
.change-bar-bg{height:6px;border-radius:3px;background:#f0f0f0;overflow:hidden}
.change-bar-fill{height:100%;border-radius:3px;transition:width .6s ease}
.change-bar-fill.up{background:#4CAF50}
.change-bar-fill.down{background:#f44336}
.change-bar-fill.flat{background:#FF9800}
.change-score{font-size:12px;color:#666;white-space:nowrap}
.change-badge{font-size:11px;padding:2px 6px;border-radius:4px;margin-left:6px;flex-shrink:0}
.change-badge.up{background:#e8f5e9;color:#2E7D32}
.change-badge.down{background:#ffebee;color:#c62828}
.change-badge.flat{background:#fff3e0;color:#e65100}

.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;text-align:center}
.stat-item{padding:8px 4px}
.stat-num{font-size:22px;font-weight:700;color:#333}
.stat-label{font-size:11px;color:#888;margin-top:4px}

.error-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.error-subj{text-align:center;padding:8px 4px;border-radius:8px;background:#fafafa}
.error-subj.high{background:#ffebee}
.error-subj.mid{background:#fff8e1}
.error-subj.low{background:#e8f5e9}
.error-subj-name{font-size:12px;color:#555}
.error-subj-count{font-size:18px;font-weight:700;margin-top:2px}
.error-subj-count.high{color:#f44336}
.error-subj-count.mid{color:#FF9800}
.error-subj-count.low{color:#4CAF50}

.truth-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.truth-item{background:#f9f9f9;border-radius:8px;padding:12px;text-align:center}
.truth-icon{font-size:20px;margin-bottom:4px}
.truth-label{font-size:11px;color:#888}
.truth-value{font-size:16px;font-weight:600;color:#333;margin-top:2px}

.report-card{padding:16px}
.report-meta{font-size:12px;color:#999;margin-top:4px}
.report-stat{display:flex;gap:16px;flex-wrap:wrap;margin-top:8px}
.report-stat-item{text-align:center;min-width:60px}
.report-stat-num{font-size:20px;font-weight:700;color:#07c160}
.report-stat-label{font-size:11px;color:#888;margin-top:2px}
.report-advice{font-size:14px;line-height:1.7;color:#444;padding:8px 0}
.report-highlight-item{padding:6px 0;display:flex;align-items:center;gap:8px;font-size:13px}

.note-item{padding:10px 0;border-bottom:1px solid #f0f0f0}
.note-item:last-child{border-bottom:none}
.note-header{display:flex;justify-content:space-between;font-size:12px;color:#888;margin-bottom:4px}
.note-body{font-size:14px;line-height:1.6;color:#444}

/* ====== 学习计划 ====== */
.plan-task{display:flex;align-items:center;padding:10px 0;border-bottom:1px solid #f5f5f5;gap:10px}
.plan-task:last-child{border-bottom:none}
.plan-check{width:20px;height:20px;border-radius:50%;border:2px solid #ddd;cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;transition:all .2s}
.plan-check.done{border-color:#4CAF50;background:#4CAF50;color:#fff}
.plan-subject{font-size:12px;padding:2px 8px;border-radius:4px;color:#fff;flex-shrink:0}
.plan-topic{flex:1;font-size:14px;color:#333}
.plan-time{font-size:12px;color:#888;white-space:nowrap}
.plan-status{font-size:11px;padding:2px 6px;border-radius:4px}
.plan-status.done{background:#e8f5e9;color:#2E7D32}
.plan-status.pending{background:#fff3e0;color:#e65100}
.plan-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.plan-date{font-size:13px;font-weight:600;color:#333}
.plan-stats{font-size:12px;color:#888}

/* ====== TOKEN ====== */
.token-summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.token-stat{text-align:center;padding:12px;background:#f9f9f9;border-radius:10px}
.token-num{font-size:20px;font-weight:700;color:#07c160}
.token-label{font-size:11px;color:#888;margin-top:4px}
.token-breakdown-item{display:flex;align-items:center;padding:8px 0;border-bottom:1px solid #f5f5f5}
.token-breakdown-item:last-child{border-bottom:none}
.token-provider{font-size:13px;font-weight:500;width:80px;flex-shrink:0}
.token-bar-wrap{flex:1;margin:0 10px}
.token-bar-bg{height:8px;border-radius:4px;background:#f0f0f0;overflow:hidden}
.token-bar-fill{height:100%;border-radius:4px;background:#07c160;transition:width .6s}
.token-count{font-size:12px;color:#666;white-space:nowrap}
.token-calls{font-size:11px;color:#999;white-space:nowrap;margin-left:8px}

/* ====== 进度条 ====== */
.progress-item{display:flex;align-items:center;padding:6px 0;gap:8px}
.progress-subject{font-size:13px;font-weight:500;width:48px;flex-shrink:0}
.progress-bar-wrap{flex:1}
.progress-bar-bg{height:8px;border-radius:4px;background:#f0f0f0;overflow:hidden}
.progress-bar-fill{height:100%;border-radius:4px;background:#07c160;transition:width .6s}
.progress-chapter{font-size:11px;color:#888;margin-top:2px}

.small-btn{padding:4px 12px;border:none;border-radius:8px;background:#07c160;color:#fff;font-size:12px;cursor:pointer}
.small-btn:hover{background:#06ad56}

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

/* ====== 活跃监控 ====== */
.activity-status-card{background:#fff;border-radius:12px;padding:16px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.activity-summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.activity-summary-item{text-align:center;padding:16px 4px;background:#f9f9f9;border-radius:10px}
.activity-num{font-size:20px;font-weight:700;color:#333}
.activity-label{font-size:11px;color:#888;margin-top:4px}
.timeline{padding:4px 0}
.timeline-slot{display:flex;align-items:center;padding:6px 0;border-bottom:1px solid #f5f5f5}
.timeline-slot:last-child{border-bottom:none}
.timeline-time{font-size:12px;color:#888;width:40px;flex-shrink:0;font-variant-numeric:tabular-nums}
.timeline-bar{width:24px;display:flex;justify-content:center;flex-shrink:0}
.timeline-fill{width:12px;height:12px;border-radius:50%;display:flex;align-items:center;justify-content:center}
.timeline-slot.green .timeline-fill{background:#4CAF50}
.timeline-slot.gray .timeline-fill{background:#e0e0e0}
.timeline-dot{width:6px;height:6px;border-radius:50%;background:#fff}
.timeline-dot.gray{background:#bbb}
.timeline-info{flex:1;font-size:12px;color:#666;margin-left:8px}
.timeline-slot.current .timeline-time{color:#07c160;font-weight:600}
.timeline-slot.current .timeline-fill{box-shadow:0 0 0 3px rgba(7,193,96,.25)}
@media(max-width:480px){
  .activity-summary-grid{grid-template-columns:repeat(2,1fr)}
}

#loading{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,.85);display:flex;align-items:center;justify-content:center;font-size:16px;color:#888;z-index:999}
#loading.hide{display:none}

@media(max-width:480px){
  .row{flex-direction:column}
  .stat-grid{grid-template-columns:repeat(3,1fr)}
  .error-grid{grid-template-columns:repeat(3,1fr)}
  .truth-grid{grid-template-columns:repeat(2,1fr)}
  .token-summary-grid{grid-template-columns:repeat(2,1fr)}
  #topBar{padding:0 8px;height:auto;padding-top:8px;padding-bottom:8px}
  .nav-btn{padding:4px 8px;font-size:11px}
  .student-select{max-width:100px}
}

@media(min-width:600px){
  .stat-grid{grid-template-columns:repeat(3,1fr)}
  .error-grid{grid-template-columns:repeat(4,1fr)}
  .truth-grid{grid-template-columns:repeat(4,1fr)}
  .token-summary-grid{grid-template-columns:repeat(4,1fr)}
}
