:root{
  --green:#2E7D32; --green-light:#E8F5E9; --green-dark:#1B5E20;
  --blue:#1565C0; --blue-light:#E3F2FD; --blue-dark:#0D47A1;
  --orange:#EF6C00; --orange-light:#FFF3E0;
  --red:#C62828; --red-light:#FFEBEE;
  --gray-50:#FAFAFA; --gray-100:#F5F5F5; --gray-200:#EEEEEE; --gray-300:#E0E0E0;
  --gray-500:#9E9E9E; --gray-700:#616161; --gray-900:#212121;
  --radius:12px; --radius-sm:8px;
  --shadow:0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.06);
  --shadow-md:0 4px 12px rgba(0,0,0,.1);
  --safe-bottom:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html{font-size:16px;-webkit-text-size-adjust:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  background:var(--gray-100);color:var(--gray-900);line-height:1.6;
  padding-bottom:calc(72px + var(--safe-bottom));
  min-height:100vh;
}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit;font-size:inherit}
input,textarea,select{font-family:inherit;font-size:16px}
svg{display:block;flex-shrink:0}

/* ===== 顶部栏 ===== */
.topbar{
  position:sticky;top:0;z-index:50;
  background:linear-gradient(135deg,var(--green) 0%,var(--green-dark) 100%);
  color:#fff;padding:14px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  box-shadow:0 2px 8px rgba(46,125,50,.25);
}
.topbar-title{font-size:17px;font-weight:600;display:flex;align-items:center;gap:8px}
.topbar-title .logo{width:28px;height:28px;background:#fff;border-radius:8px;display:flex;align-items:center;justify-content:center}
.topbar-actions{display:flex;gap:6px;align-items:center}
.btn-icon{
  width:38px;height:38px;border-radius:10px;background:rgba(255,255,255,.15);
  display:flex;align-items:center;justify-content:center;color:#fff;transition:.2s;
}
.btn-icon:hover,.btn-icon:active{background:rgba(255,255,255,.28)}

/* ===== 容器 ===== */
.container{max-width:1200px;margin:0 auto;padding:16px}

/* ===== 今天要处理 ===== */
.today-section{
  background:linear-gradient(135deg,#FFF8E1 0%,#FFF3E0 100%);
  border:1px solid #FFE0B2;border-radius:var(--radius);
  padding:14px 16px;margin-bottom:16px;
}
.today-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.today-title{font-size:15px;font-weight:600;color:#E65100;display:flex;align-items:center;gap:6px}
.today-count{
  background:var(--orange);color:#fff;font-size:12px;font-weight:600;
  padding:2px 10px;border-radius:20px;min-width:24px;text-align:center;
}
.today-list{display:flex;flex-direction:column;gap:8px}
.today-item{
  display:flex;align-items:center;gap:10px;padding:10px 12px;
  background:#fff;border-radius:var(--radius-sm);border-left:3px solid var(--orange);
  font-size:14px;box-shadow:var(--shadow);
}
.today-item.overdue{border-left-color:var(--red);background:var(--red-light)}
.today-item.overdue .today-tag{background:var(--red);color:#fff}
.today-item .today-text{flex:1}
.today-item .today-meta{font-size:12px;color:var(--gray-700);margin-top:2px}
.today-item .today-tag{
  font-size:11px;padding:2px 8px;border-radius:6px;
  background:var(--gray-200);color:var(--gray-700);font-weight:500;
}
.today-btn{
  font-size:12px;padding:6px 12px;border-radius:6px;
  background:var(--green);color:#fff;font-weight:500;white-space:nowrap;
}
.today-btn:active{background:var(--green-dark)}
.today-empty{text-align:center;color:var(--gray-700);font-size:14px;padding:12px}

/* ===== 看板数据卡片 ===== */
.section-title{
  font-size:16px;font-weight:600;margin:20px 0 12px;
  display:flex;align-items:center;gap:8px;color:var(--gray-900);
}
.section-title .bar{width:4px;height:18px;background:var(--green);border-radius:2px}
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:8px}
.stat-card{
  background:#fff;border-radius:var(--radius);padding:14px;
  box-shadow:var(--shadow);position:relative;overflow:hidden;
}
.stat-card .stat-icon{
  position:absolute;top:12px;right:12px;width:32px;height:32px;border-radius:8px;
  display:flex;align-items:center;justify-content:center;
}
.stat-card .stat-label{font-size:13px;color:var(--gray-700);margin-bottom:6px}
.stat-card .stat-value{font-size:26px;font-weight:700;line-height:1.2}
.stat-card .stat-extra{font-size:12px;color:var(--gray-500);margin-top:4px}
.stat-card.green .stat-icon{background:var(--green-light);color:var(--green)}
.stat-card.green .stat-value{color:var(--green-dark)}
.stat-card.blue .stat-icon{background:var(--blue-light);color:var(--blue)}
.stat-card.blue .stat-value{color:var(--blue-dark)}
.stat-card.orange .stat-icon{background:var(--orange-light);color:var(--orange)}
.stat-card.orange .stat-value{color:var(--orange)}
.stat-card.red .stat-icon{background:var(--red-light);color:var(--red)}
.stat-card.red .stat-value{color:var(--red)}

/* 进度条 */
.progress-bar{height:8px;background:var(--gray-200);border-radius:4px;overflow:hidden;margin-top:8px}
.progress-fill{height:100%;border-radius:4px;transition:width .5s}

/* ===== 功能分区入口 ===== */
.module-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:8px}
.module-card{
  background:#fff;border-radius:var(--radius);padding:16px;
  box-shadow:var(--shadow);cursor:pointer;transition:.2s;
  display:flex;flex-direction:column;gap:8px;border:2px solid transparent;
}
.module-card:active{transform:scale(.98)}
.module-card.active{border-color:var(--green);background:var(--green-light)}
.module-card .mc-icon{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center}
.module-card .mc-title{font-size:14px;font-weight:600}
.module-card .mc-desc{font-size:12px;color:var(--gray-700);line-height:1.4}
.module-card.locked{opacity:.55}
.module-card.locked .mc-title::after{content:" 待开通";font-size:11px;color:var(--gray-500);font-weight:400}

/* ===== 通用面板 ===== */
.panel{display:none}
.panel.active{display:block}

/* ===== 备课库 ===== */
.unit-accordion{margin-bottom:8px}
.unit-header{
  background:#fff;border-radius:var(--radius);padding:14px 16px;margin-bottom:8px;
  display:flex;align-items:center;justify-content:space-between;cursor:pointer;
  box-shadow:var(--shadow);font-weight:600;
}
.unit-header .uh-left{display:flex;align-items:center;gap:10px}
.unit-badge{
  width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:700;color:#fff;
}
.unit-meta{font-size:12px;color:var(--gray-500);font-weight:400;margin-top:2px}
.chapter-list{display:none;padding-left:8px}
.chapter-list.open{display:block}
.chapter-item{
  background:#fff;border-radius:var(--radius-sm);padding:12px 14px;margin-bottom:8px;
  box-shadow:var(--shadow);cursor:pointer;transition:.2s;
  border-left:3px solid var(--blue);
}
.chapter-item:active{background:var(--gray-50)}
.chapter-item .ci-title{font-size:14px;font-weight:600;margin-bottom:4px}
.chapter-item .ci-meta{font-size:12px;color:var(--gray-700);display:flex;gap:8px;flex-wrap:wrap}
.ci-tag{font-size:11px;padding:1px 7px;border-radius:4px;background:var(--gray-200);color:var(--gray-700)}
.ci-tag.done{background:var(--green-light);color:var(--green-dark)}
.ci-tag.todo{background:var(--orange-light);color:var(--orange)}
.ci-tag.practice{background:var(--blue-light);color:var(--blue-dark)}

/* 章节详情抽屉 */
.drawer-mask{
  position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:90;display:none;
}
.drawer-mask.open{display:block}
.drawer{
  position:fixed;right:0;top:0;bottom:0;width:min(560px,100%);
  background:var(--gray-100);z-index:100;transform:translateX(100%);
  transition:transform .3s;display:flex;flex-direction:column;
}
.drawer.open{transform:translateX(0)}
.drawer-head{
  background:#fff;padding:14px 16px;display:flex;align-items:center;justify-content:space-between;
  box-shadow:var(--shadow);flex-shrink:0;
}
.drawer-head .dh-title{font-size:15px;font-weight:600;flex:1;padding-right:8px}
.drawer-body{flex:1;overflow-y:auto;padding:16px;-webkit-overflow-scrolling:touch}
.material-card{
  background:#fff;border-radius:var(--radius);padding:14px;margin-bottom:12px;
  box-shadow:var(--shadow);
}
.mc-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.mc-head .mc-name{font-size:14px;font-weight:600;display:flex;align-items:center;gap:8px}
.mc-head .mc-actions{display:flex;gap:6px}
.mc-tag{
  font-size:11px;padding:2px 8px;border-radius:4px;font-weight:500;
}
.mc-body{font-size:13px;color:var(--gray-700);line-height:1.6}
.mc-body ul{padding-left:18px;margin-top:4px}
.mc-body li{margin:2px 0}
.mc-edit-btn{
  font-size:12px;padding:4px 10px;border-radius:6px;
  background:var(--gray-200);color:var(--gray-700);
}
.mc-edit-btn.primary{background:var(--blue-light);color:var(--blue-dark)}

/* ===== 实践活动 ===== */
.practice-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-bottom:16px}
.practice-card{
  background:#fff;border-radius:var(--radius);padding:14px;box-shadow:var(--shadow);
  cursor:pointer;transition:.2s;border-top:3px solid var(--green);
}
.practice-card:active{transform:scale(.98)}
.pc-num{
  display:inline-flex;align-items:center;justify-content:center;
  width:24px;height:24px;border-radius:50%;background:var(--green);color:#fff;
  font-size:12px;font-weight:700;margin-bottom:8px;
}
.pc-title{font-size:14px;font-weight:600;margin-bottom:4px;line-height:1.4}
.pc-meta{font-size:12px;color:var(--gray-700);display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.pc-status{font-size:11px;padding:2px 8px;border-radius:4px;font-weight:500}
.pc-status.todo{background:var(--orange-light);color:var(--orange)}
.pc-status.doing{background:var(--blue-light);color:var(--blue-dark)}
.pc-status.done{background:var(--green-light);color:var(--green-dark)}

/* 分组实验子库 */
.exp-list{display:flex;flex-direction:column;gap:8px}
.exp-item{
  background:#fff;border-radius:var(--radius-sm);padding:12px 14px;box-shadow:var(--shadow);
  display:flex;align-items:center;justify-content:space-between;cursor:pointer;
}
.exp-item:active{background:var(--gray-50)}
.exp-item .ei-left{flex:1}
.exp-item .ei-title{font-size:14px;font-weight:500}
.exp-item .ei-meta{font-size:12px;color:var(--gray-700);margin-top:2px}

/* 实践详情卡 */
.practice-detail{
  background:#fff;border-radius:var(--radius);margin-bottom:12px;
  box-shadow:var(--shadow);overflow:hidden;
}
.pd-head{
  padding:14px 16px;background:var(--green-light);
  display:flex;align-items:center;justify-content:space-between;
}
.pd-head .pd-title{font-size:15px;font-weight:600;color:var(--green-dark)}
.pd-body{padding:14px 16px}
.pd-section{margin-bottom:14px}
.pd-section:last-child{margin-bottom:0}
.pd-label{font-size:13px;font-weight:600;color:var(--gray-700);margin-bottom:6px;display:flex;align-items:center;gap:6px}
.pd-content{font-size:13px;color:var(--gray-900);line-height:1.6}
.pd-content table{width:100%;border-collapse:collapse;margin-top:6px;font-size:12px}
.pd-content th,.pd-content td{border:1px solid var(--gray-300);padding:6px 8px;text-align:left}
.pd-content th{background:var(--gray-100);font-weight:600}
.pd-list{padding-left:18px}
.pd-list li{margin:3px 0}

/* ===== 按钮 ===== */
.btn{
  padding:8px 16px;border-radius:var(--radius-sm);font-size:14px;font-weight:500;
  display:inline-flex;align-items:center;gap:6px;transition:.2s;
}
.btn-primary{background:var(--green);color:#fff}
.btn-primary:active{background:var(--green-dark)}
.btn-secondary{background:var(--gray-200);color:var(--gray-900)}
.btn-blue{background:var(--blue);color:#fff}
.btn-blue:active{background:var(--blue-dark)}
.btn-outline{border:1px solid var(--gray-300);background:#fff;color:var(--gray-900)}
.btn-sm{padding:5px 10px;font-size:12px}

/* ===== 底部导航 ===== */
.bottom-nav{
  position:fixed;bottom:0;left:0;right:0;z-index:60;
  background:#fff;border-top:1px solid var(--gray-200);
  display:flex;padding-bottom:var(--safe-bottom);
  box-shadow:0 -2px 12px rgba(0,0,0,.06);
}
.nav-item{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:8px 4px;gap:3px;color:var(--gray-500);font-size:11px;transition:.2s;
}
.nav-item.active{color:var(--green)}
.nav-item .nav-icon{width:24px;height:24px}
.nav-item:active{background:var(--gray-50)}

/* ===== 弹窗 ===== */
.modal-mask{
  position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:200;
  display:none;align-items:center;justify-content:center;padding:20px;
}
.modal-mask.open{display:flex}
.modal{
  background:#fff;border-radius:var(--radius);max-width:420px;width:100%;
  max-height:80vh;overflow-y:auto;box-shadow:var(--shadow-md);
}
.modal-head{padding:16px;font-size:16px;font-weight:600;border-bottom:1px solid var(--gray-200)}
.modal-body{padding:16px;font-size:14px;line-height:1.6}
.modal-body input,.modal-body textarea,.modal-body select{
  width:100%;padding:8px 12px;border:1px solid var(--gray-300);border-radius:var(--radius-sm);
  margin-top:4px;
}
.modal-body textarea{min-height:80px;resize:vertical;font-family:inherit}
.modal-field{margin-bottom:12px}
.modal-field label{font-size:13px;font-weight:500;color:var(--gray-700);display:block;margin-bottom:4px}
.modal-foot{padding:12px 16px;display:flex;gap:8px;justify-content:flex-end;border-top:1px solid var(--gray-200)}

/* ===== Toast ===== */
.toast{
  position:fixed;bottom:calc(90px + var(--safe-bottom));left:50%;transform:translateX(-50%);
  background:rgba(33,33,33,.92);color:#fff;padding:10px 20px;border-radius:24px;
  font-size:13px;z-index:300;opacity:0;transition:.3s;pointer-events:none;
  max-width:90%;text-align:center;
}
.toast.show{opacity:1}

/* ===== 备份提示条 ===== */
.backup-hint{
  background:var(--blue-light);border:1px solid #BBDEFB;color:var(--blue-dark);
  border-radius:var(--radius);padding:10px 14px;margin-bottom:12px;
  font-size:13px;display:flex;align-items:center;gap:8px;
}
.backup-hint button{margin-left:auto;font-size:12px;color:var(--blue);font-weight:600;text-decoration:underline}

/* ===== 响应式 ===== */
@media(max-width:768px){
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .module-grid{grid-template-columns:1fr}
  .practice-grid{grid-template-columns:1fr}
  .topbar-title{font-size:15px}
  .topbar-title .logo{width:24px;height:24px}
  .container{padding:12px}
  .stat-card .stat-value{font-size:22px}
  .drawer{width:100%}
}
@media(max-width:380px){
  .stats-grid{grid-template-columns:1fr}
}